6 /* eg: if (nblank(dprintk(x))) */
8 #define nblank(x) _nblank(x)[0]
10 #include <linux/interrupt.h>
11 #include <linux/pci.h>
13 /*------------------------------------------------------------------------------
15 *----------------------------------------------------------------------------*/
17 #define AAC_MAX_MSIX 32 /* vectors */
18 #define AAC_PCI_MSI_ENABLE 0x8000
21 AAC_ENABLE_INTERRUPT
= 0x0,
22 AAC_DISABLE_INTERRUPT
,
30 #define AAC_INT_MODE_INTX (1<<0)
31 #define AAC_INT_MODE_MSI (1<<1)
32 #define AAC_INT_MODE_AIF (1<<2)
33 #define AAC_INT_MODE_SYNC (1<<3)
34 #define AAC_INT_MODE_MSIX (1<<16)
36 #define AAC_INT_ENABLE_TYPE1_INTX 0xfffffffb
37 #define AAC_INT_ENABLE_TYPE1_MSIX 0xfffffffa
38 #define AAC_INT_DISABLE_ALL 0xffffffff
40 /* Bit definitions in IOA->Host Interrupt Register */
41 #define PMC_TRANSITION_TO_OPERATIONAL (1<<31)
42 #define PMC_IOARCB_TRANSFER_FAILED (1<<28)
43 #define PMC_IOA_UNIT_CHECK (1<<27)
44 #define PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE (1<<26)
45 #define PMC_CRITICAL_IOA_OP_IN_PROGRESS (1<<25)
46 #define PMC_IOARRIN_LOST (1<<4)
47 #define PMC_SYSTEM_BUS_MMIO_ERROR (1<<3)
48 #define PMC_IOA_PROCESSOR_IN_ERROR_STATE (1<<2)
49 #define PMC_HOST_RRQ_VALID (1<<1)
50 #define PMC_OPERATIONAL_STATUS (1<<31)
51 #define PMC_ALLOW_MSIX_VECTOR0 (1<<0)
53 #define PMC_IOA_ERROR_INTERRUPTS (PMC_IOARCB_TRANSFER_FAILED | \
54 PMC_IOA_UNIT_CHECK | \
55 PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE | \
57 PMC_SYSTEM_BUS_MMIO_ERROR | \
58 PMC_IOA_PROCESSOR_IN_ERROR_STATE)
60 #define PMC_ALL_INTERRUPT_BITS (PMC_IOA_ERROR_INTERRUPTS | \
61 PMC_HOST_RRQ_VALID | \
62 PMC_TRANSITION_TO_OPERATIONAL | \
63 PMC_ALLOW_MSIX_VECTOR0)
64 #define PMC_GLOBAL_INT_BIT2 0x00000004
65 #define PMC_GLOBAL_INT_BIT0 0x00000001
67 #ifndef AAC_DRIVER_BUILD
68 # define AAC_DRIVER_BUILD 41066
69 # define AAC_DRIVER_BRANCH "-ms"
71 #define MAXIMUM_NUM_CONTAINERS 32
73 #define AAC_NUM_MGT_FIB 8
74 #define AAC_NUM_IO_FIB (1024 - AAC_NUM_MGT_FIB)
75 #define AAC_NUM_FIB (AAC_NUM_IO_FIB + AAC_NUM_MGT_FIB)
77 #define AAC_MAX_LUN (256)
79 #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
80 #define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)256)
82 #define AAC_DEBUG_INSTRUMENT_AIF_DELETE
84 #define AAC_MAX_NATIVE_TARGETS 1024
85 /* Thor: 5 phys. buses: #0: empty, 1-4: 256 targets each */
86 #define AAC_MAX_BUSES 5
87 #define AAC_MAX_TARGETS 256
88 #define AAC_MAX_NATIVE_SIZE 2048
90 #define CISS_REPORT_PHYSICAL_LUNS 0xc3
91 #define WRITE_HOST_WELLNESS 0xa5
92 #define CISS_IDENTIFY_PHYSICAL_DEVICE 0x15
96 struct aac_ciss_phys_luns_resp
{
97 u8 list_length
[4]; /* LUN list length (N-7, big endian) */
98 u8 resp_flag
; /* extended response_flag */
101 u8 tid
[3]; /* Target ID */
102 u8 bus
; /* Bus, flag (bits 6,7) */
105 u8 node_ident
[16]; /* phys. node identifier */
106 } lun
[1]; /* List of phys. devices */
112 #define AAC_MAX_HRRQ 64
114 struct aac_ciss_identify_pd
{
115 u8 scsi_bus
; /* SCSI Bus number on controller */
116 u8 scsi_id
; /* SCSI ID on this bus */
117 u16 block_size
; /* sector size in bytes */
118 u32 total_blocks
; /* number for sectors on drive */
119 u32 reserved_blocks
; /* controller reserved (RIS) */
120 u8 model
[40]; /* Physical Drive Model */
121 u8 serial_number
[40]; /* Drive Serial Number */
122 u8 firmware_revision
[8]; /* drive firmware revision */
123 u8 scsi_inquiry_bits
; /* inquiry byte 7 bits */
124 u8 compaq_drive_stamp
; /* 0 means drive not stamped */
125 u8 last_failure_reason
;
129 u8 scsi_lun
; /* SCSI LUN for phys drive */
132 u32 spi_speed_rules
; /* SPI Speed :Ultra disable diagnose */
133 u8 phys_connector
[2]; /* connector number on controller */
134 u8 phys_box_on_bus
; /* phys enclosure this drive resides */
135 u8 phys_bay_in_box
; /* phys drv bay this drive resides */
136 u32 rpm
; /* Drive rotational speed in rpm */
137 u8 device_type
; /* type of drive */
138 u8 sata_version
; /* only valid when drive_type is SATA */
139 u64 big_total_block_count
;
140 u64 ris_starting_lba
;
143 u8 controller_phy_map
[32];
145 u8 phy_connected_dev_type
[256];
146 u8 phy_to_drive_bay_num
[256];
147 u16 phy_to_attached_dev_index
[256];
150 u16 extra_physical_drive_flags
;
151 u8 negotiated_link_rate
[256];
152 u8 phy_to_phy_map
[256];
153 u8 redundant_path_present_map
;
154 u8 redundant_path_failure_map
;
155 u8 active_path_number
;
156 u16 alternate_paths_phys_connector
[8];
157 u8 alternate_paths_phys_box_on_port
[8];
158 u8 multi_lun_device_lun_count
;
159 u8 minimum_good_fw_revision
[8];
160 u8 unique_inquiry_bytes
[20];
161 u8 current_temperature_degreesC
;
162 u8 temperature_threshold_degreesC
;
163 u8 max_temperature_degreesC
;
164 u8 logical_blocks_per_phys_block_exp
; /* phyblocksize = 512 * 2^exp */
165 u16 current_queue_depth_limit
;
168 u8 alternate_paths_switch_name
[40];
169 u8 alternate_paths_switch_port
[8];
170 u16 power_on_hours
; /* valid only if gas gauge supported */
171 u16 percent_endurance_used
; /* valid only if gas gauge supported. */
172 u8 drive_authentication
;
173 u8 smart_carrier_authentication
;
174 u8 smart_carrier_app_fw_version
;
175 u8 smart_carrier_bootloader_fw_version
;
176 u8 SanitizeSecureEraseSupport
;
178 u8 encryption_key_name
[64];
179 u32 misc_drive_flags
;
181 u16 drive_encryption_flags
;
182 u8 sanitize_maximum_time
[6];
183 u8 connector_info_mode
;
184 u8 connector_info_number
[4];
185 u8 long_connector_name
[64];
186 u8 device_unique_identifier
[16];
191 * These macros convert from physical channels to virtual channels
193 #define CONTAINER_CHANNEL (0)
194 #define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL)
195 #define CONTAINER_TO_ID(cont) (cont)
196 #define CONTAINER_TO_LUN(cont) (0)
198 #define PMC_DEVICE_S6 0x28b
199 #define PMC_DEVICE_S7 0x28c
200 #define PMC_DEVICE_S8 0x28d
201 #define PMC_DEVICE_S9 0x28f
203 #define aac_phys_to_logical(x) ((x)+1)
204 #define aac_logical_to_phys(x) ((x)?(x)-1:0)
207 * These macros are for keeping track of
208 * character device state.
210 #define AAC_CHARDEV_UNREGISTERED (-1)
211 #define AAC_CHARDEV_NEEDS_REINIT (-2)
213 /* #define AAC_DETAILED_STATUS_INFO */
229 #define FT_FILESYS 8 /* ADAPTEC's "FSA"(tm) filesystem */
230 #define FT_DRIVE 9 /* physical disk - addressable in scsi by bus/id/lun */
233 * Host side memory scatter gather list
234 * Used by the adapter for read, write, and readdirplus operations
235 * We have separate 32 and 64 bit version because even
236 * on 64 bit systems not all cards support the 64 bit version
239 __le32 addr
; /* 32-bit address. */
240 __le32 count
; /* Length. */
243 struct user_sgentry
{
244 u32 addr
; /* 32-bit address. */
245 u32 count
; /* Length. */
249 __le32 addr
[2]; /* 64-bit addr. 2 pieces for data alignment */
250 __le32 count
; /* Length. */
253 struct user_sgentry64
{
254 u32 addr
[2]; /* 64-bit addr. 2 pieces for data alignment */
255 u32 count
; /* Length. */
259 __le32 next
; /* reserved for F/W use */
260 __le32 prev
; /* reserved for F/W use */
263 __le32 flags
; /* reserved for F/W use */
266 struct user_sgentryraw
{
267 u32 next
; /* reserved for F/W use */
268 u32 prev
; /* reserved for F/W use */
271 u32 flags
; /* reserved for F/W use */
274 struct sge_ieee1212
{
284 * This is the SGMAP structure for all commands that use
290 struct sgentry sg
[1];
295 struct user_sgentry sg
[1];
300 struct sgentry64 sg
[1];
303 struct user_sgmap64
{
305 struct user_sgentry64 sg
[1];
310 struct sgentryraw sg
[1];
313 struct user_sgmapraw
{
315 struct user_sgentryraw sg
[1];
320 u8 buildnum
; /* e.g., 588 */
321 u8 usec
; /* e.g., 588 */
322 u8 via
; /* e.g., 1 = FSU,
325 u8 year
; /* e.g., 1997 = 97 */
327 * unsigned Month :4; // 1 - 12
328 * unsigned Day :6; // 1 - 32
329 * unsigned Hour :6; // 0 - 23
330 * unsigned Minute :6; // 0 - 60
331 * unsigned Second :6; // 0 - 60
333 __le32 serial
[2]; /* e.g., 0x1DEADB0BFAFAF001 */
338 * Define all the constants needed for the communication interface
342 * Define how many queue entries each queue will have and the total
343 * number of entries for the entire communication interface. Also define
344 * how many queues we support.
346 * This has to match the controller
349 #define NUMBER_OF_COMM_QUEUES 8 // 4 command; 4 response
350 #define HOST_HIGH_CMD_ENTRIES 4
351 #define HOST_NORM_CMD_ENTRIES 8
352 #define ADAP_HIGH_CMD_ENTRIES 4
353 #define ADAP_NORM_CMD_ENTRIES 512
354 #define HOST_HIGH_RESP_ENTRIES 4
355 #define HOST_NORM_RESP_ENTRIES 512
356 #define ADAP_HIGH_RESP_ENTRIES 4
357 #define ADAP_NORM_RESP_ENTRIES 8
359 #define TOTAL_QUEUE_ENTRIES \
360 (HOST_NORM_CMD_ENTRIES + HOST_HIGH_CMD_ENTRIES + ADAP_NORM_CMD_ENTRIES + ADAP_HIGH_CMD_ENTRIES + \
361 HOST_NORM_RESP_ENTRIES + HOST_HIGH_RESP_ENTRIES + ADAP_NORM_RESP_ENTRIES + ADAP_HIGH_RESP_ENTRIES)
365 * Set the queues on a 16 byte alignment
368 #define QUEUE_ALIGNMENT 16
371 * The queue headers define the Communication Region queues. These
372 * are physically contiguous and accessible by both the adapter and the
373 * host. Even though all queue headers are in the same contiguous block
374 * they will be represented as individual units in the data structures.
378 __le32 size
; /* Size in bytes of Fib which this QE points to */
379 __le32 addr
; /* Receiver address of the FIB */
383 * The adapter assumes the ProducerIndex and ConsumerIndex are grouped
384 * adjacently and in that order.
388 __le64 header_addr
;/* Address to hand the adapter to access
389 to this queue head */
390 __le32
*producer
; /* The producer index for this queue (host address) */
391 __le32
*consumer
; /* The consumer index for this queue (host address) */
395 * Define all the events which the adapter would like to notify
399 #define HostNormCmdQue 1 /* Change in host normal priority command queue */
400 #define HostHighCmdQue 2 /* Change in host high priority command queue */
401 #define HostNormRespQue 3 /* Change in host normal priority response queue */
402 #define HostHighRespQue 4 /* Change in host high priority response queue */
403 #define AdapNormRespNotFull 5
404 #define AdapHighRespNotFull 6
405 #define AdapNormCmdNotFull 7
406 #define AdapHighCmdNotFull 8
407 #define SynchCommandComplete 9
408 #define AdapInternalError 0xfe /* The adapter detected an internal error shutting down */
411 * Define all the events the host wishes to notify the
412 * adapter of. The first four values much match the Qid the
413 * corresponding queue.
416 #define AdapNormCmdQue 2
417 #define AdapHighCmdQue 3
418 #define AdapNormRespQue 6
419 #define AdapHighRespQue 7
420 #define HostShutdown 8
421 #define HostPowerFail 9
422 #define FatalCommError 10
423 #define HostNormRespNotFull 11
424 #define HostHighRespNotFull 12
425 #define HostNormCmdNotFull 13
426 #define HostHighCmdNotFull 14
428 #define AdapPrintfDone 16
431 * Define all the queues that the adapter and host use to communicate
432 * Number them to match the physical queue layout.
435 enum aac_queue_types
{
436 HostNormCmdQueue
= 0, /* Adapter to host normal priority command traffic */
437 HostHighCmdQueue
, /* Adapter to host high priority command traffic */
438 AdapNormCmdQueue
, /* Host to adapter normal priority command traffic */
439 AdapHighCmdQueue
, /* Host to adapter high priority command traffic */
440 HostNormRespQueue
, /* Adapter to host normal priority response traffic */
441 HostHighRespQueue
, /* Adapter to host high priority response traffic */
442 AdapNormRespQueue
, /* Host to adapter normal priority response traffic */
443 AdapHighRespQueue
/* Host to adapter high priority response traffic */
447 * Assign type values to the FSA communication data structures
450 #define FIB_MAGIC 0x0001
451 #define FIB_MAGIC2 0x0004
452 #define FIB_MAGIC2_64 0x0005
455 * Define the priority levels the FSA communication routines support.
460 /* transport FIB header (PMC) */
461 struct aac_fib_xporthdr
{
462 u64 HostAddress
; /* FIB host address w/o xport header */
463 u32 Size
; /* FIB size excluding xport header */
464 u32 Handle
; /* driver handle to reference the FIB */
471 * Define the FIB. The FIB is the where all the requested data and
472 * command information are put to the application on the FSA adapter.
476 __le32 XferState
; /* Current transfer state for this CCB */
477 __le16 Command
; /* Routing information for the destination */
478 u8 StructType
; /* Type FIB */
479 u8 Unused
; /* Unused */
480 __le16 Size
; /* Size of this FIB in bytes */
481 __le16 SenderSize
; /* Size of the FIB in the sender
482 (for response sizing) */
483 __le32 SenderFibAddress
; /* Host defined data in the FIB */
485 __le32 ReceiverFibAddress
;/* Logical address of this FIB for
487 __le32 SenderFibAddressHigh
;/* upper 32bit of phys. FIB address */
488 __le32 TimeStamp
; /* otherwise timestamp for FW internal use */
490 __le32 Handle
; /* FIB handle used for MSGU commnunication */
491 u32 Previous
; /* FW internal use */
492 u32 Next
; /* FW internal use */
496 struct aac_fibhdr header
;
497 u8 data
[512-sizeof(struct aac_fibhdr
)]; // Command specific data
504 #define TestCommandResponse 1
505 #define TestAdapterCommand 2
507 * Lowlevel and comm commands
509 #define LastTestCommand 100
510 #define ReinitHostNormCommandQueue 101
511 #define ReinitHostHighCommandQueue 102
512 #define ReinitHostHighRespQueue 103
513 #define ReinitHostNormRespQueue 104
514 #define ReinitAdapNormCommandQueue 105
515 #define ReinitAdapHighCommandQueue 107
516 #define ReinitAdapHighRespQueue 108
517 #define ReinitAdapNormRespQueue 109
518 #define InterfaceShutdown 110
519 #define DmaCommandFib 120
520 #define StartProfile 121
521 #define TermProfile 122
522 #define SpeedTest 123
523 #define TakeABreakPt 124
524 #define RequestPerfData 125
525 #define SetInterruptDefTimer 126
526 #define SetInterruptDefCount 127
527 #define GetInterruptDefStatus 128
528 #define LastCommCommand 129
530 * Filesystem commands
532 #define NuFileSystem 300
534 #define HostFileSystem 302
535 #define LastFileSystemCommand 303
539 #define ContainerCommand 500
540 #define ContainerCommand64 501
541 #define ContainerRawIo 502
542 #define ContainerRawIo2 503
544 * Scsi Port commands (scsi passthrough)
546 #define ScsiPortCommand 600
547 #define ScsiPortCommand64 601
549 * Misc house keeping and generic adapter initiated commands
551 #define AifRequest 700
552 #define CheckRevision 701
553 #define FsaHostShutdown 702
554 #define RequestAdapterInfo 703
555 #define IsAdapterPaused 704
556 #define SendHostTime 705
557 #define RequestSupplementAdapterInfo 706
558 #define LastMiscCommand 707
561 * Commands that will target the failover level on the FSA adapter
564 enum fib_xfer_state
{
566 AdapterOwned
= (1<<1),
567 FibInitialized
= (1<<2),
569 AllocatedFromPool
= (1<<4),
570 SentFromHost
= (1<<5),
571 SentFromAdapter
= (1<<6),
572 ResponseExpected
= (1<<7),
573 NoResponseExpected
= (1<<8),
574 AdapterProcessed
= (1<<9),
575 HostProcessed
= (1<<10),
576 HighPriority
= (1<<11),
577 NormalPriority
= (1<<12),
579 AsyncIo
= (1<<13), // rpbfix: remove with new regime
580 PageFileIo
= (1<<14), // rpbfix: remove with new regime
581 ShutdownRequest
= (1<<15),
582 LazyWrite
= (1<<16), // rpbfix: remove with new regime
583 AdapterMicroFib
= (1<<17),
584 BIOSFibPath
= (1<<18),
585 FastResponseCapable
= (1<<19),
586 ApiFib
= (1<<20), /* Its an API Fib */
587 /* PMC NEW COMM: There is no more AIF data pending */
588 NoMoreAifDataAvailable
= (1<<21)
592 * The following defines needs to be updated any time there is an
593 * incompatible change made to the aac_init structure.
596 #define ADAPTER_INIT_STRUCT_REVISION 3
597 #define ADAPTER_INIT_STRUCT_REVISION_4 4 // rocket science
598 #define ADAPTER_INIT_STRUCT_REVISION_6 6 /* PMC src */
599 #define ADAPTER_INIT_STRUCT_REVISION_7 7 /* Denali */
600 #define ADAPTER_INIT_STRUCT_REVISION_8 8 // Thor
605 __le32 init_struct_revision
;
606 __le32 no_of_msix_vectors
;
608 __le32 comm_header_address
;
609 __le32 fast_io_comm_area_address
;
610 __le32 adapter_fibs_physical_address
;
611 __le32 adapter_fibs_virtual_address
;
612 __le32 adapter_fibs_size
;
613 __le32 adapter_fib_align
;
616 /* number of 4k pages of host phys. mem. */
617 __le32 host_phys_mem_pages
;
618 /* number of seconds since 1970. */
619 __le32 host_elapsed_seconds
;
620 /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
621 __le32 init_flags
; /* flags for supported features */
622 #define INITFLAGS_NEW_COMM_SUPPORTED 0x00000001
623 #define INITFLAGS_DRIVER_USES_UTC_TIME 0x00000010
624 #define INITFLAGS_DRIVER_SUPPORTS_PM 0x00000020
625 #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED 0x00000040
626 #define INITFLAGS_FAST_JBOD_SUPPORTED 0x00000080
627 #define INITFLAGS_NEW_COMM_TYPE2_SUPPORTED 0x00000100
628 #define INITFLAGS_DRIVER_SUPPORTS_HBA_MODE 0x00000400
629 __le32 max_io_commands
; /* max outstanding commands */
630 __le32 max_io_size
; /* largest I/O command */
631 __le32 max_fib_size
; /* largest FIB to adapter */
632 /* ADAPTER_INIT_STRUCT_REVISION_5 begins here */
633 __le32 max_num_aif
; /* max number of aif */
634 /* ADAPTER_INIT_STRUCT_REVISION_6 begins here */
635 /* Host RRQ (response queue) for SRC */
636 __le32 host_rrq_addr_low
;
637 __le32 host_rrq_addr_high
;
640 /* ADAPTER_INIT_STRUCT_REVISION_8 */
641 __le32 init_struct_revision
;
642 __le32 rr_queue_count
;
643 __le32 host_elapsed_seconds
; /* number of secs since 1970. */
645 __le32 max_io_size
; /* largest I/O command */
646 __le32 max_num_aif
; /* max number of aif */
650 __le32 host_addr_low
;
651 __le32 host_addr_high
;
653 __le16 element_count
;
656 } rrq
[1]; /* up to 64 RRQ addresses */
662 LOG_AAC_INFORMATIONAL
= 20,
663 LOG_AAC_WARNING
= 30,
664 LOG_AAC_LOW_ERROR
= 40,
665 LOG_AAC_MEDIUM_ERROR
= 50,
666 LOG_AAC_HIGH_ERROR
= 60,
669 LOG_AAC_WINDBG_PRINT
= 90
672 #define FSAFS_NTC_GET_ADAPTER_FIB_CONTEXT 0x030b
673 #define FSAFS_NTC_FIB_CONTEXT 0x030c
681 /* Low level operations */
682 void (*adapter_interrupt
)(struct aac_dev
*dev
);
683 void (*adapter_notify
)(struct aac_dev
*dev
, u32 event
);
684 void (*adapter_disable_int
)(struct aac_dev
*dev
);
685 void (*adapter_enable_int
)(struct aac_dev
*dev
);
686 int (*adapter_sync_cmd
)(struct aac_dev
*dev
, u32 command
, u32 p1
, u32 p2
, u32 p3
, u32 p4
, u32 p5
, u32 p6
, u32
*status
, u32
*r1
, u32
*r2
, u32
*r3
, u32
*r4
);
687 int (*adapter_check_health
)(struct aac_dev
*dev
);
688 int (*adapter_restart
)(struct aac_dev
*dev
, int bled
);
689 void (*adapter_start
)(struct aac_dev
*dev
);
690 /* Transport operations */
691 int (*adapter_ioremap
)(struct aac_dev
* dev
, u32 size
);
692 irq_handler_t adapter_intr
;
693 /* Packet operations */
694 int (*adapter_deliver
)(struct fib
* fib
);
695 int (*adapter_bounds
)(struct aac_dev
* dev
, struct scsi_cmnd
* cmd
, u64 lba
);
696 int (*adapter_read
)(struct fib
* fib
, struct scsi_cmnd
* cmd
, u64 lba
, u32 count
);
697 int (*adapter_write
)(struct fib
* fib
, struct scsi_cmnd
* cmd
, u64 lba
, u32 count
, int fua
);
698 int (*adapter_scsi
)(struct fib
* fib
, struct scsi_cmnd
* cmd
);
699 /* Administrative operations */
700 int (*adapter_comm
)(struct aac_dev
* dev
, int comm
);
704 * Define which interrupt handler needs to be installed
707 struct aac_driver_ident
709 int (*init
)(struct aac_dev
*dev
);
717 * Some adapter firmware needs communication memory
718 * below 2gig. This tells the init function to set the
719 * dma mask such that fib memory will be allocated where the
720 * adapter firmware can get to it.
722 #define AAC_QUIRK_31BIT 0x0001
725 * Some adapter firmware, when the raid card's cache is turned off, can not
726 * split up scatter gathers in order to deal with the limits of the
727 * underlying CHIM. This limit is 34 scatter gather elements.
729 #define AAC_QUIRK_34SG 0x0002
732 * This adapter is a slave (no Firmware)
734 #define AAC_QUIRK_SLAVE 0x0004
737 * This adapter is a master.
739 #define AAC_QUIRK_MASTER 0x0008
742 * Some adapter firmware perform poorly when it must split up scatter gathers
743 * in order to deal with the limits of the underlying CHIM. This limit in this
744 * class of adapters is 17 scatter gather elements.
746 #define AAC_QUIRK_17SG 0x0010
749 * Some adapter firmware does not support 64 bit scsi passthrough
752 #define AAC_QUIRK_SCSI_32 0x0020
755 * SRC based adapters support the AifReqEvent functions
757 #define AAC_QUIRK_SRC 0x0040
760 * The adapter interface specs all queues to be located in the same
761 * physically contiguous block. The host structure that defines the
762 * commuication queues will assume they are each a separate physically
763 * contiguous memory region that will support them all being one big
765 * There is a command and response queue for each level and direction of
766 * commuication. These regions are accessed by both the host and adapter.
770 u64 logical
; /*address we give the adapter */
771 struct aac_entry
*base
; /*system virtual address */
772 struct aac_qhdr headers
; /*producer,consumer q headers*/
773 u32 entries
; /*Number of queue entries */
774 wait_queue_head_t qfull
; /*Event to wait on if q full */
775 wait_queue_head_t cmdready
; /*Cmd ready from the adapter */
776 /* This is only valid for adapter to host command queues. */
777 spinlock_t
*lock
; /* Spinlock for this queue must take this lock before accessing the lock */
778 spinlock_t lockdata
; /* Actual lock (used only on one side of the lock) */
779 struct list_head cmdq
; /* A queue of FIBs which need to be prcessed by the FS thread. This is */
780 /* only valid for command queues which receive entries from the adapter. */
781 /* Number of entries on outstanding queue. */
783 struct aac_dev
* dev
; /* Back pointer to adapter structure */
787 * Message queues. The order here is important, see also the
788 * queue type ordering
791 struct aac_queue_block
793 struct aac_queue queue
[8];
797 * SaP1 Message Unit Registers
800 struct sa_drawbridge_CSR
{
802 __le32 reserved
[10]; /* 00h-27h | Reserved */
803 u8 LUT_Offset
; /* 28h | Lookup Table Offset */
804 u8 reserved1
[3]; /* 29h-2bh | Reserved */
805 __le32 LUT_Data
; /* 2ch | Looup Table Data */
806 __le32 reserved2
[26]; /* 30h-97h | Reserved */
807 __le16 PRICLEARIRQ
; /* 98h | Primary Clear Irq */
808 __le16 SECCLEARIRQ
; /* 9ah | Secondary Clear Irq */
809 __le16 PRISETIRQ
; /* 9ch | Primary Set Irq */
810 __le16 SECSETIRQ
; /* 9eh | Secondary Set Irq */
811 __le16 PRICLEARIRQMASK
;/* a0h | Primary Clear Irq Mask */
812 __le16 SECCLEARIRQMASK
;/* a2h | Secondary Clear Irq Mask */
813 __le16 PRISETIRQMASK
; /* a4h | Primary Set Irq Mask */
814 __le16 SECSETIRQMASK
; /* a6h | Secondary Set Irq Mask */
815 __le32 MAILBOX0
; /* a8h | Scratchpad 0 */
816 __le32 MAILBOX1
; /* ach | Scratchpad 1 */
817 __le32 MAILBOX2
; /* b0h | Scratchpad 2 */
818 __le32 MAILBOX3
; /* b4h | Scratchpad 3 */
819 __le32 MAILBOX4
; /* b8h | Scratchpad 4 */
820 __le32 MAILBOX5
; /* bch | Scratchpad 5 */
821 __le32 MAILBOX6
; /* c0h | Scratchpad 6 */
822 __le32 MAILBOX7
; /* c4h | Scratchpad 7 */
823 __le32 ROM_Setup_Data
; /* c8h | Rom Setup and Data */
824 __le32 ROM_Control_Addr
;/* cch | Rom Control and Address */
825 __le32 reserved3
[12]; /* d0h-ffh | reserved */
826 __le32 LUT
[64]; /* 100h-1ffh | Lookup Table Entries */
829 #define Mailbox0 SaDbCSR.MAILBOX0
830 #define Mailbox1 SaDbCSR.MAILBOX1
831 #define Mailbox2 SaDbCSR.MAILBOX2
832 #define Mailbox3 SaDbCSR.MAILBOX3
833 #define Mailbox4 SaDbCSR.MAILBOX4
834 #define Mailbox5 SaDbCSR.MAILBOX5
835 #define Mailbox6 SaDbCSR.MAILBOX6
836 #define Mailbox7 SaDbCSR.MAILBOX7
838 #define DoorbellReg_p SaDbCSR.PRISETIRQ
839 #define DoorbellReg_s SaDbCSR.SECSETIRQ
840 #define DoorbellClrReg_p SaDbCSR.PRICLEARIRQ
843 #define DOORBELL_0 0x0001
844 #define DOORBELL_1 0x0002
845 #define DOORBELL_2 0x0004
846 #define DOORBELL_3 0x0008
847 #define DOORBELL_4 0x0010
848 #define DOORBELL_5 0x0020
849 #define DOORBELL_6 0x0040
852 #define PrintfReady DOORBELL_5
853 #define PrintfDone DOORBELL_5
855 struct sa_registers
{
856 struct sa_drawbridge_CSR SaDbCSR
; /* 98h - c4h */
860 #define SA_INIT_NUM_MSIXVECTORS 1
861 #define SA_MINIPORT_REVISION SA_INIT_NUM_MSIXVECTORS
863 #define sa_readw(AEP, CSR) readl(&((AEP)->regs.sa->CSR))
864 #define sa_readl(AEP, CSR) readl(&((AEP)->regs.sa->CSR))
865 #define sa_writew(AEP, CSR, value) writew(value, &((AEP)->regs.sa->CSR))
866 #define sa_writel(AEP, CSR, value) writel(value, &((AEP)->regs.sa->CSR))
869 * Rx Message Unit Registers
872 struct rx_mu_registers
{
873 /* Local | PCI*| Name */
874 __le32 ARSR
; /* 1300h | 00h | APIC Register Select Register */
875 __le32 reserved0
; /* 1304h | 04h | Reserved */
876 __le32 AWR
; /* 1308h | 08h | APIC Window Register */
877 __le32 reserved1
; /* 130Ch | 0Ch | Reserved */
878 __le32 IMRx
[2]; /* 1310h | 10h | Inbound Message Registers */
879 __le32 OMRx
[2]; /* 1318h | 18h | Outbound Message Registers */
880 __le32 IDR
; /* 1320h | 20h | Inbound Doorbell Register */
881 __le32 IISR
; /* 1324h | 24h | Inbound Interrupt
883 __le32 IIMR
; /* 1328h | 28h | Inbound Interrupt
885 __le32 ODR
; /* 132Ch | 2Ch | Outbound Doorbell Register */
886 __le32 OISR
; /* 1330h | 30h | Outbound Interrupt
888 __le32 OIMR
; /* 1334h | 34h | Outbound Interrupt
890 __le32 reserved2
; /* 1338h | 38h | Reserved */
891 __le32 reserved3
; /* 133Ch | 3Ch | Reserved */
892 __le32 InboundQueue
;/* 1340h | 40h | Inbound Queue Port relative to firmware */
893 __le32 OutboundQueue
;/*1344h | 44h | Outbound Queue Port relative to firmware */
894 /* * Must access through ATU Inbound
895 Translation Window */
902 #define INBOUNDDOORBELL_0 0x00000001
903 #define INBOUNDDOORBELL_1 0x00000002
904 #define INBOUNDDOORBELL_2 0x00000004
905 #define INBOUNDDOORBELL_3 0x00000008
906 #define INBOUNDDOORBELL_4 0x00000010
907 #define INBOUNDDOORBELL_5 0x00000020
908 #define INBOUNDDOORBELL_6 0x00000040
910 #define OUTBOUNDDOORBELL_0 0x00000001
911 #define OUTBOUNDDOORBELL_1 0x00000002
912 #define OUTBOUNDDOORBELL_2 0x00000004
913 #define OUTBOUNDDOORBELL_3 0x00000008
914 #define OUTBOUNDDOORBELL_4 0x00000010
916 #define InboundDoorbellReg MUnit.IDR
917 #define OutboundDoorbellReg MUnit.ODR
919 struct rx_registers
{
920 struct rx_mu_registers MUnit
; /* 1300h - 1347h */
921 __le32 reserved1
[2]; /* 1348h - 134ch */
922 struct rx_inbound IndexRegs
;
925 #define rx_readb(AEP, CSR) readb(&((AEP)->regs.rx->CSR))
926 #define rx_readl(AEP, CSR) readl(&((AEP)->regs.rx->CSR))
927 #define rx_writeb(AEP, CSR, value) writeb(value, &((AEP)->regs.rx->CSR))
928 #define rx_writel(AEP, CSR, value) writel(value, &((AEP)->regs.rx->CSR))
931 * Rkt Message Unit Registers (same as Rx, except a larger reserve region)
934 #define rkt_mu_registers rx_mu_registers
935 #define rkt_inbound rx_inbound
937 struct rkt_registers
{
938 struct rkt_mu_registers MUnit
; /* 1300h - 1347h */
939 __le32 reserved1
[1006]; /* 1348h - 22fch */
940 struct rkt_inbound IndexRegs
; /* 2300h - */
943 #define rkt_readb(AEP, CSR) readb(&((AEP)->regs.rkt->CSR))
944 #define rkt_readl(AEP, CSR) readl(&((AEP)->regs.rkt->CSR))
945 #define rkt_writeb(AEP, CSR, value) writeb(value, &((AEP)->regs.rkt->CSR))
946 #define rkt_writel(AEP, CSR, value) writel(value, &((AEP)->regs.rkt->CSR))
949 * PMC SRC message unit registers
952 #define src_inbound rx_inbound
954 struct src_mu_registers
{
956 __le32 reserved0
[6]; /* 00h | Reserved */
957 __le32 IOAR
[2]; /* 18h | IOA->host interrupt register */
958 __le32 IDR
; /* 20h | Inbound Doorbell Register */
959 __le32 IISR
; /* 24h | Inbound Int. Status Register */
960 __le32 reserved1
[3]; /* 28h | Reserved */
961 __le32 OIMR
; /* 34h | Outbound Int. Mask Register */
962 __le32 reserved2
[25]; /* 38h | Reserved */
963 __le32 ODR_R
; /* 9ch | Outbound Doorbell Read */
964 __le32 ODR_C
; /* a0h | Outbound Doorbell Clear */
965 __le32 reserved3
[3]; /* a4h | Reserved */
966 __le32 SCR0
; /* b0h | Scratchpad 0 */
967 __le32 reserved4
[2]; /* b4h | Reserved */
968 __le32 OMR
; /* bch | Outbound Message Register */
969 __le32 IQ_L
; /* c0h | Inbound Queue (Low address) */
970 __le32 IQ_H
; /* c4h | Inbound Queue (High address) */
971 __le32 ODR_MSI
; /* c8h | MSI register for sync./AIF */
974 struct src_registers
{
975 struct src_mu_registers MUnit
; /* 00h - cbh */
978 __le32 reserved1
[130789]; /* cch - 7fc5fh */
979 struct src_inbound IndexRegs
; /* 7fc60h */
982 __le32 reserved1
[973]; /* cch - fffh */
983 struct src_inbound IndexRegs
; /* 1000h */
988 #define src_readb(AEP, CSR) readb(&((AEP)->regs.src.bar0->CSR))
989 #define src_readl(AEP, CSR) readl(&((AEP)->regs.src.bar0->CSR))
990 #define src_writeb(AEP, CSR, value) writeb(value, \
991 &((AEP)->regs.src.bar0->CSR))
992 #define src_writel(AEP, CSR, value) writel(value, \
993 &((AEP)->regs.src.bar0->CSR))
995 #define src_writeq(AEP, CSR, value) writeq(value, \
996 &((AEP)->regs.src.bar0->CSR))
999 #define SRC_ODR_SHIFT 12
1000 #define SRC_IDR_SHIFT 9
1002 typedef void (*fib_callback
)(void *ctxt
, struct fib
*fibctx
);
1004 struct aac_fib_context
{
1005 s16 type
; // used for verification of structure
1007 u32 unique
; // unique value representing this context
1008 ulong jiffies
; // used for cleanup - dmb changed to ulong
1009 struct list_head next
; // used to link context's into a linked list
1010 struct semaphore wait_sem
; // this is used to wait for the next fib to arrive.
1011 int wait
; // Set to true when thread is in WaitForSingleObject
1012 unsigned long count
; // total number of FIBs on FibList
1013 struct list_head fib_list
; // this holds fibs and their attachd hw_fibs
1017 u8 error_code
; /* 70h (current errors), 71h(deferred errors) */
1018 u8 valid
:1; /* A valid bit of one indicates that the information */
1019 /* field contains valid information as defined in the
1022 u8 segment_number
; /* Only used for COPY, COMPARE, or COPY AND VERIFY Commands */
1023 u8 sense_key
:4; /* Sense Key */
1025 u8 ILI
:1; /* Incorrect Length Indicator */
1026 u8 EOM
:1; /* End Of Medium - reserved for random access devices */
1027 u8 filemark
:1; /* Filemark - reserved for random access devices */
1029 u8 information
[4]; /* for direct-access devices, contains the unsigned
1030 * logical block address or residue associated with
1033 u8 add_sense_len
; /* number of additional sense bytes to follow this field */
1034 u8 cmnd_info
[4]; /* not used */
1035 u8 ASC
; /* Additional Sense Code */
1036 u8 ASCQ
; /* Additional Sense Code Qualifier */
1037 u8 FRUC
; /* Field Replaceable Unit Code - not used */
1038 u8 bit_ptr
:3; /* indicates which byte of the CDB or parameter data
1041 u8 BPV
:1; /* bit pointer valid (BPV): 1- indicates that
1042 * the bit_ptr field has valid value
1045 u8 CD
:1; /* command data bit: 1- illegal parameter in CDB.
1046 * 0- illegal parameter in data.
1049 u8 field_ptr
[2]; /* byte of the CDB or parameter data in error */
1052 struct fsa_dev_info
{
1056 u32 config_waiting_on
;
1057 unsigned long config_waiting_stamp
;
1065 struct sense_data sense_data
;
1071 void *next
; /* this is used by the allocator */
1075 * The Adapter that this I/O is destined for.
1077 struct aac_dev
*dev
;
1079 * This is the event the sendfib routine will wait on if the
1080 * caller did not pass one and this is synch io.
1082 struct semaphore event_wait
;
1083 spinlock_t event_lock
;
1085 u32 done
; /* gets set to 1 when fib is complete */
1086 fib_callback callback
;
1087 void *callback_data
;
1088 u32 flags
; // u32 dmb was ulong
1090 * And for the internal issue/reply queues (we may be able
1091 * to merge these two)
1093 struct list_head fiblink
;
1096 struct hw_fib
*hw_fib_va
; /* Actual shared object */
1097 dma_addr_t hw_fib_pa
; /* physical address of hw_fib*/
1098 u32 hbacmd_size
; /* cmd size for native */
1101 #define AAC_DEVTYPE_RAID_MEMBER 1
1102 #define AAC_DEVTYPE_ARC_RAW 2
1103 #define AAC_DEVTYPE_NATIVE_RAW 3
1104 #define AAC_EXPOSE_DISK 0
1105 #define AAC_HIDE_DISK 3
1107 struct aac_hba_map_info
{
1108 __le32 rmw_nexus
; /* nexus for native HBA devices */
1109 u8 devtype
; /* device type */
1110 u8 reset_state
; /* 0 - no reset, 1..x - */
1111 /* after xth TM LUN reset */
1113 u8 expose
; /*checks if to expose or not*/
1117 * Adapter Information Block
1119 * This is returned by the RequestAdapterInfo block
1122 struct aac_adapter_info
1134 __le32 monitorbuild
;
1140 __le32 clusterchannelmask
;
1147 struct aac_supplement_adapter_info
1149 u8 AdapterTypeText
[17+1];
1151 __le32 FlashMemoryByteSize
;
1152 __le32 FlashImageId
;
1153 __le32 MaxNumberPorts
;
1159 __le32 CurrentNumberPorts
;
1164 u8 EcVersionString
[8];
1167 __le32 FlashFirmwareRevision
;
1168 __le32 FlashFirmwareBuild
;
1169 __le32 RaidTypeMorphOptions
;
1170 __le32 FlashFirmwareBootRevision
;
1171 __le32 FlashFirmwareBootBuild
;
1172 u8 MfgPcbaSerialNo
[12];
1174 __le32 SupportedOptions2
;
1175 __le32 StructExpansion
;
1176 /* StructExpansion == 1 */
1177 __le32 FeatureBits3
;
1178 __le32 SupportedPerformanceModes
;
1179 u8 HostBusType
; /* uses HOST_BUS_TYPE_xxx defines */
1180 u8 HostBusWidth
; /* actual width in bits or links */
1181 u16 HostBusSpeed
; /* actual bus speed/link rate in MHz */
1182 u8 MaxRRCDrives
; /* max. number of ITP-RRC drives/pool */
1183 u8 MaxDiskXtasks
; /* max. possible num of DiskX Tasks */
1188 __le64 MaxRRCCapacity
;
1189 __le32 CompiledMaxHistLogLevel
;
1190 u8 CustomBoardName
[12];
1191 u16 SupportedCntlrMode
; /* identify supported controller mode */
1192 u16 ReservedForFuture16
;
1193 __le32 SupportedOptions3
; /* reserved for future options */
1195 __le16 VirtDeviceBus
; /* virt. SCSI device for Thor */
1196 __le16 VirtDeviceTarget
;
1197 __le16 VirtDeviceLUN
;
1199 __le32 ReservedForFutureGrowth
[68];
1202 #define AAC_FEATURE_FALCON cpu_to_le32(0x00000010)
1203 #define AAC_FEATURE_JBOD cpu_to_le32(0x08000000)
1204 /* SupportedOptions2 */
1205 #define AAC_OPTION_MU_RESET cpu_to_le32(0x00000001)
1206 #define AAC_OPTION_IGNORE_RESET cpu_to_le32(0x00000002)
1207 #define AAC_OPTION_POWER_MANAGEMENT cpu_to_le32(0x00000004)
1208 #define AAC_OPTION_DOORBELL_RESET cpu_to_le32(0x00004000)
1209 /* 4KB sector size */
1210 #define AAC_OPTION_VARIABLE_BLOCK_SIZE cpu_to_le32(0x00040000)
1211 /* 240 simple volume support */
1212 #define AAC_OPTION_SUPPORTED_240_VOLUMES cpu_to_le32(0x10000000)
1213 #define AAC_SIS_VERSION_V3 3
1214 #define AAC_SIS_SLOT_UNKNOWN 0xFF
1216 #define GetBusInfo 0x00000009
1217 struct aac_bus_info
{
1218 __le32 Command
; /* VM_Ioctl */
1219 __le32 ObjType
; /* FT_DRIVE */
1220 __le32 MethodId
; /* 1 = SCSI Layer */
1221 __le32 ObjectId
; /* Handle */
1222 __le32 CtlCmd
; /* GetBusInfo */
1225 struct aac_bus_info_response
{
1226 __le32 Status
; /* ST_OK */
1228 __le32 MethodId
; /* unused */
1229 __le32 ObjectId
; /* unused */
1230 __le32 CtlCmd
; /* unused */
1231 __le32 ProbeComplete
;
1233 __le32 TargetsPerBus
;
1234 u8 InitiatorBusId
[10];
1241 #define AAC_BAT_REQ_PRESENT (1)
1242 #define AAC_BAT_REQ_NOTPRESENT (2)
1243 #define AAC_BAT_OPT_PRESENT (3)
1244 #define AAC_BAT_OPT_NOTPRESENT (4)
1245 #define AAC_BAT_NOT_SUPPORTED (5)
1249 #define AAC_CPU_SIMULATOR (1)
1250 #define AAC_CPU_I960 (2)
1251 #define AAC_CPU_STRONGARM (3)
1256 #define AAC_OPT_SNAPSHOT cpu_to_le32(1)
1257 #define AAC_OPT_CLUSTERS cpu_to_le32(1<<1)
1258 #define AAC_OPT_WRITE_CACHE cpu_to_le32(1<<2)
1259 #define AAC_OPT_64BIT_DATA cpu_to_le32(1<<3)
1260 #define AAC_OPT_HOST_TIME_FIB cpu_to_le32(1<<4)
1261 #define AAC_OPT_RAID50 cpu_to_le32(1<<5)
1262 #define AAC_OPT_4GB_WINDOW cpu_to_le32(1<<6)
1263 #define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7)
1264 #define AAC_OPT_SOFT_ERR_REPORT cpu_to_le32(1<<8)
1265 #define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9)
1266 #define AAC_OPT_SGMAP_HOST64 cpu_to_le32(1<<10)
1267 #define AAC_OPT_ALARM cpu_to_le32(1<<11)
1268 #define AAC_OPT_NONDASD cpu_to_le32(1<<12)
1269 #define AAC_OPT_SCSI_MANAGED cpu_to_le32(1<<13)
1270 #define AAC_OPT_RAID_SCSI_MODE cpu_to_le32(1<<14)
1271 #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO cpu_to_le32(1<<16)
1272 #define AAC_OPT_NEW_COMM cpu_to_le32(1<<17)
1273 #define AAC_OPT_NEW_COMM_64 cpu_to_le32(1<<18)
1274 #define AAC_OPT_EXTENDED cpu_to_le32(1<<23)
1275 #define AAC_OPT_NEW_COMM_TYPE1 cpu_to_le32(1<<28)
1276 #define AAC_OPT_NEW_COMM_TYPE2 cpu_to_le32(1<<29)
1277 #define AAC_OPT_NEW_COMM_TYPE3 cpu_to_le32(1<<30)
1278 #define AAC_OPT_NEW_COMM_TYPE4 cpu_to_le32(1<<31)
1280 #define AAC_COMM_PRODUCER 0
1281 #define AAC_COMM_MESSAGE 1
1282 #define AAC_COMM_MESSAGE_TYPE1 3
1283 #define AAC_COMM_MESSAGE_TYPE2 4
1284 #define AAC_COMM_MESSAGE_TYPE3 5
1286 #define AAC_EXTOPT_SA_FIRMWARE cpu_to_le32(1<<1)
1289 struct aac_msix_ctx
{
1291 struct aac_dev
*dev
;
1296 struct list_head entry
;
1301 * negotiated FIB settings
1303 unsigned int max_fib_size
;
1304 unsigned int sg_tablesize
;
1305 unsigned int max_num_aif
;
1307 unsigned int max_cmd_size
; /* max_fib_size or MAX_NATIVE */
1310 * Map for 128 fib objects (64k)
1312 dma_addr_t hw_fib_pa
;
1313 struct hw_fib
*hw_fib_va
;
1314 struct hw_fib
*aif_base_va
;
1320 struct fib
*free_fib
;
1321 spinlock_t fib_lock
;
1323 struct mutex ioctl_mutex
;
1324 struct aac_queue_block
*queues
;
1326 * The user API will use an IOCTL to register itself to receive
1327 * FIBs from the adapter. The following list is used to keep
1328 * track of all the threads that have requested these FIBs. The
1329 * mutex is used to synchronize access to all data associated
1330 * with the adapter fibs.
1332 struct list_head fib_list
;
1334 struct adapter_ops a_ops
;
1335 unsigned long fsrev
; /* Main driver's revision number */
1337 resource_size_t base_start
; /* main IO base */
1338 resource_size_t dbg_base
; /* address of UART
1341 resource_size_t base_size
, dbg_size
; /* Size of
1342 * mapped in region */
1344 * Holds initialization info
1345 * to communicate with adapter
1347 union aac_init
*init
;
1348 dma_addr_t init_pa
; /* Holds physical address of the init struct */
1349 /* response queue (if AAC_COMM_MESSAGE_TYPE1) */
1351 dma_addr_t host_rrq_pa
; /* phys. address */
1352 /* index into rrq buffer */
1353 u32 host_rrq_idx
[AAC_MAX_MSIX
];
1354 atomic_t rrq_outstanding
[AAC_MAX_MSIX
];
1356 struct pci_dev
*pdev
; /* Our PCI interface */
1357 /* pointer to buffer used for printf's from the adapter */
1359 void *comm_addr
; /* Base address of Comm area */
1360 dma_addr_t comm_phys
; /* Physical Address of Comm area */
1363 struct Scsi_Host
*scsi_host_ptr
;
1364 int maximum_num_containers
;
1365 int maximum_num_physicals
;
1366 int maximum_num_channels
;
1367 struct fsa_dev_info
*fsa_dev
;
1368 struct task_struct
*thread
;
1371 *This lock will protect the two 32-bit
1372 *writes to the Inbound Queue
1377 * The following is the device specific extension.
1379 #ifndef AAC_MIN_FOOTPRINT_SIZE
1380 # define AAC_MIN_FOOTPRINT_SIZE 8192
1381 # define AAC_MIN_SRC_BAR0_SIZE 0x400000
1382 # define AAC_MIN_SRC_BAR1_SIZE 0x800
1383 # define AAC_MIN_SRCV_BAR0_SIZE 0x100000
1384 # define AAC_MIN_SRCV_BAR1_SIZE 0x400
1388 struct sa_registers __iomem
*sa
;
1389 struct rx_registers __iomem
*rx
;
1390 struct rkt_registers __iomem
*rkt
;
1392 struct src_registers __iomem
*bar0
;
1396 volatile void __iomem
*base
, *dbg_base_mapped
;
1397 volatile struct rx_inbound __iomem
*IndexRegs
;
1398 u32 OIMR
; /* Mask Register Cache */
1403 struct aac_adapter_info adapter_info
;
1404 struct aac_supplement_adapter_info supplement_adapter_info
;
1405 /* These are in adapter info but they are in the io flow so
1406 * lets break them out so we don't have to do an AND to check them
1415 u8 raw_io_interface
;
1421 int management_fib_count
;
1422 spinlock_t manage_lock
;
1423 spinlock_t sync_lock
;
1425 struct fib
*sync_fib
;
1426 struct list_head sync_fib_list
;
1428 u32 max_msix
; /* max. MSI-X vectors */
1429 u32 vector_cap
; /* MSI-X vector capab.*/
1430 int msi_enabled
; /* MSI/MSI-X enabled */
1431 atomic_t msix_counter
;
1432 struct msix_entry msixentry
[AAC_MAX_MSIX
];
1433 struct aac_msix_ctx aac_msix
[AAC_MAX_MSIX
]; /* context */
1434 struct aac_hba_map_info hba_map
[AAC_MAX_BUSES
][AAC_MAX_TARGETS
];
1435 u8 adapter_shutdown
;
1436 u32 handle_pci_error
;
1439 #define aac_adapter_interrupt(dev) \
1440 (dev)->a_ops.adapter_interrupt(dev)
1442 #define aac_adapter_notify(dev, event) \
1443 (dev)->a_ops.adapter_notify(dev, event)
1445 #define aac_adapter_disable_int(dev) \
1446 (dev)->a_ops.adapter_disable_int(dev)
1448 #define aac_adapter_enable_int(dev) \
1449 (dev)->a_ops.adapter_enable_int(dev)
1451 #define aac_adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) \
1452 (dev)->a_ops.adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4)
1454 #define aac_adapter_check_health(dev) \
1455 (dev)->a_ops.adapter_check_health(dev)
1457 #define aac_adapter_restart(dev,bled) \
1458 (dev)->a_ops.adapter_restart(dev,bled)
1460 #define aac_adapter_start(dev) \
1461 ((dev)->a_ops.adapter_start(dev))
1463 #define aac_adapter_ioremap(dev, size) \
1464 (dev)->a_ops.adapter_ioremap(dev, size)
1466 #define aac_adapter_deliver(fib) \
1467 ((fib)->dev)->a_ops.adapter_deliver(fib)
1469 #define aac_adapter_bounds(dev,cmd,lba) \
1470 dev->a_ops.adapter_bounds(dev,cmd,lba)
1472 #define aac_adapter_read(fib,cmd,lba,count) \
1473 ((fib)->dev)->a_ops.adapter_read(fib,cmd,lba,count)
1475 #define aac_adapter_write(fib,cmd,lba,count,fua) \
1476 ((fib)->dev)->a_ops.adapter_write(fib,cmd,lba,count,fua)
1478 #define aac_adapter_scsi(fib,cmd) \
1479 ((fib)->dev)->a_ops.adapter_scsi(fib,cmd)
1481 #define aac_adapter_comm(dev,comm) \
1482 (dev)->a_ops.adapter_comm(dev, comm)
1484 #define FIB_CONTEXT_FLAG_TIMED_OUT (0x00000001)
1485 #define FIB_CONTEXT_FLAG (0x00000002)
1486 #define FIB_CONTEXT_FLAG_WAIT (0x00000004)
1487 #define FIB_CONTEXT_FLAG_FASTRESP (0x00000008)
1490 * Define the command values
1494 #define GetAttributes 1
1495 #define SetAttributes 2
1501 #define MakeDirectory 8
1502 #define SymbolicLink 9
1505 #define RemoveDirectoryx 12
1508 #define ReadDirectory 15
1509 #define ReadDirectoryPlus 16
1510 #define FileSystemStatus 17
1511 #define FileSystemInfo 18
1512 #define PathConfigure 19
1519 #define SimReadWrite 26
1520 #define SetFileSystemStatus 27
1521 #define BlockRead 28
1522 #define BlockWrite 29
1523 #define NvramIoctl 30
1524 #define FsSyncWait 31
1525 #define ClearArchiveBit 32
1528 #define AssignAcl 35
1529 #define FaultInsertion 36 /* Fault Insertion Command */
1530 #define CrazyCache 37 /* Crazycache */
1532 #define MAX_FSACOMMAND_NUM 38
1536 * Define the status returns. These are very unixlike although
1537 * most are not in fact used
1551 #define ST_NOTDIR 20
1558 #define ST_WOULDBLOCK 35
1559 #define ST_NAMETOOLONG 63
1560 #define ST_NOTEMPTY 66
1563 #define ST_REMOTE 71
1564 #define ST_NOT_READY 72
1565 #define ST_BADHANDLE 10001
1566 #define ST_NOT_SYNC 10002
1567 #define ST_BAD_COOKIE 10003
1568 #define ST_NOTSUPP 10004
1569 #define ST_TOOSMALL 10005
1570 #define ST_SERVERFAULT 10006
1571 #define ST_BADTYPE 10007
1572 #define ST_JUKEBOX 10008
1573 #define ST_NOTMOUNTED 10009
1574 #define ST_MAINTMODE 10010
1575 #define ST_STALEACL 10011
1578 * On writes how does the client want the data written.
1581 #define CACHE_CSTABLE 1
1582 #define CACHE_UNSTABLE 2
1585 * Lets the client know at which level the data was committed on
1589 #define CMFILE_SYNCH_NVRAM 1
1590 #define CMDATA_SYNCH_NVRAM 2
1591 #define CMFILE_SYNCH 3
1592 #define CMDATA_SYNCH 4
1593 #define CMUNSTABLE 5
1595 #define RIO_TYPE_WRITE 0x0000
1596 #define RIO_TYPE_READ 0x0001
1597 #define RIO_SUREWRITE 0x0008
1599 #define RIO2_IO_TYPE 0x0003
1600 #define RIO2_IO_TYPE_WRITE 0x0000
1601 #define RIO2_IO_TYPE_READ 0x0001
1602 #define RIO2_IO_TYPE_VERIFY 0x0002
1603 #define RIO2_IO_ERROR 0x0004
1604 #define RIO2_IO_SUREWRITE 0x0008
1605 #define RIO2_SGL_CONFORMANT 0x0010
1606 #define RIO2_SG_FORMAT 0xF000
1607 #define RIO2_SG_FORMAT_ARC 0x0000
1608 #define RIO2_SG_FORMAT_SRL 0x1000
1609 #define RIO2_SG_FORMAT_IEEE1212 0x2000
1617 struct sgmap sg
; // Must be last in struct because it is variable
1624 __le16 sector_count
;
1628 struct sgmap64 sg
; // Must be last in struct because it is variable
1631 struct aac_read_reply
1643 __le32 stable
; // Not used
1644 struct sgmap sg
; // Must be last in struct because it is variable
1651 __le16 sector_count
;
1655 struct sgmap64 sg
; // Must be last in struct because it is variable
1657 struct aac_write_reply
1669 __le16 flags
; /* 00 W, 01 R */
1670 __le16 bpTotal
; /* reserved for F/W use */
1671 __le16 bpComplete
; /* reserved for F/W use */
1675 struct aac_raw_io2
{
1680 __le16 flags
; /* RIO2 flags */
1681 __le32 sgeFirstSize
; /* size of first sge el. */
1682 __le32 sgeNominalSize
; /* size of 2nd sge el. (if conformant) */
1683 u8 sgeCnt
; /* only 8 bits required */
1684 u8 bpTotal
; /* reserved for F/W use */
1685 u8 bpComplete
; /* reserved for F/W use */
1686 u8 sgeFirstIndex
; /* reserved for F/W use */
1688 struct sge_ieee1212 sge
[1];
1691 #define CT_FLUSH_CACHE 129
1692 struct aac_synchronize
{
1693 __le32 command
; /* VM_ContainerConfig */
1694 __le32 type
; /* CT_FLUSH_CACHE */
1700 __le32 count
; /* sizeof(((struct aac_synchronize_reply *)NULL)->data) */
1703 struct aac_synchronize_reply
{
1706 __le32 status
; /* CT_OK */
1715 #define CT_POWER_MANAGEMENT 245
1716 #define CT_PM_START_UNIT 2
1717 #define CT_PM_STOP_UNIT 3
1718 #define CT_PM_UNIT_IMMEDIATE 1
1719 struct aac_power_management
{
1720 __le32 command
; /* VM_ContainerConfig */
1721 __le32 type
; /* CT_POWER_MANAGEMENT */
1722 __le32 sub
; /* CT_PM_* */
1724 __le32 parm
; /* CT_PM_sub_* */
1727 #define CT_PAUSE_IO 65
1728 #define CT_RELEASE_IO 66
1730 __le32 command
; /* VM_ContainerConfig */
1731 __le32 type
; /* CT_PAUSE_IO */
1732 __le32 timeout
; /* 10ms ticks */
1737 __le32 count
; /* sizeof(((struct aac_pause_reply *)NULL)->data) */
1748 __le32 count
; // Data xfer size
1756 * This and associated data structs are used by the
1757 * ioctl caller and are in cpu order.
1767 u32 count
; // Data xfer size
1771 struct user_sgmap sg
;
1774 #define AAC_SENSE_BUFFERSIZE 30
1776 struct aac_srb_reply
1781 __le32 data_xfer_length
;
1782 __le32 sense_data_size
;
1783 u8 sense_data
[AAC_SENSE_BUFFERSIZE
]; // Can this be SCSI_SENSE_BUFFERSIZE
1788 #define SRB_NoDataXfer 0x0000
1789 #define SRB_DisableDisconnect 0x0004
1790 #define SRB_DisableSynchTransfer 0x0008
1791 #define SRB_BypassFrozenQueue 0x0010
1792 #define SRB_DisableAutosense 0x0020
1793 #define SRB_DataIn 0x0040
1794 #define SRB_DataOut 0x0080
1797 * SRB Functions - set in aac_srb->function
1799 #define SRBF_ExecuteScsi 0x0000
1800 #define SRBF_ClaimDevice 0x0001
1801 #define SRBF_IO_Control 0x0002
1802 #define SRBF_ReceiveEvent 0x0003
1803 #define SRBF_ReleaseQueue 0x0004
1804 #define SRBF_AttachDevice 0x0005
1805 #define SRBF_ReleaseDevice 0x0006
1806 #define SRBF_Shutdown 0x0007
1807 #define SRBF_Flush 0x0008
1808 #define SRBF_AbortCommand 0x0010
1809 #define SRBF_ReleaseRecovery 0x0011
1810 #define SRBF_ResetBus 0x0012
1811 #define SRBF_ResetDevice 0x0013
1812 #define SRBF_TerminateIO 0x0014
1813 #define SRBF_FlushQueue 0x0015
1814 #define SRBF_RemoveDevice 0x0016
1815 #define SRBF_DomainValidation 0x0017
1818 * SRB SCSI Status - set in aac_srb->scsi_status
1820 #define SRB_STATUS_PENDING 0x00
1821 #define SRB_STATUS_SUCCESS 0x01
1822 #define SRB_STATUS_ABORTED 0x02
1823 #define SRB_STATUS_ABORT_FAILED 0x03
1824 #define SRB_STATUS_ERROR 0x04
1825 #define SRB_STATUS_BUSY 0x05
1826 #define SRB_STATUS_INVALID_REQUEST 0x06
1827 #define SRB_STATUS_INVALID_PATH_ID 0x07
1828 #define SRB_STATUS_NO_DEVICE 0x08
1829 #define SRB_STATUS_TIMEOUT 0x09
1830 #define SRB_STATUS_SELECTION_TIMEOUT 0x0A
1831 #define SRB_STATUS_COMMAND_TIMEOUT 0x0B
1832 #define SRB_STATUS_MESSAGE_REJECTED 0x0D
1833 #define SRB_STATUS_BUS_RESET 0x0E
1834 #define SRB_STATUS_PARITY_ERROR 0x0F
1835 #define SRB_STATUS_REQUEST_SENSE_FAILED 0x10
1836 #define SRB_STATUS_NO_HBA 0x11
1837 #define SRB_STATUS_DATA_OVERRUN 0x12
1838 #define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13
1839 #define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14
1840 #define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15
1841 #define SRB_STATUS_REQUEST_FLUSHED 0x16
1842 #define SRB_STATUS_DELAYED_RETRY 0x17
1843 #define SRB_STATUS_INVALID_LUN 0x20
1844 #define SRB_STATUS_INVALID_TARGET_ID 0x21
1845 #define SRB_STATUS_BAD_FUNCTION 0x22
1846 #define SRB_STATUS_ERROR_RECOVERY 0x23
1847 #define SRB_STATUS_NOT_STARTED 0x24
1848 #define SRB_STATUS_NOT_IN_USE 0x30
1849 #define SRB_STATUS_FORCE_ABORT 0x31
1850 #define SRB_STATUS_DOMAIN_VALIDATION_FAIL 0x32
1853 * Object-Server / Volume-Manager Dispatch Classes
1857 #define VM_NameServe 1
1858 #define VM_ContainerConfig 2
1860 #define VM_FilesystemIoctl 4
1861 #define VM_CloseAll 5
1862 #define VM_CtBlockRead 6
1863 #define VM_CtBlockWrite 7
1864 #define VM_SliceBlockRead 8 /* raw access to configured "storage objects" */
1865 #define VM_SliceBlockWrite 9
1866 #define VM_DriveBlockRead 10 /* raw access to physical devices */
1867 #define VM_DriveBlockWrite 11
1868 #define VM_EnclosureMgt 12 /* enclosure management */
1869 #define VM_Unused 13 /* used to be diskset management */
1870 #define VM_CtBlockVerify 14
1871 #define VM_CtPerf 15 /* performance test */
1872 #define VM_CtBlockRead64 16
1873 #define VM_CtBlockWrite64 17
1874 #define VM_CtBlockVerify64 18
1875 #define VM_CtHostRead64 19
1876 #define VM_CtHostWrite64 20
1877 #define VM_DrvErrTblLog 21
1878 #define VM_NameServe64 22
1879 #define VM_NameServeAllBlk 30
1881 #define MAX_VMCOMMAND_NUM 23 /* used for sizing stats array - leave last */
1884 * Descriptive information (eg, vital stats)
1885 * that a content manager might report. The
1886 * FileArray filesystem component is one example
1887 * of a content manager. Raw mode might be
1892 __le32 fsTotalSize
; /* Consumed by fs, incl. metadata */
1895 __le32 fsMaxExtendSize
;
1896 __le32 fsSpaceUnits
;
1897 __le32 fsMaxNumFiles
;
1898 __le32 fsNumFreeFiles
;
1899 __le32 fsInodeDensity
;
1900 }; /* valid iff ObjType == FT_FILESYS && !(ContentState & FSCS_NOTCLEAN) */
1902 struct aac_blockdevinfo
{
1906 union aac_contentinfo
{
1907 struct aac_fsinfo filesys
;
1908 struct aac_blockdevinfo bdevinfo
;
1912 * Query for Container Configuration Status
1915 #define CT_GET_CONFIG_STATUS 147
1916 struct aac_get_config_status
{
1917 __le32 command
; /* VM_ContainerConfig */
1918 __le32 type
; /* CT_GET_CONFIG_STATUS */
1924 __le32 count
; /* sizeof(((struct aac_get_config_status_resp *)NULL)->data) */
1927 #define CFACT_CONTINUE 0
1928 #define CFACT_PAUSE 1
1929 #define CFACT_ABORT 2
1930 struct aac_get_config_status_resp
{
1931 __le32 response
; /* ST_OK */
1933 __le32 status
; /* CT_OK */
1940 __le32 action
; /* CFACT_CONTINUE, CFACT_PAUSE or CFACT_ABORT */
1947 * Accept the configuration as-is
1950 #define CT_COMMIT_CONFIG 152
1952 struct aac_commit_config
{
1953 __le32 command
; /* VM_ContainerConfig */
1954 __le32 type
; /* CT_COMMIT_CONFIG */
1958 * Query for Container Configuration Status
1961 #define CT_GET_CONTAINER_COUNT 4
1962 struct aac_get_container_count
{
1963 __le32 command
; /* VM_ContainerConfig */
1964 __le32 type
; /* CT_GET_CONTAINER_COUNT */
1967 struct aac_get_container_count_resp
{
1968 __le32 response
; /* ST_OK */
1970 __le32 MaxContainers
;
1971 __le32 ContainerSwitchEntries
;
1972 __le32 MaxPartitions
;
1973 __le32 MaxSimpleVolumes
;
1978 * Query for "mountable" objects, ie, objects that are typically
1979 * associated with a drive letter on the client (host) side.
1984 u8 name
[16]; /* if applicable */
1985 struct creation_info create_info
; /* if applicable */
1987 __le32 vol
; /* substrate structure */
1988 __le32 obj
; /* FT_FILESYS, etc. */
1989 __le32 state
; /* unready for mounting,
1991 union aac_contentinfo fileinfo
; /* Info specific to content
1992 manager (eg, filesystem) */
1993 __le32 altoid
; /* != oid <==> snapshot or
1994 broken mirror exists */
1995 __le32 capacityhigh
;
1998 #define FSCS_NOTCLEAN 0x0001 /* fsck is necessary before mounting */
1999 #define FSCS_READONLY 0x0002 /* possible result of broken mirror */
2000 #define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */
2001 #define FSCS_NOT_READY 0x0008 /* Array spinning up to fulfil request */
2003 struct aac_query_mount
{
2011 __le32 type
; /* should be same as that requested */
2013 struct aac_mntent mnt
[1];
2016 #define CT_READ_NAME 130
2017 struct aac_get_name
{
2018 __le32 command
; /* VM_ContainerConfig */
2019 __le32 type
; /* CT_READ_NAME */
2025 __le32 count
; /* sizeof(((struct aac_get_name_resp *)NULL)->data) */
2028 struct aac_get_name_resp
{
2031 __le32 status
; /* CT_OK */
2040 #define CT_CID_TO_32BITS_UID 165
2041 struct aac_get_serial
{
2042 __le32 command
; /* VM_ContainerConfig */
2043 __le32 type
; /* CT_CID_TO_32BITS_UID */
2047 struct aac_get_serial_resp
{
2050 __le32 status
; /* CT_OK */
2055 * The following command is sent to shut down each container.
2063 struct aac_query_disk
2077 struct aac_delete_disk
{
2098 * Ugly - non Linux like ioctl coding for back compat.
2101 #define CTL_CODE(function, method) ( \
2102 (4<< 16) | ((function) << 2) | (method) \
2106 * Define the method codes for how buffers are passed for I/O and FS
2110 #define METHOD_BUFFERED 0
2111 #define METHOD_NEITHER 3
2117 #define FSACTL_SENDFIB CTL_CODE(2050, METHOD_BUFFERED)
2118 #define FSACTL_SEND_RAW_SRB CTL_CODE(2067, METHOD_BUFFERED)
2119 #define FSACTL_DELETE_DISK 0x163
2120 #define FSACTL_QUERY_DISK 0x173
2121 #define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(2100, METHOD_BUFFERED)
2122 #define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(2101, METHOD_BUFFERED)
2123 #define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(2102, METHOD_BUFFERED)
2124 #define FSACTL_MINIPORT_REV_CHECK CTL_CODE(2107, METHOD_BUFFERED)
2125 #define FSACTL_GET_PCI_INFO CTL_CODE(2119, METHOD_BUFFERED)
2126 #define FSACTL_FORCE_DELETE_DISK CTL_CODE(2120, METHOD_NEITHER)
2127 #define FSACTL_GET_CONTAINERS 2131
2128 #define FSACTL_SEND_LARGE_FIB CTL_CODE(2138, METHOD_BUFFERED)
2134 * If this value is set to 1 then interrupt moderation will occur
2135 * in the base commuication support.
2142 * Statistical counters in debug mode
2148 u32 NoResponseRecved
;
2156 extern struct aac_common aac_config
;
2160 * The following macro is used when sending and receiving FIBs. It is
2161 * only used for debugging.
2165 #define FIB_COUNTER_INCREMENT(counter) (counter)++
2167 #define FIB_COUNTER_INCREMENT(counter)
2171 * Adapter direct commands
2172 * Monitor/Kernel API
2175 #define BREAKPOINT_REQUEST 0x00000004
2176 #define INIT_STRUCT_BASE_ADDRESS 0x00000005
2177 #define READ_PERMANENT_PARAMETERS 0x0000000a
2178 #define WRITE_PERMANENT_PARAMETERS 0x0000000b
2179 #define HOST_CRASHING 0x0000000d
2180 #define SEND_SYNCHRONOUS_FIB 0x0000000c
2181 #define COMMAND_POST_RESULTS 0x00000014
2182 #define GET_ADAPTER_PROPERTIES 0x00000019
2183 #define GET_DRIVER_BUFFER_PROPERTIES 0x00000023
2184 #define RCV_TEMP_READINGS 0x00000025
2185 #define GET_COMM_PREFERRED_SETTINGS 0x00000026
2186 #define IOP_RESET 0x00001000
2187 #define IOP_RESET_ALWAYS 0x00001001
2188 #define RE_INIT_ADAPTER 0x000000ee
2191 * Adapter Status Register
2193 * Phase Staus mailbox is 32bits:
2194 * <31:16> = Phase Status
2197 * The adapter reports is present state through the phase. Only
2198 * a single phase should be ever be set. Each phase can have multiple
2199 * phase status bits to provide more detailed information about the
2200 * state of the board. Care should be taken to ensure that any phase
2201 * status bits that are set when changing the phase are also valid
2202 * for the new phase or be cleared out. Adapter software (monitor,
2203 * iflash, kernel) is responsible for properly maintining the phase
2204 * status mailbox when it is running.
2208 * Phases are bit oriented. It is NOT valid to have multiple bits set
2211 #define SELF_TEST_FAILED 0x00000004
2212 #define MONITOR_PANIC 0x00000020
2213 #define KERNEL_UP_AND_RUNNING 0x00000080
2214 #define KERNEL_PANIC 0x00000100
2215 #define FLASH_UPD_PENDING 0x00002000
2216 #define FLASH_UPD_SUCCESS 0x00004000
2217 #define FLASH_UPD_FAILED 0x00008000
2218 #define FWUPD_TIMEOUT (5 * 60)
2221 * Doorbell bit defines
2224 #define DoorBellSyncCmdAvailable (1<<0) /* Host -> Adapter */
2225 #define DoorBellPrintfDone (1<<5) /* Host -> Adapter */
2226 #define DoorBellAdapterNormCmdReady (1<<1) /* Adapter -> Host */
2227 #define DoorBellAdapterNormRespReady (1<<2) /* Adapter -> Host */
2228 #define DoorBellAdapterNormCmdNotFull (1<<3) /* Adapter -> Host */
2229 #define DoorBellAdapterNormRespNotFull (1<<4) /* Adapter -> Host */
2230 #define DoorBellPrintfReady (1<<5) /* Adapter -> Host */
2231 #define DoorBellAifPending (1<<6) /* Adapter -> Host */
2233 /* PMC specific outbound doorbell bits */
2234 #define PmDoorBellResponseSent (1<<1) /* Adapter -> Host */
2237 * For FIB communication, we need all of the following things
2238 * to send back to the user.
2241 #define AifCmdEventNotify 1 /* Notify of event */
2242 #define AifEnConfigChange 3 /* Adapter configuration change */
2243 #define AifEnContainerChange 4 /* Container configuration change */
2244 #define AifEnDeviceFailure 5 /* SCSI device failed */
2245 #define AifEnEnclosureManagement 13 /* EM_DRIVE_* */
2246 #define EM_DRIVE_INSERTION 31
2247 #define EM_DRIVE_REMOVAL 32
2248 #define EM_SES_DRIVE_INSERTION 33
2249 #define EM_SES_DRIVE_REMOVAL 26
2250 #define AifEnBatteryEvent 14 /* Change in Battery State */
2251 #define AifEnAddContainer 15 /* A new array was created */
2252 #define AifEnDeleteContainer 16 /* A container was deleted */
2253 #define AifEnExpEvent 23 /* Firmware Event Log */
2254 #define AifExeFirmwarePanic 3 /* Firmware Event Panic */
2255 #define AifHighPriority 3 /* Highest Priority Event */
2256 #define AifEnAddJBOD 30 /* JBOD created */
2257 #define AifEnDeleteJBOD 31 /* JBOD deleted */
2259 #define AifBuManagerEvent 42 /* Bu management*/
2260 #define AifBuCacheDataLoss 10
2261 #define AifBuCacheDataRecover 11
2263 #define AifCmdJobProgress 2 /* Progress report */
2264 #define AifJobCtrZero 101 /* Array Zero progress */
2265 #define AifJobStsSuccess 1 /* Job completes */
2266 #define AifJobStsRunning 102 /* Job running */
2267 #define AifCmdAPIReport 3 /* Report from other user of API */
2268 #define AifCmdDriverNotify 4 /* Notify host driver of event */
2269 #define AifDenMorphComplete 200 /* A morph operation completed */
2270 #define AifDenVolumeExtendComplete 201 /* A volume extend completed */
2271 #define AifReqJobList 100 /* Gets back complete job list */
2272 #define AifReqJobsForCtr 101 /* Gets back jobs for specific container */
2273 #define AifReqJobsForScsi 102 /* Gets back jobs for specific SCSI device */
2274 #define AifReqJobReport 103 /* Gets back a specific job report or list of them */
2275 #define AifReqTerminateJob 104 /* Terminates job */
2276 #define AifReqSuspendJob 105 /* Suspends a job */
2277 #define AifReqResumeJob 106 /* Resumes a job */
2278 #define AifReqSendAPIReport 107 /* API generic report requests */
2279 #define AifReqAPIJobStart 108 /* Start a job from the API */
2280 #define AifReqAPIJobUpdate 109 /* Update a job report from the API */
2281 #define AifReqAPIJobFinish 110 /* Finish a job from the API */
2283 /* PMC NEW COMM: Request the event data */
2284 #define AifReqEvent 200
2286 /* RAW device deleted */
2287 #define AifRawDeviceRemove 203
2290 * Adapter Initiated FIB command structures. Start with the adapter
2291 * initiated FIBs that really come from the adapter, and get responded
2296 __le32 command
; /* Tell host what type of notify this is */
2297 __le32 seqnum
; /* To allow ordering of reports (if necessary) */
2298 u8 data
[1]; /* Undefined length (from kernel viewpoint) */
2302 * Convert capacity to cylinders
2303 * accounting for the fact capacity could be a 64 bit value
2306 static inline unsigned int cap_to_cyls(sector_t capacity
, unsigned divisor
)
2308 sector_div(capacity
, divisor
);
2312 /* SCp.phase values */
2313 #define AAC_OWNER_MIDLEVEL 0x101
2314 #define AAC_OWNER_LOWLEVEL 0x102
2315 #define AAC_OWNER_ERROR_HANDLER 0x103
2316 #define AAC_OWNER_FIRMWARE 0x106
2318 int aac_acquire_irq(struct aac_dev
*dev
);
2319 void aac_free_irq(struct aac_dev
*dev
);
2320 int aac_report_phys_luns(struct aac_dev
*dev
, struct fib
*fibptr
);
2321 int aac_issue_bmic_identify(struct aac_dev
*dev
, u32 bus
, u32 target
);
2322 const char *aac_driverinfo(struct Scsi_Host
*);
2323 void aac_fib_vector_assign(struct aac_dev
*dev
);
2324 struct fib
*aac_fib_alloc(struct aac_dev
*dev
);
2325 struct fib
*aac_fib_alloc_tag(struct aac_dev
*dev
, struct scsi_cmnd
*scmd
);
2326 int aac_fib_setup(struct aac_dev
*dev
);
2327 void aac_fib_map_free(struct aac_dev
*dev
);
2328 void aac_fib_free(struct fib
* context
);
2329 void aac_fib_init(struct fib
* context
);
2330 void aac_printf(struct aac_dev
*dev
, u32 val
);
2331 int aac_fib_send(u16 command
, struct fib
* context
, unsigned long size
, int priority
, int wait
, int reply
, fib_callback callback
, void *ctxt
);
2332 int aac_consumer_get(struct aac_dev
* dev
, struct aac_queue
* q
, struct aac_entry
**entry
);
2333 void aac_consumer_free(struct aac_dev
* dev
, struct aac_queue
* q
, u32 qnum
);
2334 int aac_fib_complete(struct fib
* context
);
2335 #define fib_data(fibctx) ((void *)(fibctx)->hw_fib_va->data)
2336 struct aac_dev
*aac_init_adapter(struct aac_dev
*dev
);
2337 void aac_src_access_devreg(struct aac_dev
*dev
, int mode
);
2338 int aac_get_config_status(struct aac_dev
*dev
, int commit_flag
);
2339 int aac_get_containers(struct aac_dev
*dev
);
2340 int aac_scsi_cmd(struct scsi_cmnd
*cmd
);
2341 int aac_dev_ioctl(struct aac_dev
*dev
, int cmd
, void __user
*arg
);
2342 #ifndef shost_to_class
2343 #define shost_to_class(shost) &shost->shost_dev
2345 ssize_t
aac_get_serial_number(struct device
*dev
, char *buf
);
2346 int aac_do_ioctl(struct aac_dev
* dev
, int cmd
, void __user
*arg
);
2347 int aac_rx_init(struct aac_dev
*dev
);
2348 int aac_rkt_init(struct aac_dev
*dev
);
2349 int aac_nark_init(struct aac_dev
*dev
);
2350 int aac_sa_init(struct aac_dev
*dev
);
2351 int aac_src_init(struct aac_dev
*dev
);
2352 int aac_srcv_init(struct aac_dev
*dev
);
2353 int aac_queue_get(struct aac_dev
* dev
, u32
* index
, u32 qid
, struct hw_fib
* hw_fib
, int wait
, struct fib
* fibptr
, unsigned long *nonotify
);
2354 void aac_define_int_mode(struct aac_dev
*dev
);
2355 unsigned int aac_response_normal(struct aac_queue
* q
);
2356 unsigned int aac_command_normal(struct aac_queue
* q
);
2357 unsigned int aac_intr_normal(struct aac_dev
*dev
, u32 Index
,
2358 int isAif
, int isFastResponse
,
2359 struct hw_fib
*aif_fib
);
2360 int aac_reset_adapter(struct aac_dev
* dev
, int forced
);
2361 int aac_check_health(struct aac_dev
* dev
);
2362 int aac_command_thread(void *data
);
2363 int aac_close_fib_context(struct aac_dev
* dev
, struct aac_fib_context
*fibctx
);
2364 int aac_fib_adapter_complete(struct fib
* fibptr
, unsigned short size
);
2365 struct aac_driver_ident
* aac_get_driver_ident(int devtype
);
2366 int aac_get_adapter_info(struct aac_dev
* dev
);
2367 int aac_send_shutdown(struct aac_dev
*dev
);
2368 int aac_probe_container(struct aac_dev
*dev
, int cid
);
2369 int _aac_rx_init(struct aac_dev
*dev
);
2370 int aac_rx_select_comm(struct aac_dev
*dev
, int comm
);
2371 int aac_rx_deliver_producer(struct fib
* fib
);
2372 char * get_container_type(unsigned type
);
2374 extern char aac_driver_version
[];
2375 extern int startup_timeout
;
2376 extern int aif_timeout
;
2377 extern int expose_physicals
;
2378 extern int aac_reset_devices
;
2380 extern int aac_commit
;
2381 extern int update_interval
;
2382 extern int check_interval
;
2383 extern int aac_check_reset
;