ql4_def.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. /*
  2. * QLogic iSCSI HBA Driver
  3. * Copyright (c) 2003-2006 QLogic Corporation
  4. *
  5. * See LICENSE.qla4xxx for copyright and licensing details.
  6. */
  7. #ifndef __QL4_DEF_H
  8. #define __QL4_DEF_H
  9. #include <linux/kernel.h>
  10. #include <linux/init.h>
  11. #include <linux/types.h>
  12. #include <linux/module.h>
  13. #include <linux/list.h>
  14. #include <linux/pci.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/sched.h>
  17. #include <linux/slab.h>
  18. #include <linux/dmapool.h>
  19. #include <linux/mempool.h>
  20. #include <linux/spinlock.h>
  21. #include <linux/workqueue.h>
  22. #include <linux/delay.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/mutex.h>
  25. #include <net/tcp.h>
  26. #include <scsi/scsi.h>
  27. #include <scsi/scsi_host.h>
  28. #include <scsi/scsi_device.h>
  29. #include <scsi/scsi_cmnd.h>
  30. #include <scsi/scsi_transport.h>
  31. #include <scsi/scsi_transport_iscsi.h>
  32. #ifndef PCI_DEVICE_ID_QLOGIC_ISP4010
  33. #define PCI_DEVICE_ID_QLOGIC_ISP4010 0x4010
  34. #endif
  35. #ifndef PCI_DEVICE_ID_QLOGIC_ISP4022
  36. #define PCI_DEVICE_ID_QLOGIC_ISP4022 0x4022
  37. #endif
  38. #ifndef PCI_DEVICE_ID_QLOGIC_ISP4032
  39. #define PCI_DEVICE_ID_QLOGIC_ISP4032 0x4032
  40. #endif
  41. #define QLA_SUCCESS 0
  42. #define QLA_ERROR 1
  43. /*
  44. * Data bit definitions
  45. */
  46. #define BIT_0 0x1
  47. #define BIT_1 0x2
  48. #define BIT_2 0x4
  49. #define BIT_3 0x8
  50. #define BIT_4 0x10
  51. #define BIT_5 0x20
  52. #define BIT_6 0x40
  53. #define BIT_7 0x80
  54. #define BIT_8 0x100
  55. #define BIT_9 0x200
  56. #define BIT_10 0x400
  57. #define BIT_11 0x800
  58. #define BIT_12 0x1000
  59. #define BIT_13 0x2000
  60. #define BIT_14 0x4000
  61. #define BIT_15 0x8000
  62. #define BIT_16 0x10000
  63. #define BIT_17 0x20000
  64. #define BIT_18 0x40000
  65. #define BIT_19 0x80000
  66. #define BIT_20 0x100000
  67. #define BIT_21 0x200000
  68. #define BIT_22 0x400000
  69. #define BIT_23 0x800000
  70. #define BIT_24 0x1000000
  71. #define BIT_25 0x2000000
  72. #define BIT_26 0x4000000
  73. #define BIT_27 0x8000000
  74. #define BIT_28 0x10000000
  75. #define BIT_29 0x20000000
  76. #define BIT_30 0x40000000
  77. #define BIT_31 0x80000000
  78. /*
  79. * Host adapter default definitions
  80. ***********************************/
  81. #define MAX_HBAS 16
  82. #define MAX_BUSES 1
  83. #define MAX_TARGETS (MAX_PRST_DEV_DB_ENTRIES + MAX_DEV_DB_ENTRIES)
  84. #define MAX_LUNS 0xffff
  85. #define MAX_AEN_ENTRIES 256 /* should be > EXT_DEF_MAX_AEN_QUEUE */
  86. #define MAX_DDB_ENTRIES (MAX_PRST_DEV_DB_ENTRIES + MAX_DEV_DB_ENTRIES)
  87. #define MAX_PDU_ENTRIES 32
  88. #define INVALID_ENTRY 0xFFFF
  89. #define MAX_CMDS_TO_RISC 1024
  90. #define MAX_SRBS MAX_CMDS_TO_RISC
  91. #define MBOX_AEN_REG_COUNT 5
  92. #define MAX_INIT_RETRIES 5
  93. /*
  94. * Buffer sizes
  95. */
  96. #define REQUEST_QUEUE_DEPTH MAX_CMDS_TO_RISC
  97. #define RESPONSE_QUEUE_DEPTH 64
  98. #define QUEUE_SIZE 64
  99. #define DMA_BUFFER_SIZE 512
  100. /*
  101. * Misc
  102. */
  103. #define MAC_ADDR_LEN 6 /* in bytes */
  104. #define IP_ADDR_LEN 4 /* in bytes */
  105. #define DRIVER_NAME "qla4xxx"
  106. #define MAX_LINKED_CMDS_PER_LUN 3
  107. #define MAX_REQS_SERVICED_PER_INTR 16
  108. #define ISCSI_IPADDR_SIZE 4 /* IP address size */
  109. #define ISCSI_ALIAS_SIZE 32 /* ISCSI Alias name size */
  110. #define ISCSI_NAME_SIZE 0xE0 /* ISCSI Name size */
  111. #define LSDW(x) ((u32)((u64)(x)))
  112. #define MSDW(x) ((u32)((((u64)(x)) >> 16) >> 16))
  113. /*
  114. * Retry & Timeout Values
  115. */
  116. #define MBOX_TOV 60
  117. #define SOFT_RESET_TOV 30
  118. #define RESET_INTR_TOV 3
  119. #define SEMAPHORE_TOV 10
  120. #define ADAPTER_INIT_TOV 120
  121. #define ADAPTER_RESET_TOV 180
  122. #define EXTEND_CMD_TOV 60
  123. #define WAIT_CMD_TOV 30
  124. #define EH_WAIT_CMD_TOV 120
  125. #define FIRMWARE_UP_TOV 60
  126. #define RESET_FIRMWARE_TOV 30
  127. #define LOGOUT_TOV 10
  128. #define IOCB_TOV_MARGIN 10
  129. #define RELOGIN_TOV 18
  130. #define ISNS_DEREG_TOV 5
  131. #define MAX_RESET_HA_RETRIES 2
  132. /*
  133. * SCSI Request Block structure (srb) that is placed
  134. * on cmd->SCp location of every I/O [We have 22 bytes available]
  135. */
  136. struct srb {
  137. struct list_head list; /* (8) */
  138. struct scsi_qla_host *ha; /* HA the SP is queued on */
  139. struct ddb_entry *ddb;
  140. uint16_t flags; /* (1) Status flags. */
  141. #define SRB_DMA_VALID BIT_3 /* DMA Buffer mapped. */
  142. #define SRB_GOT_SENSE BIT_4 /* sense data recieved. */
  143. uint8_t state; /* (1) Status flags. */
  144. #define SRB_NO_QUEUE_STATE 0 /* Request is in between states */
  145. #define SRB_FREE_STATE 1
  146. #define SRB_ACTIVE_STATE 3
  147. #define SRB_ACTIVE_TIMEOUT_STATE 4
  148. #define SRB_SUSPENDED_STATE 7 /* Request in suspended state */
  149. struct scsi_cmnd *cmd; /* (4) SCSI command block */
  150. dma_addr_t dma_handle; /* (4) for unmap of single transfers */
  151. atomic_t ref_count; /* reference count for this srb */
  152. uint32_t fw_ddb_index;
  153. uint8_t err_id; /* error id */
  154. #define SRB_ERR_PORT 1 /* Request failed because "port down" */
  155. #define SRB_ERR_LOOP 2 /* Request failed because "loop down" */
  156. #define SRB_ERR_DEVICE 3 /* Request failed because "device error" */
  157. #define SRB_ERR_OTHER 4
  158. uint16_t reserved;
  159. uint16_t iocb_tov;
  160. uint16_t iocb_cnt; /* Number of used iocbs */
  161. uint16_t cc_stat;
  162. u_long r_start; /* Time we recieve a cmd from OS */
  163. u_long u_start; /* Time when we handed the cmd to F/W */
  164. /* Used for extended sense / status continuation */
  165. uint8_t *req_sense_ptr;
  166. uint16_t req_sense_len;
  167. uint16_t reserved2;
  168. };
  169. /*
  170. * Asynchronous Event Queue structure
  171. */
  172. struct aen {
  173. uint32_t mbox_sts[MBOX_AEN_REG_COUNT];
  174. };
  175. struct ql4_aen_log {
  176. int count;
  177. struct aen entry[MAX_AEN_ENTRIES];
  178. };
  179. /*
  180. * Device Database (DDB) structure
  181. */
  182. struct ddb_entry {
  183. struct list_head list; /* ddb list */
  184. struct scsi_qla_host *ha;
  185. struct iscsi_cls_session *sess;
  186. struct iscsi_cls_conn *conn;
  187. atomic_t state; /* DDB State */
  188. unsigned long flags; /* DDB Flags */
  189. unsigned long dev_scan_wait_to_start_relogin;
  190. unsigned long dev_scan_wait_to_complete_relogin;
  191. uint16_t os_target_id; /* Target ID */
  192. uint16_t fw_ddb_index; /* DDB firmware index */
  193. uint8_t reserved[2];
  194. uint32_t fw_ddb_device_state; /* F/W Device State -- see ql4_fw.h */
  195. uint32_t CmdSn;
  196. uint16_t target_session_id;
  197. uint16_t connection_id;
  198. uint16_t exe_throttle; /* Max mumber of cmds outstanding
  199. * simultaneously */
  200. uint16_t task_mgmt_timeout; /* Min time for task mgmt cmds to
  201. * complete */
  202. uint16_t default_relogin_timeout; /* Max time to wait for
  203. * relogin to complete */
  204. uint16_t tcp_source_port_num;
  205. uint32_t default_time2wait; /* Default Min time between
  206. * relogins (+aens) */
  207. atomic_t port_down_timer; /* Device connection timer */
  208. atomic_t retry_relogin_timer; /* Min Time between relogins
  209. * (4000 only) */
  210. atomic_t relogin_timer; /* Max Time to wait for relogin to complete */
  211. atomic_t relogin_retry_count; /* Num of times relogin has been
  212. * retried */
  213. uint16_t port;
  214. uint32_t tpgt;
  215. uint8_t ip_addr[ISCSI_IPADDR_SIZE];
  216. uint8_t iscsi_name[ISCSI_NAME_SIZE]; /* 72 x48 */
  217. uint8_t iscsi_alias[0x20];
  218. uint8_t isid[6];
  219. };
  220. /*
  221. * DDB states.
  222. */
  223. #define DDB_STATE_DEAD 0 /* We can no longer talk to
  224. * this device */
  225. #define DDB_STATE_ONLINE 1 /* Device ready to accept
  226. * commands */
  227. #define DDB_STATE_MISSING 2 /* Device logged off, trying
  228. * to re-login */
  229. /*
  230. * DDB flags.
  231. */
  232. #define DF_RELOGIN 0 /* Relogin to device */
  233. #define DF_NO_RELOGIN 1 /* Do not relogin if IOCTL
  234. * logged it out */
  235. #define DF_ISNS_DISCOVERED 2 /* Device was discovered via iSNS */
  236. #define DF_FO_MASKED 3
  237. #include "ql4_fw.h"
  238. #include "ql4_nvram.h"
  239. /*
  240. * Linux Host Adapter structure
  241. */
  242. struct scsi_qla_host {
  243. /* Linux adapter configuration data */
  244. unsigned long flags;
  245. #define AF_ONLINE 0 /* 0x00000001 */
  246. #define AF_INIT_DONE 1 /* 0x00000002 */
  247. #define AF_MBOX_COMMAND 2 /* 0x00000004 */
  248. #define AF_MBOX_COMMAND_DONE 3 /* 0x00000008 */
  249. #define AF_INTERRUPTS_ON 6 /* 0x00000040 */
  250. #define AF_GET_CRASH_RECORD 7 /* 0x00000080 */
  251. #define AF_LINK_UP 8 /* 0x00000100 */
  252. #define AF_IRQ_ATTACHED 10 /* 0x00000400 */
  253. #define AF_DISABLE_ACB_COMPLETE 11 /* 0x00000800 */
  254. unsigned long dpc_flags;
  255. #define DPC_RESET_HA 1 /* 0x00000002 */
  256. #define DPC_RETRY_RESET_HA 2 /* 0x00000004 */
  257. #define DPC_RELOGIN_DEVICE 3 /* 0x00000008 */
  258. #define DPC_RESET_HA_DESTROY_DDB_LIST 4 /* 0x00000010 */
  259. #define DPC_RESET_HA_INTR 5 /* 0x00000020 */
  260. #define DPC_ISNS_RESTART 7 /* 0x00000080 */
  261. #define DPC_AEN 9 /* 0x00000200 */
  262. #define DPC_GET_DHCP_IP_ADDR 15 /* 0x00008000 */
  263. struct Scsi_Host *host; /* pointer to host data */
  264. uint32_t tot_ddbs;
  265. uint16_t iocb_cnt;
  266. /* SRB cache. */
  267. #define SRB_MIN_REQ 128
  268. mempool_t *srb_mempool;
  269. /* pci information */
  270. struct pci_dev *pdev;
  271. struct isp_reg __iomem *reg; /* Base I/O address */
  272. unsigned long pio_address;
  273. unsigned long pio_length;
  274. #define MIN_IOBASE_LEN 0x100
  275. uint16_t req_q_count;
  276. uint8_t marker_needed;
  277. uint8_t rsvd1;
  278. unsigned long host_no;
  279. /* NVRAM registers */
  280. struct eeprom_data *nvram;
  281. spinlock_t hardware_lock ____cacheline_aligned;
  282. uint32_t eeprom_cmd_data;
  283. /* Counters for general statistics */
  284. uint64_t isr_count;
  285. uint64_t adapter_error_count;
  286. uint64_t device_error_count;
  287. uint64_t total_io_count;
  288. uint64_t total_mbytes_xferred;
  289. uint64_t link_failure_count;
  290. uint64_t invalid_crc_count;
  291. uint32_t bytes_xfered;
  292. uint32_t spurious_int_count;
  293. uint32_t aborted_io_count;
  294. uint32_t io_timeout_count;
  295. uint32_t mailbox_timeout_count;
  296. uint32_t seconds_since_last_intr;
  297. uint32_t seconds_since_last_heartbeat;
  298. uint32_t mac_index;
  299. /* Info Needed for Management App */
  300. /* --- From GetFwVersion --- */
  301. uint32_t firmware_version[2];
  302. uint32_t patch_number;
  303. uint32_t build_number;
  304. uint32_t board_id;
  305. /* --- From Init_FW --- */
  306. /* init_cb_t *init_cb; */
  307. uint16_t firmware_options;
  308. uint16_t tcp_options;
  309. uint8_t ip_address[IP_ADDR_LEN];
  310. uint8_t subnet_mask[IP_ADDR_LEN];
  311. uint8_t gateway[IP_ADDR_LEN];
  312. uint8_t alias[32];
  313. uint8_t name_string[256];
  314. uint8_t heartbeat_interval;
  315. uint8_t rsvd;
  316. /* --- From FlashSysInfo --- */
  317. uint8_t my_mac[MAC_ADDR_LEN];
  318. uint8_t serial_number[16];
  319. /* --- From GetFwState --- */
  320. uint32_t firmware_state;
  321. uint32_t addl_fw_state;
  322. /* Linux kernel thread */
  323. struct workqueue_struct *dpc_thread;
  324. struct work_struct dpc_work;
  325. /* Linux timer thread */
  326. struct timer_list timer;
  327. uint32_t timer_active;
  328. /* Recovery Timers */
  329. uint32_t port_down_retry_count;
  330. uint32_t discovery_wait;
  331. atomic_t check_relogin_timeouts;
  332. uint32_t retry_reset_ha_cnt;
  333. uint32_t isp_reset_timer; /* reset test timer */
  334. uint32_t nic_reset_timer; /* simulated nic reset test timer */
  335. int eh_start;
  336. struct list_head free_srb_q;
  337. uint16_t free_srb_q_count;
  338. uint16_t num_srbs_allocated;
  339. /* DMA Memory Block */
  340. void *queues;
  341. dma_addr_t queues_dma;
  342. unsigned long queues_len;
  343. #define MEM_ALIGN_VALUE \
  344. ((max(REQUEST_QUEUE_DEPTH, RESPONSE_QUEUE_DEPTH)) * \
  345. sizeof(struct queue_entry))
  346. /* request and response queue variables */
  347. dma_addr_t request_dma;
  348. struct queue_entry *request_ring;
  349. struct queue_entry *request_ptr;
  350. dma_addr_t response_dma;
  351. struct queue_entry *response_ring;
  352. struct queue_entry *response_ptr;
  353. dma_addr_t shadow_regs_dma;
  354. struct shadow_regs *shadow_regs;
  355. uint16_t request_in; /* Current indexes. */
  356. uint16_t request_out;
  357. uint16_t response_in;
  358. uint16_t response_out;
  359. /* aen queue variables */
  360. uint16_t aen_q_count; /* Number of available aen_q entries */
  361. uint16_t aen_in; /* Current indexes */
  362. uint16_t aen_out;
  363. struct aen aen_q[MAX_AEN_ENTRIES];
  364. struct ql4_aen_log aen_log;/* tracks all aens */
  365. /* This mutex protects several threads to do mailbox commands
  366. * concurrently.
  367. */
  368. struct mutex mbox_sem;
  369. /* temporary mailbox status registers */
  370. volatile uint8_t mbox_status_count;
  371. volatile uint32_t mbox_status[MBOX_REG_COUNT];
  372. /* local device database list (contains internal ddb entries) */
  373. struct list_head ddb_list;
  374. /* Map ddb_list entry by FW ddb index */
  375. struct ddb_entry *fw_ddb_index_map[MAX_DDB_ENTRIES];
  376. /* Saved srb for status continuation entry processing */
  377. struct srb *status_srb;
  378. };
  379. static inline int is_qla4010(struct scsi_qla_host *ha)
  380. {
  381. return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4010;
  382. }
  383. static inline int is_qla4022(struct scsi_qla_host *ha)
  384. {
  385. return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4022;
  386. }
  387. static inline int is_qla4032(struct scsi_qla_host *ha)
  388. {
  389. return ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP4032;
  390. }
  391. static inline int adapter_up(struct scsi_qla_host *ha)
  392. {
  393. return (test_bit(AF_ONLINE, &ha->flags) != 0) &&
  394. (test_bit(AF_LINK_UP, &ha->flags) != 0);
  395. }
  396. static inline struct scsi_qla_host* to_qla_host(struct Scsi_Host *shost)
  397. {
  398. return (struct scsi_qla_host *)shost->hostdata;
  399. }
  400. static inline void __iomem* isp_semaphore(struct scsi_qla_host *ha)
  401. {
  402. return (is_qla4010(ha) ?
  403. &ha->reg->u1.isp4010.nvram :
  404. &ha->reg->u1.isp4022.semaphore);
  405. }
  406. static inline void __iomem* isp_nvram(struct scsi_qla_host *ha)
  407. {
  408. return (is_qla4010(ha) ?
  409. &ha->reg->u1.isp4010.nvram :
  410. &ha->reg->u1.isp4022.nvram);
  411. }
  412. static inline void __iomem* isp_ext_hw_conf(struct scsi_qla_host *ha)
  413. {
  414. return (is_qla4010(ha) ?
  415. &ha->reg->u2.isp4010.ext_hw_conf :
  416. &ha->reg->u2.isp4022.p0.ext_hw_conf);
  417. }
  418. static inline void __iomem* isp_port_status(struct scsi_qla_host *ha)
  419. {
  420. return (is_qla4010(ha) ?
  421. &ha->reg->u2.isp4010.port_status :
  422. &ha->reg->u2.isp4022.p0.port_status);
  423. }
  424. static inline void __iomem* isp_port_ctrl(struct scsi_qla_host *ha)
  425. {
  426. return (is_qla4010(ha) ?
  427. &ha->reg->u2.isp4010.port_ctrl :
  428. &ha->reg->u2.isp4022.p0.port_ctrl);
  429. }
  430. static inline void __iomem* isp_port_error_status(struct scsi_qla_host *ha)
  431. {
  432. return (is_qla4010(ha) ?
  433. &ha->reg->u2.isp4010.port_err_status :
  434. &ha->reg->u2.isp4022.p0.port_err_status);
  435. }
  436. static inline void __iomem * isp_gp_out(struct scsi_qla_host *ha)
  437. {
  438. return (is_qla4010(ha) ?
  439. &ha->reg->u2.isp4010.gp_out :
  440. &ha->reg->u2.isp4022.p0.gp_out);
  441. }
  442. static inline int eeprom_ext_hw_conf_offset(struct scsi_qla_host *ha)
  443. {
  444. return (is_qla4010(ha) ?
  445. offsetof(struct eeprom_data, isp4010.ext_hw_conf) / 2 :
  446. offsetof(struct eeprom_data, isp4022.ext_hw_conf) / 2);
  447. }
  448. int ql4xxx_sem_spinlock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits);
  449. void ql4xxx_sem_unlock(struct scsi_qla_host * ha, u32 sem_mask);
  450. int ql4xxx_sem_lock(struct scsi_qla_host * ha, u32 sem_mask, u32 sem_bits);
  451. static inline int ql4xxx_lock_flash(struct scsi_qla_host *a)
  452. {
  453. if (is_qla4010(a))
  454. return ql4xxx_sem_spinlock(a, QL4010_FLASH_SEM_MASK,
  455. QL4010_FLASH_SEM_BITS);
  456. else
  457. return ql4xxx_sem_spinlock(a, QL4022_FLASH_SEM_MASK,
  458. (QL4022_RESOURCE_BITS_BASE_CODE |
  459. (a->mac_index)) << 13);
  460. }
  461. static inline void ql4xxx_unlock_flash(struct scsi_qla_host *a)
  462. {
  463. if (is_qla4010(a))
  464. ql4xxx_sem_unlock(a, QL4010_FLASH_SEM_MASK);
  465. else
  466. ql4xxx_sem_unlock(a, QL4022_FLASH_SEM_MASK);
  467. }
  468. static inline int ql4xxx_lock_nvram(struct scsi_qla_host *a)
  469. {
  470. if (is_qla4010(a))
  471. return ql4xxx_sem_spinlock(a, QL4010_NVRAM_SEM_MASK,
  472. QL4010_NVRAM_SEM_BITS);
  473. else
  474. return ql4xxx_sem_spinlock(a, QL4022_NVRAM_SEM_MASK,
  475. (QL4022_RESOURCE_BITS_BASE_CODE |
  476. (a->mac_index)) << 10);
  477. }
  478. static inline void ql4xxx_unlock_nvram(struct scsi_qla_host *a)
  479. {
  480. if (is_qla4010(a))
  481. ql4xxx_sem_unlock(a, QL4010_NVRAM_SEM_MASK);
  482. else
  483. ql4xxx_sem_unlock(a, QL4022_NVRAM_SEM_MASK);
  484. }
  485. static inline int ql4xxx_lock_drvr(struct scsi_qla_host *a)
  486. {
  487. if (is_qla4010(a))
  488. return ql4xxx_sem_lock(a, QL4010_DRVR_SEM_MASK,
  489. QL4010_DRVR_SEM_BITS);
  490. else
  491. return ql4xxx_sem_lock(a, QL4022_DRVR_SEM_MASK,
  492. (QL4022_RESOURCE_BITS_BASE_CODE |
  493. (a->mac_index)) << 1);
  494. }
  495. static inline void ql4xxx_unlock_drvr(struct scsi_qla_host *a)
  496. {
  497. if (is_qla4010(a))
  498. ql4xxx_sem_unlock(a, QL4010_DRVR_SEM_MASK);
  499. else
  500. ql4xxx_sem_unlock(a, QL4022_DRVR_SEM_MASK);
  501. }
  502. /*---------------------------------------------------------------------------*/
  503. /* Defines for qla4xxx_initialize_adapter() and qla4xxx_recover_adapter() */
  504. #define PRESERVE_DDB_LIST 0
  505. #define REBUILD_DDB_LIST 1
  506. /* Defines for process_aen() */
  507. #define PROCESS_ALL_AENS 0
  508. #define FLUSH_DDB_CHANGED_AENS 1
  509. #define RELOGIN_DDB_CHANGED_AENS 2
  510. #endif /*_QLA4XXX_H */