patch-2.2.3 linux/drivers/scsi/megaraid.h

Next file: linux/drivers/scsi/ncr53c8xx.c
Previous file: linux/drivers/scsi/megaraid.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.2/linux/drivers/scsi/megaraid.h linux/drivers/scsi/megaraid.h
@@ -1,7 +1,12 @@
 #ifndef __MEGARAID_H__
 #define __MEGARAID_H__
 
+#ifndef LINUX_VERSION_CODE
 #include <linux/version.h>
+#endif
+
+#define MULTI_IO 0    /* change to 1 for fully parallel I/O to adapter */
+                      /* works on some systems, not on others yet */
 
 #define IN_ISR                  0x80000000L
 #define NO_INTR                 0x40000000L
@@ -20,7 +25,7 @@
 
 #define MEGA_CMD_TIMEOUT        10
 
-#define MAX_SGLIST              20
+#define MAX_SGLIST              17
 #define MAX_COMMANDS            254
 
 #define MAX_LOGICAL_DRIVES      8
@@ -56,7 +61,7 @@
 #define I_TOGGLE_PORT      0x01
 #define INTR_PORT          0x0a
 
-#define MAILBOX_SIZE       70
+#define MAILBOX_SIZE       (sizeof(mega_mailbox)-16)
 #define MBOX_BUSY_PORT     0x00
 #define MBOX_PORT0         0x04
 #define MBOX_PORT1         0x05
@@ -96,6 +101,8 @@
 
 #define PCI_CONF_BASE_ADDR_OFFSET  0x10
 #define PCI_CONF_IRQ_OFFSET        0x3c
+#define PCI_CONF_AMISIG            0xa0
+#define AMI_SIGNATURE              0x11223344
 
 #if LINUX_VERSION_CODE < 0x20100
 #define MEGARAID \
@@ -113,14 +120,14 @@
     megaraid_reset,                     /* Reset Command Function    */\
     NULL,                               /* Slave Attach Function     */\
     megaraid_biosparam,                 /* Disk BIOS Parameters      */\
-    1,                                  /* # of cmds that can be\
+    254,                                /* # of cmds that can be\
                                            outstanding at any time */\
     7,                                  /* HBA Target ID             */\
     MAX_SGLIST,                         /* Scatter/Gather Table Size */\
-    1,                                  /* SCSI Commands per LUN     */\
+    64,                                 /* SCSI Commands per LUN     */\
     0,                                  /* Present                   */\
     0,                                  /* Default Unchecked ISA DMA */\
