[coreboot-gerrit] New patch to review for coreboot: elog: Use rdev_mmap to find offset of ELOG

Furquan Shaikh (furquan@google.com) gerrit at coreboot.org
Sat Jul 16 01:36:30 CEST 2016


Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15722

-gerrit

commit 531f072954dcea7d5866051948baa03ab5c70f37
Author: Furquan Shaikh <furquan at google.com>
Date:   Fri Jul 15 15:54:36 2016 -0700

    elog: Use rdev_mmap to find offset of ELOG
    
    In case of elog not being stored in CBMEM, calculate flash offset by
    using rdev_mmap instead of assuming that the entire flash is mapped just
    below 4GiB. This allows custom mappings of flash to correctly convert
    the flash offset to mmap address.
    
    BUG=chrome-os-partner:54186
    TEST=Verified behavior on reef. mosys able to read out the elog correctly.
    
    Change-Id: I3eacd2c9266ecc3da1bd45c86ff9d0e8153ca3f2
    Signed-off-by: Furquan Shaikh <furquan at google.com>
---
 src/drivers/elog/elog.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 71eaad2..202aa45 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -22,6 +22,8 @@
 #include <pc80/mc146818rtc.h>
 #endif
 #include <bcd.h>
+#include <boot_device.h>
+#include <commonlib/region.h>
 #include <fmap.h>
 #include <rtc.h>
 #include <smbios.h>
@@ -411,16 +413,12 @@ static int elog_shrink(void)
 /*
  * Convert a flash offset into a memory mapped flash address
  */
-static inline u8 *elog_flash_offset_to_address(u32 offset)
+static inline u8 *elog_flash_offset_to_address(void)
 {
-	u32 rom_size;
-
 	if (!elog_spi)
 		return NULL;
 
-	rom_size = get_rom_size();
-
-	return (u8 *)((u32)~0UL - rom_size + 1 + offset);
+	return rdev_mmap(boot_device_ro(), flash_base, total_size);
 }
 
 /*
@@ -453,7 +451,7 @@ int elog_smbios_write_type15(unsigned long *current, int handle)
 #if CONFIG_ELOG_CBMEM
 	t->address = (u32)cbmem;
 #else
-	t->address = (u32)elog_flash_offset_to_address(flash_base);
+	t->address = (u32)elog_flash_offset_to_address();
 #endif
 	t->header_format = ELOG_HEADER_TYPE_OEM;
 	t->log_type_descriptors = 0;



More information about the coreboot-gerrit mailing list