drivers/intel/fsp1_1/raminit.c: Always check FSP HOBs

Check for FSP HOBs is depending on CONFIG_DISPLAY_HOBS.
Use the CONFIG_DISPLAY_HOBS for display HOB info only and always check HOBs.

Use BIOS_ERR of printk() for FSP errors.

BUG=N/A
TEST=Check console output on Facebook FBG1701.

Change-Id: I3776fa37866c7ef3aea090842387660c22bbdd4d
Signed-off-by: Frans Hendriks <fhendriks@eltan.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/29371
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
Frans Hendriks 2019-06-28 14:11:41 +02:00 committed by Patrick Georgi
parent 71c6c1725e
commit 509f46953e
2 changed files with 24 additions and 60 deletions

View File

@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2014-2016 Intel Corporation
* Copyright (C) 2018 Eltan B.V.
* Copyright (C) 2018-2019 Eltan B.V.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,10 +52,7 @@ void raminit(struct romstage_params *params)
VPD_DATA_REGION *vpd_ptr;
UPD_DATA_REGION *upd_ptr;
int fsp_verification_failure = 0;
#if CONFIG(DISPLAY_HOBS)
unsigned long int data;
EFI_PEI_HOB_POINTERS hob_ptr;
#endif
/*
* Find and copy the UPD region to the stack so the platform can modify
@ -139,7 +136,7 @@ void raminit(struct romstage_params *params)
fsp_memory = get_next_resource_hob(&fsp_reserved_guid, hob_list_ptr);
if (fsp_memory == NULL) {
fsp_verification_failure = 1;
printk(BIOS_DEBUG,
printk(BIOS_ERR,
"7.2: FSP_RESERVED_MEMORY_RESOURCE_HOB missing!\n");
} else {
fsp_reserved_bytes = fsp_memory->ResourceLength;
@ -190,13 +187,12 @@ void raminit(struct romstage_params *params)
if (memory_info_hob == NULL) {
printk(BIOS_ERR, "FSP_SMBIOS_MEMORY_INFO HOB missing!\n");
fsp_verification_failure = 1;
} else {
printk(BIOS_DEBUG,
"FSP_SMBIOS_MEMORY_INFO HOB: 0x%p\n",
memory_info_hob);
}
#if CONFIG(DISPLAY_HOBS)
if (hob_list_ptr == NULL)
die_with_post_code(POST_RAM_FAILURE,
"ERROR - HOB pointer is NULL!\n");
/*
* Verify that FSP is generating the required HOBs:
* 7.1: FSP_BOOTLOADER_TEMP_MEMORY_HOB only produced for FSP 1.0
@ -207,47 +203,20 @@ void raminit(struct romstage_params *params)
* 7.5: EFI_PEI_GRAPHICS_INFO_HOB produced by SiliconInit
* FSP_SMBIOS_MEMORY_INFO HOB verified above
*/
if (cbmem_root != NULL) {
printk(BIOS_DEBUG,
"7.4: FSP_BOOTLOADER_TOLUM_HOB: 0x%p\n",
cbmem_root);
data = cbmem_root->PhysicalStart;
printk(BIOS_DEBUG, " 0x%016lx: PhysicalStart\n", data);
data = cbmem_root->ResourceLength;
printk(BIOS_DEBUG, " 0x%016lx: ResourceLength\n", data);
}
hob_ptr.Raw = get_next_guid_hob(&mrc_guid, hob_list_ptr);
if (hob_ptr.Raw == NULL) {
if (params->saved_data == NULL) {
if ((hob_ptr.Raw == NULL) && (params->saved_data == NULL)) {
printk(BIOS_ERR, "7.3: FSP_NON_VOLATILE_STORAGE_HOB missing!\n");
fsp_verification_failure = 1;
}
} else {
printk(BIOS_DEBUG,
"7.3: FSP_NON_VOLATILE_STORAGE_HOB: 0x%p\n",
hob_ptr.Raw);
}
if (fsp_memory != NULL) {
printk(BIOS_DEBUG,
"7.2: FSP_RESERVED_MEMORY_RESOURCE_HOB: 0x%p\n",
fsp_memory);
data = fsp_memory->PhysicalStart;
printk(BIOS_DEBUG, " 0x%016lx: PhysicalStart\n", data);
data = fsp_memory->ResourceLength;
printk(BIOS_DEBUG, " 0x%016lx: ResourceLength\n", data);
}
/* Verify all the HOBs are present */
if (fsp_verification_failure)
printk(BIOS_DEBUG,
printk(BIOS_ERR,
"ERROR - Missing one or more required FSP HOBs!\n");
/* Display the HOBs */
if (hob_list_ptr != NULL)
if (CONFIG(DISPLAY_HOBS))
print_hob_type_structure(0, hob_list_ptr);
else
printk(BIOS_ERR, "ERROR - HOB pointer is NULL!\n");
#endif
/* Get the address of the CBMEM region for the FSP reserved memory */
fsp_reserved_memory_area = cbmem_find(CBMEM_ID_FSP_RESERVED_MEMORY);
@ -258,7 +227,7 @@ void raminit(struct romstage_params *params)
if ((fsp_memory != NULL) && (cbmem_root != NULL) &&
(cbmem_root->PhysicalStart <= fsp_memory->PhysicalStart)) {
fsp_verification_failure = 1;
printk(BIOS_DEBUG,
printk(BIOS_ERR,
"ERROR - FSP reserved memory above CBMEM root!\n");
}
@ -267,13 +236,13 @@ void raminit(struct romstage_params *params)
(fsp_memory->PhysicalStart !=
(unsigned int)fsp_reserved_memory_area))) {
fsp_verification_failure = 1;
printk(BIOS_DEBUG, "ERROR - Reserving FSP memory area!\n");
printk(BIOS_ERR, "ERROR - Reserving FSP memory area!\n");
#if CONFIG(HAVE_SMI_HANDLER)
if (cbmem_root != NULL) {
size_t delta_bytes = (unsigned int)smm_base
- cbmem_root->PhysicalStart
- cbmem_root->ResourceLength;
printk(BIOS_DEBUG,
printk(BIOS_ERR,
"0x%08x: Chipset reserved bytes reported by FSP\n",
(unsigned int)delta_bytes);
die_with_post_code(POST_INVALID_VENDOR_BINARY,
@ -292,7 +261,7 @@ void raminit(struct romstage_params *params)
/* Locate the memory configuration data to speed up the next reboot */
mrc_hob = get_next_guid_hob(&mrc_guid, hob_list_ptr);
if (mrc_hob == NULL)
if ((mrc_hob == NULL) && CONFIG(DISPLAY_HOBS))
printk(BIOS_DEBUG,
"Memory Configuration Data Hob not present\n");
else if (!vboot_recovery_mode_enabled()) {

View File

@ -52,18 +52,15 @@ static void smm_memory_map(void)
static void display_hob_info(FSP_INFO_HEADER *fsp_info_header)
{
const EFI_GUID graphics_info_guid = EFI_PEI_GRAPHICS_INFO_HOB_GUID;
int missing_hob = 0;
void *hob_list_ptr = get_hob_list();
if (!CONFIG(DISPLAY_HOBS))
return;
/* Verify the HOBs */
if (hob_list_ptr == NULL) {
printk(BIOS_INFO, "ERROR - HOB pointer is NULL!\n");
printk(BIOS_ERR, "ERROR - HOB pointer is NULL!\n");
return;
}
if (CONFIG(DISPLAY_HOBS))
print_hob_type_structure(0, hob_list_ptr);
/*
@ -77,15 +74,13 @@ static void display_hob_info(FSP_INFO_HEADER *fsp_info_header)
* FSP_SMBIOS_MEMORY_INFO HOB verified by raminit
*/
if ((fsp_info_header->ImageAttribute & GRAPHICS_SUPPORT_BIT) &&
!get_next_guid_hob(&graphics_info_guid, hob_list_ptr)) {
printk(BIOS_INFO, "7.5: EFI_PEI_GRAPHICS_INFO_HOB missing!\n");
missing_hob = 1;
}
if (missing_hob)
printk(BIOS_INFO,
!get_next_guid_hob(&graphics_info_guid, hob_list_ptr) &&
CONFIG(DISPLAY_HOBS)) {
printk(BIOS_ERR, "7.5: EFI_PEI_GRAPHICS_INFO_HOB missing!\n");
printk(BIOS_ERR,
"ERROR - Missing one or more required FSP HOBs!\n");
}
}
void fsp_run_silicon_init(FSP_INFO_HEADER *fsp_info_header, int is_s3_wakeup)
{