summaryrefslogtreecommitdiff
path: root/src/arch/riscv/rom_media.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2015-04-17 22:40:53 +0200
committerPatrick Georgi <pgeorgi@google.com>2015-04-18 09:21:08 +0200
commit7effaa4c02d974b59bd86307a54cefb7bb046a3a (patch)
tree477cdd17eba7b3c4706bf610f5effb232391556c /src/arch/riscv/rom_media.c
parent42001a7051e8fcfedccaba17438a032e1ac72ed1 (diff)
riscv: use new-style CBFS header lookup
We recently restructured where the CBFS header is stored and how it is looked up, with less magic. The RISC-V port didn't get the memo, so have it follow the pack now. Change-Id: Ic27e3e7f9acd55027e357f2c4beddf960ea02c4d Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/9795 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch/riscv/rom_media.c')
-rw-r--r--src/arch/riscv/rom_media.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/arch/riscv/rom_media.c b/src/arch/riscv/rom_media.c
index 8e858cb9bc..e00e0fbba2 100644
--- a/src/arch/riscv/rom_media.c
+++ b/src/arch/riscv/rom_media.c
@@ -60,12 +60,12 @@ static int rom_media_close(struct cbfs_media *media) {
}
static int init_rom_media_cbfs(struct cbfs_media *media) {
- //extern unsigned long _cbfs_master_header;
- // On X86, we always keep a reference of pointer to CBFS header in
- // 0xfffffffc, and the pointer is still a memory-mapped address.
- // Since the CBFS core always use ROM offset, we need to figure out
- // header->romsize even before media is initialized.
- struct cbfs_header *header = (struct cbfs_header*) CONFIG_CBFS_HEADER_ROM_OFFSET; //&_cbfs_master_header;
+ /* this assumes that the CBFS resides at 0x0,
+ * which is true for the default configuration
+ */
+ int32_t *cbfs_header_ptr = (int32_t*)(uintptr_t)(CONFIG_CBFS_SIZE - 4);
+ uint64_t cbfs_header_offset = CONFIG_CBFS_SIZE + *cbfs_header_ptr;
+ struct cbfs_header *header = (struct cbfs_header*) cbfs_header_offset;
if (CBFS_HEADER_MAGIC != ntohl(header->magic)) {
printk(BIOS_ERR, "Invalid CBFS master header at %p\n", header);
printk(BIOS_ERR, "Expected %08lx and got %08lx\n", (unsigned long) CBFS_HEADER_MAGIC, (unsigned long) ntohl(header->magic));