3 * Linux MegaRAID driver for SAS based RAID controllers
5 * Copyright (c) 2003-2005 LSI Logic Corporation.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
12 * FILE : megaraid_sas.h
15 #ifndef LSI_MEGARAID_SAS_H
16 #define LSI_MEGARAID_SAS_H
19 * MegaRAID SAS Driver meta data
21 #define MEGASAS_VERSION "00.00.03.01"
22 #define MEGASAS_RELDATE "May 14, 2006"
23 #define MEGASAS_EXT_VERSION "Sun May 14 22:49:52 PDT 2006"
28 #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060
29 #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413
32 * =====================================
33 * MegaRAID SAS MFI firmware definitions
34 * =====================================
38 * MFI stands for MegaRAID SAS FW Interface. This is just a moniker for
39 * protocol between the software and firmware. Commands are issued using
44 * FW posts its state in upper 4 bits of outbound_msg_0 register
46 #define MFI_STATE_MASK 0xF0000000
47 #define MFI_STATE_UNDEFINED 0x00000000
48 #define MFI_STATE_BB_INIT 0x10000000
49 #define MFI_STATE_FW_INIT 0x40000000
50 #define MFI_STATE_WAIT_HANDSHAKE 0x60000000
51 #define MFI_STATE_FW_INIT_2 0x70000000
52 #define MFI_STATE_DEVICE_SCAN 0x80000000
53 #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000
54 #define MFI_STATE_FLUSH_CACHE 0xA0000000
55 #define MFI_STATE_READY 0xB0000000
56 #define MFI_STATE_OPERATIONAL 0xC0000000
57 #define MFI_STATE_FAULT 0xF0000000
59 #define MEGAMFI_FRAME_SIZE 64
62 * During FW init, clear pending cmds & reset state using inbound_msg_0
64 * ABORT : Abort all pending cmds
65 * READY : Move from OPERATIONAL to READY state; discard queue info
66 * MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??)
67 * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver
68 * HOTPLUG : Resume from Hotplug
69 * MFI_STOP_ADP : Send signal to FW to stop processing
71 #define MFI_INIT_ABORT 0x00000001
72 #define MFI_INIT_READY 0x00000002
73 #define MFI_INIT_MFIMODE 0x00000004
74 #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
75 #define MFI_INIT_HOTPLUG 0x00000010
76 #define MFI_STOP_ADP 0x00000020
77 #define MFI_RESET_FLAGS MFI_INIT_READY| \
84 #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000
85 #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001
86 #define MFI_FRAME_SGL32 0x0000
87 #define MFI_FRAME_SGL64 0x0002
88 #define MFI_FRAME_SENSE32 0x0000
89 #define MFI_FRAME_SENSE64 0x0004
90 #define MFI_FRAME_DIR_NONE 0x0000
91 #define MFI_FRAME_DIR_WRITE 0x0008
92 #define MFI_FRAME_DIR_READ 0x0010
93 #define MFI_FRAME_DIR_BOTH 0x0018
96 * Definition for cmd_status
98 #define MFI_CMD_STATUS_POLL_MODE 0xFF
101 * MFI command opcodes
103 #define MFI_CMD_INIT 0x00
104 #define MFI_CMD_LD_READ 0x01
105 #define MFI_CMD_LD_WRITE 0x02
106 #define MFI_CMD_LD_SCSI_IO 0x03
107 #define MFI_CMD_PD_SCSI_IO 0x04
108 #define MFI_CMD_DCMD 0x05
109 #define MFI_CMD_ABORT 0x06
110 #define MFI_CMD_SMP 0x07
111 #define MFI_CMD_STP 0x08
113 #define MR_DCMD_CTRL_GET_INFO 0x01010000
115 #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000
116 #define MR_FLUSH_CTRL_CACHE 0x01
117 #define MR_FLUSH_DISK_CACHE 0x02
119 #define MR_DCMD_CTRL_SHUTDOWN 0x01050000
120 #define MR_ENABLE_DRIVE_SPINDOWN 0x01
122 #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100
123 #define MR_DCMD_CTRL_EVENT_GET 0x01040300
124 #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500
125 #define MR_DCMD_LD_GET_PROPERTIES 0x03030000
127 #define MR_DCMD_CLUSTER 0x08000000
128 #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100
129 #define MR_DCMD_CLUSTER_RESET_LD 0x08010200
132 * MFI command completion codes
136 MFI_STAT_INVALID_CMD = 0x01,
137 MFI_STAT_INVALID_DCMD = 0x02,
138 MFI_STAT_INVALID_PARAMETER = 0x03,
139 MFI_STAT_INVALID_SEQUENCE_NUMBER = 0x04,
140 MFI_STAT_ABORT_NOT_POSSIBLE = 0x05,
141 MFI_STAT_APP_HOST_CODE_NOT_FOUND = 0x06,
142 MFI_STAT_APP_IN_USE = 0x07,
143 MFI_STAT_APP_NOT_INITIALIZED = 0x08,
144 MFI_STAT_ARRAY_INDEX_INVALID = 0x09,
145 MFI_STAT_ARRAY_ROW_NOT_EMPTY = 0x0a,
146 MFI_STAT_CONFIG_RESOURCE_CONFLICT = 0x0b,
147 MFI_STAT_DEVICE_NOT_FOUND = 0x0c,
148 MFI_STAT_DRIVE_TOO_SMALL = 0x0d,
149 MFI_STAT_FLASH_ALLOC_FAIL = 0x0e,
150 MFI_STAT_FLASH_BUSY = 0x0f,
151 MFI_STAT_FLASH_ERROR = 0x10,
152 MFI_STAT_FLASH_IMAGE_BAD = 0x11,
153 MFI_STAT_FLASH_IMAGE_INCOMPLETE = 0x12,
154 MFI_STAT_FLASH_NOT_OPEN = 0x13,
155 MFI_STAT_FLASH_NOT_STARTED = 0x14,
156 MFI_STAT_FLUSH_FAILED = 0x15,
157 MFI_STAT_HOST_CODE_NOT_FOUNT = 0x16,
158 MFI_STAT_LD_CC_IN_PROGRESS = 0x17,
159 MFI_STAT_LD_INIT_IN_PROGRESS = 0x18,
160 MFI_STAT_LD_LBA_OUT_OF_RANGE = 0x19,
161 MFI_STAT_LD_MAX_CONFIGURED = 0x1a,
162 MFI_STAT_LD_NOT_OPTIMAL = 0x1b,
163 MFI_STAT_LD_RBLD_IN_PROGRESS = 0x1c,
164 MFI_STAT_LD_RECON_IN_PROGRESS = 0x1d,
165 MFI_STAT_LD_WRONG_RAID_LEVEL = 0x1e,
166 MFI_STAT_MAX_SPARES_EXCEEDED = 0x1f,
167 MFI_STAT_MEMORY_NOT_AVAILABLE = 0x20,
168 MFI_STAT_MFC_HW_ERROR = 0x21,
169 MFI_STAT_NO_HW_PRESENT = 0x22,
170 MFI_STAT_NOT_FOUND = 0x23,
171 MFI_STAT_NOT_IN_ENCL = 0x24,
172 MFI_STAT_PD_CLEAR_IN_PROGRESS = 0x25,
173 MFI_STAT_PD_TYPE_WRONG = 0x26,
174 MFI_STAT_PR_DISABLED = 0x27,
175 MFI_STAT_ROW_INDEX_INVALID = 0x28,
176 MFI_STAT_SAS_CONFIG_INVALID_ACTION = 0x29,
177 MFI_STAT_SAS_CONFIG_INVALID_DATA = 0x2a,
178 MFI_STAT_SAS_CONFIG_INVALID_PAGE = 0x2b,
179 MFI_STAT_SAS_CONFIG_INVALID_TYPE = 0x2c,
180 MFI_STAT_SCSI_DONE_WITH_ERROR = 0x2d,
181 MFI_STAT_SCSI_IO_FAILED = 0x2e,
182 MFI_STAT_SCSI_RESERVATION_CONFLICT = 0x2f,
183 MFI_STAT_SHUTDOWN_FAILED = 0x30,
184 MFI_STAT_TIME_NOT_SET = 0x31,
185 MFI_STAT_WRONG_STATE = 0x32,
186 MFI_STAT_LD_OFFLINE = 0x33,
187 MFI_STAT_PEER_NOTIFICATION_REJECTED = 0x34,
188 MFI_STAT_PEER_NOTIFICATION_FAILED = 0x35,
189 MFI_STAT_RESERVATION_IN_PROGRESS = 0x36,
190 MFI_STAT_I2C_ERRORS_DETECTED = 0x37,
191 MFI_STAT_PCI_ERRORS_DETECTED = 0x38,
193 MFI_STAT_INVALID_STATUS = 0xFF
197 * Number of mailbox bytes in DCMD message frame
199 #define MFI_MBOX_SIZE 12
203 MR_EVT_CLASS_DEBUG = -2,
204 MR_EVT_CLASS_PROGRESS = -1,
205 MR_EVT_CLASS_INFO = 0,
206 MR_EVT_CLASS_WARNING = 1,
207 MR_EVT_CLASS_CRITICAL = 2,
208 MR_EVT_CLASS_FATAL = 3,
209 MR_EVT_CLASS_DEAD = 4,
215 MR_EVT_LOCALE_LD = 0x0001,
216 MR_EVT_LOCALE_PD = 0x0002,
217 MR_EVT_LOCALE_ENCL = 0x0004,
218 MR_EVT_LOCALE_BBU = 0x0008,
219 MR_EVT_LOCALE_SAS = 0x0010,
220 MR_EVT_LOCALE_CTRL = 0x0020,
221 MR_EVT_LOCALE_CONFIG = 0x0040,
222 MR_EVT_LOCALE_CLUSTER = 0x0080,
223 MR_EVT_LOCALE_ALL = 0xffff,
230 MR_EVT_ARGS_CDB_SENSE,
232 MR_EVT_ARGS_LD_COUNT,
234 MR_EVT_ARGS_LD_OWNER,
235 MR_EVT_ARGS_LD_LBA_PD_LBA,
237 MR_EVT_ARGS_LD_STATE,
238 MR_EVT_ARGS_LD_STRIP,
242 MR_EVT_ARGS_PD_LBA_LD,
244 MR_EVT_ARGS_PD_STATE,
254 * SAS controller properties
256 struct megasas_ctrl_prop {
259 u16 pred_fail_poll_interval;
260 u16 intr_throttle_count;
261 u16 intr_throttle_timeouts;
267 u8 cache_flush_interval;
273 u8 disable_auto_rebuild;
274 u8 disable_battery_warn;
276 u16 ecc_bucket_leak_rate;
277 u8 restore_hotspare_on_insertion;
278 u8 expose_encl_devices;
281 } __attribute__ ((packed));
284 * SAS controller information
286 struct megasas_ctrl_info {
289 * PCI device information
299 } __attribute__ ((packed)) pci;
302 * Host interface information
315 } __attribute__ ((packed)) host_interface;
318 * Device (backend) interface information
331 } __attribute__ ((packed)) device_interface;
334 * List of components residing in flash. All str are null terminated
336 u32 image_check_word;
337 u32 image_component_count;
346 } __attribute__ ((packed)) image_component[8];
349 * List of flash components that have been flashed on the card, but
350 * are not in use, pending reset of the adapter. This list will be
351 * empty if a flash operation has not occurred. All stings are null
354 u32 pending_image_component_count;
363 } __attribute__ ((packed)) pending_image_component[8];
370 char product_name[80];
374 * Other physical/controller/operation information. Indicates the
375 * presence of the hardware
385 } __attribute__ ((packed)) hw_present;
390 * Maximum data transfer sizes
392 u16 max_concurrent_cmds;
394 u32 max_request_size;
397 * Logical and physical device counts
399 u16 ld_present_count;
400 u16 ld_degraded_count;
401 u16 ld_offline_count;
403 u16 pd_present_count;
404 u16 pd_disk_present_count;
405 u16 pd_disk_pred_failure_count;
406 u16 pd_disk_failed_count;
409 * Memory size information
418 u16 mem_correctable_error_count;
419 u16 mem_uncorrectable_error_count;
422 * Cluster information
424 u8 cluster_permitted;
428 * Additional max data transfer sizes
430 u16 max_strips_per_io;
433 * Controller capabilities structures
444 } __attribute__ ((packed)) raid_levels;
454 u32 cluster_supported:1;
456 u32 spanning_allowed:1;
457 u32 dedicated_hotspares:1;
458 u32 revertible_hotspares:1;
459 u32 foreign_config_import:1;
460 u32 self_diagnostic:1;
461 u32 mixed_redundancy_arr:1;
462 u32 global_hot_spares:1;
465 } __attribute__ ((packed)) adapter_operations;
473 u32 disk_cache_policy:1;
476 } __attribute__ ((packed)) ld_operations;
484 } __attribute__ ((packed)) stripe_sz_ops;
493 } __attribute__ ((packed)) pd_operations;
497 u32 ctrl_supports_sas:1;
498 u32 ctrl_supports_sata:1;
499 u32 allow_mix_in_encl:1;
500 u32 allow_mix_in_ld:1;
501 u32 allow_sata_in_cluster:1;
504 } __attribute__ ((packed)) pd_mix_support;
507 * Define ECC single-bit-error bucket information
513 * Include the controller properties (changeable items)
515 struct megasas_ctrl_prop properties;
518 * Define FW pkg version (set in envt v'bles on OEM basis)
520 char package_version[0x60];
522 u8 pad[0x800 - 0x6a0];
524 } __attribute__ ((packed));
527 * ===============================
528 * MegaRAID SAS driver definitions
529 * ===============================
531 #define MEGASAS_MAX_PD_CHANNELS 2
532 #define MEGASAS_MAX_LD_CHANNELS 2
533 #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \
534 MEGASAS_MAX_LD_CHANNELS)
535 #define MEGASAS_MAX_DEV_PER_CHANNEL 128
536 #define MEGASAS_DEFAULT_INIT_ID -1
537 #define MEGASAS_MAX_LUN 8
538 #define MEGASAS_MAX_LD 64
541 * When SCSI mid-layer calls driver's reset routine, driver waits for
542 * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note
543 * that the driver cannot _actually_ abort or reset pending commands. While
544 * it is waiting for the commands to complete, it prints a diagnostic message
545 * every MEGASAS_RESET_NOTICE_INTERVAL seconds
547 #define MEGASAS_RESET_WAIT_TIME 180
548 #define MEGASAS_RESET_NOTICE_INTERVAL 5
550 #define MEGASAS_IOCTL_CMD 0
553 * FW reports the maximum of number of commands that it can accept (maximum
554 * commands that can be outstanding) at any time. The driver must report a
555 * lower number to the mid layer because it can issue a few internal commands
556 * itself (E.g, AEN, abort cmd, IOCTLs etc). The number of commands it needs
559 #define MEGASAS_INT_CMDS 32
562 * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit
563 * SGLs based on the size of dma_addr_t
565 #define IS_DMA64 (sizeof(dma_addr_t) == 8)
567 #define MFI_OB_INTR_STATUS_MASK 0x00000002
568 #define MFI_POLL_TIMEOUT_SECS 10
570 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
573 * register set for both 1068 and 1078 controllers
574 * structure extended for 1078 registers
577 struct megasas_register_set {
578 u32 reserved_0[4]; /*0000h*/
580 u32 inbound_msg_0; /*0010h*/
581 u32 inbound_msg_1; /*0014h*/
582 u32 outbound_msg_0; /*0018h*/
583 u32 outbound_msg_1; /*001Ch*/
585 u32 inbound_doorbell; /*0020h*/
586 u32 inbound_intr_status; /*0024h*/
587 u32 inbound_intr_mask; /*0028h*/
589 u32 outbound_doorbell; /*002Ch*/
590 u32 outbound_intr_status; /*0030h*/
591 u32 outbound_intr_mask; /*0034h*/
593 u32 reserved_1[2]; /*0038h*/
595 u32 inbound_queue_port; /*0040h*/
596 u32 outbound_queue_port; /*0044h*/
598 u32 reserved_2[22]; /*0048h*/
600 u32 outbound_doorbell_clear; /*00A0h*/
602 u32 reserved_3[3]; /*00A4h*/
604 u32 outbound_scratch_pad ; /*00B0h*/
606 u32 reserved_4[3]; /*00B4h*/
608 u32 inbound_low_queue_port ; /*00C0h*/
610 u32 inbound_high_queue_port ; /*00C4h*/
612 u32 reserved_5; /*00C8h*/
613 u32 index_registers[820]; /*00CCh*/
615 } __attribute__ ((packed));
617 struct megasas_sge32 {
622 } __attribute__ ((packed));
624 struct megasas_sge64 {
629 } __attribute__ ((packed));
633 struct megasas_sge32 sge32[1];
634 struct megasas_sge64 sge64[1];
636 } __attribute__ ((packed));
638 struct megasas_header {
641 u8 sense_len; /*01h */
642 u8 cmd_status; /*02h */
643 u8 scsi_status; /*03h */
645 u8 target_id; /*04h */
648 u8 sge_count; /*07h */
650 u32 context; /*08h */
654 u16 timeout; /*12h */
655 u32 data_xferlen; /*14h */
657 } __attribute__ ((packed));
659 union megasas_sgl_frame {
661 struct megasas_sge32 sge32[8];
662 struct megasas_sge64 sge64[5];
664 } __attribute__ ((packed));
666 struct megasas_init_frame {
669 u8 reserved_0; /*01h */
670 u8 cmd_status; /*02h */
672 u8 reserved_1; /*03h */
673 u32 reserved_2; /*04h */
675 u32 context; /*08h */
679 u16 reserved_3; /*12h */
680 u32 data_xfer_len; /*14h */
682 u32 queue_info_new_phys_addr_lo; /*18h */
683 u32 queue_info_new_phys_addr_hi; /*1Ch */
684 u32 queue_info_old_phys_addr_lo; /*20h */
685 u32 queue_info_old_phys_addr_hi; /*24h */
687 u32 reserved_4[6]; /*28h */
689 } __attribute__ ((packed));
691 struct megasas_init_queue_info {
693 u32 init_flags; /*00h */
694 u32 reply_queue_entries; /*04h */
696 u32 reply_queue_start_phys_addr_lo; /*08h */
697 u32 reply_queue_start_phys_addr_hi; /*0Ch */
698 u32 producer_index_phys_addr_lo; /*10h */
699 u32 producer_index_phys_addr_hi; /*14h */
700 u32 consumer_index_phys_addr_lo; /*18h */
701 u32 consumer_index_phys_addr_hi; /*1Ch */
703 } __attribute__ ((packed));
705 struct megasas_io_frame {
708 u8 sense_len; /*01h */
709 u8 cmd_status; /*02h */
710 u8 scsi_status; /*03h */
712 u8 target_id; /*04h */
713 u8 access_byte; /*05h */
714 u8 reserved_0; /*06h */
715 u8 sge_count; /*07h */
717 u32 context; /*08h */
721 u16 timeout; /*12h */
722 u32 lba_count; /*14h */
724 u32 sense_buf_phys_addr_lo; /*18h */
725 u32 sense_buf_phys_addr_hi; /*1Ch */
727 u32 start_lba_lo; /*20h */
728 u32 start_lba_hi; /*24h */
730 union megasas_sgl sgl; /*28h */
732 } __attribute__ ((packed));
734 struct megasas_pthru_frame {
737 u8 sense_len; /*01h */
738 u8 cmd_status; /*02h */
739 u8 scsi_status; /*03h */
741 u8 target_id; /*04h */
744 u8 sge_count; /*07h */
746 u32 context; /*08h */
750 u16 timeout; /*12h */
751 u32 data_xfer_len; /*14h */
753 u32 sense_buf_phys_addr_lo; /*18h */
754 u32 sense_buf_phys_addr_hi; /*1Ch */
757 union megasas_sgl sgl; /*30h */
759 } __attribute__ ((packed));
761 struct megasas_dcmd_frame {
764 u8 reserved_0; /*01h */
765 u8 cmd_status; /*02h */
766 u8 reserved_1[4]; /*03h */
767 u8 sge_count; /*07h */
769 u32 context; /*08h */
773 u16 timeout; /*12h */
775 u32 data_xfer_len; /*14h */
784 union megasas_sgl sgl; /*28h */
786 } __attribute__ ((packed));
788 struct megasas_abort_frame {
791 u8 reserved_0; /*01h */
792 u8 cmd_status; /*02h */
794 u8 reserved_1; /*03h */
795 u32 reserved_2; /*04h */
797 u32 context; /*08h */
801 u16 reserved_3; /*12h */
802 u32 reserved_4; /*14h */
804 u32 abort_context; /*18h */
807 u32 abort_mfi_phys_addr_lo; /*20h */
808 u32 abort_mfi_phys_addr_hi; /*24h */
810 u32 reserved_5[6]; /*28h */
812 } __attribute__ ((packed));
814 struct megasas_smp_frame {
817 u8 reserved_1; /*01h */
818 u8 cmd_status; /*02h */
819 u8 connection_status; /*03h */
821 u8 reserved_2[3]; /*04h */
822 u8 sge_count; /*07h */
824 u32 context; /*08h */
828 u16 timeout; /*12h */
830 u32 data_xfer_len; /*14h */
831 u64 sas_addr; /*18h */
834 struct megasas_sge32 sge32[2]; /* [0]: resp [1]: req */
835 struct megasas_sge64 sge64[2]; /* [0]: resp [1]: req */
838 } __attribute__ ((packed));
840 struct megasas_stp_frame {
843 u8 reserved_1; /*01h */
844 u8 cmd_status; /*02h */
845 u8 reserved_2; /*03h */
847 u8 target_id; /*04h */
848 u8 reserved_3[2]; /*05h */
849 u8 sge_count; /*07h */
851 u32 context; /*08h */
855 u16 timeout; /*12h */
857 u32 data_xfer_len; /*14h */
859 u16 fis[10]; /*18h */
863 struct megasas_sge32 sge32[2]; /* [0]: resp [1]: data */
864 struct megasas_sge64 sge64[2]; /* [0]: resp [1]: data */
867 } __attribute__ ((packed));
869 union megasas_frame {
871 struct megasas_header hdr;
872 struct megasas_init_frame init;
873 struct megasas_io_frame io;
874 struct megasas_pthru_frame pthru;
875 struct megasas_dcmd_frame dcmd;
876 struct megasas_abort_frame abort;
877 struct megasas_smp_frame smp;
878 struct megasas_stp_frame stp;
885 union megasas_evt_class_locale {
891 } __attribute__ ((packed)) members;
895 } __attribute__ ((packed));
897 struct megasas_evt_log_info {
901 u32 shutdown_seq_num;
904 } __attribute__ ((packed));
906 struct megasas_progress {
911 } __attribute__ ((packed));
913 struct megasas_evtarg_ld {
919 } __attribute__ ((packed));
921 struct megasas_evtarg_pd {
926 } __attribute__ ((packed));
928 struct megasas_evt_detail {
933 union megasas_evt_class_locale cl;
939 struct megasas_evtarg_pd pd;
945 } __attribute__ ((packed)) cdbSense;
947 struct megasas_evtarg_ld ld;
950 struct megasas_evtarg_ld ld;
952 } __attribute__ ((packed)) ld_count;
956 struct megasas_evtarg_ld ld;
957 } __attribute__ ((packed)) ld_lba;
960 struct megasas_evtarg_ld ld;
963 } __attribute__ ((packed)) ld_owner;
968 struct megasas_evtarg_ld ld;
969 struct megasas_evtarg_pd pd;
970 } __attribute__ ((packed)) ld_lba_pd_lba;
973 struct megasas_evtarg_ld ld;
974 struct megasas_progress prog;
975 } __attribute__ ((packed)) ld_prog;
978 struct megasas_evtarg_ld ld;
981 } __attribute__ ((packed)) ld_state;
985 struct megasas_evtarg_ld ld;
986 } __attribute__ ((packed)) ld_strip;
988 struct megasas_evtarg_pd pd;
991 struct megasas_evtarg_pd pd;
993 } __attribute__ ((packed)) pd_err;
997 struct megasas_evtarg_pd pd;
998 } __attribute__ ((packed)) pd_lba;
1002 struct megasas_evtarg_pd pd;
1003 struct megasas_evtarg_ld ld;
1004 } __attribute__ ((packed)) pd_lba_ld;
1007 struct megasas_evtarg_pd pd;
1008 struct megasas_progress prog;
1009 } __attribute__ ((packed)) pd_prog;
1012 struct megasas_evtarg_pd pd;
1015 } __attribute__ ((packed)) pd_state;
1022 } __attribute__ ((packed)) pci;
1030 } __attribute__ ((packed)) time;
1036 } __attribute__ ((packed)) ecc;
1044 char description[128];
1046 } __attribute__ ((packed));
1048 struct megasas_instance_template {
1049 void (*fire_cmd)(dma_addr_t ,u32 ,struct megasas_register_set __iomem *);
1051 void (*enable_intr)(struct megasas_register_set __iomem *) ;
1052 void (*disable_intr)(struct megasas_register_set __iomem *);
1054 int (*clear_intr)(struct megasas_register_set __iomem *);
1056 u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *);
1059 struct megasas_instance {
1062 dma_addr_t producer_h;
1064 dma_addr_t consumer_h;
1067 dma_addr_t reply_queue_h;
1069 unsigned long base_addr;
1070 struct megasas_register_set __iomem *reg_set;
1077 u32 max_sectors_per_req;
1079 struct megasas_cmd **cmd_list;
1080 struct list_head cmd_pool;
1081 spinlock_t cmd_pool_lock;
1082 struct dma_pool *frame_dma_pool;
1083 struct dma_pool *sense_dma_pool;
1085 struct megasas_evt_detail *evt_detail;
1086 dma_addr_t evt_detail_h;
1087 struct megasas_cmd *aen_cmd;
1088 struct semaphore aen_mutex;
1089 struct semaphore ioctl_sem;
1091 struct Scsi_Host *host;
1093 wait_queue_head_t int_cmd_wait_q;
1094 wait_queue_head_t abort_cmd_wait_q;
1096 struct pci_dev *pdev;
1099 atomic_t fw_outstanding;
1102 struct megasas_instance_template *instancet;
1105 #define MEGASAS_IS_LOGICAL(scp) \
1106 (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
1108 #define MEGASAS_DEV_INDEX(inst, scp) \
1109 ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
1112 struct megasas_cmd {
1114 union megasas_frame *frame;
1115 dma_addr_t frame_phys_addr;
1117 dma_addr_t sense_phys_addr;
1124 struct list_head list;
1125 struct scsi_cmnd *scmd;
1126 struct megasas_instance *instance;
1130 #define MAX_MGMT_ADAPTERS 1024
1131 #define MAX_IOCTL_SGE 16
1133 struct megasas_iocpacket {
1143 struct megasas_header hdr;
1146 struct iovec sgl[MAX_IOCTL_SGE];
1148 } __attribute__ ((packed));
1150 struct megasas_aen {
1154 u32 class_locale_word;
1155 } __attribute__ ((packed));
1157 #ifdef CONFIG_COMPAT
1158 struct compat_megasas_iocpacket {
1167 struct megasas_header hdr;
1169 struct compat_iovec sgl[MAX_IOCTL_SGE];
1170 } __attribute__ ((packed));
1172 #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket)
1175 #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
1176 #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen)
1178 struct megasas_mgmt_info {
1181 struct megasas_instance *instance[MAX_MGMT_ADAPTERS];
1185 #endif /*LSI_MEGARAID_SAS_H */