summaryrefslogtreecommitdiff
path: root/src/drivers/intel/fsp
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2015-01-06 07:08:46 +0100
committerEdward O'Callaghan <eocallaghan@alterapraxis.com>2015-01-06 11:19:28 +0100
commit9b29aad5263f2aeba21cf4d521e7798f9dedb2b9 (patch)
treee513c718c9cb6960c4be58d2e5c299a0bab968f7 /src/drivers/intel/fsp
parent6355cbff51966144d5b709a73e24622df3e96122 (diff)
Revert "Re-factor 'to_flash_offset()' into 'spi_flash.h'"
This reverts commit 9270553fff23462fcb298f154296319bf3639d15. Change-Id: I195f721ce7a18aac6c1aa6f4e0f9284455d531b0 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/8138 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'src/drivers/intel/fsp')
-rw-r--r--src/drivers/intel/fsp/fastboot_cache.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/drivers/intel/fsp/fastboot_cache.c b/src/drivers/intel/fsp/fastboot_cache.c
index 907e143a55..64982d8dc1 100644
--- a/src/drivers/intel/fsp/fastboot_cache.c
+++ b/src/drivers/intel/fsp/fastboot_cache.c
@@ -31,6 +31,15 @@
#include <lib.h> // hexdump
#include "fsp_util.h"
+#ifndef CONFIG_VIRTUAL_ROM_SIZE
+#error "CONFIG_VIRTUAL_ROM_SIZE must be set."
+#endif
+
+/* convert a pointer to flash area into the offset inside the flash */
+static inline u32 to_flash_offset(void *p) {
+ return ((u32)p + CONFIG_VIRTUAL_ROM_SIZE);
+}
+
static struct mrc_data_container *next_mrc_block(
struct mrc_data_container *mrc_cache)
{
@@ -196,7 +205,7 @@ void update_mrc_cache(void *unused)
"Need to erase the MRC cache region of %d bytes at %p\n",
cache_size, cache_base);
- flash->erase(flash, to_flash_offset(flash, cache_base), cache_size);
+ flash->erase(flash, to_flash_offset(cache_base), cache_size);
/* we will start at the beginning again */
cache = cache_base;
@@ -204,7 +213,7 @@ void update_mrc_cache(void *unused)
/* 4. write mrc data with flash->write() */
printk(BIOS_DEBUG, "Write MRC cache update to flash at %p\n",
cache);
- flash->write(flash, to_flash_offset(flash, cache),
+ flash->write(flash, to_flash_offset(cache),
current->mrc_data_size + sizeof(*current), current);
}