aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_def.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_def.h')
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h584
1 files changed, 330 insertions, 254 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index b97194096d8e..a29c95204975 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -181,11 +181,14 @@
181#define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/ 181#define RESPONSE_ENTRY_CNT_2100 64 /* Number of response entries.*/
182#define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/ 182#define RESPONSE_ENTRY_CNT_2300 512 /* Number of response entries.*/
183 183
184struct req_que;
185
184/* 186/*
185 * SCSI Request Block 187 * SCSI Request Block
186 */ 188 */
187typedef struct srb { 189typedef struct srb {
188 struct scsi_qla_host *ha; /* HA the SP is queued on */ 190 struct scsi_qla_host *vha; /* HA the SP is queued on */
191 struct req_que *que;
189 struct fc_port *fcport; 192 struct fc_port *fcport;
190 193
191 struct scsi_cmnd *cmd; /* Linux SCSI command pkt */ 194 struct scsi_cmnd *cmd; /* Linux SCSI command pkt */
@@ -369,9 +372,17 @@ struct device_reg_2xxx {
369 } u_end; 372 } u_end;
370}; 373};
371 374
375struct device_reg_25xxmq {
376 volatile uint32_t req_q_in;
377 volatile uint32_t req_q_out;
378 volatile uint32_t rsp_q_in;
379 volatile uint32_t rsp_q_out;
380};
381
372typedef union { 382typedef union {
373 struct device_reg_2xxx isp; 383 struct device_reg_2xxx isp;
374 struct device_reg_24xx isp24; 384 struct device_reg_24xx isp24;
385 struct device_reg_25xxmq isp25mq;
375} device_reg_t; 386} device_reg_t;
376 387
377#define ISP_REQ_Q_IN(ha, reg) \ 388#define ISP_REQ_Q_IN(ha, reg) \
@@ -1524,7 +1535,7 @@ typedef struct {
1524 */ 1535 */
1525typedef struct fc_port { 1536typedef struct fc_port {
1526 struct list_head list; 1537 struct list_head list;
1527 struct scsi_qla_host *ha; 1538 struct scsi_qla_host *vha;
1528 1539
1529 uint8_t node_name[WWN_SIZE]; 1540 uint8_t node_name[WWN_SIZE];
1530 uint8_t port_name[WWN_SIZE]; 1541 uint8_t port_name[WWN_SIZE];
@@ -1550,7 +1561,6 @@ typedef struct fc_port {
1550 unsigned long last_queue_full; 1561 unsigned long last_queue_full;
1551 unsigned long last_ramp_up; 1562 unsigned long last_ramp_up;
1552 1563
1553 struct list_head vp_fcport;
1554 uint16_t vp_idx; 1564 uint16_t vp_idx;
1555} fc_port_t; 1565} fc_port_t;
1556 1566
@@ -2037,6 +2047,8 @@ typedef struct vport_params {
2037#define VP_RET_CODE_NO_MEM 5 2047#define VP_RET_CODE_NO_MEM 5
2038#define VP_RET_CODE_NOT_FOUND 6 2048#define VP_RET_CODE_NOT_FOUND 6
2039 2049
2050struct qla_hw_data;
2051
2040/* 2052/*
2041 * ISP operations 2053 * ISP operations
2042 */ 2054 */
@@ -2055,10 +2067,11 @@ struct isp_operations {
2055 char * (*fw_version_str) (struct scsi_qla_host *, char *); 2067 char * (*fw_version_str) (struct scsi_qla_host *, char *);
2056 2068
2057 irq_handler_t intr_handler; 2069 irq_handler_t intr_handler;
2058 void (*enable_intrs) (struct scsi_qla_host *); 2070 void (*enable_intrs) (struct qla_hw_data *);
2059 void (*disable_intrs) (struct scsi_qla_host *); 2071 void (*disable_intrs) (struct qla_hw_data *);
2060 2072
2061 int (*abort_command) (struct scsi_qla_host *, srb_t *); 2073 int (*abort_command) (struct scsi_qla_host *, srb_t *,
2074 struct req_que *);
2062 int (*target_reset) (struct fc_port *, unsigned int); 2075 int (*target_reset) (struct fc_port *, unsigned int);
2063 int (*lun_reset) (struct fc_port *, unsigned int); 2076 int (*lun_reset) (struct fc_port *, unsigned int);
2064 int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t, 2077 int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t,
@@ -2089,6 +2102,10 @@ struct isp_operations {
2089 uint32_t); 2102 uint32_t);
2090 2103
2091 int (*get_flash_version) (struct scsi_qla_host *, void *); 2104 int (*get_flash_version) (struct scsi_qla_host *, void *);
2105 int (*start_scsi) (srb_t *);
2106 void (*wrt_req_reg) (struct qla_hw_data *, uint16_t, uint16_t);
2107 void (*wrt_rsp_reg) (struct qla_hw_data *, uint16_t, uint16_t);
2108 uint16_t (*rd_req_reg) (struct qla_hw_data *, uint16_t);
2092}; 2109};
2093 2110
2094/* MSI-X Support *************************************************************/ 2111/* MSI-X Support *************************************************************/
@@ -2100,16 +2117,18 @@ struct isp_operations {
2100#define QLA_MSIX_DEFAULT 0x00 2117#define QLA_MSIX_DEFAULT 0x00
2101#define QLA_MSIX_RSP_Q 0x01 2118#define QLA_MSIX_RSP_Q 0x01
2102 2119
2103#define QLA_MSIX_ENTRIES 2
2104#define QLA_MIDX_DEFAULT 0 2120#define QLA_MIDX_DEFAULT 0
2105#define QLA_MIDX_RSP_Q 1 2121#define QLA_MIDX_RSP_Q 1
2122#define QLA_PCI_MSIX_CONTROL 0xa2
2106 2123
2107struct scsi_qla_host; 2124struct scsi_qla_host;
2125struct rsp_que;
2108 2126
2109struct qla_msix_entry { 2127struct qla_msix_entry {
2110 int have_irq; 2128 int have_irq;
2111 uint32_t msix_vector; 2129 uint32_t vector;
2112 uint16_t msix_entry; 2130 uint16_t entry;
2131 struct rsp_que *rsp;
2113}; 2132};
2114 2133
2115#define WATCH_INTERVAL 1 /* number of seconds */ 2134#define WATCH_INTERVAL 1 /* number of seconds */
@@ -2160,208 +2179,137 @@ struct qla_statistics {
2160 uint64_t output_bytes; 2179 uint64_t output_bytes;
2161}; 2180};
2162 2181
2163/* 2182/* Multi queue support */
2164 * Linux Host Adapter structure 2183#define MBC_INITIALIZE_MULTIQ 0x1f
2165 */ 2184#define QLA_QUE_PAGE 0X1000
2166typedef struct scsi_qla_host { 2185#define QLA_MQ_SIZE 32
2167 struct list_head list; 2186#define QLA_MAX_HOST_QUES 16
2187#define QLA_MAX_QUEUES 256
2188#define ISP_QUE_REG(ha, id) \
2189 ((ha->mqenable) ? \
2190 ((void *)(ha->mqiobase) +\
2191 (QLA_QUE_PAGE * id)) :\
2192 ((void *)(ha->iobase)))
2193#define QLA_REQ_QUE_ID(tag) \
2194 ((tag < QLA_MAX_QUEUES && tag > 0) ? tag : 0)
2195#define QLA_DEFAULT_QUE_QOS 5
2196#define QLA_PRECONFIG_VPORTS 32
2197#define QLA_MAX_VPORTS_QLA24XX 128
2198#define QLA_MAX_VPORTS_QLA25XX 256
2199/* Response queue data structure */
2200struct rsp_que {
2201 dma_addr_t dma;
2202 response_t *ring;
2203 response_t *ring_ptr;
2204 uint16_t ring_index;
2205 uint16_t out_ptr;
2206 uint16_t length;
2207 uint16_t options;
2208 uint16_t rid;
2209 uint16_t id;
2210 uint16_t vp_idx;
2211 struct qla_hw_data *hw;
2212 struct qla_msix_entry *msix;
2213 struct req_que *req;
2214};
2168 2215
2169 /* Commonly used flags and state information. */ 2216/* Request queue data structure */
2170 struct Scsi_Host *host; 2217struct req_que {
2171 struct pci_dev *pdev; 2218 dma_addr_t dma;
2219 request_t *ring;
2220 request_t *ring_ptr;
2221 uint16_t ring_index;
2222 uint16_t in_ptr;
2223 uint16_t cnt;
2224 uint16_t length;
2225 uint16_t options;
2226 uint16_t rid;
2227 uint16_t id;
2228 uint16_t qos;
2229 uint16_t vp_idx;
2230 struct rsp_que *rsp;
2231 srb_t *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
2232 uint32_t current_outstanding_cmd;
2233 int max_q_depth;
2234};
2172 2235
2173 unsigned long host_no; 2236/*
2237 * Qlogic host adapter specific data structure.
2238*/
2239struct qla_hw_data {
2240 struct pci_dev *pdev;
2241 /* SRB cache. */
2242#define SRB_MIN_REQ 128
2243 mempool_t *srb_mempool;
2174 2244
2175 volatile struct { 2245 volatile struct {
2176 uint32_t init_done :1;
2177 uint32_t online :1;
2178 uint32_t mbox_int :1; 2246 uint32_t mbox_int :1;
2179 uint32_t mbox_busy :1; 2247 uint32_t mbox_busy :1;
2180 uint32_t rscn_queue_overflow :1;
2181 uint32_t reset_active :1;
2182
2183 uint32_t management_server_logged_in :1;
2184 uint32_t process_response_queue :1;
2185 2248
2186 uint32_t disable_risc_code_load :1; 2249 uint32_t disable_risc_code_load :1;
2187 uint32_t enable_64bit_addressing :1; 2250 uint32_t enable_64bit_addressing :1;
2188 uint32_t enable_lip_reset :1; 2251 uint32_t enable_lip_reset :1;
2189 uint32_t enable_lip_full_login :1;
2190 uint32_t enable_target_reset :1; 2252 uint32_t enable_target_reset :1;
2253 uint32_t enable_lip_full_login :1;
2191 uint32_t enable_led_scheme :1; 2254 uint32_t enable_led_scheme :1;
2192 uint32_t inta_enabled :1; 2255 uint32_t inta_enabled :1;
2193 uint32_t msi_enabled :1; 2256 uint32_t msi_enabled :1;
2194 uint32_t msix_enabled :1; 2257 uint32_t msix_enabled :1;
2195 uint32_t disable_serdes :1; 2258 uint32_t disable_serdes :1;
2196 uint32_t gpsc_supported :1; 2259 uint32_t gpsc_supported :1;
2197 uint32_t vsan_enabled :1; 2260 uint32_t vsan_enabled :1;
2198 uint32_t npiv_supported :1; 2261 uint32_t npiv_supported :1;
2199 uint32_t fce_enabled :1; 2262 uint32_t fce_enabled :1;
2200 uint32_t hw_event_marker_found :1; 2263 uint32_t hw_event_marker_found:1;
2201 } flags; 2264 } flags;
2202 2265
2203 atomic_t loop_state;
2204#define LOOP_TIMEOUT 1
2205#define LOOP_DOWN 2
2206#define LOOP_UP 3
2207#define LOOP_UPDATE 4
2208#define LOOP_READY 5
2209#define LOOP_DEAD 6
2210
2211 unsigned long dpc_flags;
2212#define RESET_MARKER_NEEDED 0 /* Send marker to ISP. */
2213#define RESET_ACTIVE 1
2214#define ISP_ABORT_NEEDED 2 /* Initiate ISP abort. */
2215#define ABORT_ISP_ACTIVE 3 /* ISP abort in progress. */
2216#define LOOP_RESYNC_NEEDED 4 /* Device Resync needed. */
2217#define LOOP_RESYNC_ACTIVE 5
2218#define LOCAL_LOOP_UPDATE 6 /* Perform a local loop update. */
2219#define RSCN_UPDATE 7 /* Perform an RSCN update. */
2220#define MAILBOX_RETRY 8
2221#define ISP_RESET_NEEDED 9 /* Initiate a ISP reset. */
2222#define FAILOVER_EVENT_NEEDED 10
2223#define FAILOVER_EVENT 11
2224#define FAILOVER_NEEDED 12
2225#define SCSI_RESTART_NEEDED 13 /* Processes SCSI retry queue. */
2226#define PORT_RESTART_NEEDED 14 /* Processes Retry queue. */
2227#define RESTART_QUEUES_NEEDED 15 /* Restarts the Lun queue. */
2228#define ABORT_QUEUES_NEEDED 16
2229#define RELOGIN_NEEDED 17
2230#define LOGIN_RETRY_NEEDED 18 /* Initiate required fabric logins. */
2231#define REGISTER_FC4_NEEDED 19 /* SNS FC4 registration required. */
2232#define ISP_ABORT_RETRY 20 /* ISP aborted. */
2233#define FCPORT_RESCAN_NEEDED 21 /* IO descriptor processing needed */
2234#define IODESC_PROCESS_NEEDED 22 /* IO descriptor processing needed */
2235#define IOCTL_ERROR_RECOVERY 23
2236#define LOOP_RESET_NEEDED 24
2237#define BEACON_BLINK_NEEDED 25
2238#define REGISTER_FDMI_NEEDED 26
2239#define FCPORT_UPDATE_NEEDED 27
2240#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */
2241#define UNLOADING 29
2242#define NPIV_CONFIG_NEEDED 30
2243
2244 uint32_t device_flags;
2245#define DFLG_LOCAL_DEVICES BIT_0
2246#define DFLG_RETRY_LOCAL_DEVICES BIT_1
2247#define DFLG_FABRIC_DEVICES BIT_2
2248#define SWITCH_FOUND BIT_3
2249#define DFLG_NO_CABLE BIT_4
2250
2251#define PCI_DEVICE_ID_QLOGIC_ISP2532 0x2532
2252#define PCI_DEVICE_ID_QLOGIC_ISP8432 0x8432
2253 uint32_t device_type;
2254#define DT_ISP2100 BIT_0
2255#define DT_ISP2200 BIT_1
2256#define DT_ISP2300 BIT_2
2257#define DT_ISP2312 BIT_3
2258#define DT_ISP2322 BIT_4
2259#define DT_ISP6312 BIT_5
2260#define DT_ISP6322 BIT_6
2261#define DT_ISP2422 BIT_7
2262#define DT_ISP2432 BIT_8
2263#define DT_ISP5422 BIT_9
2264#define DT_ISP5432 BIT_10
2265#define DT_ISP2532 BIT_11
2266#define DT_ISP8432 BIT_12
2267#define DT_ISP_LAST (DT_ISP8432 << 1)
2268
2269#define DT_IIDMA BIT_26
2270#define DT_FWI2 BIT_27
2271#define DT_ZIO_SUPPORTED BIT_28
2272#define DT_OEM_001 BIT_29
2273#define DT_ISP2200A BIT_30
2274#define DT_EXTENDED_IDS BIT_31
2275
2276#define DT_MASK(ha) ((ha)->device_type & (DT_ISP_LAST - 1))
2277#define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100)
2278#define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200)
2279#define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300)
2280#define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312)
2281#define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322)
2282#define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312)
2283#define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322)
2284#define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422)
2285#define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432)
2286#define IS_QLA5422(ha) (DT_MASK(ha) & DT_ISP5422)
2287#define IS_QLA5432(ha) (DT_MASK(ha) & DT_ISP5432)
2288#define IS_QLA2532(ha) (DT_MASK(ha) & DT_ISP2532)
2289#define IS_QLA8432(ha) (DT_MASK(ha) & DT_ISP8432)
2290
2291#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
2292 IS_QLA6312(ha) || IS_QLA6322(ha))
2293#define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
2294#define IS_QLA54XX(ha) (IS_QLA5422(ha) || IS_QLA5432(ha))
2295#define IS_QLA25XX(ha) (IS_QLA2532(ha))
2296#define IS_QLA84XX(ha) (IS_QLA8432(ha))
2297#define IS_QLA24XX_TYPE(ha) (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
2298 IS_QLA84XX(ha))
2299
2300#define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA)
2301#define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2)
2302#define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED)
2303#define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001)
2304#define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS)
2305
2306 /* SRB cache. */
2307#define SRB_MIN_REQ 128
2308 mempool_t *srb_mempool;
2309
2310 /* This spinlock is used to protect "io transactions", you must 2266 /* This spinlock is used to protect "io transactions", you must
2311 * acquire it before doing any IO to the card, eg with RD_REG*() and 2267 * acquire it before doing any IO to the card, eg with RD_REG*() and
2312 * WRT_REG*() for the duration of your entire commandtransaction. 2268 * WRT_REG*() for the duration of your entire commandtransaction.
2313 * 2269 *
2314 * This spinlock is of lower priority than the io request lock. 2270 * This spinlock is of lower priority than the io request lock.
2315 */ 2271 */
2316
2317 spinlock_t hardware_lock ____cacheline_aligned;
2318 2272
2273 spinlock_t hardware_lock ____cacheline_aligned;
2319 int bars; 2274 int bars;
2320 int mem_only; 2275 int mem_only;
2321 device_reg_t __iomem *iobase; /* Base I/O address */ 2276 device_reg_t __iomem *iobase; /* Base I/O address */
2322 resource_size_t pio_address; 2277 resource_size_t pio_address;
2323#define MIN_IOBASE_LEN 0x100
2324
2325 /* ISP ring lock, rings, and indexes */
2326 dma_addr_t request_dma; /* Physical address. */
2327 request_t *request_ring; /* Base virtual address */
2328 request_t *request_ring_ptr; /* Current address. */
2329 uint16_t req_ring_index; /* Current index. */
2330 uint16_t req_q_cnt; /* Number of available entries. */
2331 uint16_t request_q_length;
2332
2333 dma_addr_t response_dma; /* Physical address. */
2334 response_t *response_ring; /* Base virtual address */
2335 response_t *response_ring_ptr; /* Current address. */
2336 uint16_t rsp_ring_index; /* Current index. */
2337 uint16_t response_q_length;
2338
2339 struct isp_operations *isp_ops;
2340 2278
2341 /* Outstandings ISP commands. */ 2279#define MIN_IOBASE_LEN 0x100
2342 srb_t *outstanding_cmds[MAX_OUTSTANDING_COMMANDS]; 2280/* Multi queue data structs */
2343 uint32_t current_outstanding_cmd; 2281 device_reg_t *mqiobase;
2344 srb_t *status_srb; /* Status continuation entry. */ 2282 uint16_t msix_count;
2283 uint8_t mqenable;
2284 struct req_que **req_q_map;
2285 struct rsp_que **rsp_q_map;
2286 unsigned long req_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
2287 unsigned long rsp_qid_map[(QLA_MAX_QUEUES / 8) / sizeof(unsigned long)];
2288 uint16_t max_queues;
2289 struct qla_npiv_entry *npiv_info;
2290 uint16_t nvram_npiv_size;
2291
2292 uint16_t switch_cap;
2293#define FLOGI_SEQ_DEL BIT_8
2294#define FLOGI_MID_SUPPORT BIT_10
2295#define FLOGI_VSAN_SUPPORT BIT_12
2296#define FLOGI_SP_SUPPORT BIT_13
2297 /* Timeout timers. */
2298 uint8_t loop_down_abort_time; /* port down timer */
2299 atomic_t loop_down_timer; /* loop down timer */
2300 uint8_t link_down_timeout; /* link down timeout */
2301 uint16_t max_loop_id;
2345 2302
2346 /* ISP configuration data. */
2347 uint16_t loop_id; /* Host adapter loop id */
2348 uint16_t switch_cap;
2349#define FLOGI_SEQ_DEL BIT_8
2350#define FLOGI_MID_SUPPORT BIT_10
2351#define FLOGI_VSAN_SUPPORT BIT_12
2352#define FLOGI_SP_SUPPORT BIT_13
2353 uint16_t fb_rev; 2303 uint16_t fb_rev;
2354
2355 port_id_t d_id; /* Host adapter port id */
2356 uint16_t max_public_loop_ids; 2304 uint16_t max_public_loop_ids;
2357 uint16_t min_external_loopid; /* First external loop Id */ 2305 uint16_t min_external_loopid; /* First external loop Id */
2358 2306
2359#define PORT_SPEED_UNKNOWN 0xFFFF 2307#define PORT_SPEED_UNKNOWN 0xFFFF
2360#define PORT_SPEED_1GB 0x00 2308#define PORT_SPEED_1GB 0x00
2361#define PORT_SPEED_2GB 0x01 2309#define PORT_SPEED_2GB 0x01
2362#define PORT_SPEED_4GB 0x03 2310#define PORT_SPEED_4GB 0x03
2363#define PORT_SPEED_8GB 0x04 2311#define PORT_SPEED_8GB 0x04
2364 uint16_t link_data_rate; /* F/W operating speed */ 2312 uint16_t link_data_rate; /* F/W operating speed */
2365 2313
2366 uint8_t current_topology; 2314 uint8_t current_topology;
2367 uint8_t prev_topology; 2315 uint8_t prev_topology;
@@ -2370,15 +2318,69 @@ typedef struct scsi_qla_host {
2370#define ISP_CFG_FL 4 2318#define ISP_CFG_FL 4
2371#define ISP_CFG_F 8 2319#define ISP_CFG_F 8
2372 2320
2373 uint8_t operating_mode; /* F/W operating mode */ 2321 uint8_t operating_mode; /* F/W operating mode */
2374#define LOOP 0 2322#define LOOP 0
2375#define P2P 1 2323#define P2P 1
2376#define LOOP_P2P 2 2324#define LOOP_P2P 2
2377#define P2P_LOOP 3 2325#define P2P_LOOP 3
2378
2379 uint8_t marker_needed;
2380
2381 uint8_t interrupts_on; 2326 uint8_t interrupts_on;
2327 uint32_t isp_abort_cnt;
2328
2329#define PCI_DEVICE_ID_QLOGIC_ISP2532 0x2532
2330#define PCI_DEVICE_ID_QLOGIC_ISP8432 0x8432
2331 uint32_t device_type;
2332#define DT_ISP2100 BIT_0
2333#define DT_ISP2200 BIT_1
2334#define DT_ISP2300 BIT_2
2335#define DT_ISP2312 BIT_3
2336#define DT_ISP2322 BIT_4
2337#define DT_ISP6312 BIT_5
2338#define DT_ISP6322 BIT_6
2339#define DT_ISP2422 BIT_7
2340#define DT_ISP2432 BIT_8
2341#define DT_ISP5422 BIT_9
2342#define DT_ISP5432 BIT_10
2343#define DT_ISP2532 BIT_11
2344#define DT_ISP8432 BIT_12
2345#define DT_ISP_LAST (DT_ISP8432 << 1)
2346
2347#define DT_IIDMA BIT_26
2348#define DT_FWI2 BIT_27
2349#define DT_ZIO_SUPPORTED BIT_28
2350#define DT_OEM_001 BIT_29
2351#define DT_ISP2200A BIT_30
2352#define DT_EXTENDED_IDS BIT_31
2353#define DT_MASK(ha) ((ha)->device_type & (DT_ISP_LAST - 1))
2354#define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100)
2355#define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200)
2356#define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300)
2357#define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312)
2358#define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322)
2359#define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312)
2360#define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322)
2361#define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422)
2362#define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432)
2363#define IS_QLA5422(ha) (DT_MASK(ha) & DT_ISP5422)
2364#define IS_QLA5432(ha) (DT_MASK(ha) & DT_ISP5432)
2365#define IS_QLA2532(ha) (DT_MASK(ha) & DT_ISP2532)
2366#define IS_QLA8432(ha) (DT_MASK(ha) & DT_ISP8432)
2367
2368#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
2369 IS_QLA6312(ha) || IS_QLA6322(ha))
2370#define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
2371#define IS_QLA54XX(ha) (IS_QLA5422(ha) || IS_QLA5432(ha))
2372#define IS_QLA25XX(ha) (IS_QLA2532(ha))
2373#define IS_QLA84XX(ha) (IS_QLA8432(ha))
2374#define IS_QLA24XX_TYPE(ha) (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
2375 IS_QLA84XX(ha))
2376#define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \
2377 IS_QLA25XX(ha))
2378
2379#define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA)
2380#define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2)
2381#define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED)
2382#define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001)
2383#define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS)
2382 2384
2383 /* HBA serial number */ 2385 /* HBA serial number */
2384 uint8_t serial0; 2386 uint8_t serial0;
@@ -2386,8 +2388,8 @@ typedef struct scsi_qla_host {
2386 uint8_t serial2; 2388 uint8_t serial2;
2387 2389
2388 /* NVRAM configuration data */ 2390 /* NVRAM configuration data */
2389#define MAX_NVRAM_SIZE 4096 2391#define MAX_NVRAM_SIZE 4096
2390#define VPD_OFFSET MAX_NVRAM_SIZE / 2 2392#define VPD_OFFSET MAX_NVRAM_SIZE / 2
2391 uint16_t nvram_size; 2393 uint16_t nvram_size;
2392 uint16_t nvram_base; 2394 uint16_t nvram_base;
2393 void *nvram; 2395 void *nvram;
@@ -2401,22 +2403,8 @@ typedef struct scsi_qla_host {
2401 uint16_t r_a_tov; 2403 uint16_t r_a_tov;
2402 int port_down_retry_count; 2404 int port_down_retry_count;
2403 uint8_t mbx_count; 2405 uint8_t mbx_count;
2404 uint16_t last_loop_id;
2405 uint16_t mgmt_svr_loop_id;
2406
2407 uint32_t login_retry_count;
2408 int max_q_depth;
2409
2410 struct list_head work_list;
2411
2412 /* Fibre Channel Device List. */
2413 struct list_head fcports;
2414
2415 /* RSCN queue. */
2416 uint32_t rscn_queue[MAX_RSCN_COUNT];
2417 uint8_t rscn_in_ptr;
2418 uint8_t rscn_out_ptr;
2419 2406
2407 uint32_t login_retry_count;
2420 /* SNS command interfaces. */ 2408 /* SNS command interfaces. */
2421 ms_iocb_entry_t *ms_iocb; 2409 ms_iocb_entry_t *ms_iocb;
2422 dma_addr_t ms_iocb_dma; 2410 dma_addr_t ms_iocb_dma;
@@ -2426,28 +2414,20 @@ typedef struct scsi_qla_host {
2426 struct sns_cmd_pkt *sns_cmd; 2414 struct sns_cmd_pkt *sns_cmd;
2427 dma_addr_t sns_cmd_dma; 2415 dma_addr_t sns_cmd_dma;
2428 2416
2429#define SFP_DEV_SIZE 256 2417#define SFP_DEV_SIZE 256
2430#define SFP_BLOCK_SIZE 64 2418#define SFP_BLOCK_SIZE 64
2431 void *sfp_data; 2419 void *sfp_data;
2432 dma_addr_t sfp_data_dma; 2420 dma_addr_t sfp_data_dma;
2433 2421
2434 struct task_struct *dpc_thread; 2422 struct task_struct *dpc_thread;
2435 uint8_t dpc_active; /* DPC routine is active */ 2423 uint8_t dpc_active; /* DPC routine is active */
2436 2424
2437 /* Timeout timers. */
2438 uint8_t loop_down_abort_time; /* port down timer */
2439 atomic_t loop_down_timer; /* loop down timer */
2440 uint8_t link_down_timeout; /* link down timeout */
2441
2442 uint32_t timer_active;
2443 struct timer_list timer;
2444
2445 dma_addr_t gid_list_dma; 2425 dma_addr_t gid_list_dma;
2446 struct gid_list_info *gid_list; 2426 struct gid_list_info *gid_list;
2447 int gid_list_info_size; 2427 int gid_list_info_size;
2448 2428
2449 /* Small DMA pool allocations -- maximum 256 bytes in length. */ 2429 /* Small DMA pool allocations -- maximum 256 bytes in length. */
2450#define DMA_POOL_SIZE 256 2430#define DMA_POOL_SIZE 256
2451 struct dma_pool *s_dma_pool; 2431 struct dma_pool *s_dma_pool;
2452 2432
2453 dma_addr_t init_cb_dma; 2433 dma_addr_t init_cb_dma;
@@ -2459,17 +2439,17 @@ typedef struct scsi_qla_host {
2459 2439
2460 mbx_cmd_t *mcp; 2440 mbx_cmd_t *mcp;
2461 unsigned long mbx_cmd_flags; 2441 unsigned long mbx_cmd_flags;
2462#define MBX_INTERRUPT 1 2442#define MBX_INTERRUPT 1
2463#define MBX_INTR_WAIT 2 2443#define MBX_INTR_WAIT 2
2464#define MBX_UPDATE_FLASH_ACTIVE 3 2444#define MBX_UPDATE_FLASH_ACTIVE 3
2465 2445
2466 struct mutex vport_lock; /* Virtual port synchronization */ 2446 struct mutex vport_lock; /* Virtual port synchronization */
2467 struct completion mbx_cmd_comp; /* Serialize mbx access */ 2447 struct completion mbx_cmd_comp; /* Serialize mbx access */
2468 struct completion mbx_intr_comp; /* Used for completion notification */ 2448 struct completion mbx_intr_comp; /* Used for completion notification */
2469 2449
2470 uint32_t mbx_flags; 2450 uint32_t mbx_flags;
2471#define MBX_IN_PROGRESS BIT_0 2451#define MBX_IN_PROGRESS BIT_0
2472#define MBX_BUSY BIT_1 /* Got the Access */ 2452#define MBX_BUSY BIT_1 /* Got the Access */
2473#define MBX_SLEEPING_ON_SEM BIT_2 2453#define MBX_SLEEPING_ON_SEM BIT_2
2474#define MBX_POLLING_FOR_COMP BIT_3 2454#define MBX_POLLING_FOR_COMP BIT_3
2475#define MBX_COMPLETED BIT_4 2455#define MBX_COMPLETED BIT_4
@@ -2488,7 +2468,7 @@ typedef struct scsi_qla_host {
2488#define RISC_START_ADDRESS_2300 0x800 2468#define RISC_START_ADDRESS_2300 0x800
2489#define RISC_START_ADDRESS_2400 0x100000 2469#define RISC_START_ADDRESS_2400 0x100000
2490 2470
2491 uint16_t fw_options[16]; /* slots: 1,2,3,10,11 */ 2471 uint16_t fw_options[16]; /* slots: 1,2,3,10,11 */
2492 uint8_t fw_seriallink_options[4]; 2472 uint8_t fw_seriallink_options[4];
2493 uint16_t fw_seriallink_options24[4]; 2473 uint16_t fw_seriallink_options24[4];
2494 2474
@@ -2509,10 +2489,10 @@ typedef struct scsi_qla_host {
2509 uint64_t fce_wr, fce_rd; 2489 uint64_t fce_wr, fce_rd;
2510 struct mutex fce_mutex; 2490 struct mutex fce_mutex;
2511 2491
2492 uint32_t hw_event_start;
2512 uint32_t hw_event_ptr; 2493 uint32_t hw_event_ptr;
2513 uint32_t hw_event_pause_errors; 2494 uint32_t hw_event_pause_errors;
2514 2495
2515 uint8_t host_str[16];
2516 uint32_t pci_attr; 2496 uint32_t pci_attr;
2517 uint16_t chip_revision; 2497 uint16_t chip_revision;
2518 2498
@@ -2523,11 +2503,6 @@ typedef struct scsi_qla_host {
2523 char model_desc[80]; 2503 char model_desc[80];
2524 uint8_t adapter_id[16+1]; 2504 uint8_t adapter_id[16+1];
2525 2505
2526 uint8_t *node_name;
2527 uint8_t *port_name;
2528 uint8_t fabric_node_name[WWN_SIZE];
2529 uint32_t isp_abort_cnt;
2530
2531 /* Option ROM information. */ 2506 /* Option ROM information. */
2532 char *optrom_buffer; 2507 char *optrom_buffer;
2533 uint32_t optrom_size; 2508 uint32_t optrom_size;
@@ -2538,13 +2513,13 @@ typedef struct scsi_qla_host {
2538 uint32_t optrom_region_start; 2513 uint32_t optrom_region_start;
2539 uint32_t optrom_region_size; 2514 uint32_t optrom_region_size;
2540 2515
2541 /* PCI expansion ROM image information. */ 2516/* PCI expansion ROM image information. */
2542#define ROM_CODE_TYPE_BIOS 0 2517#define ROM_CODE_TYPE_BIOS 0
2543#define ROM_CODE_TYPE_FCODE 1 2518#define ROM_CODE_TYPE_FCODE 1
2544#define ROM_CODE_TYPE_EFI 3 2519#define ROM_CODE_TYPE_EFI 3
2545 uint8_t bios_revision[2]; 2520 uint8_t bios_revision[2];
2546 uint8_t efi_revision[2]; 2521 uint8_t efi_revision[2];
2547 uint8_t fcode_revision[16]; 2522 uint8_t fcode_revision[16];
2548 uint32_t fw_revision[4]; 2523 uint32_t fw_revision[4];
2549 2524
2550 uint32_t fdt_wrt_disable; 2525 uint32_t fdt_wrt_disable;
@@ -2553,39 +2528,144 @@ typedef struct scsi_qla_host {
2553 uint32_t fdt_unprotect_sec_cmd; 2528 uint32_t fdt_unprotect_sec_cmd;
2554 uint32_t fdt_protect_sec_cmd; 2529 uint32_t fdt_protect_sec_cmd;
2555 2530
2556 uint32_t flt_region_flt; 2531 uint32_t flt_region_flt;
2557 uint32_t flt_region_fdt; 2532 uint32_t flt_region_fdt;
2558 uint32_t flt_region_boot; 2533 uint32_t flt_region_boot;
2559 uint32_t flt_region_fw; 2534 uint32_t flt_region_fw;
2560 uint32_t flt_region_vpd_nvram; 2535 uint32_t flt_region_vpd_nvram;
2561 uint32_t flt_region_hw_event; 2536 uint32_t flt_region_hw_event;
2562 uint32_t flt_region_npiv_conf; 2537 uint32_t flt_region_npiv_conf;
2563 2538
2564 /* Needed for BEACON */ 2539 /* Needed for BEACON */
2565 uint16_t beacon_blink_led; 2540 uint16_t beacon_blink_led;
2566 uint8_t beacon_color_state; 2541 uint8_t beacon_color_state;
2567#define QLA_LED_GRN_ON 0x01 2542#define QLA_LED_GRN_ON 0x01
2568#define QLA_LED_YLW_ON 0x02 2543#define QLA_LED_YLW_ON 0x02
2569#define QLA_LED_ABR_ON 0x04 2544#define QLA_LED_ABR_ON 0x04
2570#define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */ 2545#define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */
2571 /* ISP2322: red, green, amber. */ 2546 /* ISP2322: red, green, amber. */
2572 2547 uint16_t zio_mode;
2573 uint16_t zio_mode; 2548 uint16_t zio_timer;
2574 uint16_t zio_timer;
2575 struct fc_host_statistics fc_host_stat; 2549 struct fc_host_statistics fc_host_stat;
2576 2550
2577 struct qla_msix_entry msix_entries[QLA_MSIX_ENTRIES]; 2551 struct qla_msix_entry *msix_entries;
2552
2553 struct list_head vp_list; /* list of VP */
2554 unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) /
2555 sizeof(unsigned long)];
2556 uint16_t num_vhosts; /* number of vports created */
2557 uint16_t num_vsans; /* number of vsan created */
2558 uint16_t max_npiv_vports; /* 63 or 125 per topoloty */
2559 int cur_vport_count;
2560
2561 struct qla_chip_state_84xx *cs84xx;
2562 struct qla_statistics qla_stats;
2563 struct isp_operations *isp_ops;
2564};
2565
2566/*
2567 * Qlogic scsi host structure
2568 */
2569typedef struct scsi_qla_host {
2570 struct list_head list;
2571 struct list_head vp_fcports; /* list of fcports */
2572 struct list_head work_list;
2573 /* Commonly used flags and state information. */
2574 struct Scsi_Host *host;
2575 unsigned long host_no;
2576 uint8_t host_str[16];
2577
2578 volatile struct {
2579 uint32_t init_done :1;
2580 uint32_t online :1;
2581 uint32_t rscn_queue_overflow :1;
2582 uint32_t reset_active :1;
2583
2584 uint32_t management_server_logged_in :1;
2585 uint32_t process_response_queue :1;
2586 } flags;
2587
2588 atomic_t loop_state;
2589#define LOOP_TIMEOUT 1
2590#define LOOP_DOWN 2
2591#define LOOP_UP 3
2592#define LOOP_UPDATE 4
2593#define LOOP_READY 5
2594#define LOOP_DEAD 6
2595
2596 unsigned long dpc_flags;
2597#define RESET_MARKER_NEEDED 0 /* Send marker to ISP. */
2598#define RESET_ACTIVE 1
2599#define ISP_ABORT_NEEDED 2 /* Initiate ISP abort. */
2600#define ABORT_ISP_ACTIVE 3 /* ISP abort in progress. */
2601#define LOOP_RESYNC_NEEDED 4 /* Device Resync needed. */
2602#define LOOP_RESYNC_ACTIVE 5
2603#define LOCAL_LOOP_UPDATE 6 /* Perform a local loop update. */
2604#define RSCN_UPDATE 7 /* Perform an RSCN update. */
2605#define MAILBOX_RETRY 8
2606#define ISP_RESET_NEEDED 9 /* Initiate a ISP reset. */
2607#define FAILOVER_EVENT_NEEDED 10
2608#define FAILOVER_EVENT 11
2609#define FAILOVER_NEEDED 12
2610#define SCSI_RESTART_NEEDED 13 /* Processes SCSI retry queue. */
2611#define PORT_RESTART_NEEDED 14 /* Processes Retry queue. */
2612#define RESTART_QUEUES_NEEDED 15 /* Restarts the Lun queue. */
2613#define ABORT_QUEUES_NEEDED 16
2614#define RELOGIN_NEEDED 17
2615#define LOGIN_RETRY_NEEDED 18 /* Initiate required fabric logins. */
2616#define REGISTER_FC4_NEEDED 19 /* SNS FC4 registration required. */
2617#define ISP_ABORT_RETRY 20 /* ISP aborted. */
2618#define FCPORT_RESCAN_NEEDED 21 /* IO descriptor processing needed */
2619#define IODESC_PROCESS_NEEDED 22 /* IO descriptor processing needed */
2620#define IOCTL_ERROR_RECOVERY 23
2621#define LOOP_RESET_NEEDED 24
2622#define BEACON_BLINK_NEEDED 25
2623#define REGISTER_FDMI_NEEDED 26
2624#define FCPORT_UPDATE_NEEDED 27
2625#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */
2626#define UNLOADING 29
2627#define NPIV_CONFIG_NEEDED 30
2628
2629 uint32_t device_flags;
2630#define DFLG_LOCAL_DEVICES BIT_0
2631#define DFLG_RETRY_LOCAL_DEVICES BIT_1
2632#define DFLG_FABRIC_DEVICES BIT_2
2633#define SWITCH_FOUND BIT_3
2634#define DFLG_NO_CABLE BIT_4
2635
2636 srb_t *status_srb; /* Status continuation entry. */
2637
2638 /* ISP configuration data. */
2639 uint16_t loop_id; /* Host adapter loop id */
2640
2641 port_id_t d_id; /* Host adapter port id */
2642 uint8_t marker_needed;
2643 uint16_t mgmt_svr_loop_id;
2644
2645
2646
2647 /* RSCN queue. */
2648 uint32_t rscn_queue[MAX_RSCN_COUNT];
2649 uint8_t rscn_in_ptr;
2650 uint8_t rscn_out_ptr;
2651
2652 /* Timeout timers. */
2653 uint8_t loop_down_abort_time; /* port down timer */
2654 atomic_t loop_down_timer; /* loop down timer */
2655 uint8_t link_down_timeout; /* link down timeout */
2656
2657 uint32_t timer_active;
2658 struct timer_list timer;
2659
2660 uint8_t node_name[WWN_SIZE];
2661 uint8_t port_name[WWN_SIZE];
2662 uint8_t fabric_node_name[WWN_SIZE];
2663 uint32_t vp_abort_cnt;
2578 2664
2579 struct list_head vp_list; /* list of VP */
2580 struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ 2665 struct fc_vport *fc_vport; /* holds fc_vport * for each vport */
2581 unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) / sizeof(unsigned long)];
2582 uint16_t num_vhosts; /* number of vports created */
2583 uint16_t num_vsans; /* number of vsan created */
2584 uint16_t vp_idx; /* vport ID */ 2666 uint16_t vp_idx; /* vport ID */
2585 2667
2586 struct scsi_qla_host *parent; /* holds pport */
2587 unsigned long vp_flags; 2668 unsigned long vp_flags;
2588 struct list_head vp_fcports; /* list of fcports */
2589#define VP_IDX_ACQUIRED 0 /* bit no 0 */ 2669#define VP_IDX_ACQUIRED 0 /* bit no 0 */
2590#define VP_CREATE_NEEDED 1 2670#define VP_CREATE_NEEDED 1
2591#define VP_BIND_NEEDED 2 2671#define VP_BIND_NEEDED 2
@@ -2604,14 +2684,10 @@ typedef struct scsi_qla_host {
2604#define VP_ERR_FAB_NORESOURCES 3 2684#define VP_ERR_FAB_NORESOURCES 3
2605#define VP_ERR_FAB_LOGOUT 4 2685#define VP_ERR_FAB_LOGOUT 4
2606#define VP_ERR_ADAP_NORESOURCES 5 2686#define VP_ERR_ADAP_NORESOURCES 5
2607 uint16_t max_npiv_vports; /* 63 or 125 per topoloty */ 2687 struct qla_hw_data *hw;
2608 int cur_vport_count; 2688 int req_ques[QLA_MAX_HOST_QUES];
2609
2610 struct qla_chip_state_84xx *cs84xx;
2611 struct qla_statistics qla_stats;
2612} scsi_qla_host_t; 2689} scsi_qla_host_t;
2613 2690
2614
2615/* 2691/*
2616 * Macros to help code, maintain, etc. 2692 * Macros to help code, maintain, etc.
2617 */ 2693 */