17 const bool s3wake =
params->power_state->prev_sleep_state ==
ACPI_S3;
18 const EFI_GUID bootldr_tolum_guid = FSP_BOOTLOADER_TOLUM_HOB_GUID;
19 EFI_HOB_RESOURCE_DESCRIPTOR *cbmem_root;
20 FSP_INFO_HEADER *fsp_header;
21 EFI_HOB_RESOURCE_DESCRIPTOR *fsp_memory;
23 FSP_MEMORY_INIT_PARAMS fsp_memory_init_params;
24 const EFI_GUID fsp_reserved_guid =
25 FSP_RESERVED_MEMORY_RESOURCE_HOB_GUID;
26 void *fsp_reserved_memory_area;
27 FSP_INIT_RT_COMMON_BUFFER fsp_rt_common_buffer;
29 FSP_SMBIOS_MEMORY_INFO *memory_info_hob;
31 MEMORY_INIT_UPD memory_init_params;
32 const EFI_GUID mrc_guid = FSP_NON_VOLATILE_STORAGE_HOB_GUID;
34 u32 fsp_reserved_bytes;
35 MEMORY_INIT_UPD *original_params;
37 VPD_DATA_REGION *vpd_ptr;
38 UPD_DATA_REGION *upd_ptr;
39 int fsp_verification_failure = 0;
40 EFI_PEI_HOB_POINTERS hob_ptr;
54 fsp_header =
params->chipset_context;
55 vpd_ptr = (VPD_DATA_REGION *)(fsp_header->CfgRegionOffset +
56 fsp_header->ImageBase);
58 upd_ptr = (UPD_DATA_REGION *)(vpd_ptr->PcdUpdRegionOffset +
59 fsp_header->ImageBase);
61 original_params = (
void *)((
u8 *)upd_ptr +
62 upd_ptr->MemoryInitUpdOffset);
63 memcpy(&memory_init_params, original_params,
64 sizeof(memory_init_params));
67 memset(&fsp_rt_common_buffer, 0,
sizeof(fsp_rt_common_buffer));
69 fsp_rt_common_buffer.BootMode = BOOT_ON_S3_RESUME;
71 fsp_rt_common_buffer.BootMode =
72 BOOT_ASSUMING_NO_CONFIGURATION_CHANGES;
74 fsp_rt_common_buffer.BootMode = BOOT_WITH_FULL_CONFIGURATION;
76 fsp_rt_common_buffer.UpdDataRgnPtr = &memory_init_params;
80 fsp_memory_init_params.NvsBufferPtr = (
void *)
params->saved_data;
81 fsp_memory_init_params.RtBufferPtr = &fsp_rt_common_buffer;
82 fsp_memory_init_params.HobListPtr = &hob_list_ptr;
94 if (
CONFIG(DISPLAY_UPD_DATA))
100 + fsp_header->FspMemoryInitEntryOffset);
103 fsp_memory_init_params.NvsBufferPtr);
105 fsp_memory_init_params.RtBufferPtr);
107 fsp_memory_init_params.HobListPtr);
117 if (status != EFI_SUCCESS)
119 "ERROR - FspMemoryInit failed to initialize memory!\n");
122 fsp_reserved_bytes = 0;
124 if (fsp_memory ==
NULL) {
125 fsp_verification_failure = 1;
127 "7.2: FSP_RESERVED_MEMORY_RESOURCE_HOB missing!\n");
129 fsp_reserved_bytes = fsp_memory->ResourceLength;
131 (
unsigned long int)fsp_reserved_bytes);
135 if (
CONFIG(HAVE_SMI_HANDLER)) {
147 fsp_reserved_bytes)) {
159 if (cbmem_root ==
NULL) {
160 fsp_verification_failure = 1;
163 fsp_rt_common_buffer.BootLoaderTolumSize);
169 if (memory_info_hob ==
NULL) {
171 fsp_verification_failure = 1;
174 if (hob_list_ptr ==
NULL)
176 "ERROR - HOB pointer is NULL!\n");
191 fsp_verification_failure = 1;
195 if (fsp_verification_failure)
205 fsp_reserved_memory_area);
208 if ((fsp_memory !=
NULL) && (cbmem_root !=
NULL) &&
209 (cbmem_root->PhysicalStart <= fsp_memory->PhysicalStart)) {
210 fsp_verification_failure = 1;
215 if ((fsp_memory !=
NULL) && ((fsp_reserved_memory_area ==
NULL) ||
216 (fsp_memory->PhysicalStart !=
217 (
unsigned int)fsp_reserved_memory_area))) {
218 fsp_verification_failure = 1;
221 if (
CONFIG(HAVE_SMI_HANDLER) && cbmem_root !=
NULL) {
222 size_t delta_bytes = smm_base
223 - cbmem_root->PhysicalStart
224 - cbmem_root->ResourceLength;
226 "0x%08x: Chipset reserved bytes reported by FSP\n",
227 (
unsigned int)delta_bytes);
229 "Please verify the chipset reserved size\n");
234 if (fsp_verification_failure)
236 "ERROR - coreboot's requirements not met by FSP binary!\n");
240 if (mrc_hob ==
NULL) {
242 "Memory Configuration Data Hob not present\n");
244 params->data_to_save = GET_GUID_HOB_DATA(mrc_hob);
246 ((
u32)GET_HOB_LENGTH(mrc_hob)), 16);
void * memcpy(void *dest, const void *src, size_t n)
void * memset(void *dstpp, int c, size_t len)
static struct sdram_info params
int cbmem_initialize_id_size(u32 id, u64 size)
static size_t cbmem_overhead_size(void)
void cbmem_initialize_empty_id_size(u32 id, u64 size)
void * cbmem_find(u32 id)
#define CBMEM_ID_FSP_RESERVED_MEMORY
#define printk(level,...)
#define die_with_post_code(value, fmt,...)
void soc_display_memory_init_params(const MEMORY_INIT_UPD *old, MEMORY_INIT_UPD *new)
void mainboard_memory_init_params(struct romstage_params *params, MEMORY_INIT_UPD *memory_params)
void soc_memory_init_params(struct romstage_params *params, MEMORY_INIT_UPD *upd)
void setup_mma(MEMORY_INIT_UPD *memory_upd)
__weak void mainboard_after_memory_init(void)
void raminit(struct romstage_params *params)
void fsp_memory_init(bool s3wake)
void fsp_set_runtime(FSP_INFO_HEADER *fih, void *hob_list)
void print_hob_type_structure(u16 hob_type, void *hob_list_ptr)
void * get_resource_hob(const EFI_GUID *guid, const void *hob_start)
void * get_guid_hob(const EFI_GUID *guid, const void *hob_start)
void smm_region(uintptr_t *start, size_t *size)
void timestamp_add_now(enum timestamp_id id)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define POST_MEM_PREINIT_PREP_END
Pre-memory init preparation end.
#define POST_RAM_FAILURE
RAM failure.
#define POST_INVALID_VENDOR_BINARY
Vendor binary error.
#define POST_FSP_MEMORY_INIT
Before calling FSP MemoryInit.
#define POST_MEM_PREINIT_PREP_START
Pre-memory init preparation start.
const struct smm_save_state_ops *legacy_ops __weak
#define FSP_SMBIOS_MEMORY_INFO_GUID
@ TS_FSP_MEMORY_INIT_START