ia64/xen-unstable

view xen/drivers/scsi/aacraid/aacraid.h @ 677:3946af49a538

bitkeeper revision 1.392 (3f3244ecABjhViAc-zlxaKkbsstr4Q)

Many files:
Upgraded our aacraid driver to latest Linux-ac version (Linux 2.4.21-ac4 with aacraid v1.1.2).
author kaf24@scramble.cl.cam.ac.uk
date Thu Aug 07 12:24:12 2003 +0000 (2003-08-07)
parents 9888f92572ba
children db2e1ea917df 7a554cbf0f58
line source
1 //#define dprintk(x) printk x
2 #if (!defined(dprintk))
3 # define dprintk(x)
4 #endif
6 /* Start of Xen additions XXX */
7 #include <asm/byteorder.h>
8 #include <xeno/interrupt.h>
9 #define TRY_TASKLET
10 /* End of Xen additions XXX */
12 /*------------------------------------------------------------------------------
13 * D E F I N E S
14 *----------------------------------------------------------------------------*/
16 #define MAXIMUM_NUM_CONTAINERS 31
17 #define MAXIMUM_NUM_ADAPTERS 8
19 #define AAC_NUM_FIB 578
20 //#define AAC_NUM_IO_FIB 512
21 #define AAC_NUM_IO_FIB 100
23 #define AAC_MAX_TARGET (MAXIMUM_NUM_CONTAINERS+1)
24 //#define AAC_MAX_TARGET (16)
25 #define AAC_MAX_LUN (8)
27 /*
28 * These macros convert from physical channels to virtual channels
29 */
30 #define CONTAINER_CHANNEL (0)
31 #define aac_phys_to_logical(x) (x+1)
32 #define aac_logical_to_phys(x) (x?x-1:0)
34 #define AAC_DETAILED_STATUS_INFO
36 struct diskparm
37 {
38 int heads;
39 int sectors;
40 int cylinders;
41 };
44 /*
45 * DON'T CHANGE THE ORDER, this is set by the firmware
46 */
48 #define CT_NONE 0
49 #define CT_VOLUME 1
50 #define CT_MIRROR 2
51 #define CT_STRIPE 3
52 #define CT_RAID5 4
53 #define CT_SSRW 5
54 #define CT_SSRO 6
55 #define CT_MORPH 7
56 #define CT_PASSTHRU 8
57 #define CT_RAID4 9
58 #define CT_RAID10 10 /* stripe of mirror */
59 #define CT_RAID00 11 /* stripe of stripe */
60 #define CT_VOLUME_OF_MIRRORS 12 /* volume of mirror */
61 #define CT_PSEUDO_RAID 13 /* really raid4 */
62 #define CT_LAST_VOLUME_TYPE 14
64 /*
65 * Types of objects addressable in some fashion by the client.
66 * This is a superset of those objects handled just by the filesystem
67 * and includes "raw" objects that an administrator would use to
68 * configure containers and filesystems.
69 */
71 #define FT_REG 1 /* regular file */
72 #define FT_DIR 2 /* directory */
73 #define FT_BLK 3 /* "block" device - reserved */
74 #define FT_CHR 4 /* "character special" device - reserved */
75 #define FT_LNK 5 /* symbolic link */
76 #define FT_SOCK 6 /* socket */
77 #define FT_FIFO 7 /* fifo */
78 #define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */
79 #define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/target/lun */
80 #define FT_SLICE 10 /* virtual disk - raw volume - slice */
81 #define FT_PARTITION 11 /* FSA partition - carved out of a slice - building block for containers */
82 #define FT_VOLUME 12 /* Container - Volume Set */
83 #define FT_STRIPE 13 /* Container - Stripe Set */
84 #define FT_MIRROR 14 /* Container - Mirror Set */
85 #define FT_RAID5 15 /* Container - Raid 5 Set */
86 #define FT_DATABASE 16 /* Storage object with "foreign" content manager */
88 /*
89 * Host side memory scatter gather list
90 * Used by the adapter for read, write, and readdirplus operations
91 * We have seperate 32 and 64 bit version because even
92 * on 64 bit systems not all cards support the 64 bit version
93 */
94 struct sgentry {
95 u32 addr; /* 32-bit address. */
96 u32 count; /* Length. */
97 };
99 struct sgentry64 {
100 u32 addr[2]; /* 64-bit addr. 2 pieces for data alignment */
101 u32 count; /* Length. */
102 };
104 /*
105 * SGMAP
106 *
107 * This is the SGMAP structure for all commands that use
108 * 32-bit addressing.
109 */
111 struct sgmap {
112 u32 count;
113 struct sgentry sg[1];
114 };
116 struct sgmap64 {
117 u32 count;
118 struct sgentry64 sg[1];
119 };
121 struct creation_info
122 {
123 u8 buildnum; /* e.g., 588 */
124 u8 usec; /* e.g., 588 */
125 u8 via; /* e.g., 1 = FSU,
126 * 2 = API
127 */
128 u8 year; /* e.g., 1997 = 97 */
129 u32 date; /*
130 * unsigned Month :4; // 1 - 12
131 * unsigned Day :6; // 1 - 32
132 * unsigned Hour :6; // 0 - 23
133 * unsigned Minute :6; // 0 - 60
134 * unsigned Second :6; // 0 - 60
135 */
136 u32 serial[2]; /* e.g., 0x1DEADB0BFAFAF001 */
137 };
140 /*
141 * Define all the constants needed for the communication interface
142 */
144 /*
145 * Define how many queue entries each queue will have and the total
146 * number of entries for the entire communication interface. Also define
147 * how many queues we support.
148 *
149 * This has to match the controller
150 */
152 #define NUMBER_OF_COMM_QUEUES 8 // 4 command; 4 response
153 #define HOST_HIGH_CMD_ENTRIES 4
154 #define HOST_NORM_CMD_ENTRIES 8
155 #define ADAP_HIGH_CMD_ENTRIES 4
156 #define ADAP_NORM_CMD_ENTRIES 512
157 #define HOST_HIGH_RESP_ENTRIES 4
158 #define HOST_NORM_RESP_ENTRIES 512
159 #define ADAP_HIGH_RESP_ENTRIES 4
160 #define ADAP_NORM_RESP_ENTRIES 8
162 #define TOTAL_QUEUE_ENTRIES \
163 (HOST_NORM_CMD_ENTRIES + HOST_HIGH_CMD_ENTRIES + ADAP_NORM_CMD_ENTRIES + ADAP_HIGH_CMD_ENTRIES + \
164 HOST_NORM_RESP_ENTRIES + HOST_HIGH_RESP_ENTRIES + ADAP_NORM_RESP_ENTRIES + ADAP_HIGH_RESP_ENTRIES)
167 /*
168 * Set the queues on a 16 byte alignment
169 */
171 #define QUEUE_ALIGNMENT 16
173 /*
174 * The queue headers define the Communication Region queues. These
175 * are physically contiguous and accessible by both the adapter and the
176 * host. Even though all queue headers are in the same contiguous block
177 * they will be represented as individual units in the data structures.
178 */
180 struct aac_entry {
181 u32 size; /* Size in bytes of Fib which this QE points to */
182 u32 addr; /* Receiver address of the FIB */
183 };
185 /*
186 * The adapter assumes the ProducerIndex and ConsumerIndex are grouped
187 * adjacently and in that order.
188 */
190 struct aac_qhdr {
191 u64 header_addr; /* Address to hand the adapter to access to this queue head */
192 u32 *producer; /* The producer index for this queue (host address) */
193 u32 *consumer; /* The consumer index for this queue (host address) */
194 };
196 /*
197 * Define all the events which the adapter would like to notify
198 * the host of.
199 */
201 #define HostNormCmdQue 1 /* Change in host normal priority command queue */
202 #define HostHighCmdQue 2 /* Change in host high priority command queue */
203 #define HostNormRespQue 3 /* Change in host normal priority response queue */
204 #define HostHighRespQue 4 /* Change in host high priority response queue */
205 #define AdapNormRespNotFull 5
206 #define AdapHighRespNotFull 6
207 #define AdapNormCmdNotFull 7
208 #define AdapHighCmdNotFull 8
209 #define SynchCommandComplete 9
210 #define AdapInternalError 0xfe /* The adapter detected an internal error shutting down */
212 /*
213 * Define all the events the host wishes to notify the
214 * adapter of. The first four values much match the Qid the
215 * corresponding queue.
216 */
218 #define AdapNormCmdQue 2
219 #define AdapHighCmdQue 3
220 #define AdapNormRespQue 6
221 #define AdapHighRespQue 7
222 #define HostShutdown 8
223 #define HostPowerFail 9
224 #define FatalCommError 10
225 #define HostNormRespNotFull 11
226 #define HostHighRespNotFull 12
227 #define HostNormCmdNotFull 13
228 #define HostHighCmdNotFull 14
229 #define FastIo 15
230 #define AdapPrintfDone 16
232 /*
233 * Define all the queues that the adapter and host use to communicate
234 * Number them to match the physical queue layout.
235 */
237 enum aac_queue_types {
238 HostNormCmdQueue = 0, /* Adapter to host normal priority command traffic */
239 HostHighCmdQueue, /* Adapter to host high priority command traffic */
240 AdapNormCmdQueue, /* Host to adapter normal priority command traffic */
241 AdapHighCmdQueue, /* Host to adapter high priority command traffic */
242 HostNormRespQueue, /* Adapter to host normal priority response traffic */
243 HostHighRespQueue, /* Adapter to host high priority response traffic */
244 AdapNormRespQueue, /* Host to adapter normal priority response traffic */
245 AdapHighRespQueue /* Host to adapter high priority response traffic */
246 };
248 /*
249 * Assign type values to the FSA communication data structures
250 */
252 #define FIB_MAGIC 0x0001
254 /*
255 * Define the priority levels the FSA communication routines support.
256 */
258 #define FsaNormal 1
259 #define FsaHigh 2
261 /*
262 * Define the FIB. The FIB is the where all the requested data and
263 * command information are put to the application on the FSA adapter.
264 */
266 struct aac_fibhdr {
267 u32 XferState; // Current transfer state for this CCB
268 u16 Command; // Routing information for the destination
269 u8 StructType; // Type FIB
270 u8 Flags; // Flags for FIB
271 u16 Size; // Size of this FIB in bytes
272 u16 SenderSize; // Size of the FIB in the sender (for response sizing)
273 u32 SenderFibAddress; // Host defined data in the FIB
274 u32 ReceiverFibAddress; // Logical address of this FIB for the adapter
275 u32 SenderData; // Place holder for the sender to store data
276 union {
277 struct {
278 u32 _ReceiverTimeStart; // Timestamp for receipt of fib
279 u32 _ReceiverTimeDone; // Timestamp for completion of fib
280 } _s;
281 // struct aac_list_head _FibLinks; // Used to link Adapter Initiated Fibs on the host
282 } _u;
283 };
285 //#define FibLinks _u._FibLinks
287 #define FIB_DATA_SIZE_IN_BYTES (512 - sizeof(struct aac_fibhdr))
290 struct hw_fib {
291 struct aac_fibhdr header;
292 u8 data[FIB_DATA_SIZE_IN_BYTES]; // Command specific data
293 };
295 /*
296 * FIB commands
297 */
299 #define TestCommandResponse 1
300 #define TestAdapterCommand 2
301 /*
302 * Lowlevel and comm commands
303 */
304 #define LastTestCommand 100
305 #define ReinitHostNormCommandQueue 101
306 #define ReinitHostHighCommandQueue 102
307 #define ReinitHostHighRespQueue 103
308 #define ReinitHostNormRespQueue 104
309 #define ReinitAdapNormCommandQueue 105
310 #define ReinitAdapHighCommandQueue 107
311 #define ReinitAdapHighRespQueue 108
312 #define ReinitAdapNormRespQueue 109
313 #define InterfaceShutdown 110
314 #define DmaCommandFib 120
315 #define StartProfile 121
316 #define TermProfile 122
317 #define SpeedTest 123
318 #define TakeABreakPt 124
319 #define RequestPerfData 125
320 #define SetInterruptDefTimer 126
321 #define SetInterruptDefCount 127
322 #define GetInterruptDefStatus 128
323 #define LastCommCommand 129
324 /*
325 * Filesystem commands
326 */
327 #define NuFileSystem 300
328 #define UFS 301
329 #define HostFileSystem 302
330 #define LastFileSystemCommand 303
331 /*
332 * Container Commands
333 */
334 #define ContainerCommand 500
335 #define ContainerCommand64 501
336 /*
337 * Cluster Commands
338 */
339 #define ClusterCommand 550
340 /*
341 * Scsi Port commands (scsi passthrough)
342 */
343 #define ScsiPortCommand 600
344 #define ScsiPortCommand64 601
345 /*
346 * Misc house keeping and generic adapter initiated commands
347 */
348 #define AifRequest 700
349 #define CheckRevision 701
350 #define FsaHostShutdown 702
351 #define RequestAdapterInfo 703
352 #define IsAdapterPaused 704
353 #define SendHostTime 705
354 #define LastMiscCommand 706
356 //
357 // Commands that will target the failover level on the FSA adapter
358 //
360 enum fib_xfer_state {
361 HostOwned = (1<<0),
362 AdapterOwned = (1<<1),
363 FibInitialized = (1<<2),
364 FibEmpty = (1<<3),
365 AllocatedFromPool = (1<<4),
366 SentFromHost = (1<<5),
367 SentFromAdapter = (1<<6),
368 ResponseExpected = (1<<7),
369 NoResponseExpected = (1<<8),
370 AdapterProcessed = (1<<9),
371 HostProcessed = (1<<10),
372 HighPriority = (1<<11),
373 NormalPriority = (1<<12),
374 Async = (1<<13),
375 AsyncIo = (1<<13), // rpbfix: remove with new regime
376 PageFileIo = (1<<14), // rpbfix: remove with new regime
377 ShutdownRequest = (1<<15),
378 LazyWrite = (1<<16), // rpbfix: remove with new regime
379 AdapterMicroFib = (1<<17),
380 BIOSFibPath = (1<<18),
381 FastResponseCapable = (1<<19),
382 ApiFib = (1<<20) // Its an API Fib.
383 };
385 /*
386 * The following defines needs to be updated any time there is an
387 * incompatible change made to the aac_init structure.
388 */
390 #define ADAPTER_INIT_STRUCT_REVISION 3
392 struct aac_init
393 {
394 u32 InitStructRevision;
395 u32 MiniPortRevision;
396 u32 fsrev;
397 u32 CommHeaderAddress;
398 u32 FastIoCommAreaAddress;
399 u32 AdapterFibsPhysicalAddress;
400 u32 AdapterFibsVirtualAddress;
401 u32 AdapterFibsSize;
402 u32 AdapterFibAlign;
403 u32 printfbuf;
404 u32 printfbufsiz;
405 u32 HostPhysMemPages; // number of 4k pages of host physical memory
406 u32 HostElapsedSeconds; // number of seconds since 1970.
407 };
409 enum aac_log_level {
410 LOG_INIT = 10,
411 LOG_INFORMATIONAL = 20,
412 LOG_WARNING = 30,
413 LOG_LOW_ERROR = 40,
414 LOG_MEDIUM_ERROR = 50,
415 LOG_HIGH_ERROR = 60,
416 LOG_PANIC = 70,
417 LOG_DEBUG = 80,
418 LOG_WINDBG_PRINT = 90
419 };
421 #define FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT 0x030b
422 #define FSAFS_NTC_FIB_CONTEXT 0x030c
424 struct aac_dev;
426 struct adapter_ops
427 {
428 void (*adapter_interrupt)(struct aac_dev *dev);
429 void (*adapter_notify)(struct aac_dev *dev, u32 event);
430 void (*adapter_enable_int)(struct aac_dev *dev, u32 event);
431 void (*adapter_disable_int)(struct aac_dev *dev, u32 event);
432 int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 *status);
433 };
435 /*
436 * Define which interrupt handler needs to be installed
437 */
439 struct aac_driver_ident
440 {
441 u16 vendor;
442 u16 device;
443 u16 subsystem_vendor;
444 u16 subsystem_device;
445 int (*init)(struct aac_dev *dev, unsigned long num);
446 char * name;
447 char * vname;
448 char * model;
449 u16 channels;
450 int quirks;
451 #define AAC_QUIRK_31BIT 1
452 };
454 /*
455 * The adapter interface specs all queues to be located in the same
456 * physically contigous block. The host structure that defines the
457 * commuication queues will assume they are each a seperate physically
458 * contigous memory region that will support them all being one big
459 * contigous block.
460 * There is a command and response queue for each level and direction of
461 * commuication. These regions are accessed by both the host and adapter.
462 */
464 struct aac_queue {
465 u64 logical; /* This is the address we give the adapter */
466 struct aac_entry *base; /* This is the system virtual address */
467 struct aac_qhdr headers; /* A pointer to the producer and consumer queue headers for this queue */
468 u32 entries; /* Number of queue entries on this queue */
469 #if 0
470 wait_queue_head_t qfull; /* Event to wait on if the queue is full */
471 wait_queue_head_t cmdready; /* Indicates there is a Command ready from the adapter on this queue. */
472 #endif /* This is only valid for adapter to host command queues. */
473 spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */
474 spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */
475 unsigned long SavedIrql; /* Previous IRQL when the spin lock is taken */
476 u32 padding; /* Padding - FIXME - can remove I believe */
477 struct list_head cmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */
478 /* only valid for command queues which receive entries from the adapter. */
479 struct list_head pendingq; /* A queue of outstanding fib's to the adapter. */
480 unsigned long numpending; /* Number of entries on outstanding queue. */
481 struct aac_dev * dev; /* Back pointer to adapter structure */
482 };
484 /*
485 * Message queues. The order here is important, see also the
486 * queue type ordering
487 */
489 struct aac_queue_block
490 {
491 struct aac_queue queue[8];
492 };
494 /*
495 * SaP1 Message Unit Registers
496 */
498 struct sa_drawbridge_CSR {
499 // Offset | Name
500 u32 reserved[10]; // 00h-27h | Reserved
501 u8 LUT_Offset; // 28h | Looup Table Offset
502 u8 reserved1[3]; // 29h-2bh | Reserved
503 u32 LUT_Data; // 2ch | Looup Table Data
504 u32 reserved2[26]; // 30h-97h | Reserved
505 u16 PRICLEARIRQ; // 98h | Primary Clear Irq
506 u16 SECCLEARIRQ; // 9ah | Secondary Clear Irq
507 u16 PRISETIRQ; // 9ch | Primary Set Irq
508 u16 SECSETIRQ; // 9eh | Secondary Set Irq
509 u16 PRICLEARIRQMASK; // a0h | Primary Clear Irq Mask
510 u16 SECCLEARIRQMASK; // a2h | Secondary Clear Irq Mask
511 u16 PRISETIRQMASK; // a4h | Primary Set Irq Mask
512 u16 SECSETIRQMASK; // a6h | Secondary Set Irq Mask
513 u32 MAILBOX0; // a8h | Scratchpad 0
514 u32 MAILBOX1; // ach | Scratchpad 1
515 u32 MAILBOX2; // b0h | Scratchpad 2
516 u32 MAILBOX3; // b4h | Scratchpad 3
517 u32 MAILBOX4; // b8h | Scratchpad 4
518 u32 MAILBOX5; // bch | Scratchpad 5
519 u32 MAILBOX6; // c0h | Scratchpad 6
520 u32 MAILBOX7; // c4h | Scratchpad 7
522 u32 ROM_Setup_Data; // c8h | Rom Setup and Data
523 u32 ROM_Control_Addr; // cch | Rom Control and Address
525 u32 reserved3[12]; // d0h-ffh | reserved
526 u32 LUT[64]; // 100h-1ffh| Lookup Table Entries
528 //
529 // TO DO
530 // need to add DMA, I2O, UART, etc registers form 80h to 364h
531 //
533 };
535 #define Mailbox0 SaDbCSR.MAILBOX0
536 #define Mailbox1 SaDbCSR.MAILBOX1
537 #define Mailbox2 SaDbCSR.MAILBOX2
538 #define Mailbox3 SaDbCSR.MAILBOX3
539 #define Mailbox4 SaDbCSR.MAILBOX4
540 #define Mailbox5 SaDbCSR.MAILBOX5
541 #define Mailbox7 SaDbCSR.MAILBOX7
543 #define DoorbellReg_p SaDbCSR.PRISETIRQ
544 #define DoorbellReg_s SaDbCSR.SECSETIRQ
545 #define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ
548 #define DOORBELL_0 cpu_to_le16(0x0001)
549 #define DOORBELL_1 cpu_to_le16(0x0002)
550 #define DOORBELL_2 cpu_to_le16(0x0004)
551 #define DOORBELL_3 cpu_to_le16(0x0008)
552 #define DOORBELL_4 cpu_to_le16(0x0010)
553 #define DOORBELL_5 cpu_to_le16(0x0020)
554 #define DOORBELL_6 cpu_to_le16(0x0040)
557 #define PrintfReady DOORBELL_5
558 #define PrintfDone DOORBELL_5
560 struct sa_registers {
561 struct sa_drawbridge_CSR SaDbCSR; /* 98h - c4h */
562 };
565 #define Sa_MINIPORT_REVISION 1
567 #define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR))
568 #define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR))
569 #define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR))
570 #define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR))
572 /*
573 * Rx Message Unit Registers
574 */
576 struct rx_mu_registers {
577 // Local | PCI* | Name
578 // | |
579 u32 ARSR; // 1300h | 00h | APIC Register Select Register
580 u32 reserved0; // 1304h | 04h | Reserved
581 u32 AWR; // 1308h | 08h | APIC Window Register
582 u32 reserved1; // 130Ch | 0Ch | Reserved
583 u32 IMRx[2]; // 1310h | 10h | Inbound Message Registers
584 u32 OMRx[2]; // 1318h | 18h | Outbound Message Registers
585 u32 IDR; // 1320h | 20h | Inbound Doorbell Register
586 u32 IISR; // 1324h | 24h | Inbound Interrupt Status Register
587 u32 IIMR; // 1328h | 28h | Inbound Interrupt Mask Register
588 u32 ODR; // 132Ch | 2Ch | Outbound Doorbell Register
589 u32 OISR; // 1330h | 30h | Outbound Interrupt Status Register
590 u32 OIMR; // 1334h | 34h | Outbound Interrupt Mask Register
591 // * Must access through ATU Inbound Translation Window
592 };
594 struct rx_inbound {
595 u32 Mailbox[8];
596 };
598 #define InboundMailbox0 IndexRegs.Mailbox[0]
599 #define InboundMailbox1 IndexRegs.Mailbox[1]
600 #define InboundMailbox2 IndexRegs.Mailbox[2]
601 #define InboundMailbox3 IndexRegs.Mailbox[3]
602 #define InboundMailbox4 IndexRegs.Mailbox[4]
604 #define INBOUNDDOORBELL_0 cpu_to_le32(0x00000001)
605 #define INBOUNDDOORBELL_1 cpu_to_le32(0x00000002)
606 #define INBOUNDDOORBELL_2 cpu_to_le32(0x00000004)
607 #define INBOUNDDOORBELL_3 cpu_to_le32(0x00000008)
608 #define INBOUNDDOORBELL_4 cpu_to_le32(0x00000010)
609 #define INBOUNDDOORBELL_5 cpu_to_le32(0x00000020)
610 #define INBOUNDDOORBELL_6 cpu_to_le32(0x00000040)
612 #define OUTBOUNDDOORBELL_0 cpu_to_le32(0x00000001)
613 #define OUTBOUNDDOORBELL_1 cpu_to_le32(0x00000002)
614 #define OUTBOUNDDOORBELL_2 cpu_to_le32(0x00000004)
615 #define OUTBOUNDDOORBELL_3 cpu_to_le32(0x00000008)
616 #define OUTBOUNDDOORBELL_4 cpu_to_le32(0x00000010)
618 #define InboundDoorbellReg MUnit.IDR
619 #define OutboundDoorbellReg MUnit.ODR
621 struct rx_registers {
622 struct rx_mu_registers MUnit; // 1300h - 1334h
623 u32 reserved1[6]; // 1338h - 134ch
624 struct rx_inbound IndexRegs;
625 };
627 #define rx_readb(AEP, CSR) readb(&((AEP)->regs.rx->CSR))
628 #define rx_readl(AEP, CSR) readl(&((AEP)->regs.rx->CSR))
629 #define rx_writeb(AEP, CSR, value) writeb(value, &((AEP)->regs.rx->CSR))
630 #define rx_writel(AEP, CSR, value) writel(value, &((AEP)->regs.rx->CSR))
632 struct fib;
634 typedef void (*fib_callback)(void *ctxt, struct fib *fibctx);
636 struct aac_fib_context {
637 s16 type; // used for verification of structure
638 s16 size;
639 ulong jiffies; // used for cleanup - dmb changed to ulong
640 struct list_head next; // used to link context's into a linked list
641 #if 0
642 struct semaphore wait_sem; // this is used to wait for the next fib to arrive.
643 #endif
644 int wait; // Set to true when thread is in WaitForSingleObject
645 unsigned long count; // total number of FIBs on FibList
646 struct list_head fib_list; // this holds fibs which should be 32 bit addresses
647 };
649 struct fsa_scsi_hba {
650 u32 size[MAXIMUM_NUM_CONTAINERS];
651 u32 type[MAXIMUM_NUM_CONTAINERS];
652 u8 valid[MAXIMUM_NUM_CONTAINERS];
653 u8 ro[MAXIMUM_NUM_CONTAINERS];
654 u8 locked[MAXIMUM_NUM_CONTAINERS];
655 u8 deleted[MAXIMUM_NUM_CONTAINERS];
656 s32 devno[MAXIMUM_NUM_CONTAINERS];
657 };
659 struct fib {
660 void *next; /* this is used by the allocator */
661 s16 type;
662 s16 size;
663 /*
664 * The Adapter that this I/O is destined for.
665 */
666 struct aac_dev *dev;
667 #if 0
668 /*
669 * This is the event the sendfib routine will wait on if the
670 * caller did not pass one and this is synch io.
671 */
672 struct semaphore event_wait;
673 #endif
674 spinlock_t event_lock;
676 u32 done; /* gets set to 1 when fib is complete */
677 fib_callback callback;
678 void *callback_data;
679 u32 flags; // u32 dmb was ulong
680 /*
681 * The following is used to put this fib context onto the
682 * Outstanding I/O queue.
683 */
684 struct list_head queue;
685 /*
686 * And for the internal issue/reply queues (we may be able
687 * to merge these two)
688 */
689 struct list_head fiblink;
690 void *data;
691 struct hw_fib *hw_fib; /* Actual shared object */
692 dma_addr_t hw_fib_pa; /* physical address of hw_fib*/
693 };
695 /*
696 * Adapter Information Block
697 *
698 * This is returned by the RequestAdapterInfo block
699 */
701 struct aac_adapter_info
702 {
703 u32 platform;
704 u32 cpu;
705 u32 subcpu;
706 u32 clock;
707 u32 execmem;
708 u32 buffermem;
709 u32 totalmem;
710 u32 kernelrev;
711 u32 kernelbuild;
712 u32 monitorrev;
713 u32 monitorbuild;
714 u32 hwrev;
715 u32 hwbuild;
716 u32 biosrev;
717 u32 biosbuild;
718 u32 cluster;
719 u32 clusterchannelmask;
720 u32 serial[2];
721 u32 battery;
722 u32 options;
723 u32 OEM;
724 };
726 /*
727 * Battery platforms
728 */
729 #define AAC_BAT_REQ_PRESENT (1)
730 #define AAC_BAT_REQ_NOTPRESENT (2)
731 #define AAC_BAT_OPT_PRESENT (3)
732 #define AAC_BAT_OPT_NOTPRESENT (4)
733 #define AAC_BAT_NOT_SUPPORTED (5)
734 /*
735 * cpu types
736 */
737 #define AAC_CPU_SIMULATOR (1)
738 #define AAC_CPU_I960 (2)
739 #define AAC_CPU_STRONGARM (3)
741 /*
742 * Supported Options
743 */
744 #define AAC_OPT_SNAPSHOT cpu_to_le32(1)
745 #define AAC_OPT_CLUSTERS cpu_to_le32(1<<1)
746 #define AAC_OPT_WRITE_CACHE cpu_to_le32(1<<2)
747 #define AAC_OPT_64BIT_DATA cpu_to_le32(1<<3)
748 #define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4)
749 #define AAC_OPT_RAID50 cpu_to_le32(1<<5)
750 #define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6)
751 #define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7)
752 #define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8)
753 #define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9)
754 #define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10)
755 #define AAC_OPT_ALARM cpu_to_le32(1<<11)
756 #define AAC_OPT_NONDASD cpu_to_le32(1<<12)
757 #define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13)
758 #define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14)
759 #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<15)
761 struct aac_dev
762 {
763 struct aac_dev *next;
764 const char *name;
765 int id;
767 u16 irq_mask;
768 /*
769 * Map for 128 fib objects (64k)
770 */
771 dma_addr_t hw_fib_pa;
772 struct hw_fib *hw_fib_va;
773 ulong fib_base_va;
774 /*
775 * Fib Headers
776 */
777 struct fib *fibs;
779 struct fib *free_fib;
780 struct fib *timeout_fib;
781 spinlock_t fib_lock;
783 struct aac_queue_block *queues;
784 /*
785 * The user API will use an IOCTL to register itself to receive
786 * FIBs from the adapter. The following list is used to keep
787 * track of all the threads that have requested these FIBs. The
788 * mutex is used to synchronize access to all data associated
789 * with the adapter fibs.
790 */
791 struct list_head fib_list;
793 struct adapter_ops a_ops;
794 unsigned long fsrev; /* Main driver's revision number */
796 struct aac_init *init; /* Holds initialization info to communicate with adapter */
797 dma_addr_t init_pa; /* Holds physical address of the init struct */
799 struct pci_dev *pdev; /* Our PCI interface */
800 void * printfbuf; /* pointer to buffer used for printf's from the adapter */
801 void * comm_addr; /* Base address of Comm area */
802 dma_addr_t comm_phys; /* Physical Address of Comm area */
803 size_t comm_size;
805 struct Scsi_Host *scsi_host_ptr;
806 struct fsa_scsi_hba fsa_dev;
807 #if 0
808 pid_t thread_pid;
809 #endif
810 int cardtype;
812 /*
813 * The following is the device specific extension.
814 */
815 union
816 {
817 struct sa_registers *sa;
818 struct rx_registers *rx;
819 } regs;
820 /*
821 * The following is the number of the individual adapter
822 */
823 u32 devnum;
824 u32 aif_thread;
825 #if 0
826 struct completion aif_completion;
827 #endif
828 struct aac_adapter_info adapter_info;
829 /* These are in adapter info but they are in the io flow so
830 * lets break them out so we don't have to do an AND to check them
831 */
832 u8 nondasd_support;
833 u8 pae_support;
834 u8 raid_scsi_mode;
835 };
837 #define AllocateAndMapFibSpace(dev, MapFibContext) \
838 dev->a_ops.AllocateAndMapFibSpace(dev, MapFibContext)
840 #define UnmapAndFreeFibSpace(dev, MapFibContext) \
841 dev->a_ops.UnmapAndFreeFibSpace(dev, MapFibContext)
843 #define aac_adapter_interrupt(dev) \
844 dev->a_ops.adapter_interrupt(dev)
846 #define aac_adapter_notify(dev, event) \
847 dev->a_ops.adapter_notify(dev, event)
849 #define aac_adapter_enable_int(dev, event) \
850 dev->a_ops.adapter_enable_int(dev, event)
852 #define aac_adapter_disable_int(dev, event) \
853 dev->a_ops.adapter_disable_int(dev, event)
857 #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001)
859 /*
860 * Define the command values
861 */
863 #define Null 0
864 #define GetAttributes 1
865 #define SetAttributes 2
866 #define Lookup 3
867 #define ReadLink 4
868 #define Read 5
869 #define Write 6
870 #define Create 7
871 #define MakeDirectory 8
872 #define SymbolicLink 9
873 #define MakeNode 10
874 #define Removex 11
875 #define RemoveDirectoryx 12
876 #define Rename 13
877 #define Link 14
878 #define ReadDirectory 15
879 #define ReadDirectoryPlus 16
880 #define FileSystemStatus 17
881 #define FileSystemInfo 18
882 #define PathConfigure 19
883 #define Commit 20
884 #define Mount 21
885 #define UnMount 22
886 #define Newfs 23
887 #define FsCheck 24
888 #define FsSync 25
889 #define SimReadWrite 26
890 #define SetFileSystemStatus 27
891 #define BlockRead 28
892 #define BlockWrite 29
893 #define NvramIoctl 30
894 #define FsSyncWait 31
895 #define ClearArchiveBit 32
896 #define SetAcl 33
897 #define GetAcl 34
898 #define AssignAcl 35
899 #define FaultInsertion 36 /* Fault Insertion Command */
900 #define CrazyCache 37 /* Crazycache */
902 #define MAX_FSACOMMAND_NUM 38
905 /*
906 * Define the status returns. These are very unixlike although
907 * most are not in fact used
908 */
910 #define ST_OK 0
911 #define ST_PERM 1
912 #define ST_NOENT 2
913 #define ST_IO 5
914 #define ST_NXIO 6
915 #define ST_E2BIG 7
916 #define ST_ACCES 13
917 #define ST_EXIST 17
918 #define ST_XDEV 18
919 #define ST_NODEV 19
920 #define ST_NOTDIR 20
921 #define ST_ISDIR 21
922 #define ST_INVAL 22
923 #define ST_FBIG 27
924 #define ST_NOSPC 28
925 #define ST_ROFS 30
926 #define ST_MLINK 31
927 #define ST_WOULDBLOCK 35
928 #define ST_NAMETOOLONG 63
929 #define ST_NOTEMPTY 66
930 #define ST_DQUOT 69
931 #define ST_STALE 70
932 #define ST_REMOTE 71
933 #define ST_BADHANDLE 10001
934 #define ST_NOT_SYNC 10002
935 #define ST_BAD_COOKIE 10003
936 #define ST_NOTSUPP 10004
937 #define ST_TOOSMALL 10005
938 #define ST_SERVERFAULT 10006
939 #define ST_BADTYPE 10007
940 #define ST_JUKEBOX 10008
941 #define ST_NOTMOUNTED 10009
942 #define ST_MAINTMODE 10010
943 #define ST_STALEACL 10011
945 /*
946 * On writes how does the client want the data written.
947 */
949 #define CACHE_CSTABLE 1
950 #define CACHE_UNSTABLE 2
952 /*
953 * Lets the client know at which level the data was commited on
954 * a write request
955 */
957 #define CMFILE_SYNCH_NVRAM 1
958 #define CMDATA_SYNCH_NVRAM 2
959 #define CMFILE_SYNCH 3
960 #define CMDATA_SYNCH 4
961 #define CMUNSTABLE 5
963 struct aac_read
964 {
965 u32 command;
966 u32 cid;
967 u32 block;
968 u32 count;
969 struct sgmap sg; // Must be last in struct because it is variable
970 };
972 struct aac_read64
973 {
974 u32 command;
975 u16 cid;
976 u16 sector_count;
977 u32 block;
978 u16 pad;
979 u16 flags;
980 struct sgmap64 sg; // Must be last in struct because it is variable
981 };
983 struct aac_read_reply
984 {
985 u32 status;
986 u32 count;
987 };
989 struct aac_write
990 {
991 u32 command;
992 u32 cid;
993 u32 block;
994 u32 count;
995 u32 stable; // Not used
996 struct sgmap sg; // Must be last in struct because it is variable
997 };
999 struct aac_write64
1001 u32 command;
1002 u16 cid;
1003 u16 sector_count;
1004 u32 block;
1005 u16 pad;
1006 u16 flags;
1007 struct sgmap64 sg; // Must be last in struct because it is variable
1008 };
1009 struct aac_write_reply
1011 u32 status;
1012 u32 count;
1013 u32 committed;
1014 };
1016 struct aac_srb
1018 u32 function;
1019 u32 channel;
1020 u32 target;
1021 u32 lun;
1022 u32 timeout;
1023 u32 flags;
1024 u32 count; // Data xfer size
1025 u32 retry_limit;
1026 u32 cdb_size;
1027 u8 cdb[16];
1028 struct sgmap sg;
1029 };
1033 #define AAC_SENSE_BUFFERSIZE 30
1035 struct aac_srb_reply
1037 u32 status;
1038 u32 srb_status;
1039 u32 scsi_status;
1040 u32 data_xfer_length;
1041 u32 sense_data_size;
1042 u8 sense_data[AAC_SENSE_BUFFERSIZE]; // Can this be SCSI_SENSE_BUFFERSIZE
1043 };
1044 /*
1045 * SRB Flags
1046 */
1047 #define SRB_NoDataXfer 0x0000
1048 #define SRB_DisableDisconnect 0x0004
1049 #define SRB_DisableSynchTransfer 0x0008
1050 #define SRB_BypassFrozenQueue 0x0010
1051 #define SRB_DisableAutosense 0x0020
1052 #define SRB_DataIn 0x0040
1053 #define SRB_DataOut 0x0080
1055 /*
1056 * SRB Functions - set in aac_srb->function
1057 */
1058 #define SRBF_ExecuteScsi 0x0000
1059 #define SRBF_ClaimDevice 0x0001
1060 #define SRBF_IO_Control 0x0002
1061 #define SRBF_ReceiveEvent 0x0003
1062 #define SRBF_ReleaseQueue 0x0004
1063 #define SRBF_AttachDevice 0x0005
1064 #define SRBF_ReleaseDevice 0x0006
1065 #define SRBF_Shutdown 0x0007
1066 #define SRBF_Flush 0x0008
1067 #define SRBF_AbortCommand 0x0010
1068 #define SRBF_ReleaseRecovery 0x0011
1069 #define SRBF_ResetBus 0x0012
1070 #define SRBF_ResetDevice 0x0013
1071 #define SRBF_TerminateIO 0x0014
1072 #define SRBF_FlushQueue 0x0015
1073 #define SRBF_RemoveDevice 0x0016
1074 #define SRBF_DomainValidation 0x0017
1076 /*
1077 * SRB SCSI Status - set in aac_srb->scsi_status
1078 */
1079 #define SRB_STATUS_PENDING 0x00
1080 #define SRB_STATUS_SUCCESS 0x01
1081 #define SRB_STATUS_ABORTED 0x02
1082 #define SRB_STATUS_ABORT_FAILED 0x03
1083 #define SRB_STATUS_ERROR 0x04
1084 #define SRB_STATUS_BUSY 0x05
1085 #define SRB_STATUS_INVALID_REQUEST 0x06
1086 #define SRB_STATUS_INVALID_PATH_ID 0x07
1087 #define SRB_STATUS_NO_DEVICE 0x08
1088 #define SRB_STATUS_TIMEOUT 0x09
1089 #define SRB_STATUS_SELECTION_TIMEOUT 0x0A
1090 #define SRB_STATUS_COMMAND_TIMEOUT 0x0B
1091 #define SRB_STATUS_MESSAGE_REJECTED 0x0D
1092 #define SRB_STATUS_BUS_RESET 0x0E
1093 #define SRB_STATUS_PARITY_ERROR 0x0F
1094 #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
1095 #define SRB_STATUS_NO_HBA 0x11
1096 #define SRB_STATUS_DATA_OVERRUN 0x12
1097 #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
1098 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
1099 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
1100 #define SRB_STATUS_REQUEST_FLUSHED 0x16
1101 #define SRB_STATUS_DELAYED_RETRY 0x17
1102 #define SRB_STATUS_INVALID_LUN 0x20
1103 #define SRB_STATUS_INVALID_TARGET_ID 0x21
1104 #define SRB_STATUS_BAD_FUNCTION 0x22
1105 #define SRB_STATUS_ERROR_RECOVERY 0x23
1106 #define SRB_STATUS_NOT_STARTED 0x24
1107 #define SRB_STATUS_NOT_IN_USE 0x30
1108 #define SRB_STATUS_FORCE_ABORT 0x31
1109 #define SRB_STATUS_DOMAIN_VALIDATION_FAIL 0x32
1111 /*
1112 * Object-Server / Volume-Manager Dispatch Classes
1113 */
1115 #define VM_Null 0
1116 #define VM_NameServe 1
1117 #define VM_ContainerConfig 2
1118 #define VM_Ioctl 3
1119 #define VM_FilesystemIoctl 4
1120 #define VM_CloseAll 5
1121 #define VM_CtBlockRead 6
1122 #define VM_CtBlockWrite 7
1123 #define VM_SliceBlockRead 8 /* raw access to configured "storage objects" */
1124 #define VM_SliceBlockWrite 9
1125 #define VM_DriveBlockRead 10 /* raw access to physical devices */
1126 #define VM_DriveBlockWrite 11
1127 #define VM_EnclosureMgt 12 /* enclosure management */
1128 #define VM_Unused 13 /* used to be diskset management */
1129 #define VM_CtBlockVerify 14
1130 #define VM_CtPerf 15 /* performance test */
1131 #define VM_CtBlockRead64 16
1132 #define VM_CtBlockWrite64 17
1133 #define VM_CtBlockVerify64 18
1134 #define VM_CtHostRead64 19
1135 #define VM_CtHostWrite64 20
1137 #define MAX_VMCOMMAND_NUM 21 /* used for sizing stats array - leave last */
1139 /*
1140 * Descriptive information (eg, vital stats)
1141 * that a content manager might report. The
1142 * FileArray filesystem component is one example
1143 * of a content manager. Raw mode might be
1144 * another.
1145 */
1147 struct aac_fsinfo {
1148 u32 fsTotalSize; /* Consumed by fs, incl. metadata */
1149 u32 fsBlockSize;
1150 u32 fsFragSize;
1151 u32 fsMaxExtendSize;
1152 u32 fsSpaceUnits;
1153 u32 fsMaxNumFiles;
1154 u32 fsNumFreeFiles;
1155 u32 fsInodeDensity;
1156 }; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */
1158 union aac_contentinfo {
1159 struct aac_fsinfo filesys; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */
1160 };
1162 /*
1163 * Query for "mountable" objects, ie, objects that are typically
1164 * associated with a drive letter on the client (host) side.
1165 */
1167 struct aac_mntent {
1168 u32 oid;
1169 u8 name[16]; // if applicable
1170 struct creation_info create_info; // if applicable
1171 u32 capacity;
1172 u32 vol; // substrate structure
1173 u32 obj; // FT_FILESYS, FT_DATABASE, etc.
1174 u32 state; // unready for mounting, readonly, etc.
1175 union aac_contentinfo fileinfo; // Info specific to content manager (eg, filesystem)
1176 u32 altoid; // != oid <==> snapshot or broken mirror exists
1177 };
1179 #define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */
1180 #define FSCS_READONLY 0x0002 /* possible result of broken mirror */
1181 #define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */
1183 struct aac_query_mount {
1184 u32 command;
1185 u32 type;
1186 u32 count;
1187 };
1189 struct aac_mount {
1190 u32 status;
1191 u32 type; /* should be same as that requested */
1192 u32 count;
1193 struct aac_mntent mnt[1];
1194 };
1196 /*
1197 * The following command is sent to shut down each container.
1198 */
1200 struct aac_close {
1201 u32 command;
1202 u32 cid;
1203 };
1205 struct aac_query_disk
1207 s32 cnum;
1208 s32 bus;
1209 s32 target;
1210 s32 lun;
1211 u32 valid;
1212 u32 locked;
1213 u32 deleted;
1214 s32 instance;
1215 s8 name[10];
1216 u32 unmapped;
1217 };
1219 struct aac_delete_disk {
1220 u32 disknum;
1221 u32 cnum;
1222 };
1224 struct fib_ioctl
1226 char *fibctx;
1227 int wait;
1228 char *fib;
1229 };
1231 struct revision
1233 u32 compat;
1234 u32 version;
1235 u32 build;
1236 };
1238 /*
1239 * Ugly - non Linux like ioctl coding for back compat.
1240 */
1242 #define CTL_CODE(function, method) ( \
1243 (4<< 16) | ((function) << 2) | (method) \
1246 /*
1247 * Define the method codes for how buffers are passed for I/O and FS
1248 * controls
1249 */
1251 #define METHOD_BUFFERED 0
1252 #define METHOD_NEITHER 3
1254 /*
1255 * Filesystem ioctls
1256 */
1258 #define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED)
1259 #define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED)
1260 #define FSACTL_DELETE_DISK 0x163
1261 #define FSACTL_QUERY_DISK 0x173
1262 #define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED)
1263 #define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED)
1264 #define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED)
1265 #define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED)
1266 #define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED)
1267 #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER)
1270 struct aac_common
1272 /*
1273 * If this value is set to 1 then interrupt moderation will occur
1274 * in the base commuication support.
1275 */
1276 u32 irq_mod;
1277 u32 peak_fibs;
1278 u32 zero_fibs;
1279 u32 fib_timeouts;
1280 /*
1281 * Statistical counters in debug mode
1282 */
1283 #ifdef DBG
1284 u32 FibsSent;
1285 u32 FibRecved;
1286 u32 NoResponseSent;
1287 u32 NoResponseRecved;
1288 u32 AsyncSent;
1289 u32 AsyncRecved;
1290 u32 NormalSent;
1291 u32 NormalRecved;
1292 #endif
1293 };
1295 extern struct aac_common aac_config;
1298 /*
1299 * The following macro is used when sending and receiving FIBs. It is
1300 * only used for debugging.
1301 */
1303 #if DBG
1304 #define FIB_COUNTER_INCREMENT(counter) (counter)++
1305 #else
1306 #define FIB_COUNTER_INCREMENT(counter)
1307 #endif
1309 /*
1310 * Adapter direct commands
1311 * Monitor/Kernel API
1312 */
1314 #define BREAKPOINT_REQUEST cpu_to_le32(0x00000004)
1315 #define INIT_STRUCT_BASE_ADDRESS cpu_to_le32(0x00000005)
1316 #define READ_PERMANENT_PARAMETERS cpu_to_le32(0x0000000a)
1317 #define WRITE_PERMANENT_PARAMETERS cpu_to_le32(0x0000000b)
1318 #define HOST_CRASHING cpu_to_le32(0x0000000d)
1319 #define SEND_SYNCHRONOUS_FIB cpu_to_le32(0x0000000c)
1320 #define GET_ADAPTER_PROPERTIES cpu_to_le32(0x00000019)
1321 #define RE_INIT_ADAPTER cpu_to_le32(0x000000ee)
1323 /*
1324 * Adapter Status Register
1326 * Phase Staus mailbox is 32bits:
1327 * <31:16> = Phase Status
1328 * <15:0> = Phase
1330 * The adapter reports is present state through the phase. Only
1331 * a single phase should be ever be set. Each phase can have multiple
1332 * phase status bits to provide more detailed information about the
1333 * state of the board. Care should be taken to ensure that any phase
1334 * status bits that are set when changing the phase are also valid
1335 * for the new phase or be cleared out. Adapter software (monitor,
1336 * iflash, kernel) is responsible for properly maintining the phase
1337 * status mailbox when it is running.
1339 * MONKER_API Phases
1341 * Phases are bit oriented. It is NOT valid to have multiple bits set
1342 */
1344 #define SELF_TEST_FAILED cpu_to_le32(0x00000004)
1345 #define KERNEL_UP_AND_RUNNING cpu_to_le32(0x00000080)
1346 #define KERNEL_PANIC cpu_to_le32(0x00000100)
1348 /*
1349 * Doorbell bit defines
1350 */
1352 #define DoorBellPrintfDone cpu_to_le32(1<<5) // Host -> Adapter
1353 #define DoorBellAdapterNormCmdReady cpu_to_le32(1<<1) // Adapter -> Host
1354 #define DoorBellAdapterNormRespReady cpu_to_le32(1<<2) // Adapter -> Host
1355 #define DoorBellAdapterNormCmdNotFull cpu_to_le32(1<<3) // Adapter -> Host
1356 #define DoorBellAdapterNormRespNotFull cpu_to_le32(1<<4) // Adapter -> Host
1357 #define DoorBellPrintfReady cpu_to_le32(1<<5) // Adapter -> Host
1359 /*
1360 * For FIB communication, we need all of the following things
1361 * to send back to the user.
1362 */
1364 #define AifCmdEventNotify 1 /* Notify of event */
1365 #define AifEnContainerChange 4 /* Container configuration change */
1366 #define AifCmdJobProgress 2 /* Progress report */
1367 #define AifCmdAPIReport 3 /* Report from other user of API */
1368 #define AifCmdDriverNotify 4 /* Notify host driver of event */
1369 #define AifDenMorphComplete 200 /* A morph operation completed */
1370 #define AifDenVolumeExtendComplete 201 /* A volume expand operation completed */
1371 #define AifReqJobList 100 /* Gets back complete job list */
1372 #define AifReqJobsForCtr 101 /* Gets back jobs for specific container */
1373 #define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */
1374 #define AifReqJobReport 103 /* Gets back a specific job report or list of them */
1375 #define AifReqTerminateJob 104 /* Terminates job */
1376 #define AifReqSuspendJob 105 /* Suspends a job */
1377 #define AifReqResumeJob 106 /* Resumes a job */
1378 #define AifReqSendAPIReport 107 /* API generic report requests */
1379 #define AifReqAPIJobStart 108 /* Start a job from the API */
1380 #define AifReqAPIJobUpdate 109 /* Update a job report from the API */
1381 #define AifReqAPIJobFinish 110 /* Finish a job from the API */
1383 /*
1384 * Adapter Initiated FIB command structures. Start with the adapter
1385 * initiated FIBs that really come from the adapter, and get responded
1386 * to by the host.
1387 */
1389 struct aac_aifcmd {
1390 u32 command; /* Tell host what type of notify this is */
1391 u32 seqnum; /* To allow ordering of reports (if necessary) */
1392 u8 data[1]; /* Undefined length (from kernel viewpoint) */
1393 };
1395 const char *aac_driverinfo(struct Scsi_Host *);
1396 struct fib *fib_alloc(struct aac_dev *dev);
1397 int fib_setup(struct aac_dev *dev);
1398 void fib_map_free(struct aac_dev *dev);
1399 void fib_free(struct fib * context);
1400 void fib_init(struct fib * context);
1401 void fib_dealloc(struct fib * context);
1402 void aac_printf(struct aac_dev *dev, u32 val);
1403 int fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt);
1404 int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry);
1405 int aac_consumer_avail(struct aac_dev * dev, struct aac_queue * q);
1406 void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
1407 int fib_complete(struct fib * context);
1408 #define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data)
1409 int aac_detach(struct aac_dev *dev);
1410 struct aac_dev *aac_init_adapter(struct aac_dev *dev);
1411 int aac_get_containers(struct aac_dev *dev);
1412 int aac_scsi_cmd(Scsi_Cmnd *scsi_cmnd_ptr);
1413 int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg);
1414 int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg);
1415 int aac_rx_init(struct aac_dev *dev, unsigned long devNumber);
1416 int aac_sa_init(struct aac_dev *dev, unsigned long devNumber);
1417 unsigned int aac_response_normal(struct aac_queue * q);
1418 unsigned int aac_command_normal(struct aac_queue * q);
1419 #ifdef TRY_TASKLET
1420 extern struct tasklet_struct aac_command_tasklet;
1421 void aac_command_thread(unsigned long data);
1422 #else
1423 int aac_command_thread(struct aac_dev * dev);
1424 #endif
1425 int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx);
1426 int fib_adapter_complete(struct fib * fibptr, unsigned short size);
1427 struct aac_driver_ident* aac_get_driver_ident(int devtype);
1428 int aac_get_adapter_info(struct aac_dev* dev);