aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.ibm.com>2023-08-29 11:24:09 +0200
committerReza Arbab <arbab@linux.ibm.com>2023-09-12 14:22:11 -0500
commit74a70f8b5ab22a6284299dfdd71d6326d0717482 (patch)
treea849b947ff2d5c23f0be5e017ac299535a053f4b
parentc2c60d1dfc8e12f737ca5d230bad881b74d9ac03 (diff)
downloadskiboot-74a70f8b5ab22a6284299dfdd71d6326d0717482.zip
skiboot-74a70f8b5ab22a6284299dfdd71d6326d0717482.tar.gz
skiboot-74a70f8b5ab22a6284299dfdd71d6326d0717482.tar.bz2
platforms/astbmc: Enable PLDM support
Last BMC firmware is available with a complete PLDM support on Rainier system. This patch allows initially to: - Initialize the MCTP core. - Enable the mctp binding over LPC bus interface and new wrappers to send and receive PLDM messages over the mctp library. - Retrieve all needed PLDM data. - "Virtualize" the content of a BMC flash based on lid files. Then, others mandatory support (watchdog, opal rtc, opal ipmi) are enabled. Signed-off-by: Christophe Lombard <clombard@linux.ibm.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
-rw-r--r--core/init.c16
-rw-r--r--platforms/astbmc/astbmc.h4
-rw-r--r--platforms/astbmc/common.c34
-rw-r--r--platforms/astbmc/pnor.c25
-rw-r--r--platforms/qemu/qemu.c6
5 files changed, 84 insertions, 1 deletions
diff --git a/core/init.c b/core/init.c
index 73748a5..2d8a545 100644
--- a/core/init.c
+++ b/core/init.c
@@ -34,6 +34,7 @@
#include <libfdt/libfdt.h>
#include <timer.h>
#include <ipmi.h>
+#include <pldm.h>
#include <sensor.h>
#include <xive.h>
#include <nvram.h>
@@ -562,8 +563,12 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
trustedboot_exit_boot_services();
+#ifdef CONFIG_PLDM
+ pldm_platform_send_progress_state_change(
+ PLDM_STATE_SET_BOOT_PROG_STATE_STARTING_OP_SYS);
+#else
ipmi_set_fw_progress_sensor(IPMI_FW_OS_BOOT);
-
+#endif
if (!is_reboot) {
/* We wait for the nvram read to complete here so we can
@@ -1408,10 +1413,19 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
/* Setup ibm,firmware-versions if able */
if (platform.bmc) {
flash_dt_add_fw_version();
+#ifdef CONFIG_PLDM
+ pldm_fru_dt_add_bmc_version();
+#else
ipmi_dt_add_bmc_info();
+#endif
}
+#ifdef CONFIG_PLDM
+ pldm_platform_send_progress_state_change(
+ PLDM_STATE_SET_BOOT_PROG_STATE_PCI_RESORUCE_CONFIG);
+#else
ipmi_set_fw_progress_sensor(IPMI_FW_PCI_INIT);
+#endif
/*
* These last few things must be done as late as possible
diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index 00f2212..7783fe2 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -96,6 +96,10 @@ extern const struct bmc_platform bmc_plat_ast2600_openbmc;
extern void astbmc_early_init(void);
extern int64_t astbmc_ipmi_reboot(void);
extern int64_t astbmc_ipmi_power_down(uint64_t request);
+#ifdef CONFIG_PLDM
+extern int astbmc_pldm_init(void);
+extern int pnor_pldm_init(void);
+#endif
extern void astbmc_init(void);
extern void astbmc_ext_irq_serirq_cpld(unsigned int chip_id);
extern int pnor_init(void);
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 6697230..675eb21 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -9,6 +9,7 @@
#include <xscom.h>
#include <ast.h>
#include <ipmi.h>
+#include <pldm.h>
#include <bt.h>
#include <errorlog.h>
#include <lpc.h>
@@ -109,6 +110,36 @@ static int astbmc_fru_init(void)
return 0;
}
+#ifdef CONFIG_PLDM
+int astbmc_pldm_init(void)
+{
+ int rc = OPAL_SUCCESS;
+
+ /* PLDM over MCTP */
+ rc = pldm_mctp_init();
+ if (!rc) {
+ /* Initialize PNOR/NVRAM */
+ rc = pnor_pldm_init();
+
+ if (!rc) {
+ pldm_watchdog_init();
+ pldm_rtc_init();
+ pldm_opal_init();
+ }
+ }
+
+ /* Initialize elog */
+ elog_init();
+
+ /* Setup UART console for use by Linux via OPAL API */
+ set_opal_console(&uart_opal_con);
+
+ if (rc)
+ prlog(PR_WARNING, "Failed to configure PLDM\n");
+
+ return rc;
+}
+#endif
void astbmc_init(void)
{
@@ -542,6 +573,9 @@ void astbmc_early_init(void)
void astbmc_exit(void)
{
+#ifdef CONFIG_PLDM
+ return;
+#endif
ipmi_wdt_final_reset();
ipmi_set_boot_count();
diff --git a/platforms/astbmc/pnor.c b/platforms/astbmc/pnor.c
index 64f2249..853da46 100644
--- a/platforms/astbmc/pnor.c
+++ b/platforms/astbmc/pnor.c
@@ -5,6 +5,7 @@
#include <device.h>
#include <console.h>
#include <opal.h>
+#include <pldm.h>
#include <libflash/ipmi-hiomap.h>
#include <libflash/mbox-flash.h>
#include <libflash/libflash.h>
@@ -32,6 +33,30 @@ static enum ast_flash_style ast_flash_get_fallback_style(void)
return raw_mem;
}
+#ifdef CONFIG_PLDM
+int pnor_pldm_init(void)
+{
+ struct blocklevel_device *bl = NULL;
+ int rc = 0;
+
+ rc = pldm_lid_files_init(&bl);
+ if (rc) {
+ prerror("PLAT: Failed to init PNOR driver\n");
+ goto fail;
+ }
+
+ rc = flash_register(bl);
+ if (!rc)
+ return 0;
+
+fail:
+ if (bl)
+ pldm_lid_files_exit(bl);
+
+ return rc;
+}
+#endif
+
int pnor_init(void)
{
struct spi_flash_ctrl *pnor_ctrl = NULL;
diff --git a/platforms/qemu/qemu.c b/platforms/qemu/qemu.c
index 96153e8..0f6e089 100644
--- a/platforms/qemu/qemu.c
+++ b/platforms/qemu/qemu.c
@@ -4,6 +4,7 @@
#include <skiboot.h>
#include <console.h>
#include <device.h>
+#include <ast.h>
#include <ipmi.h>
#include <platforms/astbmc/astbmc.h>
@@ -80,7 +81,12 @@ static void qemu_init(void)
if (!bt_device_present) {
set_opal_console(&uart_opal_con);
} else {
+#ifdef CONFIG_PLDM
+ /* need to be checked according platform: P10, P11 ... */
+ astbmc_pldm_init();
+#else
astbmc_init();
+#endif
}
}