Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <fsp/util.h> |
| 5 | |
| 6 | void fsp_print_header_info(const struct fsp_header *hdr) |
| 7 | { |
Johnny Lin | 5b47d77 | 2020-11-13 17:21:25 +0800 | [diff] [blame] | 8 | union fsp_revision revision; |
Anil Kumar | 57309d3 | 2021-11-11 18:56:21 -0800 | [diff] [blame] | 9 | union extended_fsp_revision ext_revision; |
| 10 | ext_revision.val = 0; |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 11 | int i; |
Anil Kumar | 57309d3 | 2021-11-11 18:56:21 -0800 | [diff] [blame] | 12 | |
| 13 | /* For FSP 2.3 and later use extended image revision field present in header |
| 14 | * for build number and revision calculation */ |
| 15 | if (CONFIG(PLATFORM_USES_FSP2_3)) |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 16 | ext_revision.val = hdr->extended_image_revision; |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 17 | |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 18 | revision.val = hdr->image_revision; |
Lee Leahy | b2b97a5 | 2017-03-10 08:40:18 -0800 | [diff] [blame] | 19 | printk(BIOS_SPEW, "Spec version: v%u.%u\n", (hdr->spec_version >> 4), |
Lee Leahy | 7732b35 | 2017-03-10 08:48:13 -0800 | [diff] [blame] | 20 | hdr->spec_version & 0xf); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 21 | printk(BIOS_SPEW, "Revision: %u.%u.%u, Build Number %u\n", |
Anil Kumar | 57309d3 | 2021-11-11 18:56:21 -0800 | [diff] [blame] | 22 | revision.rev.major, |
| 23 | revision.rev.minor, |
| 24 | ((ext_revision.rev.revision << 8) | revision.rev.revision), |
| 25 | ((ext_revision.rev.bld_num << 8) | revision.rev.bld_num)); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 26 | printk(BIOS_SPEW, "Type: %s/%s\n", |
Lee Leahy | b2b97a5 | 2017-03-10 08:40:18 -0800 | [diff] [blame] | 27 | (hdr->component_attribute & 1) ? "release" : "debug", |
Benjamin Doron | b339fbb | 2021-01-20 20:19:20 +0000 | [diff] [blame] | 28 | (hdr->component_attribute & 2) ? "official" : "test"); |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 29 | |
| 30 | printk(BIOS_SPEW, "image ID: "); |
| 31 | for (i = 0; i < FSP_IMAGE_ID_LENGTH; i++) |
| 32 | printk(BIOS_SPEW, "%c", hdr->image_id[i]); |
| 33 | printk(BIOS_SPEW, "\n"); |
| 34 | |
| 35 | printk(BIOS_SPEW, " base 0x%zx + 0x%zx\n", |
| 36 | (size_t)hdr->image_base, (size_t)hdr->image_size); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 37 | printk(BIOS_SPEW, "\tConfig region 0x%zx + 0x%zx\n", |
Patrick Rudolph | 31218a4 | 2020-11-30 15:50:06 +0100 | [diff] [blame] | 38 | (size_t)hdr->cfg_region_offset, (size_t)hdr->cfg_region_size); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 39 | |
| 40 | if ((hdr->component_attribute >> 12) == FSP_HDR_ATTRIB_FSPM) { |
| 41 | printk(BIOS_SPEW, "\tMemory init offset 0x%zx\n", |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 42 | (size_t)hdr->fsp_memory_init_entry_offset); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | if ((hdr->component_attribute >> 12) == FSP_HDR_ATTRIB_FSPS) { |
| 46 | printk(BIOS_SPEW, "\tSilicon init offset 0x%zx\n", |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 47 | (size_t)hdr->fsp_silicon_init_entry_offset); |
Subrata Banik | 33d9c4a | 2020-05-26 18:26:54 +0530 | [diff] [blame] | 48 | if (CONFIG(PLATFORM_USES_FSP2_2)) |
| 49 | printk(BIOS_SPEW, "\tMultiPhaseSiInit offset 0x%zx\n", |
Julian Schroeder | 8a576f6 | 2021-11-02 16:32:28 -0500 | [diff] [blame] | 50 | (size_t)hdr->fsp_multi_phase_si_init_entry_offset); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 51 | printk(BIOS_SPEW, "\tNotify phase offset 0x%zx\n", |
Patrick Rudolph | 31218a4 | 2020-11-30 15:50:06 +0100 | [diff] [blame] | 52 | (size_t)hdr->notify_phase_entry_offset); |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 53 | } |
Lee Leahy | 37b5ef2 | 2016-07-31 14:15:49 -0700 | [diff] [blame] | 54 | } |