Ravi kumar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/60534 )
Change subject: Revert "libpayload: Add CBMEM_IMD_ENTRY support to coreboot tables parser" ......................................................................
Revert "libpayload: Add CBMEM_IMD_ENTRY support to coreboot tables parser"
This reverts commit 2f236c232d9ceaeeddf8efa2868a3afbd898e1b3.
Change-Id: Ie3d121caf63a70657190441395b0cbbd6c8d9925 --- M payloads/libpayload/arch/x86/coreboot.c M payloads/libpayload/include/coreboot_tables.h M payloads/libpayload/include/sysinfo.h M payloads/libpayload/libc/coreboot.c 4 files changed, 68 insertions(+), 71 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/60534/1
diff --git a/payloads/libpayload/arch/x86/coreboot.c b/payloads/libpayload/arch/x86/coreboot.c index cad1396..38ede87 100644 --- a/payloads/libpayload/arch/x86/coreboot.c +++ b/payloads/libpayload/arch/x86/coreboot.c @@ -47,12 +47,20 @@ info->x86_rom_var_mtrr_index = rom_mtrr->index; }
+static void cb_parse_mrc_cache(void *ptr, struct sysinfo_t *info) +{ + info->mrc_cache = get_cbmem_addr(ptr); +} + int cb_parse_arch_specific(struct cb_record *rec, struct sysinfo_t *info) { switch(rec->tag) { case CB_TAG_X86_ROM_MTRR: cb_parse_x86_rom_var_mtrr(rec, info); break; + case CB_TAG_MRC_CACHE: + cb_parse_mrc_cache(rec, info); + break; default: return 0; } diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index e211805..2e3a416 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -322,16 +322,6 @@ uint64_t boot_media_size; };
- -struct cb_cbmem_entry { - uint32_t tag; - uint32_t size; - - uint64_t address; - uint32_t entry_size; - uint32_t id; -}; - struct cb_tsc_info { uint32_t tag; uint32_t size; @@ -454,4 +444,6 @@ (void *)(((u8 *) (_rec)) + sizeof(*(_rec)) \ + (sizeof((_rec)->map[0]) * (_idx)))
+/* Helper functions */ +uintptr_t get_cbmem_addr(const void *cbmem_tab_entry); #endif diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index eba4b892..6197fc4 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -151,12 +151,6 @@ #endif /* USB Type-C Port Configuration Info */ uintptr_t type_c_info; - - /* CBFS RW/RO Metadata Cache */ - uintptr_t cbfs_ro_mcache_offset; - uint32_t cbfs_ro_mcache_size; - uintptr_t cbfs_rw_mcache_offset; - uint32_t cbfs_rw_mcache_size; };
extern struct sysinfo_t lib_sysinfo; diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index 6f4f4a4..af588ad 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -29,7 +29,6 @@
#include <libpayload-config.h> #include <libpayload.h> -#include <commonlib/bsd/cbmem_id.h> #include <coreboot_tables.h> #include <stdint.h>
@@ -42,6 +41,12 @@ /* === Parsing code === */ /* This is the generic parsing code. */
+uintptr_t get_cbmem_addr(const void *const cbmem_tab_entry) +{ + const struct cb_cbmem_tab *const cbmem = cbmem_tab_entry; + return cbmem->cbmem_tab; +} + static void cb_parse_memory(void *ptr, struct sysinfo_t *info) { struct cb_memory *mem = ptr; @@ -78,6 +83,11 @@ info->cb_serial = virt_to_phys(ptr); }
+static void cb_parse_vboot_workbuf(unsigned char *ptr, struct sysinfo_t *info) +{ + info->vboot_workbuf = get_cbmem_addr(ptr); +} + static void cb_parse_vbnv(unsigned char *ptr, struct sysinfo_t *info) { struct lb_range *vbnv = (struct lb_range *)ptr; @@ -183,6 +193,11 @@ *info = virt_to_phys(str->string); }
+static void cb_parse_wifi_calibration(void *ptr, struct sysinfo_t *info) +{ + info->wifi_calibration = get_cbmem_addr(ptr); +} + static void cb_parse_ramoops(void *ptr, struct sysinfo_t *info) { struct lb_range *ramoops = (struct lb_range *)ptr; @@ -226,6 +241,21 @@ info->boot_media_size = bmp->boot_media_size; }
+static void cb_parse_vpd(void *ptr, struct sysinfo_t *info) +{ + info->chromeos_vpd = get_cbmem_addr(ptr); +} + +static void cb_parse_fmap_cache(void *ptr, struct sysinfo_t *info) +{ + info->fmap_cache = get_cbmem_addr(ptr); +} + +static void cb_parse_type_c_info(void *ptr, struct sysinfo_t *info) +{ + info->type_c_info = get_cbmem_addr(ptr); +} + #if CONFIG(LP_TIMER_RDTSC) static void cb_parse_tsc_info(void *ptr, struct sysinfo_t *info) { @@ -239,57 +269,6 @@ } #endif
-static void cb_parse_cbmem_entry(void *ptr, struct sysinfo_t *info) -{ - const struct cb_cbmem_entry *cbmem_entry = ptr; - - if (cbmem_entry->size != sizeof(*cbmem_entry)) - return; - - switch (cbmem_entry->id) { - case CBMEM_ID_ACPI_CNVS: - info->acpi_cnvs = cbmem_entry->address; - break; - case CBMEM_ID_ACPI_GNVS: - info->acpi_gnvs = cbmem_entry->address; - break; - case CBMEM_ID_CBFS_RO_MCACHE: - info->cbfs_ro_mcache_offset = cbmem_entry->address; - info->cbfs_ro_mcache_size = cbmem_entry->size; - break; - case CBMEM_ID_CBFS_RW_MCACHE: - info->cbfs_rw_mcache_offset = cbmem_entry->address; - info->cbfs_rw_mcache_size = cbmem_entry->size; - break; - case CBMEM_ID_CONSOLE: - info->cbmem_cons = cbmem_entry->address; - break; - case CBMEM_ID_MRCDATA: - info->mrc_cache = cbmem_entry->address; - break; - case CBMEM_ID_VBOOT_WORKBUF: - info->vboot_workbuf = cbmem_entry->address; - break; - case CBMEM_ID_TIMESTAMP: - info->tstamp_table = cbmem_entry->address; - break; - case CBMEM_ID_VPD: - info->chromeos_vpd = cbmem_entry->address; - break; - case CBMEM_ID_FMAP: - info->fmap_cache = cbmem_entry->address; - break; - case CBMEM_ID_WIFI_CALIBRATION: - info->wifi_calibration = cbmem_entry->address; - break; - case CBMEM_ID_TYPE_C_INFO: - info->type_c_info = cbmem_entry->address; - break; - default: - break; - } -} - int cb_parse_header(void *addr, int len, struct sysinfo_t *info) { struct cb_header *header; @@ -401,15 +380,33 @@ case CB_TAG_VBNV: cb_parse_vbnv(ptr, info); break; + case CB_TAG_VBOOT_WORKBUF: + cb_parse_vboot_workbuf(ptr, info); + break; case CB_TAG_MAC_ADDRS: cb_parse_mac_addresses(ptr, info); break; case CB_TAG_SERIALNO: cb_parse_string(ptr, &info->serialno); break; + case CB_TAG_TIMESTAMPS: + cb_parse_tstamp(ptr, info); + break; + case CB_TAG_CBMEM_CONSOLE: + cb_parse_cbmem_cons(ptr, info); + break; + case CB_TAG_ACPI_GNVS: + cb_parse_acpi_gnvs(ptr, info); + break; + case CB_TAG_ACPI_CNVS: + cb_parse_acpi_cnvs(ptr, info); + break; case CB_TAG_BOARD_CONFIG: cb_parse_board_config(ptr, info); break; + case CB_TAG_WIFI_CALIBRATION: + cb_parse_wifi_calibration(ptr, info); + break; case CB_TAG_RAM_OOPS: cb_parse_ramoops(ptr, info); break; @@ -425,14 +422,20 @@ case CB_TAG_BOOT_MEDIA_PARAMS: cb_parse_boot_media_params(ptr, info); break; - case CB_TAG_CBMEM_ENTRY: - cb_parse_cbmem_entry(ptr, info); - break; #if CONFIG(LP_TIMER_RDTSC) case CB_TAG_TSC_INFO: cb_parse_tsc_info(ptr, info); break; #endif + case CB_TAG_VPD: + cb_parse_vpd(ptr, info); + break; + case CB_TAG_FMAP: + cb_parse_fmap_cache(ptr, info); + break; + case CB_TAG_TYPE_C_INFO: + cb_parse_type_c_info(ptr, info); + break; default: cb_parse_arch_specific(rec, info); break;