diff options
author | Subrata Banik <subrata.banik@intel.com> | 2018-01-23 16:31:03 +0530 |
---|---|---|
committer | Subrata Banik <subrata.banik@intel.com> | 2018-01-31 05:57:16 +0000 |
commit | 73b67dcee8428b1ad824bedd79a52ba9dc6e9aae (patch) | |
tree | 97fa8aaf6dbd767c5054c08ca4d96beb8adbeef6 /src/drivers | |
parent | df74577e99d895a29e5b1b803b2058ea656803ec (diff) |
drivers/intel/fsp2_0: Add support to display FSP version info Hob
This patch locates FSP FVI hob in order to extract all firmware
ingredient version information.
So far this feature is only supported for CannonLake SoC onwards.
Change-Id: Ib749e49a9f263d85947b60d4c445faf8c37f5931
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/23386
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/intel/fsp2_0/Kconfig | 5 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/hand_off_block.c | 85 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/include/fsp/soc_binding.h | 3 | ||||
-rw-r--r-- | src/drivers/intel/fsp2_0/include/fsp/util.h | 3 |
4 files changed, 94 insertions, 2 deletions
diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig index 7f3d165547..1ff8aa68ef 100644 --- a/src/drivers/intel/fsp2_0/Kconfig +++ b/src/drivers/intel/fsp2_0/Kconfig @@ -112,6 +112,11 @@ config RESET_ON_INVALID_RAMSTAGE_CACHE bool "Reset the system on S3 wake when ramstage cache invalid." default n +config DISPLAY_FSP_VERSION_INFO + bool "Display Firmware Ingredient Version Information" + help + Select this option to display Firmware version information. + config FSP2_0_USES_TPM_MRC_HASH bool default y if HAS_RECOVERY_MRC_CACHE diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index 2d7e209ec3..cce81f90f1 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -1,7 +1,7 @@ /* * This file is part of the coreboot project. * - * Copyright (C) 2015-2016 Intel Corp. + * Copyright (C) 2015-2018 Intel Corp. * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.) * * This program is free software; you can redistribute it and/or modify @@ -15,6 +15,7 @@ #include <cbmem.h> #include <commonlib/helpers.h> #include <console/console.h> +#include <fsp/api.h> #include <fsp/util.h> #include <inttypes.h> #include <lib.h> @@ -43,6 +44,11 @@ const uint8_t smbios_memory_info_guid[16] = { 0x88, 0xc3, 0xee, 0xe8, 0xc4, 0x9e, 0xfb, 0x89 }; +static const uint8_t uuid_fv_info[16] = { + 0x2e, 0x72, 0x8e, 0x79, 0xb2, 0x15, 0x13, 0x4e, + 0x8a, 0xe9, 0x6b, 0xa3, 0x0f, 0xf7, 0xf1, 0x67 +}; + /* * Utilities for walking HOBs */ @@ -217,6 +223,83 @@ const void *fsp_find_extension_hob_by_guid(const uint8_t *guid, size_t *size) return NULL; } +static void display_fsp_version_info_hob(const void *hob, size_t size) +{ +#if IS_ENABLED(CONFIG_DISPLAY_FSP_VERSION_INFO) + const FIRMWARE_VERSION_INFO *fvi; + const FIRMWARE_VERSION_INFO_HOB *fvih = + (FIRMWARE_VERSION_INFO_HOB *)hob; + int index, cnt; + char *str_ptr; + + fvi = (void *)&fvih[1]; + str_ptr = (char *)((uintptr_t)fvi + + (fvih->Count * sizeof (FIRMWARE_VERSION_INFO))); + size -= sizeof(SMBIOS_STRUCTURE); + + printk(BIOS_DEBUG, "Display FSP Version Info HOB \n"); + for (index = 0; index < fvih->Count; index++) { + cnt = strlen(str_ptr); + + /* Don't show ingredient name and version if its all 0xFF */ + if (fvi[index].Version.MajorVersion == 0xFF && + fvi[index].Version.MajorVersion == 0xFF && + fvi[index].Version.MajorVersion == 0xFF && + fvi[index].Version.MajorVersion == 0xFF && + fvi[index].VersionStringIndex == 0) { + str_ptr = (char *)((uintptr_t)str_ptr + cnt + + sizeof(uint8_t)); + continue; + } + /* + * Firmware Version String is consist of 2 informations + * 1. Component Name: string type data holds FW type name. + * 2. Version Information : Either a string type data or + * numeric field holds FW version information. + */ + printk(BIOS_DEBUG, "%s = ", str_ptr); + + if (!fvi[index].VersionStringIndex) + printk(BIOS_DEBUG, "%x.%x.%x.%x\n", + fvi[index].Version.MajorVersion, + fvi[index].Version.MinorVersion, + fvi[index].Version.Revision, + fvi[index].Version.BuildNumber); + else { + str_ptr = (char *)((uintptr_t)str_ptr + cnt + + sizeof(uint8_t)); + cnt = strlen(str_ptr); + printk(BIOS_DEBUG, "%s\n", str_ptr); + } + str_ptr = (char *)((uintptr_t)str_ptr + cnt + + sizeof(uint8_t)); + } +#endif +} + +void fsp_display_fvi_version_hob(void) +{ + const uint8_t *hob_uuid; + const struct hob_header *hob = fsp_get_hob_list(); + size_t size; + + if (!hob) + return; + + for ( ; hob->type != HOB_TYPE_END_OF_HOB_LIST; + hob = fsp_next_hob(hob)) { + if (hob->type != HOB_TYPE_GUID_EXTENSION) + continue; + + hob_uuid = hob_header_to_struct(hob); + + if (fsp_guid_compare(hob_uuid, uuid_fv_info)) { + size = hob->length - (HOB_HEADER_LEN + 16); + display_fsp_version_info_hob(hob, size); + } + } +} + const void *fsp_find_nv_storage_data(size_t *size) { return fsp_find_extension_hob_by_guid(fsp_nv_storage_guid, size); diff --git a/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h b/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h index 5c8b441f1b..94abe78dd1 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h +++ b/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h @@ -26,6 +26,9 @@ #include <Base.h> #include <FspmUpd.h> #include <FspsUpd.h> +#if IS_ENABLED(CONFIG_DISPLAY_FSP_VERSION_INFO) +#include <FirmwareVersionInfoHob.h> +#endif #pragma pack(pop) diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h index ecbd7faf92..eeca491e88 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/util.h +++ b/src/drivers/intel/fsp2_0/include/fsp/util.h @@ -1,7 +1,7 @@ /* * This file is part of the coreboot project. * - * Copyright (C) 2015-2016 Intel Corp. + * Copyright (C) 2015-2018 Intel Corp. * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.) * * This program is free software; you can redistribute it and/or modify @@ -77,6 +77,7 @@ const void *fsp_find_nv_storage_data(size_t *size); const void *fsp_find_smbios_memory_info(size_t *size); enum cb_err fsp_fill_lb_framebuffer(struct lb_framebuffer *framebuffer); int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16]); +void fsp_display_fvi_version_hob(void); int fsp_find_reserved_memory(struct range_entry *re); const struct hob_resource *fsp_hob_header_to_resource( const struct hob_header *hob); |