[Skiboot] [PATCH v3 02/11] libflash/mbox-flash: Always close windows before opening a new window

Cyril Bur cyril.bur at au1.ibm.com
Tue Dec 5 12:01:04 AEDT 2017


The MBOX protocol states that if an open window command fails then all
open windows are closed. Currently, if an open window command fails
mbox-flash will erroneously assume that the previously open window is
still open.

The solution to this is to mark all windows as closed before issuing an
open window command and then on success we'll mark the new window as
open.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/mbox-flash.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index 950e24f0..c8a8dade 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -617,6 +617,9 @@ static int mbox_window_move(struct mbox_flash_data *mbox_flash,
 		goto out;
 	}
 
+	mbox_flash->read.open = false;
+	mbox_flash->write.open = false;
+
 	rc = wait_for_bmc(mbox_flash, MBOX_DEFAULT_TIMEOUT);
 	if (rc) {
 		prlog(PR_ERR, "Error waiting for BMC\n");
-- 
2.15.1



More information about the Skiboot mailing list