[Skiboot] [PATCH] libflash/mbox-flash: fallback to requesting lower MBOX versions from BMC

Stewart Smith stewart at linux.vnet.ibm.com
Tue Dec 19 17:14:53 AEDT 2017


Some BMC mbox implementations seem to sometimes mysteriously fail when trying
to negotiate v3 when they only support v2. To work around this, we
can fall back to requesting lower mbox protocol versions until we find
one that works.

In theory, this should already "just work", but we have a counter example,
which this patch fixes.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 libflash/mbox-flash.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index d33a52c0ebf0..4a3c53f5957f 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -1018,6 +1018,7 @@ static int protocol_init(struct mbox_flash_data *mbox_flash, uint8_t shift)
 	 */
 	mbox_flash->version = 3;
 
+negotiate_version:
 	msg_put_u8(&msg, 0, mbox_flash->version);
 	msg_put_u8(&msg, 1, shift);
 	rc = msg_send(mbox_flash, &msg, mbox_flash->timeout);
@@ -1029,6 +1030,12 @@ static int protocol_init(struct mbox_flash_data *mbox_flash, uint8_t shift)
 	rc = wait_for_bmc(mbox_flash, mbox_flash->timeout);
 	if (rc) {
 		prlog(PR_ERR, "Error waiting for BMC\n");
+		if (mbox_flash->version > 1) {
+			mbox_flash->version--;
+			prlog(PR_INFO, "Retrying MBOX negotiation with BMC"
+			      " with MBOXv%d\n", mbox_flash->version);
+			goto negotiate_version;
+		}
 		return rc;
 	}
 
-- 
2.14.3



More information about the Skiboot mailing list