summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2022-08-14 11:18:47 +0530
committerTim Wawrzynczak <twawrzynczak@chromium.org>2022-08-24 21:25:34 +0000
commit3befdf1161f9ee11646f52e0878c756c146d44a4 (patch)
tree8603c6bf104b75224ad36c4346d60b185b16be49
parent9b0f169d2503dc044500e2790b987d766928782a (diff)
drivers: Implement EFI_PEI_MP_SERVICES_PPI with FSP_UNSUPPORTED type
This patch implements EFI_PEI_MP_SERVICES_PPI structure definitions with APIs that return mp_api_unsupported(). The reason behind this change is to fix an FSP issue where FSP assumes ownership of the APs (Application Processors) upon passing a `NULL` pointer to the CpuMpPpi FSP-S UPD.Hence, this patch implements `MP_SERVICES_PPI_DEFAULT` config to fill EFI_PEI_MP_SERVICES_PPI with `mp_api_unsupported` APIs. Later this data structure can be passed to the CpuMpPpi UPD to avoid APs from getting hijacked by FSP while coreboot decides to set SkipMpInit UPD. TEST=Able to build and boot Google/Taeko with this patch. Signed-off-by: Subrata Banik <subratabanik@google.com> Change-Id: I31fcaa2aa633071b6d6bfa05dbe891ef87978d2c Reviewed-on: https://review.coreboot.org/c/coreboot/+/66708 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r--src/drivers/intel/fsp2_0/ppi/Kconfig8
-rw-r--r--src/drivers/intel/fsp2_0/ppi/Makefile.inc1
-rw-r--r--src/drivers/intel/fsp2_0/ppi/mp_service2_noop.c89
3 files changed, 98 insertions, 0 deletions
diff --git a/src/drivers/intel/fsp2_0/ppi/Kconfig b/src/drivers/intel/fsp2_0/ppi/Kconfig
index d45114681e..188fffaa4c 100644
--- a/src/drivers/intel/fsp2_0/ppi/Kconfig
+++ b/src/drivers/intel/fsp2_0/ppi/Kconfig
@@ -26,3 +26,11 @@ config MP_SERVICES_PPI_V2
modification over MP services1 PPIs. A new API StartupAllCPUs have been
added to allow running a task on BSP and all APs. Also the EFI_PEI_SERVICES
parameter has been removed from all MP PPI APIs.
+
+config MP_SERVICES_PPI_V2_NOOP
+ bool
+ default n
+ select MP_SERVICES_PPI
+ help
+ This option implement EFI_PEI_MP_SERVICES_PPI structure definitions
+ with APIs that returns mp_api_unsupported().
diff --git a/src/drivers/intel/fsp2_0/ppi/Makefile.inc b/src/drivers/intel/fsp2_0/ppi/Makefile.inc
index 8bda899ea9..823718bf28 100644
--- a/src/drivers/intel/fsp2_0/ppi/Makefile.inc
+++ b/src/drivers/intel/fsp2_0/ppi/Makefile.inc
@@ -3,3 +3,4 @@
ramstage-$(CONFIG_MP_SERVICES_PPI) += mp_service_ppi.c
ramstage-$(CONFIG_MP_SERVICES_PPI_V1) += mp_service1.c
ramstage-$(CONFIG_MP_SERVICES_PPI_V2) += mp_service2.c
+ramstage-$(CONFIG_MP_SERVICES_PPI_V2_NOOP) += mp_service2_noop.c
diff --git a/src/drivers/intel/fsp2_0/ppi/mp_service2_noop.c b/src/drivers/intel/fsp2_0/ppi/mp_service2_noop.c
new file mode 100644
index 0000000000..4570bd917c
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/ppi/mp_service2_noop.c
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <fsp/api.h>
+#include <fsp/ppi/mp_service_ppi.h>
+#include <Ppi/MpServices2.h>
+
+typedef EDKII_PEI_MP_SERVICES2_PPI efi_pei_mp_services_ppi;
+
+static efi_return_status_t mps2_noop_get_number_of_processors(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_uintn_t *ignored2,
+ efi_uintn_t *ignored3)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_get_processor_info(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_uintn_t ignored2,
+ efi_processor_information *ignored3)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_startup_all_aps(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_ap_procedure ignored2, efi_boolean_t ignored3,
+ efi_uintn_t ignored4, void *ignored5)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_startup_all_cpus(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_ap_procedure ignored2,
+ efi_uintn_t ignored3, void *ignored4)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_startup_this_ap(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_ap_procedure ignored2, efi_uintn_t ignored3,
+ efi_uintn_t ignored4, void *ignored5)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_switch_bsp(
+ efi_pei_mp_services_ppi *ignored1, efi_uintn_t ignored2,
+ efi_boolean_t ignored3)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_enable_disable_ap(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_uintn_t ignored2, efi_boolean_t ignored3, efi_uint32_t *ignored4)
+{
+ return mp_api_unsupported();
+}
+
+static efi_return_status_t mps2_noop_identify_processor(
+ efi_pei_mp_services_ppi *ignored1,
+ efi_uintn_t *ignored2)
+{
+ return mp_api_unsupported();
+}
+
+/*
+ * Default MP Services data structure adhering to the EDK2 UEFIPKG Open
+ * Source version 2 specification
+ */
+
+static efi_pei_mp_services_ppi mp_service2_noop_ppi = {
+ mps2_noop_get_number_of_processors,
+ mps2_noop_get_processor_info,
+ mps2_noop_startup_all_aps,
+ mps2_noop_startup_this_ap,
+ mps2_noop_switch_bsp,
+ mps2_noop_enable_disable_ap,
+ mps2_noop_identify_processor,
+ mps2_noop_startup_all_cpus,
+};
+
+void *mp_fill_ppi_services_data(void)
+{
+ return (void *)&mp_service2_noop_ppi;
+}