| 1 |
|
| 2 |
|
| 3 |
#include <console/console.h> |
| 4 |
#include <fsp/util.h> |
| 5 |
#include <types.h> |
| 6 |
|
| 7 |
struct amd_image_revision { |
| 8 |
uint8_t build; |
| 9 |
uint8_t revision; |
| 10 |
uint8_t minor; |
| 11 |
uint8_t major; |
| 12 |
} __packed; |
| 13 |
|
| 14 |
|
| 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 |
|
| 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 |
|
| 28 |
|
| 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 |
} |