[Skiboot] [PATCH] astbmc: Only mbox_init() if we mbox_flash_init()

Andrew Jeffery andrew at aj.id.au
Fri Oct 5 23:12:54 AEST 2018


Avoid setting up the hardware if we're not going to use it. Setting it
up without using it is actively harmful as it prevents us succesfully
entering Petitboot (we exit skiboot with locks held and checkstop the
machine).

Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
 libflash/mbox-flash.c     | 6 ++++++
 platforms/astbmc/common.c | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index 3239be964b57..11ec90523d58 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -1134,6 +1134,12 @@ int mbox_flash_init(struct blocklevel_device **bl)
 	if (!bl)
 		return FLASH_ERR_PARM_ERROR;
 
+	/* XXX: We only support one blocklevel flash device over mbox. If we
+	 * ever support more than one, move this out. The chances of that are
+	 * slim though due to circumstances.
+	 */
+	mbox_init();
+
 	*bl = NULL;
 
 	mbox_flash = zalloc(sizeof(struct mbox_flash_data));
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index a616f24fd863..10aed3f72901 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -419,8 +419,6 @@ void astbmc_early_init(void)
 	/* Setup UART and use it as console */
 	uart_init();
 
-	mbox_init();
-
 	prd_init();
 }
 
-- 
2.17.1



More information about the Skiboot mailing list