aboutsummaryrefslogtreecommitdiff
path: root/platforms/astbmc
diff options
context:
space:
mode:
authorChristophe Lombard <clombard@linux.ibm.com>2023-08-29 11:23:19 +0200
committerReza Arbab <arbab@linux.ibm.com>2023-09-12 14:22:11 -0500
commit4fc06a6cb136a0acaef03e603bb906a6e6c48788 (patch)
tree4a532dbcbfd67687706350fa669fb2bbc579eae0 /platforms/astbmc
parent66c38f45e9fc079dc47c8865ee6a27da5e7cdc0f (diff)
downloadskiboot-4fc06a6cb136a0acaef03e603bb906a6e6c48788.zip
skiboot-4fc06a6cb136a0acaef03e603bb906a6e6c48788.tar.gz
skiboot-4fc06a6cb136a0acaef03e603bb906a6e6c48788.tar.bz2
hw/ast-bmc: Initialize ast lpc mctp binding
The Management Component Transport Protocol (MCTP) defines a communication model intended to facilitate communication. This patch initialize MCTP binding over LPC Bus interface. Several steps must be performed: - Initialize the MCTP core (mctp_init()). - Initialize a hardware binding as AST LPC mode host (mctp_astlpc_init()). - Register the hardware binding with the core (mctp_register_bus()), using a predefined EID (Host default is 9). To transmit a MCTP message, mctp_message_tx() is used. To receive a MCTP message, a callback need to be provided and registered through mctp_set_rx_all(). For the transfer of MCTP messages, two basics components are used: - A window of the LPC FW address space, where reads and writes are forwarded to BMC memory. - An interrupt mechanism using the KCS interface. hw/ast-bmc/ast-mctp.c is compilated if the compiler flag CONFIG_PLDM is set. Reviewed-by: Abhishek Singh Tomar <abhishek@linux.ibm.com> Signed-off-by: Christophe Lombard <clombard@linux.ibm.com> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Diffstat (limited to 'platforms/astbmc')
-rw-r--r--platforms/astbmc/common.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index bfbba2d..6697230 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -31,6 +31,11 @@
#define MBOX_IO_COUNT 6
#define MBOX_LPC_IRQ 9
+/* MCTP config */
+#define MCTP_IO_BASE 0xca2
+#define MCTP_IO_COUNT 2
+#define MCTP_LPC_IRQ 11
+
void astbmc_ext_irq_serirq_cpld(unsigned int chip_id)
{
lpc_all_interrupts(chip_id);
@@ -227,6 +232,37 @@ static void astbmc_fixup_dt_system_id(void)
dt_add_property_strings(dt_root, "system-id", "unavailable");
}
+#ifdef CONFIG_PLDM
+static void astbmc_fixup_dt_mctp(struct dt_node *lpc)
+{
+ struct dt_node *mctp;
+ char namebuf[32];
+
+ if (!lpc)
+ return;
+
+ /* First check if the mbox interface is already there */
+ dt_for_each_child(lpc, mctp) {
+ if (dt_node_is_compatible(mctp, "mctp"))
+ return;
+ }
+
+ snprintf(namebuf, sizeof(namebuf), "mctp@i%x", MCTP_IO_BASE);
+ mctp = dt_new(lpc, namebuf);
+
+ dt_add_property_cells(mctp, "reg",
+ 1, /* IO space */
+ MCTP_IO_BASE, MCTP_IO_COUNT);
+ dt_add_property_strings(mctp, "compatible", "mctp");
+
+ /* Mark it as reserved to avoid Linux trying to claim it */
+ dt_add_property_strings(mctp, "status", "reserved");
+
+ dt_add_property_cells(mctp, "interrupts", MCTP_LPC_IRQ);
+ dt_add_property_cells(mctp, "interrupt-parent", lpc->phandle);
+}
+#endif
+
static void astbmc_fixup_dt_bt(struct dt_node *lpc)
{
struct dt_node *bt;
@@ -404,6 +440,11 @@ static void astbmc_fixup_dt(void)
/* BT is not in HB either */
astbmc_fixup_dt_bt(primary_lpc);
+#ifdef CONFIG_PLDM
+ /* Fixup the MCTP, that might be missing from HB */
+ astbmc_fixup_dt_mctp(primary_lpc);
+#endif
+
/* The pel logging code needs a system-id property to work so
make sure we have one. */
astbmc_fixup_dt_system_id();