aboutsummaryrefslogtreecommitdiff
path: root/libflash
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2017-12-19 00:11:56 -0600
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-20 08:54:07 +1100
commitf23d6c626bd657e967347bda872242427b0d9221 (patch)
treef5ba9bb84195fc3dc7226b55a644a5717364442b /libflash
parent8c762d5359d6d00ae2ca2d9e5a4e2ae87a402cf0 (diff)
downloadskiboot-f23d6c626bd657e967347bda872242427b0d9221.zip
skiboot-f23d6c626bd657e967347bda872242427b0d9221.tar.gz
skiboot-f23d6c626bd657e967347bda872242427b0d9221.tar.bz2
libflash/mbox-flash: fallback to requesting lower MBOX versions from BMC
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@linux.vnet.ibm.com>
Diffstat (limited to 'libflash')
-rw-r--r--libflash/mbox-flash.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index d33a52c..4a3c53f 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;
}