coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
fsp_validate.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <fsp/util.h>
5 #include <types.h>
6 
13 
14 /* Validate the FSP-M header in romstage */
15 void soc_validate_fspm_header(const struct fsp_header *hdr)
16 {
17  struct amd_image_revision *rev;
18 
19  rev = (struct amd_image_revision *) &(hdr->image_revision);
20 
21  /* Check if the image fits into the reserved memory region */
22  if (hdr->image_size > CONFIG_FSP_M_SIZE)
23  die("The FSP-M binary is %u bytes larger than the memory region"
24  " allocated for it. Increase FSP_M_SIZE to make it fit.\n",
25  hdr->image_size - CONFIG_FSP_M_SIZE);
26 
27  /* a coding bug on the AMD FSP side makes this value 1 in
28  older versions of the FSP.*/
29  if (hdr->image_revision == 1) {
30  printk(BIOS_WARNING, "No AMD FSP image revision information available\n");
31  return;
32  }
33 
34  printk(BIOS_INFO, "FSP major = %d\n", rev->major);
35  printk(BIOS_INFO, "FSP minor = %d\n", rev->minor);
36  printk(BIOS_INFO, "FSP revision = %d\n", rev->revision);
37  printk(BIOS_INFO, "FSP build = %d\n", rev->build);
38 
39  if ((rev->major != IMAGE_REVISION_MAJOR_VERSION) ||
40  (rev->minor != IMAGE_REVISION_MINOR_VERSION)) {
41  printk(BIOS_WARNING, "FSP binary and SOC FSP header file don't match.\n");
42  printk(BIOS_WARNING, "include file ImageRevisionMajorVersion=%d\n",
43  IMAGE_REVISION_MAJOR_VERSION);
44  printk(BIOS_WARNING, "include file ImageRevisionMinorVersion=%d\n",
45  IMAGE_REVISION_MINOR_VERSION);
46  printk(BIOS_WARNING, "Please update FspmUpd.h based on the corresponding FSP"
47  " build's FspmUpd.h\n");
48  }
49 
50  if (rev->major != IMAGE_REVISION_MAJOR_VERSION)
51  die("IMAGE_REVISION_MAJOR_VERSION mismatch, halting\nGoodbye now\n");
52 }
#define printk(level,...)
Definition: stdlib.h:16
void __noreturn die(const char *fmt,...)
Definition: die.c:17
struct amd_image_revision __packed
void soc_validate_fspm_header(const struct fsp_header *hdr)
Definition: fsp_validate.c:15
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
unsigned char uint8_t
Definition: stdint.h:8