Print this page
        
@@ -12,15 +12,17 @@
  *              Manju R
  *              Rasheed
  *              Shakeel Bukhari
  */
 
-#ifndef INCLUDE_LD_PD_MAP
-#define INCLUDE_LD_PD_MAP
+#ifndef _LD_PD_MAP
+#define _LD_PD_MAP
 #include <sys/scsi/scsi.h>
 #include "fusion.h"
 
+struct mrsas_instance;  /* This will be defined in mr_sas.h */
+
 /* raid->write_mode; raid->read_ahead; dcmd->state */
 /* Write through */
 #define WRITE_THROUGH                           0
 /* Delayed Write */
 #define WRITE_BACK                              1
@@ -31,13 +33,13 @@
 #define READ_10         0x28
 #define READ_12         0xA8
 #define WRITE_16        0x8A
 #define WRITE_10        0x2A
 
-// maximum disks per array
+/* maximum disks per array */
 #define MAX_ROW_SIZE                            32
-// maximum spans per logical drive
+/* maximum spans per logical drive */
 #define MAX_SPAN_DEPTH                          8
 #define MEGASAS_LOAD_BALANCE_FLAG               0x1
 #define MR_DEFAULT_IO_TIMEOUT   20
 
 
@@ -63,27 +65,28 @@
         MR_FW_RAID_MAP raidMap;
         MR_LD_SPAN_MAP ldSpanMap[MAX_LOGICAL_DRIVES - 1];
 } MR_FW_RAID_MAP_ALL;
 
 /*
- * Raid Context structure which describes MegaRAID specific IO Paramenters
+ * Raid Context structure which describes MegaRAID specific IO Parameters
  * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames
  */
 typedef struct _MPI2_SCSI_IO_VENDOR_UNIQUE {
-        U8              nsegType;                       // 0x00 nseg[7:4], Type[3:0] */
-        U8              resvd0;                         // 0x01
+        U8 nsegType;            /* 0x00 nseg[7:4], Type[3:0] */
+        U8 resvd0;              /* 0x01 */
     U16     timeoutValue;       /* 0x02 -0x03  */
     U8      regLockFlags;       /* 0x04        */
     U8      reservedForHw1;     /* 0x05        */
     U16     ldTargetId;         /* 0x06 - 0x07 */
     U64     regLockRowLBA;      /* 0x08 - 0x0F */
     U32     regLockLength;      /* 0x10 - 0x13 */
     U16     nextLMId;           /* 0x14 - 0x15 */
     U8      extStatus;          /* 0x16        */
     U8      status;             /* 0x17 status */
-    U8      RAIDFlags;          /* 0x18 resvd[7:6], ioSubType[5:4], resvd[3:1], preferredCpu[0] */
-    U8      numSGE;             /* 0x19 numSge; not including chain entries*/
+        U8 RAIDFlags;           /* 0x18 resvd[7:6], ioSubType[5:4], */
+                                /* resvd[3:1], preferredCpu[0] */
+        U8 numSGE;              /* 0x19 numSge; not including chain entries */
     U16     configSeqNum;       /* 0x1A -0x1B */
     U8      spanArm;            /* 0x1C span[7:5], arm[4:0] */
     U8      resvd2[3];          /* 0x1D-0x1f */
 } MPI2_SCSI_IO_VENDOR_UNIQUE, MPI25_SCSI_IO_VENDOR_UNIQUE;
 
@@ -137,25 +140,25 @@
 
 /*
  * define region lock types
  */
 typedef enum    _REGION_TYPE {
-        REGION_TYPE_UNUSED      = 0,    // lock is currently not active
-        REGION_TYPE_SHARED_READ = 1,    // shared lock (for reads)
+        REGION_TYPE_UNUSED      = 0,    /* lock is currently not active */
+        REGION_TYPE_SHARED_READ = 1,    /* shared lock (for reads) */
         REGION_TYPE_SHARED_WRITE = 2,
-        REGION_TYPE_EXCLUSIVE   = 3,    // exclusive lock (for writes)
+        REGION_TYPE_EXCLUSIVE   = 3     /* exclusive lock (for writes) */
 } REGION_TYPE;
 
 
 #define DM_PATH_MAXPATH         2
 #define DM_PATH_FIRSTPATH       0
 #define DM_PATH_SECONDPATH      1
 
-// declare valid Region locking values
+/* declare valid Region locking values */
 typedef enum _REGION_LOCK {
         REGION_LOCK_BYPASS              = 0,
-        // for RAID 6 single-drive failure
+        /* for RAID 6 single-drive failure */
         REGION_LOCK_UNCOND_SHARED_READ  = 1,
         REGION_LOCK_UNCOND_SHARED_WRITE = 2,
         REGION_LOCK_UNCOND_SHARED_OTHER = 3,
         REGION_LOCK_UNCOND_SHARED_EXCLUSIVE = 0xFF
 } REGION_LOCK;
@@ -223,11 +226,11 @@
         MRSAS_SCSI_VARIABLE_LENGTH_CMD          = 0x7F,
         MRSAS_SCSI_SERVICE_ACTION_READ32        = 0x9,
         MRSAS_SCSI_SERVICE_ACTION_WRITE32       = 0xB,
         MRSAS_SCSI_ADDL_CDB_LEN                 = 0x18,
         MRSAS_RD_WR_PROTECT                     = 0x20,
-        MRSAS_EEDPBLOCKSIZE                     = 512,
+        MRSAS_EEDPBLOCKSIZE                     = 512
 };
 
 
 #define IEEE_SGE_FLAGS_ADDR_MASK        (0x03)
 #define IEEE_SGE_FLAGS_SYSTEM_ADDR      (0x00)
@@ -238,6 +241,9 @@
 #define IEEE_SGE_FLAGS_END_OF_LIST      (0x40)
 
 
 U8      MR_ValidateMapInfo(MR_FW_RAID_MAP_ALL *map, PLD_LOAD_BALANCE_INFO lbInfo);
 U16     MR_CheckDIF(U32, MR_FW_RAID_MAP_ALL *);
-#endif // INCLUDE_LD_PD_MAP
+U8 MR_BuildRaidContext(struct mrsas_instance *, struct IO_REQUEST_INFO *,
+    MPI2_SCSI_IO_VENDOR_UNIQUE *, MR_FW_RAID_MAP_ALL *);
+
+#endif /* _LD_PD_MAP */