summaryrefslogtreecommitdiff
path: root/src/drivers/intel/fsp2_0
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/intel/fsp2_0')
-rw-r--r--src/drivers/intel/fsp2_0/Kconfig7
-rw-r--r--src/drivers/intel/fsp2_0/Makefile.inc2
-rw-r--r--src/drivers/intel/fsp2_0/fsp_debug_event.c28
-rw-r--r--src/drivers/intel/fsp2_0/include/fsp/fsp_debug_event.h19
4 files changed, 56 insertions, 0 deletions
diff --git a/src/drivers/intel/fsp2_0/Kconfig b/src/drivers/intel/fsp2_0/Kconfig
index fdea4b886f..0823aa3020 100644
--- a/src/drivers/intel/fsp2_0/Kconfig
+++ b/src/drivers/intel/fsp2_0/Kconfig
@@ -352,4 +352,11 @@ config USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE
to perform the required lock down and chipset register configuration prior
boot to payload.
+config FSP_USES_CB_DEBUG_EVENT_HANDLER
+ bool
+ default n
+ help
+ This option allows to create `Debug Event Handler` to print FSP debug messages
+ to output device using coreboot native implementation.
+
endif
diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc
index eaf99d1492..076ab2d84b 100644
--- a/src/drivers/intel/fsp2_0/Makefile.inc
+++ b/src/drivers/intel/fsp2_0/Makefile.inc
@@ -5,6 +5,7 @@ ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y)
bootblock-$(CONFIG_FSP_CAR) += fspt_report.c
romstage-y += debug.c
+romstage-$(CONFIG_FSP_USES_CB_DEBUG_EVENT_HANDLER) += fsp_debug_event.c
romstage-y += hand_off_block.c
romstage-$(CONFIG_DISPLAY_FSP_HEADER) += header_display.c
romstage-$(CONFIG_DISPLAY_HOBS) += hob_display.c
@@ -16,6 +17,7 @@ romstage-$(CONFIG_MMA) += mma_core.c
romstage-y += cbmem.c
ramstage-y += debug.c
+ramstage-$(CONFIG_FSP_USES_CB_DEBUG_EVENT_HANDLER) += fsp_debug_event.c
ramstage-$(CONFIG_USE_INTEL_FSP_MP_INIT) += fsp_mpinit.c
ramstage-$(CONFIG_RUN_FSP_GOP) += graphics.c
ramstage-y += hand_off_block.c
diff --git a/src/drivers/intel/fsp2_0/fsp_debug_event.c b/src/drivers/intel/fsp2_0/fsp_debug_event.c
new file mode 100644
index 0000000000..f58424b0c5
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/fsp_debug_event.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <fsp/api.h>
+#include <fsp/fsp_debug_event.h>
+#include <fsp/util.h>
+
+static const uint8_t fsp_string_type_guid[16] = {
+ 0x80, 0x10, 0xd1, 0x92, 0x6f, 0x49, 0x95, 0x4d,
+ 0xbe, 0x7e, 0x03, 0x74, 0x88, 0x38, 0x2b, 0x0a
+};
+
+static efi_return_status_t print_fsp_string_data(const efi_status_code_data_t *data)
+{
+ printk(BIOS_SPEW, "%s", ((efi_status_code_string_data *) data)->String.Ascii);
+
+ return FSP_SUCCESS;
+}
+
+efi_return_status_t fsp_debug_event_handler(efi_status_code_type_t ignored1,
+ efi_status_code_value_t ignored2, efi_uint32_t ignored3, efi_guid_t *ignored4,
+ efi_status_code_data_t *data)
+{
+ if (!fsp_guid_compare((uint8_t *)&(data->Type), fsp_string_type_guid))
+ return FSP_NOT_FOUND;
+
+ return print_fsp_string_data(data);
+}
diff --git a/src/drivers/intel/fsp2_0/include/fsp/fsp_debug_event.h b/src/drivers/intel/fsp2_0/include/fsp/fsp_debug_event.h
new file mode 100644
index 0000000000..7d50c1e68f
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/include/fsp/fsp_debug_event.h
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef FSP_DEBUG_EVENT_H
+#define FSP_DEBUG_EVENT_H
+
+/*
+ * This file to implement FSP_EVENT_HANDLER for Intel FSP to use.
+ * More details about this structure can be found here :
+ * http://github.com/tianocore/edk2/blob/master/IntelFsp2Pkg/Include/FspEas/FspApi.h
+ */
+#include <efi/efi_datatype.h>
+#include <fsp/soc_binding.h>
+
+/* fsp debug event handler */
+efi_return_status_t fsp_debug_event_handler(efi_status_code_type_t ignored1,
+ efi_status_code_value_t ignored2, efi_uint32_t ignored3, efi_guid_t *ignored4,
+ efi_status_code_data_t *data);
+
+#endif /* FSP_DEBUG_EVENT_H */