aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/intel/fsp2_0/hand_off_block.c
diff options
context:
space:
mode:
authorSubrata Banik <subrata.banik@intel.com>2018-01-23 16:31:03 +0530
committerSubrata Banik <subrata.banik@intel.com>2018-01-31 05:57:16 +0000
commit73b67dcee8428b1ad824bedd79a52ba9dc6e9aae (patch)
tree97fa8aaf6dbd767c5054c08ca4d96beb8adbeef6 /src/drivers/intel/fsp2_0/hand_off_block.c
parentdf74577e99d895a29e5b1b803b2058ea656803ec (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/intel/fsp2_0/hand_off_block.c')
-rw-r--r--src/drivers/intel/fsp2_0/hand_off_block.c85
1 files changed, 84 insertions, 1 deletions
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);