]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: aacraid: Auto detect INTx or MSIx mode during sync cmd processing
authorRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Wed, 7 Feb 2018 16:40:58 +0000 (08:40 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 14 Feb 2018 02:37:04 +0000 (21:37 -0500)
During sync command processing, if legacy INTx status indicates command
is not completed, sample the MSIx register and check if it indicates
command completion, set controller MSIx enabled flag.

Signed-off-by: Prasad B Munirathnam <prasad.munirathnam@microsemi.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/src.c

index c3fdec9d817a5241e701fd8c1b23b3065bddbb56..29bf1e60f5428ab4542cf0bd838342bd8d405f8b 100644 (file)
@@ -1231,6 +1231,7 @@ struct src_registers {
 
 #define SRC_ODR_SHIFT          12
 #define SRC_IDR_SHIFT          9
+#define SRC_MSI_READ_MASK      0x1000
 
 typedef void (*fib_callback)(void *ctxt, struct fib *fibctx);
 
index 09b82d3325fc7d88b248e7f52b3c768580af6eb4..3122389f380f21738467f57652a0d9af88e03713 100644 (file)
@@ -1405,13 +1405,23 @@ void aac_src_access_devreg(struct aac_dev *dev, int mode)
 
 static int aac_src_get_sync_status(struct aac_dev *dev)
 {
+       int msix_val = 0;
+       int legacy_val = 0;
 
-       int val;
+       msix_val = src_readl(dev, MUnit.ODR_MSI) & SRC_MSI_READ_MASK ? 1 : 0;
 
-       if (dev->msi_enabled)
-               val = src_readl(dev, MUnit.ODR_MSI) & 0x1000 ? 1 : 0;
-       else
-               val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT;
+       if (!dev->msi_enabled) {
+               /*
+                * if Legacy int status indicates cmd is not complete
+                * sample MSIx register to see if it indiactes cmd complete,
+                * if yes set the controller in MSIx mode and consider cmd
+                * completed
+                */
+               legacy_val = src_readl(dev, MUnit.ODR_R) >> SRC_ODR_SHIFT;
+               if (!(legacy_val & 1) && msix_val)
+                       dev->msi_enabled = 1;
+               return legacy_val;
+       }
 
-       return val;
+       return msix_val;
 }