* [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom
@ 2019-04-17 13:21 Christian Gmeiner
2019-04-17 13:21 ` [U-Boot] [PATCH 2/2] fs: cbfs: add file_cbfs_init_ext(..) Christian Gmeiner
2019-04-17 15:17 ` [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
0 siblings, 2 replies; 4+ messages in thread
From: Christian Gmeiner @ 2019-04-17 13:21 UTC (permalink / raw)
To: u-boot
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
fs/cbfs/cbfs.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index 7b2513cb24..c60a8d5dc1 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -162,13 +162,10 @@ static void file_cbfs_fill_cache(u8 *start, u32 size, u32 align)
}
/* Get the CBFS header out of the ROM and do endian conversion. */
-static int file_cbfs_load_header(uintptr_t end_of_rom,
- struct cbfs_header *header)
+static int file_cbfs_load_header(uintptr_t addr, struct cbfs_header *header)
{
- struct cbfs_header *header_in_rom;
- int32_t offset = *(u32 *)(end_of_rom - 3);
+ struct cbfs_header *header_in_rom = (struct cbfs_header *)addr;
- header_in_rom = (struct cbfs_header *)(end_of_rom + offset + 1);
swap_header(header, header_in_rom);
if (header->magic != good_magic || header->offset >
@@ -183,8 +180,9 @@ void file_cbfs_init(uintptr_t end_of_rom)
{
u8 *start_of_rom;
initialized = 0;
+ const int32_t offset = *(u32 *)(end_of_rom - 3);
- if (file_cbfs_load_header(end_of_rom, &cbfs_header))
+ if (file_cbfs_load_header(end_of_rom + offset + 1, &cbfs_header))
return;
start_of_rom = (u8 *)(end_of_rom + 1 - cbfs_header.rom_size);
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 2/2] fs: cbfs: add file_cbfs_init_ext(..)
2019-04-17 13:21 [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
@ 2019-04-17 13:21 ` Christian Gmeiner
2019-04-17 15:17 ` [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
1 sibling, 0 replies; 4+ messages in thread
From: Christian Gmeiner @ 2019-04-17 13:21 UTC (permalink / raw)
To: u-boot
On Intel Apollolake the BIOS region on the flash is mapped right below 4GiB
in the address space. However, 256KiB right below 4GiB is decoded by read-only
SRAM. For this case we need a new API to handle this case - file_cbfs_init_ext().
This patch only does the groundwork to fix this issue. The caller of this
API is responsible to calucalte/determine the correct cbfs addresses.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
fs/cbfs/cbfs.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/cbfs/cbfs.c b/fs/cbfs/cbfs.c
index c60a8d5dc1..97272ce5e8 100644
--- a/fs/cbfs/cbfs.c
+++ b/fs/cbfs/cbfs.c
@@ -193,6 +193,19 @@ void file_cbfs_init(uintptr_t end_of_rom)
initialized = 1;
}
+void file_cbfs_init_ext(uintptr_t header, uintptr_t cbfs_start, u32 cbfs_size)
+{
+ initialized = 0;
+
+ if (file_cbfs_load_header(header, &cbfs_header))
+ return;
+
+ file_cbfs_fill_cache((u8 *)cbfs_start, cbfs_size, cbfs_header.align);
+
+ if (file_cbfs_result == CBFS_SUCCESS)
+ initialized = 1;
+}
+
const struct cbfs_header *file_cbfs_get_header(void)
{
if (initialized) {
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom
2019-04-17 13:21 [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
2019-04-17 13:21 ` [U-Boot] [PATCH 2/2] fs: cbfs: add file_cbfs_init_ext(..) Christian Gmeiner
@ 2019-04-17 15:17 ` Christian Gmeiner
2019-04-18 3:09 ` Bin Meng
1 sibling, 1 reply; 4+ messages in thread
From: Christian Gmeiner @ 2019-04-17 15:17 UTC (permalink / raw)
To: u-boot
Am Mi., 17. Apr. 2019 um 15:21 Uhr schrieb Christian Gmeiner
<christian.gmeiner@gmail.com>:
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
I think I will send out a v2 that compiles :/
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom
2019-04-17 15:17 ` [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
@ 2019-04-18 3:09 ` Bin Meng
0 siblings, 0 replies; 4+ messages in thread
From: Bin Meng @ 2019-04-18 3:09 UTC (permalink / raw)
To: u-boot
Hi Christian,
On Wed, Apr 17, 2019 at 11:17 PM Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
>
> Am Mi., 17. Apr. 2019 um 15:21 Uhr schrieb Christian Gmeiner
> <christian.gmeiner@gmail.com>:
> >
> > Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>
> I think I will send out a v2 that compiles :/
>
and please add some descriptions in the commit message. Thanks!
Regards,
Bin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-18 3:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 13:21 [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
2019-04-17 13:21 ` [U-Boot] [PATCH 2/2] fs: cbfs: add file_cbfs_init_ext(..) Christian Gmeiner
2019-04-17 15:17 ` [U-Boot] [PATCH 1/2] fs: cbfs: make file_cbfs_load_header(..) independent of end-of-rom Christian Gmeiner
2019-04-18 3:09 ` Bin Meng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.