drivers/intel/fsp2_0: Add support for FSP_NON_VOLATILE_STORAGE_HOB2

FSP 2.3 spec introduced new version of NV storage HOB
FSP_NON_VOLATILE_STORAGE_HOB2. This new HOB addresses the limitation of
FSP_NON_VOLATILE_STORAGE_HOB which can support data length
upto 64KB. FSP_NON_VOLATILE_STORAGE_HOB2 allows >64KB of NVS data to be
stored by specifying a pointer to the NVS data.

FSP_NON_VOLATILE_STORAGE_HOB HOB is deprecated
from FSP 2.3 onwards and is maintained for backward compatibility only.

This patch implements the parsing method for
FSP_NON_VOLATILE_STORAGE_HOB2 HOB structure .The HOB list is first
searched for FSP_NON_VOLATILE_STORAGE_HOB2. If not found we continue
to search for FSP_NON_VOLATILE_STORAGE_HOB HOB.

BUG=b:200113959
TEST=Verified on sapphire rapids and meteor lake FSP platform that
introduces FSP_NON_VOLATILE_STORAGE_HOB2 for retrieving MRC cached data.

Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I27647e9ac1a4902256b3f1c34b60e1f0b787a06e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59638
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Anil Kumar 2021-11-24 14:31:04 -08:00 committed by Felix Held
parent d400d497fb
commit 0dd0368740
2 changed files with 21 additions and 0 deletions

View File

@ -22,6 +22,11 @@ const uint8_t fsp_reserved_memory_guid[16] = {
0xa6, 0xc4, 0xc7, 0xf5, 0x9e, 0xfd, 0x98, 0x6e, 0xa6, 0xc4, 0xc7, 0xf5, 0x9e, 0xfd, 0x98, 0x6e,
}; };
const uint8_t fsp_nv_storage_guid_2[16] = {
0x8f, 0x78, 0x66, 0x48, 0xa8, 0x6b, 0xd8, 0x47,
0x83, 0x6, 0xac, 0xf7, 0x7f, 0x55, 0x10, 0x46
};
const uint8_t fsp_nv_storage_guid[16] = { const uint8_t fsp_nv_storage_guid[16] = {
0x02, 0xcf, 0x1a, 0x72, 0x77, 0x4d, 0x2a, 0x4c, 0x02, 0xcf, 0x1a, 0x72, 0x77, 0x4d, 0x2a, 0x4c,
0xb3, 0xdc, 0x27, 0x0b, 0x7b, 0xa9, 0xe4, 0xb0 0xb3, 0xdc, 0x27, 0x0b, 0x7b, 0xa9, 0xe4, 0xb0
@ -306,6 +311,16 @@ void fsp_display_fvi_version_hob(void)
const void *fsp_find_nv_storage_data(size_t *size) const void *fsp_find_nv_storage_data(size_t *size)
{ {
if (CONFIG(PLATFORM_USES_FSP2_3)) {
const struct fsp_nvs_hob2_data_region_header *hob;
hob = (const struct fsp_nvs_hob2_data_region_header *)
fsp_find_extension_hob_by_guid(fsp_nv_storage_guid_2, size);
if (hob != NULL) {
*size = hob->nvs_data_length;
return (void *)(uintptr_t)hob->nvs_data_ptr;
}
}
return fsp_find_extension_hob_by_guid(fsp_nv_storage_guid, size); return fsp_find_extension_hob_by_guid(fsp_nv_storage_guid, size);
} }

View File

@ -8,6 +8,7 @@
#include <commonlib/region.h> #include <commonlib/region.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <fsp/api.h> #include <fsp/api.h>
#include <efi/efi_datatype.h>
#include <fsp/info_header.h> #include <fsp/info_header.h>
#include <memrange.h> #include <memrange.h>
#include <program_loading.h> #include <program_loading.h>
@ -27,6 +28,11 @@ struct hob_header {
uint16_t length; uint16_t length;
} __packed; } __packed;
struct fsp_nvs_hob2_data_region_header {
efi_physical_address nvs_data_ptr;
uint64_t nvs_data_length;
};
struct fsp_notify_params { struct fsp_notify_params {
enum fsp_notify_phase phase; enum fsp_notify_phase phase;
}; };