diff options
author | Jonathan Zhang <jonzhang@fb.com> | 2020-07-06 11:47:26 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-07-12 19:37:34 +0000 |
commit | 1866a8cba4b6a538cb98da380a9ddb805cd235ce (patch) | |
tree | 148f2635c347970fa1d9c9428ed1654fc66ed825 | |
parent | 8b85e8152be0b0c3cd761d22a7a8bfa84c1eeace (diff) |
soc/intel/xeon_sp/cpx: use HOB_TYPE_GUID_EXTENSION to interpret platform HOBs
Platform HOBs (in particular IIO_UDS and MemoryMap HOBs) are of HOB type
HOB_TYPE_GUID_EXTENSION, therefore they do not have resource structure.
Remove the erroneous code related to resource structure.
Remove unnecessary function prototypes from header files, and define them
as static in hob_display.c.
Since we have the HOB pointer, there is not need to search HOB by GUID.
Remove unnecessary calling of fsp_find_extension_hob_by_guid().
Signed-off-by: Jonathan Zhang <jonzhang@fb.com>
Signed-off-by: Reddy Chagam <anjaneya.chagam@intel.com>
Change-Id: Ib99bce39e6eb2aeb95242dfba36774653bbe91fd
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43335
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/soc/intel/xeon_sp/cpx/hob_display.c | 62 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h | 1 | ||||
-rw-r--r-- | src/vendorcode/intel/fsp/fsp2_0/cooperlake_sp/hob_memmap.h | 2 |
3 files changed, 25 insertions, 40 deletions
diff --git a/src/soc/intel/xeon_sp/cpx/hob_display.c b/src/soc/intel/xeon_sp/cpx/hob_display.c index d5910c302b..0263472fc0 100644 --- a/src/soc/intel/xeon_sp/cpx/hob_display.c +++ b/src/soc/intel/xeon_sp/cpx/hob_display.c @@ -33,37 +33,14 @@ const char *soc_get_guid_name(const uint8_t *guid) return NULL; } -void soc_display_hob(const struct hob_header *hob) -{ - const struct hob_resource *res; - - res = fsp_hob_header_to_resource(hob); - assert(res != NULL); - printk(BIOS_DEBUG, "\tResource type: 0x%x, attribute: 0x%x, addr: 0x%08llx, len: 0x%08llx\n", - res->type, res->attribute_type, res->addr, res->length); - printk(BIOS_DEBUG, "\tOwner GUID: "); - fsp_print_guid(res->owner_guid); - printk(BIOS_DEBUG, " (%s)\n", fsp_get_guid_name(res->owner_guid)); - - if (fsp_guid_compare(res->owner_guid, fsp_hob_iio_uds_guid)) - soc_display_iio_universal_data_hob(); - else if (fsp_guid_compare(res->owner_guid, fsp_hob_memmap_guid)) - soc_display_memmap_hob(); -} - -void soc_display_memmap_hob(void) +static void soc_display_memmap_hob(const struct SystemMemoryMapHob *hob_addr) { - size_t hob_size; - const struct SystemMemoryMapHob *hob; - const uint8_t mem_hob_guid[16] = FSP_SYSTEM_MEMORYMAP_HOB_GUID; + struct SystemMemoryMapHob *hob = (struct SystemMemoryMapHob *)hob_addr; - hob = (const struct SystemMemoryMapHob *)fsp_find_extension_hob_by_guid( - mem_hob_guid, &hob_size); - assert(hob != NULL); + printk(BIOS_DEBUG, "================== MEMORY MAP HOB DATA ==================\n"); + printk(BIOS_DEBUG, "hob: %p, structure size: 0x%lx\n", + hob, sizeof(*hob)); - printk(BIOS_DEBUG, "===================== MEMORY MAP HOB DATA =====================\n"); - printk(BIOS_DEBUG, "hob: %p, size: 0x%lx, structure size: 0x%lx\n", - hob, hob_size, sizeof(*hob)); printk(BIOS_DEBUG, "\tlowMemBase: 0x%x, lowMemSize: 0x%x, highMemBase: 0x%x, " "highMemSize: 0x%x\n", hob->lowMemBase, hob->lowMemSize, hob->highMemBase, hob->highMemSize); @@ -82,17 +59,11 @@ void soc_display_memmap_hob(void) hexdump(hob, sizeof(*hob)); } -void soc_display_iio_universal_data_hob(void) +static void soc_display_iio_universal_data_hob(const IIO_UDS *hob) { - size_t hob_size; - const IIO_UDS *hob; - const uint8_t fsp_hob_iio_universal_data_guid[16] = FSP_HOB_IIO_UNIVERSAL_DATA_GUID; - - hob = (const IIO_UDS *)fsp_find_extension_hob_by_guid( - fsp_hob_iio_universal_data_guid, &hob_size); - assert(hob != NULL); - printk(BIOS_DEBUG, "===================== IIO_UDS HOB DATA =====================\n"); + printk(BIOS_DEBUG, "hob: %p, structure size: 0x%lx\n", + hob, sizeof(*hob)); printk(BIOS_DEBUG, "\t===================== SYSTEM STATUS =====================\n"); printk(BIOS_DEBUG, "\tnumCpus: 0x%x\n", hob->SystemStatus.numCpus); @@ -194,4 +165,21 @@ void soc_display_iio_universal_data_hob(void) iio_resource.PcieInfo.PortInfo[p].Function); } } + + hexdump(hob, sizeof(*hob)); +} + +void soc_display_hob(const struct hob_header *hob) +{ + uint8_t *guid; + + if (hob->type != HOB_TYPE_GUID_EXTENSION) + return; + + guid = (uint8_t *) fsp_hob_header_to_resource(hob); + + if (fsp_guid_compare(guid, fsp_hob_iio_uds_guid)) + soc_display_iio_universal_data_hob((const IIO_UDS *)(guid + 16)); + else if (fsp_guid_compare(guid, fsp_hob_memmap_guid)) + soc_display_memmap_hob((const struct SystemMemoryMapHob *)(guid + 16)); } diff --git a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h index d9ef24d7e8..412730b647 100644 --- a/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h +++ b/src/soc/intel/xeon_sp/cpx/include/soc/soc_util.h @@ -42,6 +42,5 @@ int get_threads_per_package(void); const struct SystemMemoryMapHob *get_system_memory_map(void); void set_bios_init_completion(void); -void soc_display_iio_universal_data_hob(void); #endif /* _SOC_UTIL_H_ */ diff --git a/src/vendorcode/intel/fsp/fsp2_0/cooperlake_sp/hob_memmap.h b/src/vendorcode/intel/fsp/fsp2_0/cooperlake_sp/hob_memmap.h index ee86a6ddec..df7787a330 100644 --- a/src/vendorcode/intel/fsp/fsp2_0/cooperlake_sp/hob_memmap.h +++ b/src/vendorcode/intel/fsp/fsp2_0/cooperlake_sp/hob_memmap.h @@ -109,6 +109,4 @@ typedef struct SystemMemoryMapHob { #pragma pack() -void soc_display_memmap_hob(void); - #endif |