ELOG: Find flash base in FMAP if possible
Now that we have FMAP support in coreboot use it to find the offset in flash for ELOG to use. If coreboot has elog configured with a smaller size then use that over the FMAP size. This is because I set aside a 16KB region in the FMAP but we only use 4KB of it to keep the impact to boot/resume speed to a minimum. FMAP: Found "FMAP" version 1.0 at ffe10000. FMAP: base = 0 size = 800000 #areas = 32 FMAP: area RW_ELOG found FMAP: offset: 3f0000 FMAP: size: 16384 bytes FMAP: No valid base address, using 0xff800000 ELOG: base=0x003f0000 base_ptr=0xffbf0000 ELOG: MEM @0x00190ad8 FLASH @0xffbf0000 ELOG: areas are 4096 bytes, full threshold 3072, shrink size 1024 Change-Id: I3d826812c0f259d61f41b42797c58dd179f9f1c8 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: http://review.coreboot.org/1706 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
parent
f1c76ef605
commit
86bf3f518f
|
@ -28,7 +28,9 @@
|
||||||
#include <elog.h>
|
#include <elog.h>
|
||||||
#include "elog_internal.h"
|
#include "elog_internal.h"
|
||||||
|
|
||||||
#if CONFIG_ELOG_FLASH_BASE == 0
|
#if CONFIG_CHROMEOS
|
||||||
|
#include <vendorcode/google/chromeos/fmap.h>
|
||||||
|
#elif CONFIG_ELOG_FLASH_BASE == 0
|
||||||
#error "CONFIG_ELOG_FLASH_BASE is invalid"
|
#error "CONFIG_ELOG_FLASH_BASE is invalid"
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_ELOG_FULL_THRESHOLD >= CONFIG_ELOG_AREA_SIZE
|
#if CONFIG_ELOG_FULL_THRESHOLD >= CONFIG_ELOG_AREA_SIZE
|
||||||
|
@ -735,6 +737,12 @@ int elog_clear(void)
|
||||||
*/
|
*/
|
||||||
int elog_init(void)
|
int elog_init(void)
|
||||||
{
|
{
|
||||||
|
u32 flash_base = CONFIG_ELOG_FLASH_BASE;
|
||||||
|
int flash_size = CONFIG_ELOG_AREA_SIZE;
|
||||||
|
#if CONFIG_CHROMEOS
|
||||||
|
u8 *flash_base_ptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (elog_initialized)
|
if (elog_initialized)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -746,9 +754,24 @@ int elog_init(void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_CHROMEOS
|
||||||
|
/* Find the ELOG base and size in FMAP */
|
||||||
|
flash_size = find_fmap_entry("RW_ELOG", (void **)&flash_base_ptr);
|
||||||
|
if (flash_size < 0) {
|
||||||
|
printk(BIOS_WARNING, "ELOG: Unable to find RW_ELOG in FMAP, "
|
||||||
|
"using CONFIG_ELOG_FLASH_BASE instead\n");
|
||||||
|
flash_size = CONFIG_ELOG_AREA_SIZE;
|
||||||
|
} else {
|
||||||
|
flash_base = elog_flash_address_to_offset(flash_base_ptr);
|
||||||
|
|
||||||
|
/* Use configured size if smaller than FMAP size */
|
||||||
|
if (flash_size > CONFIG_ELOG_AREA_SIZE)
|
||||||
|
flash_size = CONFIG_ELOG_AREA_SIZE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Setup descriptors for flash and memory areas */
|
/* Setup descriptors for flash and memory areas */
|
||||||
if (elog_setup_descriptors(CONFIG_ELOG_FLASH_BASE,
|
if (elog_setup_descriptors(flash_base, flash_size) < 0) {
|
||||||
CONFIG_ELOG_AREA_SIZE) < 0) {
|
|
||||||
printk(BIOS_ERR, "ELOG: Unable to initialize descriptors\n");
|
printk(BIOS_ERR, "ELOG: Unable to initialize descriptors\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,3 +25,4 @@ romstage-y += vboot.c
|
||||||
ramstage-y += gnvs.c
|
ramstage-y += gnvs.c
|
||||||
romstage-y += fmap.c
|
romstage-y += fmap.c
|
||||||
ramstage-y += fmap.c
|
ramstage-y += fmap.c
|
||||||
|
smm-y += fmap.c
|
||||||
|
|
Loading…
Reference in New Issue