Skip to content

Commit

Permalink
libflash/mbox-flash: fallback to requesting lower MBOX versions from BMC
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stewartsmith committed Dec 19, 2017
1 parent 8c762d5 commit f23d6c6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libflash/mbox-flash.c
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit f23d6c6

Please sign in to comment.