diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-03-28 23:56:22 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-05-26 22:33:53 +0200 |
commit | 0424c95a6dafdb65070538d6c5aa394b75eb9850 (patch) | |
tree | f5bd9f485a1a44eece1662a29c1435a44ab5c58a /src/soc/intel/common | |
parent | b6981c0f9c4ce89c4209c14fb326a414096f2ff1 (diff) |
fmap: new API using region_device
Instead of being pointer based use the region infrastrucutre.
Additionally, this removes the need for arch-specific compilation
paths. The users of the new API can use the region APIs to memory
map or read the region provided by the new fmap API.
Change-Id: Ie36e9ff9cb554234ec394b921f029eeed6845aee
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9170
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r-- | src/soc/intel/common/mrc_cache.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/soc/intel/common/mrc_cache.c b/src/soc/intel/common/mrc_cache.c index 9366aa52f4..6783f18fe3 100644 --- a/src/soc/intel/common/mrc_cache.c +++ b/src/soc/intel/common/mrc_cache.c @@ -20,10 +20,8 @@ #include <string.h> #include <console/console.h> #include <cbmem.h> +#include <fmap.h> #include <ip_checksum.h> -#if CONFIG_CHROMEOS -#include <vendorcode/google/chromeos/fmap.h> -#endif #include "mrc_cache.h" #define MRC_DATA_ALIGN 0x1000 @@ -39,16 +37,23 @@ struct mrc_data_region { /* common code */ static int mrc_cache_get_region(struct mrc_data_region *region) { -#if CONFIG_CHROMEOS - int ret; - ret = find_fmap_entry("RW_MRC_CACHE", ®ion->base); - if (ret >= 0) { - region->size = ret; + if (IS_ENABLED(CONFIG_CHROMEOS)) { + struct region_device rdev; + + if (fmap_locate_area_as_rdev("RW_MRC_CACHE", &rdev)) + return -1; + + region->size = region_device_sz(&rdev); + region->base = rdev_mmap_full(&rdev); + + if (region->base == NULL) + return -1; + return 0; + } else { + region->base = (void *)CONFIG_MRC_SETTINGS_CACHE_BASE; + region->size = CONFIG_MRC_SETTINGS_CACHE_SIZE; } -#endif - region->base = (void *)CONFIG_MRC_SETTINGS_CACHE_BASE; - region->size = CONFIG_MRC_SETTINGS_CACHE_SIZE; return 0; } |