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 for Intel Corp.) * * This program is free software; you can redistribute it and/or modify @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -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 #include #include +#if IS_ENABLED(CONFIG_DISPLAY_FSP_VERSION_INFO) +#include +#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 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);