diff options
author | Lee Leahy <leroy.p.leahy@intel.com> | 2017-03-13 16:37:20 -0700 |
---|---|---|
committer | Lee Leahy <leroy.p.leahy@intel.com> | 2017-03-15 05:12:15 +0100 |
commit | 70bb05715ad0fa8edecb2185e1c1373c76ee2128 (patch) | |
tree | e4906fba38ed957aa678a8b1a6a18241305c8f04 /src/soc/intel/quark/romstage/romstage.c | |
parent | 36984d85e758bd7b280a835c5c6e5c68b10e82b6 (diff) |
soc/intel/quark: Read the rmu.bin file from read-only region
Always read the rmu.bin file from the read-only section of the SPI
flash. Without this change vboot attempts to read this file from the
A or B section of the flash.
TEST=Build and run on Galileo Gen2
Change-Id: Ied8eaa2cd37645bf401aa957936943946bfd6182
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18803
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/intel/quark/romstage/romstage.c')
-rw-r--r-- | src/soc/intel/quark/romstage/romstage.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/soc/intel/quark/romstage/romstage.c b/src/soc/intel/quark/romstage/romstage.c index e774993bf2..c5f59c6325 100644 --- a/src/soc/intel/quark/romstage/romstage.c +++ b/src/soc/intel/quark/romstage/romstage.c @@ -16,6 +16,7 @@ #define __SIMPLE_DEVICE__ #include <arch/early_variables.h> +#include <cbfs.h> #include <console/console.h> #include <fsp/util.h> #include <soc/pci_devs.h> @@ -61,3 +62,32 @@ void disable_rom_shadow(void) QNC_MSG_FSBIC_REG_HMISC, data); } } + +void *locate_rmu_file(size_t *rmu_file_len) +{ + struct cbfsf fh; + size_t fsize; + void *rmu_data; + uint32_t type; + + /* Locate the rmu.bin file in the read-only region of the flash */ + type = CBFS_TYPE_RAW; + if (cbfs_locate_file_in_region(&fh, "COREBOOT", "rmu.bin", &type)) + return NULL; + + /* Get the file size */ + fsize = region_device_sz(&fh.data); + if (rmu_file_len != NULL) + *rmu_file_len = fsize; + + /* Get the data address */ + rmu_data = rdev_mmap(&fh.data, 0, fsize); + + /* Since the SPI flash is directly mapped into memory, we do not need + * the mapping provided by the rdev service. Unmap the file to prevent + * a memory leak. Return/leak the SPI flash address for the rmu.bin + * file data which will be directly accessed by FSP MemoryInit. + */ + rdev_munmap(&fh.data, rmu_data); + return rmu_data; +} |