added mtd driver
[linux-2.4.git] / drivers / scsi / megaraid2.h
1 #ifndef __MEGARAID_H__
2 #define __MEGARAID_H__
3
4 #include <linux/version.h>
5 #include <linux/spinlock.h>
6
7
8 #define MEGARAID_VERSION        \
9         "v2.10.10.1 (Release Date: Thu Jan 27 16:19:44 EDT 2005)\n"
10
11 /*
12  * Driver features - change the values to enable or disable features in the
13  * driver.
14  */
15
16 /*
17  * Comand coalescing - This feature allows the driver to be able to combine
18  * two or more commands and issue as one command in order to boost I/O
19  * performance. Useful if the nature of the I/O is sequential. It is not very
20  * useful for random natured I/Os.
21  */
22 #define MEGA_HAVE_COALESCING    0
23
24 /*
25  * Clustering support - Set this flag if you are planning to use the
26  * clustering services provided by the megaraid controllers and planning to
27  * setup a cluster
28  */
29 #define MEGA_HAVE_CLUSTERING    1
30
31 /*
32  * Driver statistics - Set this flag if you are interested in statics about
33  * number of I/O completed on each logical drive and how many interrupts
34  * generated. If enabled, this information is available through /proc
35  * interface and through the private ioctl. Setting this flag has a
36  * performance penalty.
37  */
38 #define MEGA_HAVE_STATS         0
39
40 /*
41  * Enhanced /proc interface - This feature will allow you to have a more
42  * detailed /proc interface for megaraid driver. E.g., a real time update of
43  * the status of the logical drives, battery status, physical drives etc.
44  */
45 #define MEGA_HAVE_ENH_PROC      1
46
47 #ifndef PCI_VENDOR_ID_AMI
48 #define PCI_VENDOR_ID_AMI               0x101E
49 #endif
50
51 #ifndef PCI_VENDOR_ID_DELL
52 #define PCI_VENDOR_ID_DELL              0x1028
53 #endif
54
55 #ifndef PCI_VENDOR_ID_INTEL
56 #define PCI_VENDOR_ID_INTEL             0x8086
57 #endif
58
59 #ifndef PCI_DEVICE_ID_AMI_MEGARAID
60 #define PCI_DEVICE_ID_AMI_MEGARAID      0x9010
61 #endif
62
63 #ifndef PCI_DEVICE_ID_AMI_MEGARAID2
64 #define PCI_DEVICE_ID_AMI_MEGARAID2     0x9060
65 #endif
66
67 #ifndef PCI_DEVICE_ID_AMI_MEGARAID3
68 #define PCI_DEVICE_ID_AMI_MEGARAID3     0x1960
69 #endif
70
71 #define PCI_DEVICE_ID_DISCOVERY         0x000E
72 #define PCI_DEVICE_ID_PERC4_DI          0x000F
73 #define PCI_DEVICE_ID_PERC4_QC_VERDE    0x0407
74 #define PCI_DEVICE_ID_PERC4E_SI_DI      0x0013
75 #define PCI_DEVICE_ID_PERC4E_DC_SC      0x0408
76 #define PCI_DEVICE_ID_LSI_SATA_PCIX     0x0409
77
78 /* Sub-System Vendor IDs */
79 #define AMI_SUBSYS_VID                  0x101E
80 #define DELL_SUBSYS_VID                 0x1028
81 #define HP_SUBSYS_VID                   0x103C
82 #define LSI_SUBSYS_VID                  0x1000
83 #define INTEL_SUBSYS_VID                0x8086
84 #define FSC_SUBSYS_VID                  0x1734
85 #define ACER_SUBSYS_VID                 0x1025
86 #define NEC_SUBSYS_VID                  0x1033
87
88 #define HBA_SIGNATURE                   0x3344
89 #define HBA_SIGNATURE_471               0xCCCC
90 #define HBA_SIGNATURE_64BIT             0x0299
91
92 #define MBOX_BUSY_WAIT                  10      /* wait for up to 10 usec for
93                                                    mailbox to be free */
94 #define DEFAULT_INITIATOR_ID    7
95
96 #define MAX_SGLIST              64      /* max supported in f/w */
97 #define MIN_SGLIST              26      /* guaranteed to support these many */
98 #define MAX_COMMANDS            126
99 #define CMDID_INT_CMDS          MAX_COMMANDS+1  /* make sure CMDID_INT_CMDS
100                                                 is less than max commands
101                                                 supported by any f/w */
102
103 #define MAX_CDB_LEN             10
104 #define MAX_EXT_CDB_LEN         16      /* we support cdb length up to 16 */
105
106 #define DEF_CMD_PER_LUN         63
107 #define MAX_CMD_PER_LUN         MAX_COMMANDS
108 #define MAX_FIRMWARE_STATUS     46
109 #define MAX_XFER_PER_CMD        (64*1024)
110 #define MAX_SECTORS_PER_IO      128
111
112 #define MAX_LOGICAL_DRIVES_40LD         40
113 #define FC_MAX_PHYSICAL_DEVICES         256
114 #define MAX_LOGICAL_DRIVES_8LD          8
115 #define MAX_CHANNELS                    5
116 #define MAX_TARGET                      15
117 #define MAX_PHYSICAL_DRIVES             MAX_CHANNELS*MAX_TARGET
118 #define MAX_ROW_SIZE_40LD               32
119 #define MAX_ROW_SIZE_8LD                8
120 #define MAX_SPAN_DEPTH                  8
121
122 #define NVIRT_CHAN              4       /* # of virtual channels to represent
123                                            up to 60 logical drives */
124
125 #define MEGARAID                                                \
126 {                                                               \
127         .name =                         "MegaRAID",             \
128         .proc_name =                    "megaraid",             \
129         .detect =                       megaraid_detect,        \
130         .release =                      megaraid_release,       \
131         .info =                         megaraid_info,          \
132         .command =                      megaraid_command,       \
133         .queuecommand =                 megaraid_queue,         \
134         .max_sectors =                  MAX_SECTORS_PER_IO,     \
135         .can_queue =                    MAX_COMMANDS,           \
136         .this_id =                      DEFAULT_INITIATOR_ID,   \
137         .sg_tablesize =                 MAX_SGLIST,             \
138         .cmd_per_lun =                  DEF_CMD_PER_LUN,        \
139         .present =                      0,                      \
140         .unchecked_isa_dma =            0,                      \
141         .use_clustering =               ENABLE_CLUSTERING,      \
142         .use_new_eh_code =              1,                      \
143         .eh_abort_handler =             megaraid_abort,         \
144         .eh_device_reset_handler =      megaraid_reset,         \
145         .eh_bus_reset_handler =         megaraid_reset,         \
146         .eh_host_reset_handler =        megaraid_reset,         \
147         .highmem_io =                   1                       \
148 }
149
150
151
152 typedef struct {
153         /* 0x0 */ u8 cmd;
154         /* 0x1 */ u8 cmdid;
155         /* 0x2 */ u16 numsectors;
156         /* 0x4 */ u32 lba;
157         /* 0x8 */ u32 xferaddr;
158         /* 0xC */ u8 logdrv;
159         /* 0xD */ u8 numsgelements;
160         /* 0xE */ u8 resvd;
161         /* 0xF */ volatile u8 busy;
162         /* 0x10 */ volatile u8 numstatus;
163         /* 0x11 */ volatile u8 status;
164         /* 0x12 */ volatile u8 completed[MAX_FIRMWARE_STATUS];
165         volatile u8 poll;
166         volatile u8 ack;
167 } __attribute__ ((packed)) mbox_t;
168
169 typedef struct {
170         u32 xfer_segment_lo;
171         u32 xfer_segment_hi;
172         mbox_t mbox;
173 } __attribute__ ((packed)) mbox64_t;
174
175
176 /*
177  * Passthru definitions
178  */
179 #define MAX_REQ_SENSE_LEN       0x20
180
181 typedef struct {
182         u8 timeout:3;           /* 0=6sec/1=60sec/2=10min/3=3hrs */
183         u8 ars:1;
184         u8 reserved:3;
185         u8 islogical:1;
186         u8 logdrv;              /* if islogical == 1 */
187         u8 channel;             /* if islogical == 0 */
188         u8 target;              /* if islogical == 0 */
189         u8 queuetag;            /* unused */
190         u8 queueaction;         /* unused */
191         u8 cdb[MAX_CDB_LEN];
192         u8 cdblen;
193         u8 reqsenselen;
194         u8 reqsensearea[MAX_REQ_SENSE_LEN];
195         u8 numsgelements;
196         u8 scsistatus;
197         u32 dataxferaddr;
198         u32 dataxferlen;
199 } __attribute__ ((packed)) mega_passthru;
200
201
202 /*
203  * Extended passthru: support CDB > 10 bytes
204  */
205 typedef struct {
206         u8 timeout:3;           /* 0=6sec/1=60sec/2=10min/3=3hrs */
207         u8 ars:1;
208         u8 rsvd1:1;
209         u8 cd_rom:1;
210         u8 rsvd2:1;
211         u8 islogical:1;
212         u8 logdrv;              /* if islogical == 1 */
213         u8 channel;             /* if islogical == 0 */
214         u8 target;              /* if islogical == 0 */
215         u8 queuetag;            /* unused */
216         u8 queueaction;         /* unused */
217         u8 cdblen;
218         u8 rsvd3;
219         u8 cdb[MAX_EXT_CDB_LEN];
220         u8 numsgelements;
221         u8 status;
222         u8 reqsenselen;
223         u8 reqsensearea[MAX_REQ_SENSE_LEN];
224         u8 rsvd4;
225         u32 dataxferaddr;
226         u32 dataxferlen;
227 } __attribute__ ((packed)) mega_ext_passthru;
228
229 typedef struct {
230         u64 address;
231         u32 length;
232 } __attribute__ ((packed)) mega_sgl64;
233
234 typedef struct {
235         u32 address;
236         u32 length;
237 } __attribute__ ((packed)) mega_sglist;
238
239
240 /* Queued command data */
241 typedef struct {
242         int     idx;
243         u32     state;
244         struct list_head        list;
245         u8      raw_mbox[66];
246         u32     dma_type;
247         u32     dma_direction;
248
249         Scsi_Cmnd       *cmd;
250         dma_addr_t      dma_h_bulkdata;
251         dma_addr_t      dma_h_sgdata;
252
253         mega_sglist     *sgl;
254         mega_sgl64      *sgl64;
255         dma_addr_t      sgl_dma_addr;
256
257         mega_passthru           *pthru;
258         dma_addr_t              pthru_dma_addr;
259         mega_ext_passthru       *epthru;
260         dma_addr_t              epthru_dma_addr;
261 } scb_t;
262
263 /*
264  * Flags to follow the scb as it transitions between various stages
265  */
266 #define SCB_FREE        0x0000  /* on the free list */
267 #define SCB_ACTIVE      0x0001  /* off the free list */
268 #define SCB_PENDQ       0x0002  /* on the pending queue */
269 #define SCB_ISSUED      0x0004  /* issued - owner f/w */
270 #define SCB_ABORT       0x0008  /* Got an abort for this one */
271 #define SCB_RESET       0x0010  /* Got a reset for this one */
272
273 /*
274  * Utilities declare this strcture size as 1024 bytes. So more fields can
275  * be added in future.
276  */
277 typedef struct {
278         u32     data_size; /* current size in bytes (not including resvd) */
279
280         u32     config_signature;
281                 /* Current value is 0x00282008
282                  * 0x28=MAX_LOGICAL_DRIVES,
283                  * 0x20=Number of stripes and
284                  * 0x08=Number of spans */
285
286         u8      fw_version[16];         /* printable ASCI string */
287         u8      bios_version[16];       /* printable ASCI string */
288         u8      product_name[80];       /* printable ASCI string */
289
290         u8      max_commands;           /* Max. concurrent commands supported */
291         u8      nchannels;              /* Number of SCSI Channels detected */
292         u8      fc_loop_present;        /* Number of Fibre Loops detected */
293         u8      mem_type;               /* EDO, FPM, SDRAM etc */
294
295         u32     signature;
296         u16     dram_size;              /* In terms of MB */
297         u16     subsysid;
298
299         u16     subsysvid;
300         u8      notify_counters;
301         u8      pad1k[889];             /* 135 + 889 resvd = 1024 total size */
302 } __attribute__ ((packed)) mega_product_info;
303
304 struct notify {
305         u32 global_counter;     /* Any change increments this counter */
306
307         u8 param_counter;       /* Indicates any params changed  */
308         u8 param_id;            /* Param modified - defined below */
309         u16 param_val;          /* New val of last param modified */
310
311         u8 write_config_counter;        /* write config occurred */
312         u8 write_config_rsvd[3];
313
314         u8 ldrv_op_counter;     /* Indicates ldrv op started/completed */
315         u8 ldrv_opid;           /* ldrv num */
316         u8 ldrv_opcmd;          /* ldrv operation - defined below */
317         u8 ldrv_opstatus;       /* status of the operation */
318
319         u8 ldrv_state_counter;  /* Indicates change of ldrv state */
320         u8 ldrv_state_id;               /* ldrv num */
321         u8 ldrv_state_new;      /* New state */
322         u8 ldrv_state_old;      /* old state */
323
324         u8 pdrv_state_counter;  /* Indicates change of ldrv state */
325         u8 pdrv_state_id;               /* pdrv id */
326         u8 pdrv_state_new;      /* New state */
327         u8 pdrv_state_old;      /* old state */
328
329         u8 pdrv_fmt_counter;    /* Indicates pdrv format started/over */
330         u8 pdrv_fmt_id;         /* pdrv id */
331         u8 pdrv_fmt_val;                /* format started/over */
332         u8 pdrv_fmt_rsvd;
333
334         u8 targ_xfer_counter;   /* Indicates SCSI-2 Xfer rate change */
335         u8 targ_xfer_id;        /* pdrv Id  */
336         u8 targ_xfer_val;               /* new Xfer params of last pdrv */
337         u8 targ_xfer_rsvd;
338
339         u8 fcloop_id_chg_counter;       /* Indicates loopid changed */
340         u8 fcloopid_pdrvid;             /* pdrv id */
341         u8 fcloop_id0;                  /* loopid on fc loop 0 */
342         u8 fcloop_id1;                  /* loopid on fc loop 1 */
343
344         u8 fcloop_state_counter;        /* Indicates loop state changed */
345         u8 fcloop_state0;               /* state of fc loop 0 */
346         u8 fcloop_state1;               /* state of fc loop 1 */
347         u8 fcloop_state_rsvd;
348 } __attribute__ ((packed));
349
350 #define MAX_NOTIFY_SIZE     0x80
351 #define CUR_NOTIFY_SIZE     sizeof(struct notify)
352
353 typedef struct {
354         u32     data_size; /* current size in bytes (not including resvd) */
355
356         struct notify notify;
357
358         u8      notify_rsvd[MAX_NOTIFY_SIZE - CUR_NOTIFY_SIZE];
359
360         u8      rebuild_rate;           /* Rebuild rate (0% - 100%) */
361         u8      cache_flush_interval;   /* In terms of Seconds */
362         u8      sense_alert;
363         u8      drive_insert_count;     /* drive insertion count */
364
365         u8      battery_status;
366         u8      num_ldrv;               /* No. of Log Drives configured */
367         u8      recon_state[MAX_LOGICAL_DRIVES_40LD / 8];       /* State of
368                                                            reconstruct */
369         u16     ldrv_op_status[MAX_LOGICAL_DRIVES_40LD / 8]; /* logdrv
370                                                                  Status */
371
372         u32     ldrv_size[MAX_LOGICAL_DRIVES_40LD];/* Size of each log drv */
373         u8      ldrv_prop[MAX_LOGICAL_DRIVES_40LD];
374         u8      ldrv_state[MAX_LOGICAL_DRIVES_40LD];/* State of log drives */
375         u8      pdrv_state[FC_MAX_PHYSICAL_DEVICES];/* State of phys drvs. */
376         u16     pdrv_format[FC_MAX_PHYSICAL_DEVICES / 16];
377
378         u8      targ_xfer[80];  /* phys device transfer rate */
379         u8      pad1k[263];     /* 761 + 263reserved = 1024 bytes total size */
380 } __attribute__ ((packed)) mega_inquiry3;
381
382
383 /* Structures */
384 typedef struct {
385         u8      max_commands;   /* Max concurrent commands supported */
386         u8      rebuild_rate;   /* Rebuild rate - 0% thru 100% */
387         u8      max_targ_per_chan;      /* Max targ per channel */
388         u8      nchannels;      /* Number of channels on HBA */
389         u8      fw_version[4];  /* Firmware version */
390         u16     age_of_flash;   /* Number of times FW has been flashed */
391         u8      chip_set_value; /* Contents of 0xC0000832 */
392         u8      dram_size;      /* In MB */
393         u8      cache_flush_interval;   /* in seconds */
394         u8      bios_version[4];
395         u8      board_type;
396         u8      sense_alert;
397         u8      write_config_count;     /* Increase with every configuration
398                                            change */
399         u8      drive_inserted_count;   /* Increase with every drive inserted
400                                          */
401         u8      inserted_drive; /* Channel:Id of inserted drive */
402         u8      battery_status; /*
403                                  * BIT 0: battery module missing
404                                  * BIT 1: VBAD
405                                  * BIT 2: temprature high
406                                  * BIT 3: battery pack missing
407                                  * BIT 4,5:
408                                  *   00 - charge complete
409                                  *   01 - fast charge in progress
410                                  *   10 - fast charge fail
411                                  *   11 - undefined
412                                  * Bit 6: counter > 1000
413                                  * Bit 7: Undefined
414                                  */
415         u8      dec_fault_bus_info;
416 } __attribute__ ((packed)) mega_adp_info;
417
418
419 typedef struct {
420         u8      num_ldrv;       /* Number of logical drives configured */
421         u8      rsvd[3];
422         u32     ldrv_size[MAX_LOGICAL_DRIVES_8LD];
423         u8      ldrv_prop[MAX_LOGICAL_DRIVES_8LD];
424         u8      ldrv_state[MAX_LOGICAL_DRIVES_8LD];
425 } __attribute__ ((packed)) mega_ldrv_info;
426
427 typedef struct {
428         u8      pdrv_state[MAX_PHYSICAL_DRIVES];
429         u8      rsvd;
430 } __attribute__ ((packed)) mega_pdrv_info;
431
432 /* RAID inquiry: Mailbox command 0x05*/
433 typedef struct {
434         mega_adp_info   adapter_info;
435         mega_ldrv_info  logdrv_info;
436         mega_pdrv_info  pdrv_info;
437 } __attribute__ ((packed)) mraid_inquiry;
438
439
440 /* RAID extended inquiry: Mailbox command 0x04*/
441 typedef struct {
442         mraid_inquiry   raid_inq;
443         u16     phys_drv_format[MAX_CHANNELS];
444         u8      stack_attn;
445         u8      modem_status;
446         u8      rsvd[2];
447 } __attribute__ ((packed)) mraid_ext_inquiry;
448
449
450 typedef struct {
451         u8      channel;
452         u8      target;
453 }__attribute__ ((packed)) adp_device;
454
455 typedef struct {
456         u32             start_blk;      /* starting block */
457         u32             num_blks;       /* # of blocks */
458         adp_device      device[MAX_ROW_SIZE_40LD];
459 }__attribute__ ((packed)) adp_span_40ld;
460
461 typedef struct {
462         u32             start_blk;      /* starting block */
463         u32             num_blks;       /* # of blocks */
464         adp_device      device[MAX_ROW_SIZE_8LD];
465 }__attribute__ ((packed)) adp_span_8ld;
466
467 typedef struct {
468         u8      span_depth;     /* Total # of spans */
469         u8      level;          /* RAID level */
470         u8      read_ahead;     /* read ahead, no read ahead, adaptive read
471                                    ahead */
472         u8      stripe_sz;      /* Encoded stripe size */
473         u8      status;         /* Status of the logical drive */
474         u8      write_mode;     /* write mode, write_through/write_back */
475         u8      direct_io;      /* direct io or through cache */
476         u8      row_size;       /* Number of stripes in a row */
477 } __attribute__ ((packed)) logdrv_param;
478
479 typedef struct {
480         logdrv_param    lparam;
481         adp_span_40ld   span[MAX_SPAN_DEPTH];
482 }__attribute__ ((packed)) logdrv_40ld;
483
484 typedef struct {
485         logdrv_param    lparam;
486         adp_span_8ld    span[MAX_SPAN_DEPTH];
487 }__attribute__ ((packed)) logdrv_8ld;
488
489 typedef struct {
490         u8      type;           /* Type of the device */
491         u8      cur_status;     /* current status of the device */
492         u8      tag_depth;      /* Level of tagging */
493         u8      sync_neg;       /* sync negotiation - ENABLE or DISBALE */
494         u32     size;           /* configurable size in terms of 512 byte
495                                    blocks */
496 }__attribute__ ((packed)) phys_drv;
497
498 typedef struct {
499         u8              nlog_drives;            /* number of logical drives */
500         u8              resvd[3];
501         logdrv_40ld     ldrv[MAX_LOGICAL_DRIVES_40LD];
502         phys_drv        pdrv[MAX_PHYSICAL_DRIVES];
503 }__attribute__ ((packed)) disk_array_40ld;
504
505 typedef struct {
506         u8              nlog_drives;    /* number of logical drives */
507         u8              resvd[3];
508         logdrv_8ld      ldrv[MAX_LOGICAL_DRIVES_8LD];
509         phys_drv        pdrv[MAX_PHYSICAL_DRIVES];
510 }__attribute__ ((packed)) disk_array_8ld;
511
512 /*
513  *    FW Definitions & Data Structures for 8LD 4-Span and 8-Span Controllers
514  */
515 #define MAX_STRIPES     8
516 #define SPAN4_DEPTH     4
517 #define SPAN8_DEPTH     8
518 #define MAX_PHYDRVS     5 * 16  /* 5 Channels * 16 Targets */
519
520 typedef struct  {
521         unsigned char   channel;
522         unsigned char   target;
523 }__attribute__ ((packed)) device_t;
524
525 typedef struct {
526         unsigned long   start_blk;
527         unsigned long   total_blks;
528         device_t        device[ MAX_STRIPES ];
529 }__attribute__ ((packed)) span_t;
530
531 typedef struct {
532         unsigned char   type;
533         unsigned char   curr_status;
534         unsigned char   tag_depth;
535         unsigned char   resvd1;
536         unsigned long   size;
537 }__attribute__ ((packed)) phydrv_t;
538
539 typedef struct {
540         unsigned char   span_depth;
541         unsigned char   raid;
542         unsigned char   read_ahead;     /* 0=No rdahead,1=RDAHEAD,2=adaptive */
543         unsigned char   stripe_sz;
544         unsigned char   status;
545         unsigned char   write_policy;   /* 0=wrthru,1=wrbak */
546         unsigned char   direct_io;      /* 1=directio,0=cached */
547         unsigned char   no_stripes;
548         span_t          span[ SPAN4_DEPTH ];
549 }__attribute__ ((packed)) ld_span4_t;
550
551 typedef struct {
552         unsigned char   span_depth;
553         unsigned char   raid;
554         unsigned char   read_ahead;     /* 0=No rdahead,1=RDAHEAD,2=adaptive */
555         unsigned char   stripe_sz;
556         unsigned char   status;
557         unsigned char   write_policy;   /* 0=wrthru,1=wrbak */
558         unsigned char   direct_io;      /* 1=directio,0=cached */
559         unsigned char   no_stripes;
560         span_t          span[ SPAN8_DEPTH ];
561 }__attribute__ ((packed)) ld_span8_t;
562
563 typedef struct {
564         unsigned char   no_log_drives;
565         unsigned char   pad[3];
566         ld_span4_t      log_drv[ MAX_LOGICAL_DRIVES_8LD ];
567         phydrv_t        phys_drv[ MAX_PHYDRVS ];
568 }__attribute__ ((packed)) diskarray_span4_t;
569
570 typedef struct {
571         unsigned char   no_log_drives;
572         unsigned char   pad[3];
573         ld_span8_t      log_drv[ MAX_LOGICAL_DRIVES_8LD ];
574         phydrv_t        phys_drv[ MAX_PHYDRVS ];
575 }__attribute__ ((packed)) diskarray_span8_t;
576
577 /*
578  * User ioctl structure.
579  * This structure will be used for Traditional Method ioctl interface
580  * commands (0x80),Alternate Buffer Method (0x81) ioctl commands and the
581  * Driver ioctls.
582  * The Driver ioctl interface handles the commands at the driver level,
583  * without being sent to the card.
584  */
585 /* system call imposed limit. Change accordingly */
586 #define IOCTL_MAX_DATALEN       4096
587
588 struct uioctl_t {
589         u32 inlen;
590         u32 outlen;
591         union {
592                 u8 fca[16];
593                 struct {
594                         u8 opcode;
595                         u8 subopcode;
596                         u16 adapno;
597 #if BITS_PER_LONG == 32
598                         u8 *buffer;
599                         u8 pad[4];
600 #endif
601 #if BITS_PER_LONG == 64
602                         u8 *buffer;
603 #endif
604                         u32 length;
605                 } __attribute__ ((packed)) fcs;
606         } __attribute__ ((packed)) ui;
607         u8 mbox[18];            /* 16 bytes + 2 status bytes */
608         mega_passthru pthru;
609 #if BITS_PER_LONG == 32
610         char *data;             /* buffer <= 4096 for 0x80 commands */
611         char pad[4];
612 #endif
613 #if BITS_PER_LONG == 64
614         char *data;
615 #endif
616 } __attribute__ ((packed));
617
618 /*
619  * struct mcontroller is used to pass information about the controllers in the
620  * system. Its upto the application how to use the information. We are passing
621  * as much info about the cards as possible and useful. Before issuing the
622  * call to find information about the cards, the applicaiton needs to issue a
623  * ioctl first to find out the number of controllers in the system.
624  */
625 #define MAX_CONTROLLERS 32
626
627 struct mcontroller {
628         u64 base;
629         u8 irq;
630         u8 numldrv;
631         u8 pcibus;
632         u16 pcidev;
633         u8 pcifun;
634         u16 pciid;
635         u16 pcivendor;
636         u8 pcislot;
637         u32 uid;
638 };
639
640 /*
641  * mailbox structure used for internal commands
642  */
643 typedef struct {
644         u8      cmd;
645         u8      cmdid;
646         u8      opcode;
647         u8      subopcode;
648         u32     lba;
649         u32     xferaddr;
650         u8      logdrv;
651         u8      rsvd[3];
652         u8      numstatus;
653         u8      status;
654 } __attribute__ ((packed)) megacmd_t;
655
656 /*
657  * Defines for Driver IOCTL interface
658  */
659 #define MEGAIOC_MAGIC   'm'
660
661 /* Mega IOCTL command */
662 #define MEGAIOCCMD      _IOWR(MEGAIOC_MAGIC, 0, struct uioctl_t)
663
664 #define MEGAIOC_QNADAP          'm'     /* Query # of adapters */
665 #define MEGAIOC_QDRVRVER        'e'     /* Query driver version */
666 #define MEGAIOC_QADAPINFO       'g'     /* Query adapter information */
667 #define MKADAP(adapno)          (MEGAIOC_MAGIC << 8 | (adapno) )
668 #define GETADAP(mkadap)         ( (mkadap) ^ MEGAIOC_MAGIC << 8 )
669
670 /*
671  * Definition for the new ioctl interface (NIT)
672  */
673
674 /*
675  * Vendor specific Group-7 commands
676  */
677 #define VENDOR_SPECIFIC_COMMANDS        0xE0
678 #define MEGA_INTERNAL_CMD               VENDOR_SPECIFIC_COMMANDS + 0x01
679
680 /*
681  * The ioctl command. No other command shall be used for this interface
682  */
683 #define USCSICMD        VENDOR_SPECIFIC_COMMANDS
684
685 /*
686  * Data direction flags
687  */
688 #define UIOC_RD         0x00001
689 #define UIOC_WR         0x00002
690
691 /*
692  * ioctl opcodes
693  */
694 #define MBOX_CMD        0x00000 /* DCMD or passthru command */
695 #define GET_DRIVER_VER  0x10000 /* Get driver version */
696 #define GET_N_ADAP      0x20000 /* Get number of adapters */
697 #define GET_ADAP_INFO   0x30000 /* Get information about a adapter */
698 #define GET_CAP         0x40000 /* Get ioctl capabilities */
699 #define GET_STATS       0x50000 /* Get statistics, including error info */
700
701
702 /*
703  * The ioctl structure.
704  * MBOX macro converts a nitioctl_t structure to megacmd_t pointer and
705  * MBOX_P macro converts a nitioctl_t pointer to megacmd_t pointer.
706  */
707 typedef struct {
708         char            signature[8];   /* Must contain "MEGANIT" */
709         u32             opcode;         /* opcode for the command */
710         u32             adapno;         /* adapter number */
711         mbox_t          u_mbox;         /* user mailbox */
712         caddr_t         u_dataaddr;     /* xferaddr for DCMD and non-mbox
713                                            commands */
714         mega_passthru   pthru;
715
716 #define RMBOX(uioc)     ((u8 *)&(uioc).u_mbox)
717 #define MBOX(uioc)      ((megacmd_t *)&(uioc).u_mbox)
718 #define MBOX_P(uioc)    ((megacmd_t *)&(uioc)->u_mbox)
719
720
721         u32             xferlen;        /* xferlen for DCMD and non-mbox
722                                            commands */
723         u32             flags;          /* data direction flags */
724 }nitioctl_t;
725
726
727 /*
728  * I/O statistics for some applications like SNMP agent. The caller must
729  * provide the number of logical drives for which status should be reported.
730  */
731 typedef struct {
732         int     num_ldrv;       /* Number for logical drives for which the
733                                    status should be reported. */
734         u32     nreads[MAX_LOGICAL_DRIVES_40LD];        /* number of reads for
735                                                         each logical drive */
736         u32     nreadblocks[MAX_LOGICAL_DRIVES_40LD];   /* number of blocks
737                                                         read for each logical
738                                                         drive */
739         u32     nwrites[MAX_LOGICAL_DRIVES_40LD];       /* number of writes
740                                                         for each logical
741                                                         drive */
742         u32     nwriteblocks[MAX_LOGICAL_DRIVES_40LD];  /* number of blocks
743                                                         writes for each
744                                                         logical drive */
745         u32     rd_errors[MAX_LOGICAL_DRIVES_40LD];     /* number of read
746                                                            errors for each
747                                                            logical drive */
748         u32     wr_errors[MAX_LOGICAL_DRIVES_40LD];     /* number of write
749                                                            errors for each
750                                                            logical drive */
751 }megastat_t;
752
753
754 struct private_bios_data {
755         u8      geometry:4;     /*
756                                  * bits 0-3 - BIOS geometry
757                                  * 0x0001 - 1GB
758                                  * 0x0010 - 2GB
759                                  * 0x1000 - 8GB
760                                  * Others values are invalid
761                                                          */
762         u8      unused:4;       /* bits 4-7 are unused */
763         u8      boot_drv;       /*
764                                  * logical drive set as boot drive
765                                  * 0..7 - for 8LD cards
766                                  * 0..39 - for 40LD cards
767                                  */
768         u8      rsvd[12];
769         u16     cksum;  /* 0-(sum of first 13 bytes of this structure) */
770 } __attribute__ ((packed));
771
772
773
774
775 /*
776  * Mailbox and firmware commands and subopcodes used in this driver.
777  */
778
779 #define MEGA_MBOXCMD_LREAD      0x01
780 #define MEGA_MBOXCMD_LWRITE     0x02
781 #define MEGA_MBOXCMD_PASSTHRU   0x03
782 #define MEGA_MBOXCMD_ADPEXTINQ  0x04
783 #define MEGA_MBOXCMD_ADAPTERINQ 0x05
784 #define MEGA_MBOXCMD_LREAD64    0xA7
785 #define MEGA_MBOXCMD_LWRITE64   0xA8
786 #define MEGA_MBOXCMD_PASSTHRU64 0xC3
787 #define MEGA_MBOXCMD_EXTPTHRU   0xE3
788
789 #define MAIN_MISC_OPCODE        0xA4    /* f/w misc opcode */
790 #define GET_MAX_SG_SUPPORT      0x01    /* get max sg len supported by f/w */
791
792 #define FC_NEW_CONFIG           0xA1
793 #define NC_SUBOP_PRODUCT_INFO   0x0E
794 #define NC_SUBOP_ENQUIRY3       0x0F
795 #define ENQ3_GET_SOLICITED_FULL 0x02
796 #define OP_DCMD_READ_CONFIG     0x04
797 #define NEW_READ_CONFIG_8LD     0x67
798 #define READ_CONFIG_8LD         0x07
799 #define FLUSH_ADAPTER           0x0A
800 #define FLUSH_SYSTEM            0xFE
801
802 /*
803  * Command for random deletion of logical drives
804  */
805 #define FC_DEL_LOGDRV           0xA4    /* f/w command */
806 #define OP_SUP_DEL_LOGDRV       0x2A    /* is feature supported */
807 #define OP_GET_LDID_MAP         0x18    /* get ldid and logdrv number map */
808 #define OP_DEL_LOGDRV           0x1C    /* delete logical drive */
809
810 /*
811  * BIOS commands
812  */
813 #define IS_BIOS_ENABLED         0x62
814 #define GET_BIOS                0x01
815 #define CHNL_CLASS              0xA9
816 #define GET_CHNL_CLASS          0x00
817 #define SET_CHNL_CLASS          0x01
818 #define CH_RAID                 0x01
819 #define CH_SCSI                 0x00
820 #define BIOS_PVT_DATA           0x40
821 #define GET_BIOS_PVT_DATA       0x00
822
823
824 /*
825  * Commands to support clustering
826  */
827 #define MEGA_GET_TARGET_ID      0x7D
828 #define MEGA_CLUSTER_OP         0x70
829 #define MEGA_GET_CLUSTER_MODE   0x02
830 #define MEGA_CLUSTER_CMD        0x6E
831 #define MEGA_RESERVE_LD         0x01
832 #define MEGA_RELEASE_LD         0x02
833 #define MEGA_RESET_RESERVATIONS 0x03
834 #define MEGA_RESERVATION_STATUS 0x04
835 #define MEGA_RESERVE_PD         0x05
836 #define MEGA_RELEASE_PD         0x06
837
838
839 /*
840  * Module battery status
841  */
842 #define MEGA_BATT_MODULE_MISSING        0x01
843 #define MEGA_BATT_LOW_VOLTAGE           0x02
844 #define MEGA_BATT_TEMP_HIGH             0x04
845 #define MEGA_BATT_PACK_MISSING          0x08
846 #define MEGA_BATT_CHARGE_MASK           0x30
847 #define MEGA_BATT_CHARGE_DONE           0x00
848 #define MEGA_BATT_CHARGE_INPROG         0x10
849 #define MEGA_BATT_CHARGE_FAIL           0x20
850 #define MEGA_BATT_CYCLES_EXCEEDED       0x40
851
852 /*
853  * Physical drive states.
854  */
855 #define PDRV_UNCNF      0
856 #define PDRV_ONLINE     3
857 #define PDRV_FAILED     4
858 #define PDRV_RBLD       5
859 #define PDRV_HOTSPARE   6
860
861
862 /*
863  * Raid logical drive states.
864  */
865 #define RDRV_OFFLINE    0
866 #define RDRV_DEGRADED   1
867 #define RDRV_OPTIMAL    2
868 #define RDRV_DELETED    3
869
870 /*
871  * Read, write and cache policies
872  */
873 #define NO_READ_AHEAD           0
874 #define READ_AHEAD              1
875 #define ADAP_READ_AHEAD         2
876 #define WRMODE_WRITE_THRU       0
877 #define WRMODE_WRITE_BACK       1
878 #define CACHED_IO               0
879 #define DIRECT_IO               1
880
881
882 /*
883  * Each controller's soft state
884  */
885 typedef struct {
886         int     this_id;        /* our id, may set to different than 7 if
887                                    clustering is available */
888         u32     flag;
889
890         unsigned long   base;
891
892         /* mbox64 with mbox not aligned on 16-byte boundry */
893         mbox64_t        *una_mbox64;
894         dma_addr_t      una_mbox64_dma;
895
896         volatile mbox64_t       *mbox64;/* ptr to 64-bit mailbox */
897         volatile mbox_t         *mbox;  /* ptr to standard mailbox */
898         dma_addr_t              mbox_dma;
899         struct pci_dev          *dev;
900
901         struct list_head        free_list;
902         struct list_head        pending_list;
903
904         struct Scsi_Host        *host;
905
906 #define MEGA_BUFFER_SIZE (2*1024)
907         u8              *mega_buffer;
908         dma_addr_t      buf_dma_handle;
909
910         mega_product_info       product_info;
911
912         u8              max_cmds;
913         scb_t           *scb_list;
914
915         atomic_t        pend_cmds;      /* maintain a counter for
916                                         pending commands in firmware */
917
918 #if MEGA_HAVE_STATS
919         u32     nreads[MAX_LOGICAL_DRIVES_40LD];
920         u32     nreadblocks[MAX_LOGICAL_DRIVES_40LD];
921         u32     nwrites[MAX_LOGICAL_DRIVES_40LD];
922         u32     nwriteblocks[MAX_LOGICAL_DRIVES_40LD];
923         u32     rd_errors[MAX_LOGICAL_DRIVES_40LD];
924         u32     wr_errors[MAX_LOGICAL_DRIVES_40LD];
925 #endif
926
927         /* Host adapter parameters */
928         u8      numldrv;
929         u8      fw_version[7];
930         u8      bios_version[7];
931
932 #ifdef CONFIG_PROC_FS
933         struct proc_dir_entry   *controller_proc_dir_entry;
934         struct proc_dir_entry   *proc_read;
935         struct proc_dir_entry   *proc_stat;
936         struct proc_dir_entry   *proc_mbox;
937
938 #if MEGA_HAVE_ENH_PROC
939         struct proc_dir_entry   *proc_rr;
940         struct proc_dir_entry   *proc_battery;
941 #define MAX_PROC_CHANNELS       4
942         struct proc_dir_entry   *proc_pdrvstat[MAX_PROC_CHANNELS];
943         struct proc_dir_entry   *proc_rdrvstat[MAX_PROC_CHANNELS];
944 #endif
945
946 #endif
947
948         int     has_64bit_addr;         /* are we using 64-bit addressing */
949         int     support_ext_cdb;
950         int     boot_ldrv_enabled;
951         int     boot_ldrv;
952         int     boot_pdrv_enabled;      /* boot from physical drive */
953         int     boot_pdrv_ch;           /* boot physical drive channel */
954         int     boot_pdrv_tgt;          /* boot physical drive target */
955
956
957         int     support_random_del;     /* Do we support random deletion of
958                                            logdrvs */
959         int     read_ldidmap;   /* set after logical drive deltion. The
960                                    logical drive number must be read from the
961                                    map */
962         atomic_t        quiescent;      /* a stage reached when delete logical
963                                            drive needs to be done. Stop
964                                            sending requests to the hba till
965                                            delete operation is completed */
966         spinlock_t      lock;
967         spinlock_t      *host_lock;     // pointer to appropriate lock
968
969         u8      logdrv_chan[MAX_CHANNELS+NVIRT_CHAN]; /* logical drive are on
970                                                         what channels. */
971         int     mega_ch_class;
972
973         u8      sglen;  /* f/w supported scatter-gather list length */
974
975         scb_t                   int_scb;
976         Scsi_Cmnd               int_scmd;
977         struct semaphore        int_mtx;        /* To synchronize the internal
978                                                 commands */
979         wait_queue_head_t       int_waitq;      /* wait queue for internal
980                                                  cmds */
981
982         int     has_cluster;    /* cluster support on this HBA */
983
984 #define INT_MEMBLK_SZ           (28*1024)
985         mega_passthru           *int_pthru;             /*internal pthru*/
986         dma_addr_t              int_pthru_dma_hndl;
987         caddr_t                 int_data;               /*internal data*/
988         dma_addr_t              int_data_dma_hndl;
989
990         int                     hw_error;
991
992 }adapter_t;
993
994
995 struct mega_hbas {
996         int is_bios_enabled;
997         adapter_t *hostdata_addr;
998 };
999
1000
1001 /*
1002  * For state flag. Do not use LSB(8 bits) which are
1003  * reserved for storing info about channels.
1004  */
1005 #define IN_ABORT        0x80000000L
1006 #define IN_RESET        0x40000000L
1007 #define BOARD_MEMMAP    0x20000000L
1008 #define BOARD_IOMAP     0x10000000L
1009 #define BOARD_40LD      0x08000000L
1010 #define BOARD_64BIT     0x04000000L
1011
1012 #define INTR_VALID                      0x40
1013
1014 #define PCI_CONF_AMISIG                 0xa0
1015 #define PCI_CONF_AMISIG64               0xa4
1016
1017
1018 #define MEGA_DMA_TYPE_NONE              0xFFFF
1019 #define MEGA_BULK_DATA                  0x0001
1020 #define MEGA_SGLIST                     0x0002
1021
1022 /*
1023  * lockscope definitions, callers can specify the lock scope with this data
1024  * type. LOCK_INT would mean the caller has not acquired the lock before
1025  * making the call and LOCK_EXT would mean otherwise.
1026  */
1027 typedef enum { LOCK_INT, LOCK_EXT } lockscope_t;
1028
1029 /*
1030  * Parameters for the io-mapped controllers
1031  */
1032
1033 /* I/O Port offsets */
1034 #define CMD_PORT                0x00
1035 #define ACK_PORT                0x00
1036 #define TOGGLE_PORT             0x01
1037 #define INTR_PORT               0x0a
1038
1039 #define MBOX_BUSY_PORT          0x00
1040 #define MBOX_PORT0              0x04
1041 #define MBOX_PORT1              0x05
1042 #define MBOX_PORT2              0x06
1043 #define MBOX_PORT3              0x07
1044 #define ENABLE_MBOX_REGION      0x0B
1045
1046 /* I/O Port Values */
1047 #define ISSUE_BYTE              0x10
1048 #define ACK_BYTE                0x08
1049 #define ENABLE_INTR_BYTE        0xc0
1050 #define DISABLE_INTR_BYTE       0x00
1051 #define VALID_INTR_BYTE         0x40
1052 #define MBOX_BUSY_BYTE          0x10
1053 #define ENABLE_MBOX_BYTE        0x00
1054
1055
1056 /* Setup some port macros here */
1057 #define issue_command(adapter)  \
1058                 outb_p(ISSUE_BYTE, (adapter)->base + CMD_PORT)
1059
1060 #define irq_state(adapter)      inb_p((adapter)->base + INTR_PORT)
1061
1062 #define set_irq_state(adapter, value)   \
1063                 outb_p((value), (adapter)->base + INTR_PORT)
1064
1065 #define irq_ack(adapter)        \
1066                 outb_p(ACK_BYTE, (adapter)->base + ACK_PORT)
1067
1068 #define irq_enable(adapter)     \
1069         outb_p(ENABLE_INTR_BYTE, (adapter)->base + TOGGLE_PORT)
1070
1071 #define irq_disable(adapter)    \
1072         outb_p(DISABLE_INTR_BYTE, (adapter)->base + TOGGLE_PORT)
1073
1074
1075 /*
1076  * This is our SYSDEP area. All kernel specific detail should be placed here -
1077  * as much as possible
1078  */
1079
1080 /*
1081  * End of SYSDEP area
1082  */
1083
1084 /*
1085  * ASSERT macro for megaraid. This should panic but printk should do for now
1086  */
1087 #ifdef DEBUG
1088 #define ASSERT( expression )                                            \
1089         if( !(expression) ) {                                           \
1090                 panic("assertion failed: %s, file: %s, line: %d\n",     \
1091                                 #expression, __FILE__, __LINE__);       \
1092         }
1093 #else
1094 #define ASSERT(expression)
1095 #endif
1096
1097 #define MBOX_ABORT_SLEEP        60
1098 #define MBOX_RESET_SLEEP        30
1099 #define MBOX_RESET_WAIT         180
1100
1101 const char *megaraid_info (struct Scsi_Host *);
1102
1103 static int megaraid_detect(Scsi_Host_Template *);
1104 static void mega_find_card(Scsi_Host_Template *, u16, u16);
1105 static int mega_query_adapter(adapter_t *);
1106 static inline int issue_scb(adapter_t *, scb_t *);
1107 static int mega_setup_mailbox(adapter_t *);
1108
1109 static int megaraid_queue (Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
1110 static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *);
1111 static inline scb_t *mega_allocate_scb(adapter_t *, Scsi_Cmnd *);
1112 static void __mega_runpendq(adapter_t *);
1113 static inline void mega_runpendq(adapter_t *);
1114 static int issue_scb_block(adapter_t *, u_char *);
1115
1116 static void megaraid_isr_memmapped(int, void *, struct pt_regs *);
1117 static inline void megaraid_memmbox_ack_sequence(adapter_t *);
1118 static void megaraid_isr_iomapped(int, void *, struct pt_regs *);
1119 static inline void megaraid_iombox_ack_sequence(adapter_t *);
1120
1121 static void mega_free_scb(adapter_t *, scb_t *);
1122
1123 static int megaraid_release (struct Scsi_Host *);
1124 static int megaraid_command (Scsi_Cmnd *);
1125 static int megaraid_abort(Scsi_Cmnd *);
1126 static int megaraid_reset(Scsi_Cmnd *);
1127
1128 static int mega_build_sglist (adapter_t *adapter, scb_t *scb,
1129                               u32 *buffer, u32 *length);
1130 static inline int mega_busywait_mbox (adapter_t *);
1131 static int __mega_busywait_mbox (adapter_t *);
1132 static inline void mega_cmd_done(adapter_t *, u8 [], int, int);
1133 static inline void mega_free_sgl (adapter_t *adapter);
1134 static void mega_8_to_40ld (mraid_inquiry *inquiry,
1135                 mega_inquiry3 *enquiry3, mega_product_info *);
1136
1137 static int megaraid_reboot_notify (struct notifier_block *,
1138                                    unsigned long, void *);
1139 static int megadev_open (struct inode *, struct file *);
1140
1141 #if defined( __x86_64__) || defined(IA32_EMULATION)
1142 #ifndef __ia64__
1143 #define LSI_CONFIG_COMPAT
1144 #endif
1145 #endif
1146
1147
1148 #ifdef LSI_CONFIG_COMPAT
1149 static int megadev_compat_ioctl(unsigned int, unsigned int, unsigned long,
1150         struct file *);
1151 #endif
1152
1153 static int megadev_ioctl_entry (struct inode *, struct file *, unsigned int,
1154                 unsigned long);
1155 static int megadev_ioctl (struct inode *, struct file *, unsigned int,
1156                 unsigned long);
1157 static int mega_m_to_n(void *, nitioctl_t *);
1158 static int mega_n_to_m(void *, megacmd_t *);
1159 static int megadev_close (struct inode *, struct file *);
1160
1161 static int mega_init_scb (adapter_t *);
1162
1163 static int mega_is_bios_enabled (adapter_t *);
1164 static void mega_reorder_hosts (void);
1165 static void mega_swap_hosts (struct Scsi_Host *, struct Scsi_Host *);
1166
1167 #ifdef CONFIG_PROC_FS
1168 static void mega_create_proc_entry(int, struct proc_dir_entry *);
1169 static int proc_read_config(char *, char **, off_t, int, int *, void *);
1170 static int proc_read_stat(char *, char **, off_t, int, int *, void *);
1171 static int proc_read_mbox(char *, char **, off_t, int, int *, void *);
1172 static int proc_rebuild_rate(char *, char **, off_t, int, int *, void *);
1173 static int proc_battery(char *, char **, off_t, int, int *, void *);
1174 static int proc_pdrv_ch0(char *, char **, off_t, int, int *, void *);
1175 static int proc_pdrv_ch1(char *, char **, off_t, int, int *, void *);
1176 static int proc_pdrv_ch2(char *, char **, off_t, int, int *, void *);
1177 static int proc_pdrv_ch3(char *, char **, off_t, int, int *, void *);
1178 static int proc_pdrv(adapter_t *, char *, int);
1179 static int proc_rdrv_10(char *, char **, off_t, int, int *, void *);
1180 static int proc_rdrv_20(char *, char **, off_t, int, int *, void *);
1181 static int proc_rdrv_30(char *, char **, off_t, int, int *, void *);
1182 static int proc_rdrv_40(char *, char **, off_t, int, int *, void *);
1183 static int proc_rdrv(adapter_t *, char *, int, int);
1184
1185 static int mega_adapinq(adapter_t *, dma_addr_t);
1186 static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t);
1187 static inline caddr_t mega_allocate_inquiry(dma_addr_t *, struct pci_dev *);
1188 static inline void mega_free_inquiry(caddr_t, dma_addr_t, struct pci_dev *);
1189 static int mega_print_inquiry(char *, char *);
1190 #endif
1191
1192 static int mega_support_ext_cdb(adapter_t *);
1193 static mega_passthru* mega_prepare_passthru(adapter_t *, scb_t *,
1194                 Scsi_Cmnd *, int, int);
1195 static mega_ext_passthru* mega_prepare_extpassthru(adapter_t *,
1196                 scb_t *, Scsi_Cmnd *, int, int);
1197 static void mega_enum_raid_scsi(adapter_t *);
1198 static void mega_get_boot_drv(adapter_t *);
1199 static inline int mega_get_ldrv_num(adapter_t *, Scsi_Cmnd *, int);
1200 static int mega_support_random_del(adapter_t *);
1201 static int mega_del_logdrv(adapter_t *, int);
1202 static int mega_do_del_logdrv(adapter_t *, int);
1203 static void mega_get_max_sgl(adapter_t *);
1204 static int mega_internal_command(adapter_t *, lockscope_t, megacmd_t *,
1205                 mega_passthru *);
1206 static void mega_internal_done(Scsi_Cmnd *);
1207 static int mega_support_cluster(adapter_t *);
1208 #endif
1209
1210 /* vi: set ts=8 sw=8 tw=78: */