Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70302 )
Change subject: cpu/intel/car/romstage: Clear graphics before exiting romstage
......................................................................
cpu/intel/car/romstage: Clear graphics before exiting romstage
Leaving the graphics configuration with the display on confuses the
FSP GOP driver and can lead to undesired graphics artifacts.
This CL introduces the GRAPHICS_OFF_BEFORE_RAMSTAGE configuration flag
to trigger graphic off procedure.
BUG=b:252792591
BRANCH=firmware-brya-14505.B
TEST=TO-BE-COMPLETED
Change-Id: I31b6470478177938f988afe11febaadd165c4b52
Signed-off-by: Jeremy Compostella <jeremy.compostella(a)intel.com>
---
M src/cpu/intel/car/romstage.c
M src/device/Kconfig
2 files changed, 35 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/70302/1
diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c
index 7df512d..70948e9 100644
--- a/src/cpu/intel/car/romstage.c
+++ b/src/cpu/intel/car/romstage.c
@@ -6,6 +6,7 @@
#include <commonlib/helpers.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
+#include <intelblocks/early_graphics.h>
#include <program_loading.h>
#include <romstage_common.h>
#include <security/vboot/vboot_common.h>
@@ -65,6 +66,9 @@
if (CONFIG(SMM_TSEG))
smm_list_regions();
+ if (CONFIG(GRAPHICS_OFF_BEFORE_RAMSTAGE))
+ early_graphics_stop();
+
prepare_and_run_postcar();
/* We do not return here. */
}
diff --git a/src/device/Kconfig b/src/device/Kconfig
index b0000f6..2e0e529 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -146,6 +146,17 @@
endchoice
+config GRAPHICS_OFF_BEFORE_RAMSTAGE
+ bool "Turn off graphics before jumping to ramstage"
+ depends on MAINBOARD_USE_ROMSTAGE_LIBGFXINIT
+ default y if RUN_FSP_GOP
+ default n
+ help
+ Clear graphics configuration at the end of romstage.
+ Leaving graphic configuration performed by libgfxinit with
+ the display turned on confuses the FSP GOP driver and it can
+ lead to undesirable graphic artifacts.
+
config PRE_GRAPHICS_DELAY_MS
int "Graphics initialization delay in ms"
default 0
--
To view, visit https://review.coreboot.org/c/coreboot/+/70302
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I31b6470478177938f988afe11febaadd165c4b52
Gerrit-Change-Number: 70302
Gerrit-PatchSet: 1
Gerrit-Owner: Jérémy Compostella <jeremy.compostella(a)intel.com>
Gerrit-MessageType: newchange
Attention is currently required from: Andrey Petrov.
Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70300 )
Change subject: drivers/intel/fsp2_0/memory_init: inform user of memory training
......................................................................
drivers/intel/fsp2_0/memory_init: inform user of memory training
If memory training is going to happen and early graphics is supported
by the mainboard, the `CONFIG_DISPLAY_MSG_DURING_MEMORY_TRAINING'
option makes coreboot display (on screen) the
`CONFIG_MEMORY_TRAINING_MSG' text message to inform the user that
memory training is in progress.
Memory training can take a while and an impatient end user facing a
black screen for a while may reset the device unnecessarily.
Note: macro compilation had to be used because the
`CONFIG_MEMORY_TRAINING_MSG' is a string and as such is not
systematically defined.
Change-Id: I4ea15123eed1a4355c5ff7d815925032d4151de0
Signed-off-by: Jeremy Compostella <jeremy.compostella(a)intel.com>
---
M src/drivers/intel/fsp2_0/Kconfig
M src/drivers/intel/fsp2_0/memory_init.c
2 files changed, 63 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/70300/1
diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig
index 8c36063..e7677ec 100644
--- a/src/drivers/intel/fsp2_0/Kconfig
+++ b/src/drivers/intel/fsp2_0/Kconfig
@@ -39,6 +39,22 @@
1. Added ExtendedImageRevision field in FSP_INFO_HEADER
2. Added FSP_NON_VOLATILE_STORAGE_HOB2
+config INFORM_USER_OF_MEMORY_TRAINING
+ bool
+ default n
+ depends on ROMSTAGE_GFX_GMA
+ help
+ Display a message on-screen to inform the end-user that
+ memory training is in progress
+
+config MEMORY_TRAINING_TEXT
+ string "Text to display during memory training"
+ default "Memory training in progress, please wait..."
+ depends on INFORM_USER_OF_MEMORY_TRAINING
+ help
+ Message to be displayed while memory training is in
+ progress. It should not exceed 80 characters.
+
if PLATFORM_USES_FSP2_0
config PLATFORM_USES_FSP2_X86_32
diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c
index 99b0fea..61e6f1d 100644
--- a/src/drivers/intel/fsp2_0/memory_init.c
+++ b/src/drivers/intel/fsp2_0/memory_init.c
@@ -10,9 +10,11 @@
#include <elog.h>
#include <fsp/api.h>
#include <fsp/util.h>
+#include <intelblocks/early_graphics.h>
#include <memrange.h>
#include <mode_switch.h>
#include <mrc_cache.h>
+#include <pc80/vga.h>
#include <program_loading.h>
#include <romstage_handoff.h>
#include <security/tpm/tspi.h>
@@ -221,6 +223,20 @@
struct memranges memmap;
};
+static void inform_user_of_memory_training(bool start)
+{
+#if CONFIG(INFORM_USER_OF_MEMORY_TRAINING)
+ static bool vga_ready;
+ const char *str = start ? CONFIG_MEMORY_TRAINING_TEXT : "";
+
+ if (!vga_ready)
+ vga_ready = early_graphics_init();
+
+ if (vga_ready)
+ vga_line_write_centered(12, str);
+#endif
+}
+
static void do_fsp_memory_init(const struct fspm_context *context, bool s3wake)
{
uint32_t status;
@@ -288,6 +304,10 @@
post_code(POST_MEM_PREINIT_PREP_END);
+ /* Inform the end user that memory training is in progress. */
+ if (!arch_upd->NvsBufferPtr)
+ inform_user_of_memory_training(true);
+
/* Call FspMemoryInit */
fsp_raminit = (void *)(uintptr_t)(hdr->image_base + hdr->fsp_memory_init_entry_offset);
fsp_debug_before_memory_init(fsp_raminit, upd, &fspm_upd);
@@ -307,6 +327,10 @@
post_code(POST_FSP_MEMORY_EXIT);
timestamp_add_now(TS_FSP_MEMORY_INIT_END);
+ /* Memory training is over, clear the end-user notification. */
+ if (!arch_upd->NvsBufferPtr)
+ inform_user_of_memory_training(false);
+
/* Handle any errors returned by FspMemoryInit */
fsp_handle_reset(status);
if (status != FSP_SUCCESS) {
--
To view, visit https://review.coreboot.org/c/coreboot/+/70300
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4ea15123eed1a4355c5ff7d815925032d4151de0
Gerrit-Change-Number: 70300
Gerrit-PatchSet: 1
Gerrit-Owner: Jérémy Compostella <jeremy.compostella(a)intel.com>
Gerrit-Reviewer: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-Attention: Andrey Petrov <andrey.petrov(a)gmail.com>
Gerrit-MessageType: newchange
Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70277 )
Change subject: drivers/pc80/vga: display a string centered on a line
......................................................................
drivers/pc80/vga: display a string centered on a line
This patch introduces the `vga_line_write_centered(unsigned int line,
const char *string)' function to display a centered line of text. The
string length is limited to eighy characters.
BUG=b:252792591
BRANCH=firmware-brya-14505.B
TEST=TO-BE-COMPLETED
Change-Id: Ie742795bb44bbea8cf24222e7bd4f355a6fece2f
Signed-off-by: Jeremy Compostella <jeremy.compostella(a)intel.com>
---
M src/drivers/pc80/vga/vga.c
M src/include/pc80/vga.h
2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/70277/1
diff --git a/src/drivers/pc80/vga/vga.c b/src/drivers/pc80/vga/vga.c
index d970fea..1719cba 100644
--- a/src/drivers/pc80/vga/vga.c
+++ b/src/drivers/pc80/vga/vga.c
@@ -274,6 +274,28 @@
}
/*
+ * fills a line centering the given string.
+ * The string is truncated it exceeds 80 characters.
+ */
+void
+vga_line_write_centered(unsigned int line, const char *string)
+{
+ unsigned short *p = (unsigned short *) VGA_FB + (80 * line);
+ size_t i, margin, len = strlen(string);
+
+ if (len > 80)
+ len = 80;
+ margin = 40 - (len / 2);
+
+ for (i = 0; i < 80; i++) {
+ if (i < margin || i > 80 - margin)
+ p[i] = 0x0F00;
+ else
+ p[i] = 0x0F00 | string[i - margin];
+ }
+}
+
+/*
* set up everything to get a basic 80x25 textmode.
*/
void
diff --git a/src/include/pc80/vga.h b/src/include/pc80/vga.h
index 4b7b26c..9e72f6f 100644
--- a/src/include/pc80/vga.h
+++ b/src/include/pc80/vga.h
@@ -19,5 +19,6 @@
void vga_frame_set(unsigned int line, unsigned int character);
void vga_line_write(unsigned int line, const char *string);
+void vga_line_write_centered(unsigned int line, const char *string);
#endif /* VGA_H */
--
To view, visit https://review.coreboot.org/c/coreboot/+/70277
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie742795bb44bbea8cf24222e7bd4f355a6fece2f
Gerrit-Change-Number: 70277
Gerrit-PatchSet: 1
Gerrit-Owner: Jérémy Compostella <jeremy.compostella(a)intel.com>
Gerrit-MessageType: newchange
Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70275 )
Change subject: lib: Hook up libhwbase in romstage
......................................................................
lib: Hook up libhwbase in romstage
It's hidden behind the configuration option `CONFIG_ROMSTAGE_LIBHWBASE'.
This also adds some glue code to use the coreboot console for debug
output and our monotonic timer framework as timer backend.
Running Ada code in romstage and more particular libhwbase brings a few
challenges as global initialized variables are not supported in
Cache-As-Ram mode.
1. The libhwbase dynamic mmio driver implementation makes the Gnat
compiler generate some global initialized variables.
For this reason, when compiled for romstage or for romstage and
ramstage the static mmio driver is enforced (`HWBASE_STATIC_MMIO').
2. The Gnat compiler generates elaboration functions to initialize
program data at runtime. These elaboration functions are called by
the romstage_adainit() function.
The data references symbols suffixed by `_E'. Even though these
symbols, at compilation time, do not contain any data and are
filled with zeros, the Gnat compiler installs them in the .data
section.
Since these symbols are actually filled with zeros, it is safe to
install them in the .bss section.
cf. https://docs.adacore.com/gnat_ugn-docs/html/gnat_ugn/gnat_ugn/elaboration_o…
This patch requires the libhwbase
https://review.coreboot.org/c/libhwbase/+/69854 CL.
BUG=b:252792591
BRANCH=firmware-brya-14505.B
TEST=TO-BE-COMPLETED
Change-Id: I670249d33506e886a683e55d1589cb2bf9b16aa3
Signed-off-by: Jeremy Compostella <jeremy.compostella(a)intel.com>
---
M src/arch/x86/car.ld
M src/console/Makefile.inc
M src/lib/Kconfig
M src/lib/Makefile.inc
4 files changed, 85 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/70275/1
diff --git a/src/arch/x86/car.ld b/src/arch/x86/car.ld
index 47afd78..dc075c6 100644
--- a/src/arch/x86/car.ld
+++ b/src/arch/x86/car.ld
@@ -67,6 +67,12 @@
*(.bss.*)
*(.sbss)
*(.sbss.*)
+ /* '*_E' GNAT generated global variables actually are un-initialized
+ * (filled with zeros) variables which are initialized at
+ * runtime. Therefore, they can be placed in the _bss region. */
+#if CONFIG(ROMSTAGE_LIBHWBASE)
+ *(.data.hw__*_E)
+#endif
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_ebss = .;
RECORD_SIZE(bss)
diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc
index e2a20d7..4296426 100644
--- a/src/console/Makefile.inc
+++ b/src/console/Makefile.inc
@@ -5,6 +5,8 @@
ifeq ($(CONFIG_HWBASE_DEBUG_CB),y)
ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.ads
ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.adb
+romstage-$(CONFIG_ROMSTAGE_LIBHWBASE) += hw-debug_sink.ads
+romstage-$(CONFIG_ROMSTAGE_LIBHWBASE) += hw-debug_sink.adb
endif
smm-$(CONFIG_DEBUG_SMI) += init.c console.c vtxprintf.c printk.c
diff --git a/src/lib/Kconfig b/src/lib/Kconfig
index 96181c9..837d8ac 100644
--- a/src/lib/Kconfig
+++ b/src/lib/Kconfig
@@ -21,6 +21,12 @@
help
Selected by features that require `libhwbase` in ramstage.
+config ROMSTAGE_LIBHWBASE
+ bool
+ select ROMSTAGE_ADA
+ help
+ Selected by features that require `libhwbase` in romstage.
+
config FLATTENED_DEVICE_TREE
bool
help
@@ -68,11 +74,22 @@
help
Name of the FMAP region created in the default FMAP to cache SPD data.
-if RAMSTAGE_LIBHWBASE
+if RAMSTAGE_LIBHWBASE && !ROMSTAGE_LIBHWBASE
config HWBASE_DYNAMIC_MMIO
def_bool y
+endif
+
+if ROMSTAGE_LIBHWBASE
+
+config HWBASE_STATIC_MMIO
+ def_bool y
+
+endif
+
+if RAMSTAGE_LIBHWBASE || ROMSTAGE_LIBHWBASE
+
config HWBASE_DEFAULT_MMCONF
hex
default ECAM_MMCONF_BASE_ADDRESS
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 600c6dc..6897ac5 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -342,28 +342,34 @@
ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads
romstage-$(CONFIG_ROMSTAGE_ADA) += cb.ads
-ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y)
+ifneq (,$(filter y, $(CONFIG_RAMSTAGE_LIBHWBASE) $(CONFIG_ROMSTAGE_LIBHWBASE)))
to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#)
$(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF)
+libhwbase-stages = $(foreach stage, romstage ramstage, \
+ $(if $(filter y,$(CONFIG_$(call toupper,$(stage))_LIBHWBASE)),$(stage)))
+
$(call add-special-class,hw)
-hw-handler = $(eval ramstage-srcs += $$(addprefix $(1),$(2)))
+hw-handler +=$(foreach stage, $(libhwbase-stages), \
+ $(eval $(stage)-srcs += $$(addprefix $(1),$(2))))
$(call add-special-class,hw-gen)
hw-gen-handler = \
$(eval additional-dirs += $(dir $(2))) \
- $(eval ramstage-srcs += $(2)) \
- $(eval ramstage-ads-deps += $(2)) \
- $(eval ramstage-adb-deps += $(2)) \
+ $(foreach stage, $(libhwbase-stages), \
+ $(eval $(stage)-srcs += $(2)) \
+ $(eval $(stage)-ads-deps += $(2)) \
+ $(eval $(stage)-adb-deps += $(2))) \
$(eval $(2): $(obj)/config.h)
subdirs-y += ../../3rdparty/libhwbase
-ramstage-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb
+$(foreach stage,$(libhwbase-stages), \
+ $(eval $(stage)-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb))
-endif # CONFIG_RAMSTAGE_LIBHWBASE
+endif # CONFIG_ROMSTAGE_LIBHWBASE || CONFIG_RAMSTAGE_LIBHWBASE
romstage-y += spd_bin.c
--
To view, visit https://review.coreboot.org/c/coreboot/+/70275
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I670249d33506e886a683e55d1589cb2bf9b16aa3
Gerrit-Change-Number: 70275
Gerrit-PatchSet: 1
Gerrit-Owner: Jérémy Compostella <jeremy.compostella(a)intel.com>
Gerrit-MessageType: newchange
Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/70274 )
Change subject: Add option to use Ada code in romstage
......................................................................
Add option to use Ada code in romstage
If selected, libgnat is linked into romstage. In addition, a call to
romstage_adainit() is added to support Ada program data intialization.
BUG=b:252792591
BRANCH=firmware-brya-14505.B
TEST=TO-BE-COMPLETED
Change-Id: I74f0460f6b14fde2b4bd6391e1782b2e5b217707
Signed-off-by: Jeremy Compostella <jeremy.compostella(a)intel.com>
---
M Makefile
M src/cpu/intel/car/romstage.c
M src/include/adainit.h
M src/lib/Kconfig
M src/lib/Makefile.inc
M src/lib/gnat/Makefile.inc
6 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/70274/1
diff --git a/Makefile b/Makefile
index 58cd85b..d09032d 100644
--- a/Makefile
+++ b/Makefile
@@ -315,6 +315,9 @@
ifeq ($(CONFIG_RAMSTAGE_ADA),y)
ramstage-srcs += $(obj)/ramstage/$(notdir $(KCONFIG_AUTOADS))
endif
+ifeq ($(CONFIG_ROMSTAGE_ADA),y)
+romstage-srcs += $(obj)/romstage/$(notdir $(KCONFIG_AUTOADS))
+endif
# To track dependencies, we need all Ada specification (.ads) files in
# *-srcs. Extract / filter all specification files that have a matching
diff --git a/src/cpu/intel/car/romstage.c b/src/cpu/intel/car/romstage.c
index c7c218b..7df512d 100644
--- a/src/cpu/intel/car/romstage.c
+++ b/src/cpu/intel/car/romstage.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <adainit.h>
#include <arch/romstage.h>
#include <arch/symbols.h>
#include <commonlib/helpers.h>
@@ -40,6 +41,18 @@
if (CONFIG(VBOOT_EARLY_EC_SYNC))
vboot_sync_ec();
+ /*
+ * We can generally jump between C and Ada code back and forth
+ * without trouble. But since we don't have an Ada main() we
+ * have to do some Ada package initializations that GNAT would
+ * do there. This has to be done before calling any Ada code.
+ *
+ * The package initializations should not have any dependen-
+ * cies on C code. So we can call them here early, and don't
+ * have to worry at which point we can start to use Ada.
+ */
+ romstage_adainit();
+
mainboard_romstage_entry();
/* Check the stack. */
diff --git a/src/include/adainit.h b/src/include/adainit.h
index 4953d44..389499e 100644
--- a/src/include/adainit.h
+++ b/src/include/adainit.h
@@ -21,4 +21,10 @@
static inline void ramstage_adainit(void) {}
#endif
+#if CONFIG(ROMSTAGE_ADA)
+void romstage_adainit(void);
+#else
+static inline void romstage_adainit(void) {}
+#endif
+
#endif /* _ADAINIT_H */
diff --git a/src/lib/Kconfig b/src/lib/Kconfig
index ae96fc6..96181c9 100644
--- a/src/lib/Kconfig
+++ b/src/lib/Kconfig
@@ -10,6 +10,11 @@
help
Selected by features that use Ada code in ramstage.
+config ROMSTAGE_ADA
+ bool
+ help
+ Selected by features that use Ada code in romstage.
+
config RAMSTAGE_LIBHWBASE
bool
select RAMSTAGE_ADA
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 1c7bc22..600c6dc 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -340,6 +340,7 @@
$(RMODTOOL) -i $< -o $@
ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads
+romstage-$(CONFIG_ROMSTAGE_ADA) += cb.ads
ifeq ($(CONFIG_RAMSTAGE_LIBHWBASE),y)
diff --git a/src/lib/gnat/Makefile.inc b/src/lib/gnat/Makefile.inc
index 065ba71..0dd642d 100644
--- a/src/lib/gnat/Makefile.inc
+++ b/src/lib/gnat/Makefile.inc
@@ -54,3 +54,6 @@
ifeq ($(CONFIG_RAMSTAGE_ADA),y)
ramstage-libs += $(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a
endif
+ifeq ($(CONFIG_ROMSTAGE_ADA),y)
+romstage-libs += $(obj)/libgnat-$(ARCH-romstage-y)/libgnat.a
+endif
--
To view, visit https://review.coreboot.org/c/coreboot/+/70274
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I74f0460f6b14fde2b4bd6391e1782b2e5b217707
Gerrit-Change-Number: 70274
Gerrit-PatchSet: 1
Gerrit-Owner: Jérémy Compostella <jeremy.compostella(a)intel.com>
Gerrit-MessageType: newchange