aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_def.h
diff options
context:
space:
mode:
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>2008-11-06 13:40:19 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:15 -0500
commit7b867cf76fbcc8d77867cbec6f509f71dce8a98f (patch)
treeef5fcc1e21701ed1baa1b131c7c29f29cd41d5d6 /drivers/scsi/qla2xxx/qla_def.h
parenta9b589d90e3d7748dae459031c2d912cd9e83c88 (diff)
[SCSI] qla2xxx: Refactor qla data structures
Following changes have been made to the qla2xxx FC driver in preparation for the multi- queue and future SR IOV hardware. 1. scsi_qla_host structure has been changed to contain scsi host specific data only. 2. A new structure, qla_hw_data is created to contain HBA specific hardware data. 3. Request and response IO specific data strucures are created. 4. The global list of fcports for the hba is not maintained anymore, instead a fcport list is construted on per scsi_qla_host. Signed-of-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_def.h')
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h525
1 files changed, 278 insertions, 247 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index b97194096d8e..edead2802517 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -185,7 +185,7 @@
185 * SCSI Request Block 185 * SCSI Request Block
186 */ 186 */
187typedef struct srb { 187typedef struct srb {
188 struct scsi_qla_host *ha; /* HA the SP is queued on */ 188 struct scsi_qla_host *vha; /* HA the SP is queued on */
189 struct fc_port *fcport; 189 struct fc_port *fcport;
190 190
191 struct scsi_cmnd *cmd; /* Linux SCSI command pkt */ 191 struct scsi_cmnd *cmd; /* Linux SCSI command pkt */
@@ -1524,7 +1524,7 @@ typedef struct {
1524 */ 1524 */
1525typedef struct fc_port { 1525typedef struct fc_port {
1526 struct list_head list; 1526 struct list_head list;
1527 struct scsi_qla_host *ha; 1527 struct scsi_qla_host *vha;
1528 1528
1529 uint8_t node_name[WWN_SIZE]; 1529 uint8_t node_name[WWN_SIZE];
1530 uint8_t port_name[WWN_SIZE]; 1530 uint8_t port_name[WWN_SIZE];
@@ -1550,7 +1550,6 @@ typedef struct fc_port {
1550 unsigned long last_queue_full; 1550 unsigned long last_queue_full;
1551 unsigned long last_ramp_up; 1551 unsigned long last_ramp_up;
1552 1552
1553 struct list_head vp_fcport;
1554 uint16_t vp_idx; 1553 uint16_t vp_idx;
1555} fc_port_t; 1554} fc_port_t;
1556 1555
@@ -2037,6 +2036,8 @@ typedef struct vport_params {
2037#define VP_RET_CODE_NO_MEM 5 2036#define VP_RET_CODE_NO_MEM 5
2038#define VP_RET_CODE_NOT_FOUND 6 2037#define VP_RET_CODE_NOT_FOUND 6
2039 2038
2039struct qla_hw_data;
2040
2040/* 2041/*
2041 * ISP operations 2042 * ISP operations
2042 */ 2043 */
@@ -2055,8 +2056,8 @@ struct isp_operations {
2055 char * (*fw_version_str) (struct scsi_qla_host *, char *); 2056 char * (*fw_version_str) (struct scsi_qla_host *, char *);
2056 2057
2057 irq_handler_t intr_handler; 2058 irq_handler_t intr_handler;
2058 void (*enable_intrs) (struct scsi_qla_host *); 2059 void (*enable_intrs) (struct qla_hw_data *);
2059 void (*disable_intrs) (struct scsi_qla_host *); 2060 void (*disable_intrs) (struct qla_hw_data *);
2060 2061
2061 int (*abort_command) (struct scsi_qla_host *, srb_t *); 2062 int (*abort_command) (struct scsi_qla_host *, srb_t *);
2062 int (*target_reset) (struct fc_port *, unsigned int); 2063 int (*target_reset) (struct fc_port *, unsigned int);
@@ -2089,6 +2090,7 @@ struct isp_operations {
2089 uint32_t); 2090 uint32_t);
2090 2091
2091 int (*get_flash_version) (struct scsi_qla_host *, void *); 2092 int (*get_flash_version) (struct scsi_qla_host *, void *);
2093 int (*start_scsi) (srb_t *);
2092}; 2094};
2093 2095
2094/* MSI-X Support *************************************************************/ 2096/* MSI-X Support *************************************************************/
@@ -2160,208 +2162,108 @@ struct qla_statistics {
2160 uint64_t output_bytes; 2162 uint64_t output_bytes;
2161}; 2163};
2162 2164
2163/* 2165/* Response queue data structure */
2164 * Linux Host Adapter structure 2166struct rsp_que {
2165 */ 2167 dma_addr_t dma;
2166typedef struct scsi_qla_host { 2168 response_t *ring;
2167 struct list_head list; 2169 response_t *ring_ptr;
2170 uint16_t ring_index;
2171 uint16_t out_ptr;
2172 uint16_t length;
2173 uint16_t options;
2174 uint16_t msix_vector;
2175 uint16_t rid;
2176 struct qla_hw_data *hw;
2177};
2168 2178
2169 /* Commonly used flags and state information. */ 2179/* Request queue data structure */
2170 struct Scsi_Host *host; 2180struct req_que {
2171 struct pci_dev *pdev; 2181 dma_addr_t dma;
2182 request_t *ring;
2183 request_t *ring_ptr;
2184 uint16_t ring_index;
2185 uint16_t in_ptr;
2186 uint16_t cnt;
2187 uint16_t length;
2188 uint16_t options;
2189 uint16_t rid;
2190 uint16_t qos;
2191 uint16_t vp_idx;
2192 struct rsp_que *asso_que;
2193 /* Outstandings ISP commands. */
2194 srb_t *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
2195 uint32_t current_outstanding_cmd;
2196 int max_q_depth;
2197};
2172 2198
2173 unsigned long host_no; 2199/*
2200 * Qlogic host adapter specific data structure.
2201*/
2202struct qla_hw_data {
2203 struct pci_dev *pdev;
2204 /* SRB cache. */
2205#define SRB_MIN_REQ 128
2206 mempool_t *srb_mempool;
2174 2207
2175 volatile struct { 2208 volatile struct {
2176 uint32_t init_done :1;
2177 uint32_t online :1;
2178 uint32_t mbox_int :1; 2209 uint32_t mbox_int :1;
2179 uint32_t mbox_busy :1; 2210 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 2211
2186 uint32_t disable_risc_code_load :1; 2212 uint32_t disable_risc_code_load :1;
2187 uint32_t enable_64bit_addressing :1; 2213 uint32_t enable_64bit_addressing :1;
2188 uint32_t enable_lip_reset :1; 2214 uint32_t enable_lip_reset :1;
2189 uint32_t enable_lip_full_login :1;
2190 uint32_t enable_target_reset :1; 2215 uint32_t enable_target_reset :1;
2216 uint32_t enable_lip_full_login :1;
2191 uint32_t enable_led_scheme :1; 2217 uint32_t enable_led_scheme :1;
2192 uint32_t inta_enabled :1; 2218 uint32_t inta_enabled :1;
2193 uint32_t msi_enabled :1; 2219 uint32_t msi_enabled :1;
2194 uint32_t msix_enabled :1; 2220 uint32_t msix_enabled :1;
2195 uint32_t disable_serdes :1; 2221 uint32_t disable_serdes :1;
2196 uint32_t gpsc_supported :1; 2222 uint32_t gpsc_supported :1;
2197 uint32_t vsan_enabled :1; 2223 uint32_t vsan_enabled :1;
2198 uint32_t npiv_supported :1; 2224 uint32_t npiv_supported :1;
2199 uint32_t fce_enabled :1; 2225 uint32_t fce_enabled :1;
2200 uint32_t hw_event_marker_found :1; 2226 uint32_t hw_event_marker_found:1;
2201 } flags; 2227 } flags;
2202 2228
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 2229 /* 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 2230 * acquire it before doing any IO to the card, eg with RD_REG*() and
2312 * WRT_REG*() for the duration of your entire commandtransaction. 2231 * WRT_REG*() for the duration of your entire commandtransaction.
2313 * 2232 *
2314 * This spinlock is of lower priority than the io request lock. 2233 * This spinlock is of lower priority than the io request lock.
2315 */ 2234 */
2316
2317 spinlock_t hardware_lock ____cacheline_aligned;
2318 2235
2236 spinlock_t hardware_lock ____cacheline_aligned;
2319 int bars; 2237 int bars;
2320 int mem_only; 2238 int mem_only;
2321 device_reg_t __iomem *iobase; /* Base I/O address */ 2239 device_reg_t __iomem *iobase; /* Base I/O address */
2322 resource_size_t pio_address; 2240 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 2241
2339 struct isp_operations *isp_ops; 2242#define MIN_IOBASE_LEN 0x100
2243 struct req_que *req;
2244 struct rsp_que *rsp;
2340 2245
2341 /* Outstandings ISP commands. */ 2246 uint16_t switch_cap;
2342 srb_t *outstanding_cmds[MAX_OUTSTANDING_COMMANDS]; 2247#define FLOGI_SEQ_DEL BIT_8
2343 uint32_t current_outstanding_cmd; 2248#define FLOGI_MID_SUPPORT BIT_10
2344 srb_t *status_srb; /* Status continuation entry. */ 2249#define FLOGI_VSAN_SUPPORT BIT_12
2250#define FLOGI_SP_SUPPORT BIT_13
2251 /* Timeout timers. */
2252 uint8_t loop_down_abort_time; /* port down timer */
2253 atomic_t loop_down_timer; /* loop down timer */
2254 uint8_t link_down_timeout; /* link down timeout */
2255 uint16_t max_loop_id;
2345 2256
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; 2257 uint16_t fb_rev;
2354
2355 port_id_t d_id; /* Host adapter port id */
2356 uint16_t max_public_loop_ids; 2258 uint16_t max_public_loop_ids;
2357 uint16_t min_external_loopid; /* First external loop Id */ 2259 uint16_t min_external_loopid; /* First external loop Id */
2358 2260
2359#define PORT_SPEED_UNKNOWN 0xFFFF 2261#define PORT_SPEED_UNKNOWN 0xFFFF
2360#define PORT_SPEED_1GB 0x00 2262#define PORT_SPEED_1GB 0x00
2361#define PORT_SPEED_2GB 0x01 2263#define PORT_SPEED_2GB 0x01
2362#define PORT_SPEED_4GB 0x03 2264#define PORT_SPEED_4GB 0x03
2363#define PORT_SPEED_8GB 0x04 2265#define PORT_SPEED_8GB 0x04
2364 uint16_t link_data_rate; /* F/W operating speed */ 2266 uint16_t link_data_rate; /* F/W operating speed */
2365 2267
2366 uint8_t current_topology; 2268 uint8_t current_topology;
2367 uint8_t prev_topology; 2269 uint8_t prev_topology;
@@ -2370,15 +2272,69 @@ typedef struct scsi_qla_host {
2370#define ISP_CFG_FL 4 2272#define ISP_CFG_FL 4
2371#define ISP_CFG_F 8 2273#define ISP_CFG_F 8
2372 2274
2373 uint8_t operating_mode; /* F/W operating mode */ 2275 uint8_t operating_mode; /* F/W operating mode */
2374#define LOOP 0 2276#define LOOP 0
2375#define P2P 1 2277#define P2P 1
2376#define LOOP_P2P 2 2278#define LOOP_P2P 2
2377#define P2P_LOOP 3 2279#define P2P_LOOP 3
2378
2379 uint8_t marker_needed;
2380
2381 uint8_t interrupts_on; 2280 uint8_t interrupts_on;
2281 uint32_t isp_abort_cnt;
2282
2283#define PCI_DEVICE_ID_QLOGIC_ISP2532 0x2532
2284#define PCI_DEVICE_ID_QLOGIC_ISP8432 0x8432
2285 uint32_t device_type;
2286#define DT_ISP2100 BIT_0
2287#define DT_ISP2200 BIT_1
2288#define DT_ISP2300 BIT_2
2289#define DT_ISP2312 BIT_3
2290#define DT_ISP2322 BIT_4
2291#define DT_ISP6312 BIT_5
2292#define DT_ISP6322 BIT_6
2293#define DT_ISP2422 BIT_7
2294#define DT_ISP2432 BIT_8
2295#define DT_ISP5422 BIT_9
2296#define DT_ISP5432 BIT_10
2297#define DT_ISP2532 BIT_11
2298#define DT_ISP8432 BIT_12
2299#define DT_ISP_LAST (DT_ISP8432 << 1)
2300
2301#define DT_IIDMA BIT_26
2302#define DT_FWI2 BIT_27
2303#define DT_ZIO_SUPPORTED BIT_28
2304#define DT_OEM_001 BIT_29
2305#define DT_ISP2200A BIT_30
2306#define DT_EXTENDED_IDS BIT_31
2307#define DT_MASK(ha) ((ha)->device_type & (DT_ISP_LAST - 1))
2308#define IS_QLA2100(ha) (DT_MASK(ha) & DT_ISP2100)
2309#define IS_QLA2200(ha) (DT_MASK(ha) & DT_ISP2200)
2310#define IS_QLA2300(ha) (DT_MASK(ha) & DT_ISP2300)
2311#define IS_QLA2312(ha) (DT_MASK(ha) & DT_ISP2312)
2312#define IS_QLA2322(ha) (DT_MASK(ha) & DT_ISP2322)
2313#define IS_QLA6312(ha) (DT_MASK(ha) & DT_ISP6312)
2314#define IS_QLA6322(ha) (DT_MASK(ha) & DT_ISP6322)
2315#define IS_QLA2422(ha) (DT_MASK(ha) & DT_ISP2422)
2316#define IS_QLA2432(ha) (DT_MASK(ha) & DT_ISP2432)
2317#define IS_QLA5422(ha) (DT_MASK(ha) & DT_ISP5422)
2318#define IS_QLA5432(ha) (DT_MASK(ha) & DT_ISP5432)
2319#define IS_QLA2532(ha) (DT_MASK(ha) & DT_ISP2532)
2320#define IS_QLA8432(ha) (DT_MASK(ha) & DT_ISP8432)
2321
2322#define IS_QLA23XX(ha) (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || \
2323 IS_QLA6312(ha) || IS_QLA6322(ha))
2324#define IS_QLA24XX(ha) (IS_QLA2422(ha) || IS_QLA2432(ha))
2325#define IS_QLA54XX(ha) (IS_QLA5422(ha) || IS_QLA5432(ha))
2326#define IS_QLA25XX(ha) (IS_QLA2532(ha))
2327#define IS_QLA84XX(ha) (IS_QLA8432(ha))
2328#define IS_QLA24XX_TYPE(ha) (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
2329 IS_QLA84XX(ha))
2330#define IS_QLA2XXX_MIDTYPE(ha) (IS_QLA24XX(ha) || IS_QLA84XX(ha) || \
2331 IS_QLA25XX(ha))
2332
2333#define IS_IIDMA_CAPABLE(ha) ((ha)->device_type & DT_IIDMA)
2334#define IS_FWI2_CAPABLE(ha) ((ha)->device_type & DT_FWI2)
2335#define IS_ZIO_SUPPORTED(ha) ((ha)->device_type & DT_ZIO_SUPPORTED)
2336#define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001)
2337#define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS)
2382 2338
2383 /* HBA serial number */ 2339 /* HBA serial number */
2384 uint8_t serial0; 2340 uint8_t serial0;
@@ -2386,8 +2342,8 @@ typedef struct scsi_qla_host {
2386 uint8_t serial2; 2342 uint8_t serial2;
2387 2343
2388 /* NVRAM configuration data */ 2344 /* NVRAM configuration data */
2389#define MAX_NVRAM_SIZE 4096 2345#define MAX_NVRAM_SIZE 4096
2390#define VPD_OFFSET MAX_NVRAM_SIZE / 2 2346#define VPD_OFFSET MAX_NVRAM_SIZE / 2
2391 uint16_t nvram_size; 2347 uint16_t nvram_size;
2392 uint16_t nvram_base; 2348 uint16_t nvram_base;
2393 void *nvram; 2349 void *nvram;
@@ -2401,22 +2357,8 @@ typedef struct scsi_qla_host {
2401 uint16_t r_a_tov; 2357 uint16_t r_a_tov;
2402 int port_down_retry_count; 2358 int port_down_retry_count;
2403 uint8_t mbx_count; 2359 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 2360
2361 uint32_t login_retry_count;
2420 /* SNS command interfaces. */ 2362 /* SNS command interfaces. */
2421 ms_iocb_entry_t *ms_iocb; 2363 ms_iocb_entry_t *ms_iocb;
2422 dma_addr_t ms_iocb_dma; 2364 dma_addr_t ms_iocb_dma;
@@ -2426,28 +2368,20 @@ typedef struct scsi_qla_host {
2426 struct sns_cmd_pkt *sns_cmd; 2368 struct sns_cmd_pkt *sns_cmd;
2427 dma_addr_t sns_cmd_dma; 2369 dma_addr_t sns_cmd_dma;
2428 2370
2429#define SFP_DEV_SIZE 256 2371#define SFP_DEV_SIZE 256
2430#define SFP_BLOCK_SIZE 64 2372#define SFP_BLOCK_SIZE 64
2431 void *sfp_data; 2373 void *sfp_data;
2432 dma_addr_t sfp_data_dma; 2374 dma_addr_t sfp_data_dma;
2433 2375
2434 struct task_struct *dpc_thread; 2376 struct task_struct *dpc_thread;
2435 uint8_t dpc_active; /* DPC routine is active */ 2377 uint8_t dpc_active; /* DPC routine is active */
2436 2378
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; 2379 dma_addr_t gid_list_dma;
2446 struct gid_list_info *gid_list; 2380 struct gid_list_info *gid_list;
2447 int gid_list_info_size; 2381 int gid_list_info_size;
2448 2382
2449 /* Small DMA pool allocations -- maximum 256 bytes in length. */ 2383 /* Small DMA pool allocations -- maximum 256 bytes in length. */
2450#define DMA_POOL_SIZE 256 2384#define DMA_POOL_SIZE 256
2451 struct dma_pool *s_dma_pool; 2385 struct dma_pool *s_dma_pool;
2452 2386
2453 dma_addr_t init_cb_dma; 2387 dma_addr_t init_cb_dma;
@@ -2459,17 +2393,17 @@ typedef struct scsi_qla_host {
2459 2393
2460 mbx_cmd_t *mcp; 2394 mbx_cmd_t *mcp;
2461 unsigned long mbx_cmd_flags; 2395 unsigned long mbx_cmd_flags;
2462#define MBX_INTERRUPT 1 2396#define MBX_INTERRUPT 1
2463#define MBX_INTR_WAIT 2 2397#define MBX_INTR_WAIT 2
2464#define MBX_UPDATE_FLASH_ACTIVE 3 2398#define MBX_UPDATE_FLASH_ACTIVE 3
2465 2399
2466 struct mutex vport_lock; /* Virtual port synchronization */ 2400 struct mutex vport_lock; /* Virtual port synchronization */
2467 struct completion mbx_cmd_comp; /* Serialize mbx access */ 2401 struct completion mbx_cmd_comp; /* Serialize mbx access */
2468 struct completion mbx_intr_comp; /* Used for completion notification */ 2402 struct completion mbx_intr_comp; /* Used for completion notification */
2469 2403
2470 uint32_t mbx_flags; 2404 uint32_t mbx_flags;
2471#define MBX_IN_PROGRESS BIT_0 2405#define MBX_IN_PROGRESS BIT_0
2472#define MBX_BUSY BIT_1 /* Got the Access */ 2406#define MBX_BUSY BIT_1 /* Got the Access */
2473#define MBX_SLEEPING_ON_SEM BIT_2 2407#define MBX_SLEEPING_ON_SEM BIT_2
2474#define MBX_POLLING_FOR_COMP BIT_3 2408#define MBX_POLLING_FOR_COMP BIT_3
2475#define MBX_COMPLETED BIT_4 2409#define MBX_COMPLETED BIT_4
@@ -2488,7 +2422,7 @@ typedef struct scsi_qla_host {
2488#define RISC_START_ADDRESS_2300 0x800 2422#define RISC_START_ADDRESS_2300 0x800
2489#define RISC_START_ADDRESS_2400 0x100000 2423#define RISC_START_ADDRESS_2400 0x100000
2490 2424
2491 uint16_t fw_options[16]; /* slots: 1,2,3,10,11 */ 2425 uint16_t fw_options[16]; /* slots: 1,2,3,10,11 */
2492 uint8_t fw_seriallink_options[4]; 2426 uint8_t fw_seriallink_options[4];
2493 uint16_t fw_seriallink_options24[4]; 2427 uint16_t fw_seriallink_options24[4];
2494 2428
@@ -2509,10 +2443,10 @@ typedef struct scsi_qla_host {
2509 uint64_t fce_wr, fce_rd; 2443 uint64_t fce_wr, fce_rd;
2510 struct mutex fce_mutex; 2444 struct mutex fce_mutex;
2511 2445
2446 uint32_t hw_event_start;
2512 uint32_t hw_event_ptr; 2447 uint32_t hw_event_ptr;
2513 uint32_t hw_event_pause_errors; 2448 uint32_t hw_event_pause_errors;
2514 2449
2515 uint8_t host_str[16];
2516 uint32_t pci_attr; 2450 uint32_t pci_attr;
2517 uint16_t chip_revision; 2451 uint16_t chip_revision;
2518 2452
@@ -2523,11 +2457,6 @@ typedef struct scsi_qla_host {
2523 char model_desc[80]; 2457 char model_desc[80];
2524 uint8_t adapter_id[16+1]; 2458 uint8_t adapter_id[16+1];
2525 2459
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. */ 2460 /* Option ROM information. */
2532 char *optrom_buffer; 2461 char *optrom_buffer;
2533 uint32_t optrom_size; 2462 uint32_t optrom_size;
@@ -2538,13 +2467,13 @@ typedef struct scsi_qla_host {
2538 uint32_t optrom_region_start; 2467 uint32_t optrom_region_start;
2539 uint32_t optrom_region_size; 2468 uint32_t optrom_region_size;
2540 2469
2541 /* PCI expansion ROM image information. */ 2470/* PCI expansion ROM image information. */
2542#define ROM_CODE_TYPE_BIOS 0 2471#define ROM_CODE_TYPE_BIOS 0
2543#define ROM_CODE_TYPE_FCODE 1 2472#define ROM_CODE_TYPE_FCODE 1
2544#define ROM_CODE_TYPE_EFI 3 2473#define ROM_CODE_TYPE_EFI 3
2545 uint8_t bios_revision[2]; 2474 uint8_t bios_revision[2];
2546 uint8_t efi_revision[2]; 2475 uint8_t efi_revision[2];
2547 uint8_t fcode_revision[16]; 2476 uint8_t fcode_revision[16];
2548 uint32_t fw_revision[4]; 2477 uint32_t fw_revision[4];
2549 2478
2550 uint32_t fdt_wrt_disable; 2479 uint32_t fdt_wrt_disable;
@@ -2553,39 +2482,145 @@ typedef struct scsi_qla_host {
2553 uint32_t fdt_unprotect_sec_cmd; 2482 uint32_t fdt_unprotect_sec_cmd;
2554 uint32_t fdt_protect_sec_cmd; 2483 uint32_t fdt_protect_sec_cmd;
2555 2484
2556 uint32_t flt_region_flt; 2485 uint32_t flt_region_flt;
2557 uint32_t flt_region_fdt; 2486 uint32_t flt_region_fdt;
2558 uint32_t flt_region_boot; 2487 uint32_t flt_region_boot;
2559 uint32_t flt_region_fw; 2488 uint32_t flt_region_fw;
2560 uint32_t flt_region_vpd_nvram; 2489 uint32_t flt_region_vpd_nvram;
2561 uint32_t flt_region_hw_event; 2490 uint32_t flt_region_hw_event;
2562 uint32_t flt_region_npiv_conf; 2491 uint32_t flt_region_npiv_conf;
2563 2492
2564 /* Needed for BEACON */ 2493 /* Needed for BEACON */
2565 uint16_t beacon_blink_led; 2494 uint16_t beacon_blink_led;
2566 uint8_t beacon_color_state; 2495 uint8_t beacon_color_state;
2567#define QLA_LED_GRN_ON 0x01 2496#define QLA_LED_GRN_ON 0x01
2568#define QLA_LED_YLW_ON 0x02 2497#define QLA_LED_YLW_ON 0x02
2569#define QLA_LED_ABR_ON 0x04 2498#define QLA_LED_ABR_ON 0x04
2570#define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */ 2499#define QLA_LED_ALL_ON 0x07 /* yellow, green, amber. */
2571 /* ISP2322: red, green, amber. */ 2500 /* ISP2322: red, green, amber. */
2572 2501 uint16_t zio_mode;
2573 uint16_t zio_mode; 2502 uint16_t zio_timer;
2574 uint16_t zio_timer;
2575 struct fc_host_statistics fc_host_stat; 2503 struct fc_host_statistics fc_host_stat;
2576 2504
2577 struct qla_msix_entry msix_entries[QLA_MSIX_ENTRIES]; 2505 struct qla_msix_entry msix_entries[QLA_MSIX_ENTRIES];
2578 2506
2579 struct list_head vp_list; /* list of VP */ 2507 struct list_head vp_list; /* list of VP */
2508 unsigned long vp_idx_map[(MAX_MULTI_ID_FABRIC / 8) /
2509 sizeof(unsigned long)];
2510 uint16_t num_vhosts; /* number of vports created */
2511 uint16_t num_vsans; /* number of vsan created */
2512 uint16_t max_npiv_vports; /* 63 or 125 per topoloty */
2513 int cur_vport_count;
2514
2515 struct qla_chip_state_84xx *cs84xx;
2516 struct qla_statistics qla_stats;
2517 struct isp_operations *isp_ops;
2518};
2519
2520/*
2521 * Qlogic scsi host structure
2522 */
2523typedef struct scsi_qla_host {
2524 struct list_head list;
2525 struct list_head vp_fcports; /* list of fcports */
2526 struct list_head work_list;
2527
2528 /* Commonly used flags and state information. */
2529 struct Scsi_Host *host;
2530 unsigned long host_no;
2531 uint8_t host_str[16];
2532
2533 volatile struct {
2534 uint32_t init_done :1;
2535 uint32_t online :1;
2536 uint32_t rscn_queue_overflow :1;
2537 uint32_t reset_active :1;
2538
2539 uint32_t management_server_logged_in :1;
2540 uint32_t process_response_queue :1;
2541 } flags;
2542
2543 atomic_t loop_state;
2544#define LOOP_TIMEOUT 1
2545#define LOOP_DOWN 2
2546#define LOOP_UP 3
2547#define LOOP_UPDATE 4
2548#define LOOP_READY 5
2549#define LOOP_DEAD 6
2550
2551 unsigned long dpc_flags;
2552#define RESET_MARKER_NEEDED 0 /* Send marker to ISP. */
2553#define RESET_ACTIVE 1
2554#define ISP_ABORT_NEEDED 2 /* Initiate ISP abort. */
2555#define ABORT_ISP_ACTIVE 3 /* ISP abort in progress. */
2556#define LOOP_RESYNC_NEEDED 4 /* Device Resync needed. */
2557#define LOOP_RESYNC_ACTIVE 5
2558#define LOCAL_LOOP_UPDATE 6 /* Perform a local loop update. */
2559#define RSCN_UPDATE 7 /* Perform an RSCN update. */
2560#define MAILBOX_RETRY 8
2561#define ISP_RESET_NEEDED 9 /* Initiate a ISP reset. */
2562#define FAILOVER_EVENT_NEEDED 10
2563#define FAILOVER_EVENT 11
2564#define FAILOVER_NEEDED 12
2565#define SCSI_RESTART_NEEDED 13 /* Processes SCSI retry queue. */
2566#define PORT_RESTART_NEEDED 14 /* Processes Retry queue. */
2567#define RESTART_QUEUES_NEEDED 15 /* Restarts the Lun queue. */
2568#define ABORT_QUEUES_NEEDED 16
2569#define RELOGIN_NEEDED 17
2570#define LOGIN_RETRY_NEEDED 18 /* Initiate required fabric logins. */
2571#define REGISTER_FC4_NEEDED 19 /* SNS FC4 registration required. */
2572#define ISP_ABORT_RETRY 20 /* ISP aborted. */
2573#define FCPORT_RESCAN_NEEDED 21 /* IO descriptor processing needed */
2574#define IODESC_PROCESS_NEEDED 22 /* IO descriptor processing needed */
2575#define IOCTL_ERROR_RECOVERY 23
2576#define LOOP_RESET_NEEDED 24
2577#define BEACON_BLINK_NEEDED 25
2578#define REGISTER_FDMI_NEEDED 26
2579#define FCPORT_UPDATE_NEEDED 27
2580#define VP_DPC_NEEDED 28 /* wake up for VP dpc handling */
2581#define UNLOADING 29
2582#define NPIV_CONFIG_NEEDED 30
2583
2584 uint32_t device_flags;
2585#define DFLG_LOCAL_DEVICES BIT_0
2586#define DFLG_RETRY_LOCAL_DEVICES BIT_1
2587#define DFLG_FABRIC_DEVICES BIT_2
2588#define SWITCH_FOUND BIT_3
2589#define DFLG_NO_CABLE BIT_4
2590
2591 srb_t *status_srb; /* Status continuation entry. */
2592
2593 /* ISP configuration data. */
2594 uint16_t loop_id; /* Host adapter loop id */
2595
2596 port_id_t d_id; /* Host adapter port id */
2597 uint8_t marker_needed;
2598 uint16_t mgmt_svr_loop_id;
2599
2600
2601
2602 /* RSCN queue. */
2603 uint32_t rscn_queue[MAX_RSCN_COUNT];
2604 uint8_t rscn_in_ptr;
2605 uint8_t rscn_out_ptr;
2606
2607 /* Timeout timers. */
2608 uint8_t loop_down_abort_time; /* port down timer */
2609 atomic_t loop_down_timer; /* loop down timer */
2610 uint8_t link_down_timeout; /* link down timeout */
2611
2612 uint32_t timer_active;
2613 struct timer_list timer;
2614
2615 uint8_t node_name[WWN_SIZE];
2616 uint8_t port_name[WWN_SIZE];
2617 uint8_t fabric_node_name[WWN_SIZE];
2618 uint32_t vp_abort_cnt;
2619
2580 struct fc_vport *fc_vport; /* holds fc_vport * for each vport */ 2620 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 */ 2621 uint16_t vp_idx; /* vport ID */
2585 2622
2586 struct scsi_qla_host *parent; /* holds pport */
2587 unsigned long vp_flags; 2623 unsigned long vp_flags;
2588 struct list_head vp_fcports; /* list of fcports */
2589#define VP_IDX_ACQUIRED 0 /* bit no 0 */ 2624#define VP_IDX_ACQUIRED 0 /* bit no 0 */
2590#define VP_CREATE_NEEDED 1 2625#define VP_CREATE_NEEDED 1
2591#define VP_BIND_NEEDED 2 2626#define VP_BIND_NEEDED 2
@@ -2604,11 +2639,7 @@ typedef struct scsi_qla_host {
2604#define VP_ERR_FAB_NORESOURCES 3 2639#define VP_ERR_FAB_NORESOURCES 3
2605#define VP_ERR_FAB_LOGOUT 4 2640#define VP_ERR_FAB_LOGOUT 4
2606#define VP_ERR_ADAP_NORESOURCES 5 2641#define VP_ERR_ADAP_NORESOURCES 5
2607 uint16_t max_npiv_vports; /* 63 or 125 per topoloty */ 2642 struct qla_hw_data *hw;
2608 int cur_vport_count;
2609
2610 struct qla_chip_state_84xx *cs84xx;
2611 struct qla_statistics qla_stats;
2612} scsi_qla_host_t; 2643} scsi_qla_host_t;
2613 2644
2614 2645