Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35637 )
Change subject: Revert "lib/fmap: Cache FMAP in cbmem" ......................................................................
Revert "lib/fmap: Cache FMAP in cbmem"
This reverts commit 6d787c2590920fc5ea222d692004818bbed6b3e5.
Change-Id: I2ac50f6c0d650ed4d92163288a3aa69e1714bf88 Signed-off-by: Subrata Banik subrata.banik@intel.com --- M src/commonlib/include/commonlib/cbmem_id.h M src/commonlib/include/commonlib/coreboot_tables.h M src/lib/coreboot_table.c M src/lib/fmap.c 4 files changed, 2 insertions(+), 68 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/35637/1
diff --git a/src/commonlib/include/commonlib/cbmem_id.h b/src/commonlib/include/commonlib/cbmem_id.h index 30bf88a..8d0ca46 100644 --- a/src/commonlib/include/commonlib/cbmem_id.h +++ b/src/commonlib/include/commonlib/cbmem_id.h @@ -76,7 +76,6 @@ #define CBMEM_ID_ROM1 0x524f4d31 #define CBMEM_ID_ROM2 0x524f4d32 #define CBMEM_ID_ROM3 0x524f4d33 -#define CBMEM_ID_FMAP 0x464d4150
#define CBMEM_ID_TO_NAME_TABLE \ { CBMEM_ID_ACPI, "ACPI " }, \ @@ -135,6 +134,5 @@ { CBMEM_ID_ROM0, "VGA ROM #0 "}, \ { CBMEM_ID_ROM1, "VGA ROM #1 "}, \ { CBMEM_ID_ROM2, "VGA ROM #2 "}, \ - { CBMEM_ID_ROM3, "VGA ROM #3 "}, \ - { CBMEM_ID_FMAP, "FMAP "}, + { CBMEM_ID_ROM3, "VGA ROM #3 "}, #endif /* _CBMEM_ID_H_ */ diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index 6816670..7bded2a 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -89,7 +89,6 @@ LB_TAG_VBOOT_WORKBUF = 0x0034, LB_TAG_MMC_INFO = 0x0035, LB_TAG_TCPA_LOG = 0x0036, - LB_TAG_FMAP = 0x0037, LB_TAG_CMOS_OPTION_TABLE = 0x00c8, LB_TAG_OPTION = 0x00c9, LB_TAG_OPTION_ENUM = 0x00ca, diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 9c5942f..66afcf3 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -345,8 +345,7 @@ {CBMEM_ID_ACPI_GNVS, LB_TAG_ACPI_GNVS}, {CBMEM_ID_VPD, LB_TAG_VPD}, {CBMEM_ID_WIFI_CALIBRATION, LB_TAG_WIFI_CALIBRATION}, - {CBMEM_ID_TCPA_LOG, LB_TAG_TCPA_LOG}, - {CBMEM_ID_FMAP, LB_TAG_FMAP}, + {CBMEM_ID_TCPA_LOG, LB_TAG_TCPA_LOG} }; int i;
diff --git a/src/lib/fmap.c b/src/lib/fmap.c index f007418..2b4e3ba 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -20,7 +20,6 @@ #include <commonlib/fmap_serialized.h> #include <stddef.h> #include <string.h> -#include <cbmem.h>
#include "fmap_config.h"
@@ -29,7 +28,6 @@ */
static int fmap_print_once CAR_GLOBAL; -static struct mem_region_device fmap_cache CAR_GLOBAL;
int find_fmap_directory(struct region_device *fmrd) { @@ -38,16 +36,6 @@ size_t fmap_size; size_t offset = FMAP_OFFSET;
- if (cbmem_possibly_online() && !ENV_SMM) { - /* Try FMAP cache first */ - const struct mem_region_device *cache; - - cache = car_get_var_ptr(&fmap_cache); - if (region_device_sz(&cache->rdev)) - return rdev_chain(fmrd, &cache->rdev, 0, - region_device_sz(&cache->rdev)); - } - boot_device_init(); boot = boot_device_ro();
@@ -207,53 +195,3 @@ return -1; return rdev_writeat(&rdev, buffer, 0, size); } - -static void fmap_register_cache(int unused) -{ - const struct cbmem_entry *e; - struct mem_region_device *mdev; - - mdev = car_get_var_ptr(&fmap_cache); - - /* Find the FMAP cache installed by previous stage */ - e = cbmem_entry_find(CBMEM_ID_FMAP); - /* Don't set fmap_cache so that find_fmap_directory will use regular path */ - if (!e) - return; - - mem_region_device_ro_init(mdev, cbmem_entry_start(e), cbmem_entry_size(e)); -} - -/* - * The main reason to copy the FMAP into CBMEM is to make it available to the - * OS on every architecture. As side effect use the CBMEM copy as cache. - */ -static void fmap_setup_cache(int unused) -{ - struct region_device fmrd; - - if (find_fmap_directory(&fmrd)) - return; - - /* Reloads the FMAP even on ACPI S3 resume */ - const size_t s = region_device_sz(&fmrd); - struct fmap *fmap = cbmem_add(CBMEM_ID_FMAP, s); - if (!fmap) { - printk(BIOS_ERR, "ERROR: Failed to allocate CBMEM\n"); - return; - } - - const ssize_t ret = rdev_readat(&fmrd, fmap, 0, s); - if (ret != s) { - printk(BIOS_ERR, "ERROR: Failed to read FMAP into CBMEM\n"); - cbmem_entry_remove(cbmem_entry_find(CBMEM_ID_FMAP)); - return; - } - - /* Finally advertise the cache for the current stage */ - fmap_register_cache(unused); -} - -ROMSTAGE_CBMEM_INIT_HOOK(fmap_setup_cache) -RAMSTAGE_CBMEM_INIT_HOOK(fmap_register_cache) -POSTCAR_CBMEM_INIT_HOOK(fmap_register_cache)