[Skiboot] [PATCH 2/2] astbmc: Enable mbox depending on scratch reg

Joel Stanley joel at jms.id.au
Wed Feb 28 17:16:10 AEDT 2018


P8 boxes can opt in for mbox pnor support if they set the scratch
register bit to indicate it is supported.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
 hw/ast-bmc/ast-io.c       | 14 ++++++++++++++
 include/ast.h             |  1 +
 platforms/astbmc/common.c |  5 +++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/hw/ast-bmc/ast-io.c b/hw/ast-bmc/ast-io.c
index cd1aba2a177a..964d41513379 100644
--- a/hw/ast-bmc/ast-io.c
+++ b/hw/ast-bmc/ast-io.c
@@ -116,6 +116,7 @@
  */
 
 #define BMC_SIO_SCR29 0x29
+#define BMC_SIO_SCR29_MBOX 0x08
 #define BMC_SIO_SCR29_MEMBOOT 0x10
 
 enum {
@@ -427,6 +428,19 @@ bool ast_is_ahb_lpc_pnor(void)
 	return !(boot_flags & BMC_SIO_SCR29_MEMBOOT);
 }
 
+bool ast_scratch_reg_is_mbox(void)
+{
+	uint8_t boot_version;
+	uint8_t boot_flags;
+
+	boot_version = bmc_sio_inb(BMC_SIO_SCR28);
+	if (boot_version != BOOT_FLAGS_VERSION)
+		return false;
+
+	boot_flags = bmc_sio_inb(BMC_SIO_SCR29);
+	return boot_flags & BMC_SIO_SCR29_MBOX;
+}
+
 void ast_setup_ibt(uint16_t io_base, uint8_t irq)
 {
 	uint32_t v;
diff --git a/include/ast.h b/include/ast.h
index 414ff6a3d39a..2c1336b2a79b 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -82,6 +82,7 @@ int ast_copy_from_ahb(void *dst, uint32_t reg, uint32_t len);
 void ast_io_init(void);
 bool ast_is_ahb_lpc_pnor(void);
 bool ast_is_mbox_pnor(void);
+bool ast_scratch_reg_is_mbox(void);
 
 /* UART configuration */
 
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 243ad9461239..9cf679161e7a 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -207,8 +207,9 @@ static void astbmc_fixup_dt_mbox(struct dt_node *lpc)
 	struct dt_node *mbox;
 	char namebuf[32];
 
-	/* All P9 machines have this and no earlier machines do */
-	if (proc_gen != proc_gen_p9)
+	/* All P9 machines use mbox. P8 machines can indicate they support
+	 * it using the scratch register */
+	if (proc_gen != proc_gen_p9 && !ast_scratch_reg_is_mbox())
 		return;
 
 	/* First check if the mbox interface is already there */
-- 
2.15.1



More information about the Skiboot mailing list