[coreboot-gerrit] Patch set updated for coreboot: drivers/intel/fsp2_0: Add UPD display support

Lee Leahy (leroy.p.leahy@intel.com) gerrit at coreboot.org
Wed Jul 27 21:14:33 CEST 2016


Lee Leahy (leroy.p.leahy at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15847

-gerrit

commit 2cb4f3899ddf9639aea15645d617a8ec9b599972
Author: Lee Leahy <leroy.p.leahy at intel.com>
Date:   Thu Jul 21 09:48:49 2016 -0700

    drivers/intel/fsp2_0: Add UPD display support
    
    Add UPD display support:
    *  Add a Kconfig value to enable UPD value display
    *  Add a routine to display a UPD value
    *  Add a call in MemoryInit to conditionally display the UPD parameters
    *  Add a routine to display the architectural parameters for MemoryInit
    *  Add a weak routine to display the other UPD parameters for MemoryInit
    *  Add a call in SiliconInit to conditionally display the UPD parameters
    *  Add a weak routine to display the UPD parameters for SiliconInit
    
    TEST=Build and run on Galileo Gen2.
    
    Change-Id: I35fb8410c0bccf217b32af4b8bbe5ad6671f81f6
    Signed-off-by: Lee Leahy <leroy.p.leahy at intel.com>
---
 src/drivers/intel/fsp2_0/Kconfig             |  7 +++
 src/drivers/intel/fsp2_0/Makefile.inc        |  2 +
 src/drivers/intel/fsp2_0/include/fsp/debug.h | 32 ++++++++++++
 src/drivers/intel/fsp2_0/memory_init.c       |  1 +
 src/drivers/intel/fsp2_0/silicon_init.c      |  2 +
 src/drivers/intel/fsp2_0/upd_display.c       | 75 ++++++++++++++++++++++++++++
 6 files changed, 119 insertions(+)

diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig
index 01ce75d..10c7cac 100644
--- a/src/drivers/intel/fsp2_0/Kconfig
+++ b/src/drivers/intel/fsp2_0/Kconfig
@@ -27,6 +27,13 @@ config ADD_FSP_BINARIES
 	  Add the FSP-M and FSP-S binaries to CBFS. Currently coreboot does not
 	  use the FSP-T binary and it is not added.
 
+config DISPLAY_UPD_DATA
+	bool "Display UPD data"
+	default n
+	help
+	  Display the user specified product data prior to memory
+	  initialization.
+
 config FSP_S_CBFS
 	string "Name of FSP-S in CBFS"
 	default "fsps.bin"
diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc
index 4f36664..91e86b5 100644
--- a/src/drivers/intel/fsp2_0/Makefile.inc
+++ b/src/drivers/intel/fsp2_0/Makefile.inc
@@ -16,6 +16,7 @@
 ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
 
 romstage-y += hand_off_block.c
+romstage-$(CONFIG_DISPLAY_UPD_DATA) += upd_display.c
 romstage-y += util.c
 romstage-y += memory_init.c
 
@@ -23,6 +24,7 @@ ramstage-y += graphics.c
 ramstage-y += hand_off_block.c
 ramstage-y += notify.c
 ramstage-y += silicon_init.c
+ramstage-$(CONFIG_DISPLAY_UPD_DATA) += upd_display.c
 ramstage-y += util.c
 
 CPPFLAGS_common += -I$(src)/drivers/intel/fsp2_0/include
diff --git a/src/drivers/intel/fsp2_0/include/fsp/debug.h b/src/drivers/intel/fsp2_0/include/fsp/debug.h
index 7dbd945..af158bd 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/debug.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/debug.h
@@ -15,6 +15,38 @@
 #include <fsp/util.h>
 #include <soc/intel/common/util.h>
 
+
+#if IS_ENABLED(CONFIG_DISPLAY_UPD_DATA)
+
+/* Display UPD API */
+void fspm_display_upd_values(struct FSPM_UPD *old, struct FSPM_UPD *new);
+
+/* Callbacks for displaying UPD parameters - place in a separate file
+ * that is conditionally build with CONFIG_DISPLAY_UPD_DATA.
+ */
+void soc_display_fspm_upd_params(const struct FSPM_UPD *fspm_old_upd,
+	const struct FSPM_UPD *fspm_new_upd);
+void soc_display_fsps_upd_params(const struct FSPS_UPD *fsps_old_upd,
+	const struct FSPS_UPD *fsps_new_upd);
+
+/* Display UPD utility functions */
+void fsp_display_upd_value(const char *name, uint32_t size, uint64_t old,
+	uint64_t new);
+
+#else /* CONFIG_DISPLAY_UPD_DATA */
+/* Remove UPD display code from the image */
+static inline __attribute__((always_inline)) void soc_display_fsps_upd_params(
+	const struct FSPS_UPD *fsps_old_upd,
+	const struct FSPS_UPD *fsps_new_upd)
+{
+}
+
+static inline __attribute__((always_inline)) void fspm_display_upd_values(
+	struct FSPM_UPD *old, struct FSPM_UPD *new)
+{
+}
+#endif /* CONFIG_DISPLAY_UPD_DATA */
+
 static inline __attribute__((always_inline)) void fsp_debug_memory_init(void)
 {
 	/* Display the MTRRs */
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c
index ecd8761..43ca381 100644
--- a/src/drivers/intel/fsp2_0/memory_init.c
+++ b/src/drivers/intel/fsp2_0/memory_init.c
@@ -209,6 +209,7 @@ static enum fsp_status do_fsp_memory_init(struct fsp_header *hdr, bool s3wake,
 
 	/* Give SoC and mainboard a chance to update the UPD */
 	platform_fsp_memory_init_params_cb(&fspm_upd);
+	fspm_display_upd_values(upd, &fspm_upd);
 
 	/* Call FspMemoryInit */
 	fsp_raminit = (void *)(hdr->image_base + hdr->memory_init_entry_offset);
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c
index 0da658e..25fc0c3 100644
--- a/src/drivers/intel/fsp2_0/silicon_init.c
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -43,7 +43,9 @@ static enum fsp_status do_silicon_init(struct fsp_header *hdr)
 
 	/* Give SoC/mainboard a chance to populate entries */
 	platform_fsp_silicon_init_params_cb(&upd);
+	soc_display_fsps_upd_params(supd, &upd);
 
+	/* Call SiliconInit */
 	timestamp_add_now(TS_FSP_SILICON_INIT_START);
 	post_code(POST_FSP_SILICON_INIT);
 	silicon_init = (void *) (hdr->image_base +
diff --git a/src/drivers/intel/fsp2_0/upd_display.c b/src/drivers/intel/fsp2_0/upd_display.c
new file mode 100644
index 0000000..6d54957
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/upd_display.c
@@ -0,0 +1,75 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <arch/cpu.h>
+#include <console/console.h>
+#include <fsp/util.h>
+#include <lib.h>
+
+void fsp_display_upd_value(const char *name, uint32_t size, uint64_t old,
+	uint64_t new)
+{
+	size *= 2;
+	if (old == new) {
+		printk(BIOS_SPEW, "  0x%0*llx: %s", size, new, name);
+	} else {
+		printk(BIOS_SPEW, "  0x%0*llx --> 0x%0*llx: %s", size, old,
+			size, new, name);
+	}
+}
+
+static void fspm_display_arch_params(const struct FSPM_ARCH_UPD *old,
+	const struct FSPM_ARCH_UPD *new)
+{
+	/* Display the architectural parameters for MemoryInit */
+	printk(BIOS_SPEW, "Architectural UPD values for MemoryInit at: 0x%p\n",
+		new);
+	fsp_display_upd_value("Revision", sizeof(old->Revision),
+		old->Revision, new->Revision);
+	fsp_display_upd_value("NvsBufferPtr", sizeof(old->NvsBufferPtr),
+		(uint64_t)(uintptr_t)old->NvsBufferPtr,
+		(uint64_t)(uintptr_t)new->NvsBufferPtr);
+	fsp_display_upd_value("StackBase", sizeof(old->StackBase),
+		(uint64_t)(uintptr_t)old->StackBase,
+		(uint64_t)(uintptr_t)new->StackBase);
+	fsp_display_upd_value("StackSize", sizeof(old->StackSize),
+		old->StackSize, new->StackSize);
+	fsp_display_upd_value("BootLoaderTolumSize",
+		sizeof(old->BootLoaderTolumSize),
+		old->BootLoaderTolumSize, new->BootLoaderTolumSize);
+	fsp_display_upd_value("BootMode", sizeof(old->BootMode),
+		old->BootMode, new->BootMode);
+}
+
+/* Display the UPD parameters for MemoryInit */
+__attribute__((weak)) void soc_display_fspm_upd_params(
+	const struct FSPM_UPD *fspm_old_upd,
+	const struct FSPM_UPD *fspm_new_upd)
+{
+	printk(BIOS_DEBUG, "UPD values for MemoryInit:\n");
+	hexdump(fspm_new_upd, sizeof(*fspm_new_upd));
+}
+
+void fspm_display_upd_values(struct FSPM_UPD *old, struct FSPM_UPD *new)
+{
+	/* Display the UPD data */
+	fspm_display_arch_params(&old->FspmArchUpd, &new->FspmArchUpd);
+	soc_display_fspm_upd_params(old, new);
+}
+
+/* Display the UPD parameters for SiliconInit */
+__attribute__((weak)) void soc_display_fsps_upd_params(
+	const struct FSPS_UPD *fsps_old_upd,
+	const struct FSPS_UPD *fsps_new_upd)
+{
+	printk(BIOS_DEBUG, "UPD values for SiliconInit:\n");
+	hexdump(fsps_new_upd, sizeof(*fsps_new_upd));
+}



More information about the coreboot-gerrit mailing list