-    ENABLE_CLUSTERING }                 /* Enable Clustering         */
+    ENABLE_CLUSTERING }		/* Enable Clustering         */
 #else
 #define MEGARAID \
   {\
@@ -134,10 +141,10 @@
     abort:            megaraid_abort,          /* Abort Command Function    */\
     reset:            megaraid_reset,          /* Reset Command Function    */\
     bios_param:       megaraid_biosparam,      /* Disk BIOS Parameters      */\
-    can_queue:        255,                     /* Can Queue                 */\
+    can_queue:        1 /* MAX_COMMANDS */,            /* Can Queue                 */\
     this_id:          7,                       /* HBA Target ID             */\
     sg_tablesize:     MAX_SGLIST,              /* Scatter/Gather Table Size */\
-    cmd_per_lun:      1,                       /* SCSI Commands per LUN     */\
+    cmd_per_lun:      64,                      /* SCSI Commands per LUN     */\
     present:          0,                       /* Present                   */\
     unchecked_isa_dma:0,                       /* Default Unchecked ISA DMA */\
     use_clustering:   ENABLE_CLUSTERING       /* Enable Clustering         */\
@@ -145,140 +152,150 @@
 #endif
 
 /* Structures */
-typedef struct _mega_ADP_INFO
-{
-  u_char    MaxConcCmds;
-  u_char    RbldRate;
-  u_char    MaxTargPerChan;
-  u_char    ChanPresent;
-  u_char    FwVer[4];
-  u_short   AgeOfFlash;
-  u_char    ChipSet;
-  u_char    DRAMSize;
-  u_char    CacheFlushInterval;
-  u_char    BiosVer[4];
-  u_char    resvd[7];
+typedef struct _mega_ADP_INFO {
+    u_char MaxConcCmds;
+    u_char RbldRate;
+    u_char MaxTargPerChan;
+    u_char ChanPresent;
+    u_char FwVer[4];
+    u_short AgeOfFlash;
+    u_char ChipSet;
+    u_char DRAMSize;
+    u_char CacheFlushInterval;
+    u_char BiosVer[4];
+    u_char resvd[7];
 } mega_ADP_INFO;
 
-typedef struct _mega_LDRV_INFO
-{
-  u_char   NumLDrv;
-  u_char   resvd[3];
-  u_long   LDrvSize[MAX_LOGICAL_DRIVES];
-  u_char   LDrvProp[MAX_LOGICAL_DRIVES];
-  u_char   LDrvState[MAX_LOGICAL_DRIVES];
+typedef struct _mega_LDRV_INFO {
+    u_char NumLDrv;
+    u_char resvd[3];
+    u_long LDrvSize[MAX_LOGICAL_DRIVES];
+    u_char LDrvProp[MAX_LOGICAL_DRIVES];
+    u_char LDrvState[MAX_LOGICAL_DRIVES];
 } mega_LDRV_INFO;
 
-typedef struct _mega_PDRV_INFO
-{
-  u_char   PDrvState[MAX_PHYSICAL_DRIVES];
-  u_char   resvd;
+typedef struct _mega_PDRV_INFO {
+    u_char PDrvState[MAX_PHYSICAL_DRIVES];
+    u_char resvd;
 } mega_PDRV_INFO;
 
 // RAID inquiry: Mailbox command 0x5
-typedef struct _mega_RAIDINQ
-{
-  mega_ADP_INFO    AdpInfo;
-  mega_LDRV_INFO   LogdrvInfo;
-  mega_PDRV_INFO   PhysdrvInfo;
+typedef struct _mega_RAIDINQ {
+    mega_ADP_INFO AdpInfo;
+    mega_LDRV_INFO LogdrvInfo;
+    mega_PDRV_INFO PhysdrvInfo;
 } mega_RAIDINQ;
 
 // Passthrough command: Mailbox command 0x3
-typedef struct mega_passthru
-{
-  u_char            timeout:3;              /* 0=6sec/1=60sec/2=10min/3=3hrs */
-  u_char            ars:1;
-  u_char            reserved:3;
-  u_char            islogical:1;
-  u_char            logdrv;                 /* if islogical == 1 */
-  u_char            channel;                /* if islogical == 0 */
-  u_char            target;                 /* if islogical == 0 */
-  u_char            queuetag;               /* unused */
-  u_char            queueaction;            /* unused */
-  u_char            cdb[MAX_CDB_LEN];
-  u_char            cdblen;
-  u_char            reqsenselen;
-  u_char            reqsensearea[MAX_REQ_SENSE_LEN];
-  u_char            numsgelements;
-  u_char            scsistatus;
-  u_long            dataxferaddr;
-  u_long            dataxferlen;
+typedef struct mega_passthru {
+    u_char timeout:3;		/* 0=6sec/1=60sec/2=10min/3=3hrs */
+    u_char ars:1;
+    u_char reserved:3;
+    u_char islogical:1;
+    u_char logdrv;		/* if islogical == 1 */
+    u_char channel;		/* if islogical == 0 */
+    u_char target;		/* if islogical == 0 */
+    u_char queuetag;		/* unused */
+    u_char queueaction;		/* unused */
+    u_char cdb[MAX_CDB_LEN];
+    u_char cdblen;
+    u_char reqsenselen;
+    u_char reqsensearea[MAX_REQ_SENSE_LEN];
+    u_char numsgelements;
+    u_char scsistatus;
+    u_long dataxferaddr;
+    u_long dataxferlen;
 } mega_passthru;
 
-typedef struct _mega_mailbox
-{
-  /* 0x0 */ u_char    cmd;
-  /* 0x1 */ u_char    cmdid;
-  /* 0x2 */ u_short   numsectors;
-  /* 0x4 */ u_long    lba;
-  /* 0x8 */ u_long    xferaddr;
-  /* 0xC */ u_char    logdrv;
-  /* 0xD */ u_char    numsgelements;
-  /* 0xE */ u_char    resvd;
-  /* 0xF */ u_char    busy;
-  /* 0x10*/ u_char    numstatus;
-  /* 0x11*/ u_char    status;
-  /* 0x12*/ u_char    completed[46];
-            u_char    mraid_poll;
-            u_char    mraid_ack;
-            u_char    pad[16];
+typedef struct _mega_mailbox {
+    /* 0x0 */ u_char cmd;
+    /* 0x1 */ u_char cmdid;
+    /* 0x2 */ u_short numsectors;
+    /* 0x4 */ u_long lba;
+    /* 0x8 */ u_long xferaddr;
+    /* 0xC */ u_char logdrv;
+    /* 0xD */ u_char numsgelements;
+    /* 0xE */ u_char resvd;
+    /* 0xF */ u_char busy;
+    /* 0x10 */ u_char numstatus;
+    /* 0x11 */ u_char status;
+    /* 0x12 */ u_char completed[46];
+    u_char mraid_poll;
+    u_char mraid_ack;
+    u_char pad[16];
 } mega_mailbox;
 
-typedef struct _mega_sglist
-{
-  u_long     address;
-  u_long     length;
+typedef struct _mega_ioctl_mbox {
+    /* 0x0 */ u_char cmd;
+    /* 0x1 */ u_char cmdid;
+    /* 0x2 */ u_char channel;
+    /* 0x3 */ u_char param;
+    /* 0x4 */ u_char pad[4];
+    /* 0x8 */ u_long xferaddr;
+    /* 0xC */ u_char logdrv;
+    /* 0xD */ u_char numsgelements;
+    /* 0xE */ u_char resvd;
+    /* 0xF */ u_char busy;
+    /* 0x10 */ u_char numstatus;
+    /* 0x11 */ u_char status;
+    /* 0x12 */ u_char completed[46];
+    u_char mraid_poll;
+    u_char mraid_ack;
+    u_char malign[16];
+} mega_ioctl_mbox;
+
+typedef struct _mega_sglist {
+    u_long address;
+    u_long length;
 } mega_sglist;
 
 /* Queued command data */
 typedef struct _mega_scb mega_scb;
 
-struct _mega_scb
-{
-  int             idx;
-  u_long          flag;
-  Scsi_Cmnd      *SCpnt;
-  u_char          mboxData[16];
-  mega_passthru   pthru;
-  mega_sglist    *sgList;
-  mega_scb       *next;
+struct _mega_scb {
+    int idx;
+    u_long flag;
+    Scsi_Cmnd *SCpnt;
+    u_char mboxData[16];
+    mega_passthru pthru;
+    mega_sglist *sgList;
+    mega_scb *next;
 };
 
 /* Per-controller data */
-typedef struct _mega_host_config
-{
-  u_char               numldrv;
-  u_long               flag;
-  u_long               base;
-
-  struct tq_struct     megaTq;
-
-  /* Host adapter parameters */
-  u_char               fwVer[7];
-  u_char               biosVer[7];
-
-  struct Scsi_Host     *host;
-
-  /* The following must be DMA-able!! */
-  volatile mega_mailbox *mbox;
-  volatile mega_mailbox mailbox;
-  volatile u_char       mega_buffer[2*1024L];
+typedef struct _mega_host_config {
+    u_char numldrv;
+    u_long flag;
+    u_long base;
+
+    struct tq_struct megaTq;
+
+    /* Host adapter parameters */
+    u_char fwVer[7];
+    u_char biosVer[7];
+
+    struct Scsi_Host *host;
+
+    /* The following must be DMA-able!! */
+    volatile mega_mailbox *mbox;
+    volatile mega_mailbox mailbox;
+    volatile u_char mega_buffer[2 * 1024L];
 
-  u_char                max_cmds;
-  mega_scb              scbList[MAX_COMMANDS];
+    u_char max_cmds;
+    mega_scb scbList[MAX_COMMANDS];
 } mega_host_config;
 
 extern struct proc_dir_entry proc_scsi_megaraid;
 
-const char *megaraid_info( struct Scsi_Host * );
-int        megaraid_detect( Scsi_Host_Template * );
-int        megaraid_release(struct Scsi_Host *);
-int        megaraid_command( Scsi_Cmnd * );
-int        megaraid_abort( Scsi_Cmnd * );
-int        megaraid_reset( Scsi_Cmnd *, unsigned int); 
-int        megaraid_queue( Scsi_Cmnd *, void (*done)(Scsi_Cmnd *) );
-int        megaraid_biosparam( Disk *, kdev_t, int * );
-int        megaraid_proc_info( char *buffer, char **start, off_t offset,
-			       int length, int hostno, int inout );
+const char *megaraid_info(struct Scsi_Host *);
+int megaraid_detect(Scsi_Host_Template *);
+int megaraid_release(struct Scsi_Host *);
+int megaraid_command(Scsi_Cmnd *);
+int megaraid_abort(Scsi_Cmnd *);
+int megaraid_reset(Scsi_Cmnd *, unsigned int);
+int megaraid_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
+int megaraid_biosparam(Disk *, kdev_t, int *);
+int megaraid_proc_info(char *buffer, char **start, off_t offset,
+		       int length, int hostno, int inout);
 
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)