drivers/usb/acpi: Don't add GPIOs to _CRS for Intel Bluetooth
[coreboot2.git] / src / soc / amd / common / fsp / fsp_validate.c
blobe0867f40c7797f0ffa2313dd0195ef164c977073
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <fsp/util.h>
5 #include <types.h>
7 struct amd_image_revision {
8 uint8_t build;
9 uint8_t revision;
10 uint8_t minor;
11 uint8_t major;
12 } __packed;
14 /* Validate the FSP-M header in romstage */
15 void soc_validate_fspm_header(const struct fsp_header *hdr)
17 struct amd_image_revision *rev;
19 rev = (struct amd_image_revision *)&(hdr->image_revision);
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);
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;
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);
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");
50 if (rev->major != IMAGE_REVISION_MAJOR_VERSION)
51 die("IMAGE_REVISION_MAJOR_VERSION mismatch, halting\nGoodbye now\n");