summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/fsp_baytrail/nvm.c
diff options
context:
space:
mode:
authorEdward O'Callaghan <eocallaghan@alterapraxis.com>2014-05-24 04:09:50 +1000
committerEdward O'Callaghan <eocallaghan@alterapraxis.com>2015-01-06 04:56:14 +0100
commit9270553fff23462fcb298f154296319bf3639d15 (patch)
tree2ba8245407efd91d8862cbe7ac333d46cfd4390a /src/soc/intel/fsp_baytrail/nvm.c
parent089a51029221ddceb0cf61daecb275971d2b2f22 (diff)
downloadcoreboot-9270553fff23462fcb298f154296319bf3639d15.tar.gz
coreboot-9270553fff23462fcb298f154296319bf3639d15.tar.bz2
coreboot-9270553fff23462fcb298f154296319bf3639d15.zip
Re-factor 'to_flash_offset()' into 'spi_flash.h'
Re-factor to_flash_offset() into 'spi_flash.h' header. Motivated by Clang complaining that the function 'to_flash_offset' is unused. Change-Id: Ic75fd2fb4edc5e434c199ebd10c7384d197e0c63 Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-on: http://review.coreboot.org/7519 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/soc/intel/fsp_baytrail/nvm.c')
-rw-r--r--src/soc/intel/fsp_baytrail/nvm.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/soc/intel/fsp_baytrail/nvm.c b/src/soc/intel/fsp_baytrail/nvm.c
index 02244636f83a..d1e52239967e 100644
--- a/src/soc/intel/fsp_baytrail/nvm.c
+++ b/src/soc/intel/fsp_baytrail/nvm.c
@@ -47,15 +47,6 @@ static int nvm_init(void)
return 0;
}
-/* Convert memory mapped pointer to flash offset. */
-static inline uint32_t to_flash_offset(void *p)
-{
-#ifndef CONFIG_ROM_SIZE
-#error CONFIG_ROM_SIZE must be set.
-#endif
- return CONFIG_ROM_SIZE + (uintptr_t)p;
-}
-
int nvm_is_erased(const void *start, size_t size)
{
const uint8_t *cur = start;
@@ -74,7 +65,7 @@ int nvm_erase(void *start, size_t size)
{
if (nvm_init() < 0)
return -1;
- flash->erase(flash, to_flash_offset(start), size);
+ flash->erase(flash, to_flash_offset(flash, start), size);
return 0;
}
@@ -83,6 +74,6 @@ int nvm_write(void *start, const void *data, size_t size)
{
if (nvm_init() < 0)
return -1;
- flash->write(flash, to_flash_offset(start), size, data);
+ flash->write(flash, to_flash_offset(flash, start), size, data);
return 0;
}