RE: [PATCH 2/2] benet: Wait I/O while resuming device
From: Perla, Sathya <hidden>
Date: 2013-03-04 09:17:26
-----Original Message----- From: Gavin Shan [mailto:shangw@linux.vnet.ibm.com] After resetting the adapter, the config space register (0x7c) might give fake information to indicate the f/w is ready. In turn, 0xFF's is always returned while accessing on I/O space registers. The patch adds more check to make sure the I/O space is ready for access before accessing that region.
...
+int be_cmd_fw_wait_io(struct be_adapter *adapter) {
+ void __iomem *db = adapter->db + MPU_MAILBOX_DB_OFFSET;
+ int timeout = 0;
+ u32 val;
+
+ if (lancer_chip(adapter))
+ return 0;
+
+ do {
+ val = ioread32(db);
+ if (val != 0xffffffff)
+ return 0;Wouldn't reading 0xffffffff from a register cause a new EEH flow to be triggered? Anyway, the SLIPORT_SEMAPHORE register that returns a valid POST state *always* is available in the CSR BAR space. This will be for BE2 and BE3 chips. For Skyhawk-R chips config-space/0x7c will work fine. I can give a patch with these changes in a few days if that works for you....
+
+ dev_info(&adapter->pdev->dev,
+ "Wating for I/O (0x%08x), %ds elapsed\n",
+ val, timeout);
+ if (msleep_interruptible(2000)) {
+ dev_err(&adapter->pdev->dev,
+ "Waiting for I/O aborted\n");
+ return -EIO;
+ }
+ timeout += 2;
+ } while (timeout < 60);
+
+ dev_err(&adapter->pdev->dev, "Timeout waiting for I/O (%d)\n",
timeout);
+ return -1;
+}
+