qla1280.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. /******************************************************************************
  2. * QLOGIC LINUX SOFTWARE
  3. *
  4. * QLogic ISP1280 (Ultra2) /12160 (Ultra3) SCSI driver
  5. * Copyright (C) 2000 Qlogic Corporation
  6. * (www.qlogic.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2, or (at your option) any
  11. * later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. ******************************************************************************/
  19. #ifndef _QLA1280_H
  20. #define _QLA1280_H
  21. /*
  22. * Data bit definitions.
  23. */
  24. #define BIT_0 0x1
  25. #define BIT_1 0x2
  26. #define BIT_2 0x4
  27. #define BIT_3 0x8
  28. #define BIT_4 0x10
  29. #define BIT_5 0x20
  30. #define BIT_6 0x40
  31. #define BIT_7 0x80
  32. #define BIT_8 0x100
  33. #define BIT_9 0x200
  34. #define BIT_10 0x400
  35. #define BIT_11 0x800
  36. #define BIT_12 0x1000
  37. #define BIT_13 0x2000
  38. #define BIT_14 0x4000
  39. #define BIT_15 0x8000
  40. #define BIT_16 0x10000
  41. #define BIT_17 0x20000
  42. #define BIT_18 0x40000
  43. #define BIT_19 0x80000
  44. #define BIT_20 0x100000
  45. #define BIT_21 0x200000
  46. #define BIT_22 0x400000
  47. #define BIT_23 0x800000
  48. #define BIT_24 0x1000000
  49. #define BIT_25 0x2000000
  50. #define BIT_26 0x4000000
  51. #define BIT_27 0x8000000
  52. #define BIT_28 0x10000000
  53. #define BIT_29 0x20000000
  54. #define BIT_30 0x40000000
  55. #define BIT_31 0x80000000
  56. #if MEMORY_MAPPED_IO
  57. #define RD_REG_WORD(addr) readw_relaxed(addr)
  58. #define RD_REG_WORD_dmasync(addr) readw(addr)
  59. #define WRT_REG_WORD(addr, data) writew(data, addr)
  60. #else /* MEMORY_MAPPED_IO */
  61. #define RD_REG_WORD(addr) inw((unsigned long)addr)
  62. #define RD_REG_WORD_dmasync(addr) RD_REG_WORD(addr)
  63. #define WRT_REG_WORD(addr, data) outw(data, (unsigned long)addr)
  64. #endif /* MEMORY_MAPPED_IO */
  65. /*
  66. * Host adapter default definitions.
  67. */
  68. #define MAX_BUSES 2 /* 2 */
  69. #define MAX_B_BITS 1
  70. #define MAX_TARGETS 16 /* 16 */
  71. #define MAX_T_BITS 4 /* 4 */
  72. #define MAX_LUNS 8 /* 32 */
  73. #define MAX_L_BITS 3 /* 5 */
  74. /*
  75. * Watchdog time quantum
  76. */
  77. #define QLA1280_WDG_TIME_QUANTUM 5 /* In seconds */
  78. /* Command retry count (0-65535) */
  79. #define COMMAND_RETRY_COUNT 255
  80. /* Maximum outstanding commands in ISP queues */
  81. #define MAX_OUTSTANDING_COMMANDS 512
  82. #define INVALID_HANDLE (MAX_OUTSTANDING_COMMANDS + 2)
  83. /* ISP request and response entry counts (37-65535) */
  84. #define REQUEST_ENTRY_CNT 256 /* Number of request entries. */
  85. #define RESPONSE_ENTRY_CNT 16 /* Number of response entries. */
  86. /* Number of segments 1 - 65535 */
  87. #define SG_SEGMENTS 32 /* Cmd entry + 6 continuations */
  88. /*
  89. * SCSI Request Block structure (sp) that is placed
  90. * on cmd->SCp location of every I/O
  91. */
  92. struct srb {
  93. struct list_head list; /* (8/16) LU queue */
  94. struct scsi_cmnd *cmd; /* (4/8) SCSI command block */
  95. /* NOTE: the sp->cmd will be NULL when this completion is
  96. * called, so you should know the scsi_cmnd when using this */
  97. struct completion *wait;
  98. dma_addr_t saved_dma_handle; /* for unmap of single transfers */
  99. uint8_t flags; /* (1) Status flags. */
  100. uint8_t dir; /* direction of transfer */
  101. };
  102. /*
  103. * SRB flag definitions
  104. */
  105. #define SRB_TIMEOUT (1 << 0) /* Command timed out */
  106. #define SRB_SENT (1 << 1) /* Command sent to ISP */
  107. #define SRB_ABORT_PENDING (1 << 2) /* Command abort sent to device */
  108. #define SRB_ABORTED (1 << 3) /* Command aborted command already */
  109. /*
  110. * ISP I/O Register Set structure definitions.
  111. */
  112. struct device_reg {
  113. uint16_t id_l; /* ID low */
  114. uint16_t id_h; /* ID high */
  115. uint16_t cfg_0; /* Configuration 0 */
  116. #define ISP_CFG0_HWMSK 0x000f /* Hardware revision mask */
  117. #define ISP_CFG0_1020 BIT_0 /* ISP1020 */
  118. #define ISP_CFG0_1020A BIT_1 /* ISP1020A */
  119. #define ISP_CFG0_1040 BIT_2 /* ISP1040 */
  120. #define ISP_CFG0_1040A BIT_3 /* ISP1040A */
  121. #define ISP_CFG0_1040B BIT_4 /* ISP1040B */
  122. #define ISP_CFG0_1040C BIT_5 /* ISP1040C */
  123. uint16_t cfg_1; /* Configuration 1 */
  124. #define ISP_CFG1_F128 BIT_6 /* 128-byte FIFO threshold */
  125. #define ISP_CFG1_F64 BIT_4|BIT_5 /* 128-byte FIFO threshold */
  126. #define ISP_CFG1_F32 BIT_5 /* 128-byte FIFO threshold */
  127. #define ISP_CFG1_F16 BIT_4 /* 128-byte FIFO threshold */
  128. #define ISP_CFG1_BENAB BIT_2 /* Global Bus burst enable */
  129. #define ISP_CFG1_SXP BIT_0 /* SXP register select */
  130. uint16_t ictrl; /* Interface control */
  131. #define ISP_RESET BIT_0 /* ISP soft reset */
  132. #define ISP_EN_INT BIT_1 /* ISP enable interrupts. */
  133. #define ISP_EN_RISC BIT_2 /* ISP enable RISC interrupts. */
  134. #define ISP_FLASH_ENABLE BIT_8 /* Flash BIOS Read/Write enable */
  135. #define ISP_FLASH_UPPER BIT_9 /* Flash upper bank select */
  136. uint16_t istatus; /* Interface status */
  137. #define PCI_64BIT_SLOT BIT_14 /* PCI 64-bit slot indicator. */
  138. #define RISC_INT BIT_2 /* RISC interrupt */
  139. #define PCI_INT BIT_1 /* PCI interrupt */
  140. uint16_t semaphore; /* Semaphore */
  141. uint16_t nvram; /* NVRAM register. */
  142. #define NV_DESELECT 0
  143. #define NV_CLOCK BIT_0
  144. #define NV_SELECT BIT_1
  145. #define NV_DATA_OUT BIT_2
  146. #define NV_DATA_IN BIT_3
  147. uint16_t flash_data; /* Flash BIOS data */
  148. uint16_t flash_address; /* Flash BIOS address */
  149. uint16_t unused_1[0x06];
  150. /* cdma_* and ddma_* are 1040 only */
  151. uint16_t cdma_cfg;
  152. #define CDMA_CONF_SENAB BIT_3 /* SXP to DMA Data enable */
  153. #define CDMA_CONF_RIRQ BIT_2 /* RISC interrupt enable */
  154. #define CDMA_CONF_BENAB BIT_1 /* Bus burst enable */
  155. #define CDMA_CONF_DIR BIT_0 /* DMA direction (0=fifo->host 1=host->fifo) */
  156. uint16_t cdma_ctrl;
  157. uint16_t cdma_status;
  158. uint16_t cdma_fifo_status;
  159. uint16_t cdma_count;
  160. uint16_t cdma_reserved;
  161. uint16_t cdma_address_count_0;
  162. uint16_t cdma_address_count_1;
  163. uint16_t cdma_address_count_2;
  164. uint16_t cdma_address_count_3;
  165. uint16_t unused_2[0x06];
  166. uint16_t ddma_cfg;
  167. #define DDMA_CONF_SENAB BIT_3 /* SXP to DMA Data enable */
  168. #define DDMA_CONF_RIRQ BIT_2 /* RISC interrupt enable */
  169. #define DDMA_CONF_BENAB BIT_1 /* Bus burst enable */
  170. #define DDMA_CONF_DIR BIT_0 /* DMA direction (0=fifo->host 1=host->fifo) */
  171. uint16_t ddma_ctrl;
  172. uint16_t ddma_status;
  173. uint16_t ddma_fifo_status;
  174. uint16_t ddma_xfer_count_low;
  175. uint16_t ddma_xfer_count_high;
  176. uint16_t ddma_addr_count_0;
  177. uint16_t ddma_addr_count_1;
  178. uint16_t ddma_addr_count_2;
  179. uint16_t ddma_addr_count_3;
  180. uint16_t unused_3[0x0e];
  181. uint16_t mailbox0; /* Mailbox 0 */
  182. uint16_t mailbox1; /* Mailbox 1 */
  183. uint16_t mailbox2; /* Mailbox 2 */
  184. uint16_t mailbox3; /* Mailbox 3 */
  185. uint16_t mailbox4; /* Mailbox 4 */
  186. uint16_t mailbox5; /* Mailbox 5 */
  187. uint16_t mailbox6; /* Mailbox 6 */
  188. uint16_t mailbox7; /* Mailbox 7 */
  189. uint16_t unused_4[0x20];/* 0x80-0xbf Gap */
  190. uint16_t host_cmd; /* Host command and control */
  191. #define HOST_INT BIT_7 /* host interrupt bit */
  192. #define BIOS_ENABLE BIT_0
  193. uint16_t unused_5[0x5]; /* 0xc2-0xcb Gap */
  194. uint16_t gpio_data;
  195. uint16_t gpio_enable;
  196. uint16_t unused_6[0x11]; /* d0-f0 */
  197. uint16_t scsiControlPins; /* f2 */
  198. };
  199. #define MAILBOX_REGISTER_COUNT 8
  200. /*
  201. * ISP product identification definitions in mailboxes after reset.
  202. */
  203. #define PROD_ID_1 0x4953
  204. #define PROD_ID_2 0x0000
  205. #define PROD_ID_2a 0x5020
  206. #define PROD_ID_3 0x2020
  207. #define PROD_ID_4 0x1
  208. /*
  209. * ISP host command and control register command definitions
  210. */
  211. #define HC_RESET_RISC 0x1000 /* Reset RISC */
  212. #define HC_PAUSE_RISC 0x2000 /* Pause RISC */
  213. #define HC_RELEASE_RISC 0x3000 /* Release RISC from reset. */
  214. #define HC_SET_HOST_INT 0x5000 /* Set host interrupt */
  215. #define HC_CLR_HOST_INT 0x6000 /* Clear HOST interrupt */
  216. #define HC_CLR_RISC_INT 0x7000 /* Clear RISC interrupt */
  217. #define HC_DISABLE_BIOS 0x9000 /* Disable BIOS. */
  218. /*
  219. * ISP mailbox Self-Test status codes
  220. */
  221. #define MBS_FRM_ALIVE 0 /* Firmware Alive. */
  222. #define MBS_CHKSUM_ERR 1 /* Checksum Error. */
  223. #define MBS_SHADOW_LD_ERR 2 /* Shadow Load Error. */
  224. #define MBS_BUSY 4 /* Busy. */
  225. /*
  226. * ISP mailbox command complete status codes
  227. */
  228. #define MBS_CMD_CMP 0x4000 /* Command Complete. */
  229. #define MBS_INV_CMD 0x4001 /* Invalid Command. */
  230. #define MBS_HOST_INF_ERR 0x4002 /* Host Interface Error. */
  231. #define MBS_TEST_FAILED 0x4003 /* Test Failed. */
  232. #define MBS_CMD_ERR 0x4005 /* Command Error. */
  233. #define MBS_CMD_PARAM_ERR 0x4006 /* Command Parameter Error. */
  234. /*
  235. * ISP mailbox asynchronous event status codes
  236. */
  237. #define MBA_ASYNC_EVENT 0x8000 /* Asynchronous event. */
  238. #define MBA_BUS_RESET 0x8001 /* SCSI Bus Reset. */
  239. #define MBA_SYSTEM_ERR 0x8002 /* System Error. */
  240. #define MBA_REQ_TRANSFER_ERR 0x8003 /* Request Transfer Error. */
  241. #define MBA_RSP_TRANSFER_ERR 0x8004 /* Response Transfer Error. */
  242. #define MBA_WAKEUP_THRES 0x8005 /* Request Queue Wake-up. */
  243. #define MBA_TIMEOUT_RESET 0x8006 /* Execution Timeout Reset. */
  244. #define MBA_DEVICE_RESET 0x8007 /* Bus Device Reset. */
  245. #define MBA_BUS_MODE_CHANGE 0x800E /* SCSI bus mode transition. */
  246. #define MBA_SCSI_COMPLETION 0x8020 /* Completion response. */
  247. /*
  248. * ISP mailbox commands
  249. */
  250. #define MBC_NOP 0 /* No Operation */
  251. #define MBC_LOAD_RAM 1 /* Load RAM */
  252. #define MBC_EXECUTE_FIRMWARE 2 /* Execute firmware */
  253. #define MBC_DUMP_RAM 3 /* Dump RAM contents */
  254. #define MBC_WRITE_RAM_WORD 4 /* Write ram word */
  255. #define MBC_READ_RAM_WORD 5 /* Read ram word */
  256. #define MBC_MAILBOX_REGISTER_TEST 6 /* Wrap incoming mailboxes */
  257. #define MBC_VERIFY_CHECKSUM 7 /* Verify checksum */
  258. #define MBC_ABOUT_FIRMWARE 8 /* Get firmware revision */
  259. #define MBC_INIT_REQUEST_QUEUE 0x10 /* Initialize request queue */
  260. #define MBC_INIT_RESPONSE_QUEUE 0x11 /* Initialize response queue */
  261. #define MBC_EXECUTE_IOCB 0x12 /* Execute IOCB command */
  262. #define MBC_ABORT_COMMAND 0x15 /* Abort IOCB command */
  263. #define MBC_ABORT_DEVICE 0x16 /* Abort device (ID/LUN) */
  264. #define MBC_ABORT_TARGET 0x17 /* Abort target (ID) */
  265. #define MBC_BUS_RESET 0x18 /* SCSI bus reset */
  266. #define MBC_GET_RETRY_COUNT 0x22 /* Get retry count and delay */
  267. #define MBC_GET_TARGET_PARAMETERS 0x28 /* Get target parameters */
  268. #define MBC_SET_INITIATOR_ID 0x30 /* Set initiator SCSI ID */
  269. #define MBC_SET_SELECTION_TIMEOUT 0x31 /* Set selection timeout */
  270. #define MBC_SET_RETRY_COUNT 0x32 /* Set retry count and delay */
  271. #define MBC_SET_TAG_AGE_LIMIT 0x33 /* Set tag age limit */
  272. #define MBC_SET_CLOCK_RATE 0x34 /* Set clock rate */
  273. #define MBC_SET_ACTIVE_NEGATION 0x35 /* Set active negation state */
  274. #define MBC_SET_ASYNC_DATA_SETUP 0x36 /* Set async data setup time */
  275. #define MBC_SET_PCI_CONTROL 0x37 /* Set BUS control parameters */
  276. #define MBC_SET_TARGET_PARAMETERS 0x38 /* Set target parameters */
  277. #define MBC_SET_DEVICE_QUEUE 0x39 /* Set device queue parameters */
  278. #define MBC_SET_RESET_DELAY_PARAMETERS 0x3A /* Set reset delay parameters */
  279. #define MBC_SET_SYSTEM_PARAMETER 0x45 /* Set system parameter word */
  280. #define MBC_SET_FIRMWARE_FEATURES 0x4A /* Set firmware feature word */
  281. #define MBC_INIT_REQUEST_QUEUE_A64 0x52 /* Initialize request queue A64 */
  282. #define MBC_INIT_RESPONSE_QUEUE_A64 0x53 /* Initialize response q A64 */
  283. #define MBC_ENABLE_TARGET_MODE 0x55 /* Enable target mode */
  284. #define MBC_SET_DATA_OVERRUN_RECOVERY 0x5A /* Set data overrun recovery mode */
  285. /*
  286. * ISP Get/Set Target Parameters mailbox command control flags.
  287. */
  288. #define TP_PPR BIT_5 /* PPR */
  289. #define TP_RENEGOTIATE BIT_8 /* Renegotiate on error. */
  290. #define TP_STOP_QUEUE BIT_9 /* Stop que on check condition */
  291. #define TP_AUTO_REQUEST_SENSE BIT_10 /* Automatic request sense. */
  292. #define TP_TAGGED_QUEUE BIT_11 /* Tagged queuing. */
  293. #define TP_SYNC BIT_12 /* Synchronous data transfers. */
  294. #define TP_WIDE BIT_13 /* Wide data transfers. */
  295. #define TP_PARITY BIT_14 /* Parity checking. */
  296. #define TP_DISCONNECT BIT_15 /* Disconnect privilege. */
  297. /*
  298. * NVRAM Command values.
  299. */
  300. #define NV_START_BIT BIT_2
  301. #define NV_WRITE_OP (BIT_26 | BIT_24)
  302. #define NV_READ_OP (BIT_26 | BIT_25)
  303. #define NV_ERASE_OP (BIT_26 | BIT_25 | BIT_24)
  304. #define NV_MASK_OP (BIT_26 | BIT_25 | BIT_24)
  305. #define NV_DELAY_COUNT 10
  306. /*
  307. * QLogic ISP1280/ISP12160 NVRAM structure definition.
  308. */
  309. struct nvram {
  310. uint8_t id0; /* 0 */
  311. uint8_t id1; /* 1 */
  312. uint8_t id2; /* 2 */
  313. uint8_t id3; /* 3 */
  314. uint8_t version; /* 4 */
  315. struct {
  316. uint8_t bios_configuration_mode:2;
  317. uint8_t bios_disable:1;
  318. uint8_t selectable_scsi_boot_enable:1;
  319. uint8_t cd_rom_boot_enable:1;
  320. uint8_t disable_loading_risc_code:1;
  321. uint8_t enable_64bit_addressing:1;
  322. uint8_t unused_7:1;
  323. } cntr_flags_1; /* 5 */
  324. struct {
  325. uint8_t boot_lun_number:5;
  326. uint8_t scsi_bus_number:1;
  327. uint8_t unused_6:1;
  328. uint8_t unused_7:1;
  329. } cntr_flags_2l; /* 7 */
  330. struct {
  331. uint8_t boot_target_number:4;
  332. uint8_t unused_12:1;
  333. uint8_t unused_13:1;
  334. uint8_t unused_14:1;
  335. uint8_t unused_15:1;
  336. } cntr_flags_2h; /* 8 */
  337. uint16_t unused_8; /* 8, 9 */
  338. uint16_t unused_10; /* 10, 11 */
  339. uint16_t unused_12; /* 12, 13 */
  340. uint16_t unused_14; /* 14, 15 */
  341. union {
  342. uint8_t c;
  343. struct {
  344. uint8_t reserved:2;
  345. uint8_t burst_enable:1;
  346. uint8_t reserved_1:1;
  347. uint8_t fifo_threshold:4;
  348. } f;
  349. } isp_config; /* 16 */
  350. /* Termination
  351. * 0 = Disable, 1 = high only, 3 = Auto term
  352. */
  353. union {
  354. uint8_t c;
  355. struct {
  356. uint8_t scsi_bus_1_control:2;
  357. uint8_t scsi_bus_0_control:2;
  358. uint8_t unused_0:1;
  359. uint8_t unused_1:1;
  360. uint8_t unused_2:1;
  361. uint8_t auto_term_support:1;
  362. } f;
  363. } termination; /* 17 */
  364. uint16_t isp_parameter; /* 18, 19 */
  365. union {
  366. uint16_t w;
  367. struct {
  368. uint16_t enable_fast_posting:1;
  369. uint16_t report_lvd_bus_transition:1;
  370. uint16_t unused_2:1;
  371. uint16_t unused_3:1;
  372. uint16_t disable_iosbs_with_bus_reset_status:1;
  373. uint16_t disable_synchronous_backoff:1;
  374. uint16_t unused_6:1;
  375. uint16_t synchronous_backoff_reporting:1;
  376. uint16_t disable_reselection_fairness:1;
  377. uint16_t unused_9:1;
  378. uint16_t unused_10:1;
  379. uint16_t unused_11:1;
  380. uint16_t unused_12:1;
  381. uint16_t unused_13:1;
  382. uint16_t unused_14:1;
  383. uint16_t unused_15:1;
  384. } f;
  385. } firmware_feature; /* 20, 21 */
  386. uint16_t unused_22; /* 22, 23 */
  387. struct {
  388. struct {
  389. uint8_t initiator_id:4;
  390. uint8_t scsi_reset_disable:1;
  391. uint8_t scsi_bus_size:1;
  392. uint8_t scsi_bus_type:1;
  393. uint8_t unused_7:1;
  394. } config_1; /* 24 */
  395. uint8_t bus_reset_delay; /* 25 */
  396. uint8_t retry_count; /* 26 */
  397. uint8_t retry_delay; /* 27 */
  398. struct {
  399. uint8_t async_data_setup_time:4;
  400. uint8_t req_ack_active_negation:1;
  401. uint8_t data_line_active_negation:1;
  402. uint8_t unused_6:1;
  403. uint8_t unused_7:1;
  404. } config_2; /* 28 */
  405. uint8_t unused_29; /* 29 */
  406. uint16_t selection_timeout; /* 30, 31 */
  407. uint16_t max_queue_depth; /* 32, 33 */
  408. uint16_t unused_34; /* 34, 35 */
  409. uint16_t unused_36; /* 36, 37 */
  410. uint16_t unused_38; /* 38, 39 */
  411. struct {
  412. union {
  413. uint8_t c;
  414. struct {
  415. uint8_t renegotiate_on_error:1;
  416. uint8_t stop_queue_on_check:1;
  417. uint8_t auto_request_sense:1;
  418. uint8_t tag_queuing:1;
  419. uint8_t enable_sync:1;
  420. uint8_t enable_wide:1;
  421. uint8_t parity_checking:1;
  422. uint8_t disconnect_allowed:1;
  423. } f;
  424. } parameter; /* 40 */
  425. uint8_t execution_throttle; /* 41 */
  426. uint8_t sync_period; /* 42 */
  427. union { /* 43 */
  428. uint8_t flags_43;
  429. struct {
  430. uint8_t sync_offset:4;
  431. uint8_t device_enable:1;
  432. uint8_t lun_disable:1;
  433. uint8_t unused_6:1;
  434. uint8_t unused_7:1;
  435. } flags1x80;
  436. struct {
  437. uint8_t sync_offset:5;
  438. uint8_t device_enable:1;
  439. uint8_t unused_6:1;
  440. uint8_t unused_7:1;
  441. } flags1x160;
  442. } flags;
  443. union { /* PPR flags for the 1x160 controllers */
  444. uint8_t unused_44;
  445. struct {
  446. uint8_t ppr_options:4;
  447. uint8_t ppr_bus_width:2;
  448. uint8_t unused_8:1;
  449. uint8_t enable_ppr:1;
  450. } flags; /* 44 */
  451. } ppr_1x160;
  452. uint8_t unused_45; /* 45 */
  453. } target[MAX_TARGETS];
  454. } bus[MAX_BUSES];
  455. uint16_t unused_248; /* 248, 249 */
  456. uint16_t subsystem_id[2]; /* 250, 251, 252, 253 */
  457. union { /* 254 */
  458. uint8_t unused_254;
  459. uint8_t system_id_pointer;
  460. } sysid_1x160;
  461. uint8_t chksum; /* 255 */
  462. };
  463. /*
  464. * ISP queue - command entry structure definition.
  465. */
  466. #define MAX_CMDSZ 12 /* SCSI maximum CDB size. */
  467. struct cmd_entry {
  468. uint8_t entry_type; /* Entry type. */
  469. #define COMMAND_TYPE 1 /* Command entry */
  470. uint8_t entry_count; /* Entry count. */
  471. uint8_t sys_define; /* System defined. */
  472. uint8_t entry_status; /* Entry Status. */
  473. uint32_t handle; /* System handle. */
  474. uint8_t lun; /* SCSI LUN */
  475. uint8_t target; /* SCSI ID */
  476. uint16_t cdb_len; /* SCSI command length. */
  477. uint16_t control_flags; /* Control flags. */
  478. uint16_t reserved;
  479. uint16_t timeout; /* Command timeout. */
  480. uint16_t dseg_count; /* Data segment count. */
  481. uint8_t scsi_cdb[MAX_CMDSZ]; /* SCSI command words. */
  482. uint32_t dseg_0_address; /* Data segment 0 address. */
  483. uint32_t dseg_0_length; /* Data segment 0 length. */
  484. uint32_t dseg_1_address; /* Data segment 1 address. */
  485. uint32_t dseg_1_length; /* Data segment 1 length. */
  486. uint32_t dseg_2_address; /* Data segment 2 address. */
  487. uint32_t dseg_2_length; /* Data segment 2 length. */
  488. uint32_t dseg_3_address; /* Data segment 3 address. */
  489. uint32_t dseg_3_length; /* Data segment 3 length. */
  490. };
  491. /*
  492. * ISP queue - continuation entry structure definition.
  493. */
  494. struct cont_entry {
  495. uint8_t entry_type; /* Entry type. */
  496. #define CONTINUE_TYPE 2 /* Continuation entry. */
  497. uint8_t entry_count; /* Entry count. */
  498. uint8_t sys_define; /* System defined. */
  499. uint8_t entry_status; /* Entry Status. */
  500. uint32_t reserved; /* Reserved */
  501. uint32_t dseg_0_address; /* Data segment 0 address. */
  502. uint32_t dseg_0_length; /* Data segment 0 length. */
  503. uint32_t dseg_1_address; /* Data segment 1 address. */
  504. uint32_t dseg_1_length; /* Data segment 1 length. */
  505. uint32_t dseg_2_address; /* Data segment 2 address. */
  506. uint32_t dseg_2_length; /* Data segment 2 length. */
  507. uint32_t dseg_3_address; /* Data segment 3 address. */
  508. uint32_t dseg_3_length; /* Data segment 3 length. */
  509. uint32_t dseg_4_address; /* Data segment 4 address. */
  510. uint32_t dseg_4_length; /* Data segment 4 length. */
  511. uint32_t dseg_5_address; /* Data segment 5 address. */
  512. uint32_t dseg_5_length; /* Data segment 5 length. */
  513. uint32_t dseg_6_address; /* Data segment 6 address. */
  514. uint32_t dseg_6_length; /* Data segment 6 length. */
  515. };
  516. /*
  517. * ISP queue - status entry structure definition.
  518. */
  519. struct response {
  520. uint8_t entry_type; /* Entry type. */
  521. #define STATUS_TYPE 3 /* Status entry. */
  522. uint8_t entry_count; /* Entry count. */
  523. uint8_t sys_define; /* System defined. */
  524. uint8_t entry_status; /* Entry Status. */
  525. #define RF_CONT BIT_0 /* Continuation. */
  526. #define RF_FULL BIT_1 /* Full */
  527. #define RF_BAD_HEADER BIT_2 /* Bad header. */
  528. #define RF_BAD_PAYLOAD BIT_3 /* Bad payload. */
  529. uint32_t handle; /* System handle. */
  530. uint16_t scsi_status; /* SCSI status. */
  531. uint16_t comp_status; /* Completion status. */
  532. uint16_t state_flags; /* State flags. */
  533. #define SF_TRANSFER_CMPL BIT_14 /* Transfer Complete. */
  534. #define SF_GOT_SENSE BIT_13 /* Got Sense */
  535. #define SF_GOT_STATUS BIT_12 /* Got Status */
  536. #define SF_TRANSFERRED_DATA BIT_11 /* Transferred data */
  537. #define SF_SENT_CDB BIT_10 /* Send CDB */
  538. #define SF_GOT_TARGET BIT_9 /* */
  539. #define SF_GOT_BUS BIT_8 /* */
  540. uint16_t status_flags; /* Status flags. */
  541. uint16_t time; /* Time. */
  542. uint16_t req_sense_length; /* Request sense data length. */
  543. uint32_t residual_length; /* Residual transfer length. */
  544. uint16_t reserved[4];
  545. uint8_t req_sense_data[32]; /* Request sense data. */
  546. };
  547. /*
  548. * ISP queue - marker entry structure definition.
  549. */
  550. struct mrk_entry {
  551. uint8_t entry_type; /* Entry type. */
  552. #define MARKER_TYPE 4 /* Marker entry. */
  553. uint8_t entry_count; /* Entry count. */
  554. uint8_t sys_define; /* System defined. */
  555. uint8_t entry_status; /* Entry Status. */
  556. uint32_t reserved;
  557. uint8_t lun; /* SCSI LUN */
  558. uint8_t target; /* SCSI ID */
  559. uint8_t modifier; /* Modifier (7-0). */
  560. #define MK_SYNC_ID_LUN 0 /* Synchronize ID/LUN */
  561. #define MK_SYNC_ID 1 /* Synchronize ID */
  562. #define MK_SYNC_ALL 2 /* Synchronize all ID/LUN */
  563. uint8_t reserved_1[53];
  564. };
  565. /*
  566. * ISP queue - extended command entry structure definition.
  567. *
  568. * Unused by the driver!
  569. */
  570. struct ecmd_entry {
  571. uint8_t entry_type; /* Entry type. */
  572. #define EXTENDED_CMD_TYPE 5 /* Extended command entry. */
  573. uint8_t entry_count; /* Entry count. */
  574. uint8_t sys_define; /* System defined. */
  575. uint8_t entry_status; /* Entry Status. */
  576. uint32_t handle; /* System handle. */
  577. uint8_t lun; /* SCSI LUN */
  578. uint8_t target; /* SCSI ID */
  579. uint16_t cdb_len; /* SCSI command length. */
  580. uint16_t control_flags; /* Control flags. */
  581. uint16_t reserved;
  582. uint16_t timeout; /* Command timeout. */
  583. uint16_t dseg_count; /* Data segment count. */
  584. uint8_t scsi_cdb[88]; /* SCSI command words. */
  585. };
  586. /*
  587. * ISP queue - 64-Bit addressing, command entry structure definition.
  588. */
  589. typedef struct {
  590. uint8_t entry_type; /* Entry type. */
  591. #define COMMAND_A64_TYPE 9 /* Command A64 entry */
  592. uint8_t entry_count; /* Entry count. */
  593. uint8_t sys_define; /* System defined. */
  594. uint8_t entry_status; /* Entry Status. */
  595. uint32_t handle; /* System handle. */
  596. uint8_t lun; /* SCSI LUN */
  597. uint8_t target; /* SCSI ID */
  598. uint16_t cdb_len; /* SCSI command length. */
  599. uint16_t control_flags; /* Control flags. */
  600. uint16_t reserved;
  601. uint16_t timeout; /* Command timeout. */
  602. uint16_t dseg_count; /* Data segment count. */
  603. uint8_t scsi_cdb[MAX_CMDSZ]; /* SCSI command words. */
  604. uint32_t reserved_1[2]; /* unused */
  605. uint32_t dseg_0_address[2]; /* Data segment 0 address. */
  606. uint32_t dseg_0_length; /* Data segment 0 length. */
  607. uint32_t dseg_1_address[2]; /* Data segment 1 address. */
  608. uint32_t dseg_1_length; /* Data segment 1 length. */
  609. } cmd_a64_entry_t, request_t;
  610. /*
  611. * ISP queue - 64-Bit addressing, continuation entry structure definition.
  612. */
  613. struct cont_a64_entry {
  614. uint8_t entry_type; /* Entry type. */
  615. #define CONTINUE_A64_TYPE 0xA /* Continuation A64 entry. */
  616. uint8_t entry_count; /* Entry count. */
  617. uint8_t sys_define; /* System defined. */
  618. uint8_t entry_status; /* Entry Status. */
  619. uint32_t dseg_0_address[2]; /* Data segment 0 address. */
  620. uint32_t dseg_0_length; /* Data segment 0 length. */
  621. uint32_t dseg_1_address[2]; /* Data segment 1 address. */
  622. uint32_t dseg_1_length; /* Data segment 1 length. */
  623. uint32_t dseg_2_address[2]; /* Data segment 2 address. */
  624. uint32_t dseg_2_length; /* Data segment 2 length. */
  625. uint32_t dseg_3_address[2]; /* Data segment 3 address. */
  626. uint32_t dseg_3_length; /* Data segment 3 length. */
  627. uint32_t dseg_4_address[2]; /* Data segment 4 address. */
  628. uint32_t dseg_4_length; /* Data segment 4 length. */
  629. };
  630. /*
  631. * ISP queue - enable LUN entry structure definition.
  632. */
  633. struct elun_entry {
  634. uint8_t entry_type; /* Entry type. */
  635. #define ENABLE_LUN_TYPE 0xB /* Enable LUN entry. */
  636. uint8_t entry_count; /* Entry count. */
  637. uint8_t reserved_1;
  638. uint8_t entry_status; /* Entry Status not used. */
  639. uint32_t reserved_2;
  640. uint16_t lun; /* Bit 15 is bus number. */
  641. uint16_t reserved_4;
  642. uint32_t option_flags;
  643. uint8_t status;
  644. uint8_t reserved_5;
  645. uint8_t command_count; /* Number of ATIOs allocated. */
  646. uint8_t immed_notify_count; /* Number of Immediate Notify */
  647. /* entries allocated. */
  648. uint8_t group_6_length; /* SCSI CDB length for group 6 */
  649. /* commands (2-26). */
  650. uint8_t group_7_length; /* SCSI CDB length for group 7 */
  651. /* commands (2-26). */
  652. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  653. uint16_t reserved_6[20];
  654. };
  655. /*
  656. * ISP queue - modify LUN entry structure definition.
  657. *
  658. * Unused by the driver!
  659. */
  660. struct modify_lun_entry {
  661. uint8_t entry_type; /* Entry type. */
  662. #define MODIFY_LUN_TYPE 0xC /* Modify LUN entry. */
  663. uint8_t entry_count; /* Entry count. */
  664. uint8_t reserved_1;
  665. uint8_t entry_status; /* Entry Status. */
  666. uint32_t reserved_2;
  667. uint8_t lun; /* SCSI LUN */
  668. uint8_t reserved_3;
  669. uint8_t operators;
  670. uint8_t reserved_4;
  671. uint32_t option_flags;
  672. uint8_t status;
  673. uint8_t reserved_5;
  674. uint8_t command_count; /* Number of ATIOs allocated. */
  675. uint8_t immed_notify_count; /* Number of Immediate Notify */
  676. /* entries allocated. */
  677. uint16_t reserved_6;
  678. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  679. uint16_t reserved_7[20];
  680. };
  681. /*
  682. * ISP queue - immediate notify entry structure definition.
  683. */
  684. struct notify_entry {
  685. uint8_t entry_type; /* Entry type. */
  686. #define IMMED_NOTIFY_TYPE 0xD /* Immediate notify entry. */
  687. uint8_t entry_count; /* Entry count. */
  688. uint8_t reserved_1;
  689. uint8_t entry_status; /* Entry Status. */
  690. uint32_t reserved_2;
  691. uint8_t lun;
  692. uint8_t initiator_id;
  693. uint8_t reserved_3;
  694. uint8_t target_id;
  695. uint32_t option_flags;
  696. uint8_t status;
  697. uint8_t reserved_4;
  698. uint8_t tag_value; /* Received queue tag message value */
  699. uint8_t tag_type; /* Received queue tag message type */
  700. /* entries allocated. */
  701. uint16_t seq_id;
  702. uint8_t scsi_msg[8]; /* SCSI message not handled by ISP */
  703. uint16_t reserved_5[8];
  704. uint8_t sense_data[18];
  705. };
  706. /*
  707. * ISP queue - notify acknowledge entry structure definition.
  708. */
  709. struct nack_entry {
  710. uint8_t entry_type; /* Entry type. */
  711. #define NOTIFY_ACK_TYPE 0xE /* Notify acknowledge entry. */
  712. uint8_t entry_count; /* Entry count. */
  713. uint8_t reserved_1;
  714. uint8_t entry_status; /* Entry Status. */
  715. uint32_t reserved_2;
  716. uint8_t lun;
  717. uint8_t initiator_id;
  718. uint8_t reserved_3;
  719. uint8_t target_id;
  720. uint32_t option_flags;
  721. uint8_t status;
  722. uint8_t event;
  723. uint16_t seq_id;
  724. uint16_t reserved_4[22];
  725. };
  726. /*
  727. * ISP queue - Accept Target I/O (ATIO) entry structure definition.
  728. */
  729. struct atio_entry {
  730. uint8_t entry_type; /* Entry type. */
  731. #define ACCEPT_TGT_IO_TYPE 6 /* Accept target I/O entry. */
  732. uint8_t entry_count; /* Entry count. */
  733. uint8_t reserved_1;
  734. uint8_t entry_status; /* Entry Status. */
  735. uint32_t reserved_2;
  736. uint8_t lun;
  737. uint8_t initiator_id;
  738. uint8_t cdb_len;
  739. uint8_t target_id;
  740. uint32_t option_flags;
  741. uint8_t status;
  742. uint8_t scsi_status;
  743. uint8_t tag_value; /* Received queue tag message value */
  744. uint8_t tag_type; /* Received queue tag message type */
  745. uint8_t cdb[26];
  746. uint8_t sense_data[18];
  747. };
  748. /*
  749. * ISP queue - Continue Target I/O (CTIO) entry structure definition.
  750. */
  751. struct ctio_entry {
  752. uint8_t entry_type; /* Entry type. */
  753. #define CONTINUE_TGT_IO_TYPE 7 /* CTIO entry */
  754. uint8_t entry_count; /* Entry count. */
  755. uint8_t reserved_1;
  756. uint8_t entry_status; /* Entry Status. */
  757. uint32_t reserved_2;
  758. uint8_t lun; /* SCSI LUN */
  759. uint8_t initiator_id;
  760. uint8_t reserved_3;
  761. uint8_t target_id;
  762. uint32_t option_flags;
  763. uint8_t status;
  764. uint8_t scsi_status;
  765. uint8_t tag_value; /* Received queue tag message value */
  766. uint8_t tag_type; /* Received queue tag message type */
  767. uint32_t transfer_length;
  768. uint32_t residual;
  769. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  770. uint16_t dseg_count; /* Data segment count. */
  771. uint32_t dseg_0_address; /* Data segment 0 address. */
  772. uint32_t dseg_0_length; /* Data segment 0 length. */
  773. uint32_t dseg_1_address; /* Data segment 1 address. */
  774. uint32_t dseg_1_length; /* Data segment 1 length. */
  775. uint32_t dseg_2_address; /* Data segment 2 address. */
  776. uint32_t dseg_2_length; /* Data segment 2 length. */
  777. uint32_t dseg_3_address; /* Data segment 3 address. */
  778. uint32_t dseg_3_length; /* Data segment 3 length. */
  779. };
  780. /*
  781. * ISP queue - CTIO returned entry structure definition.
  782. */
  783. struct ctio_ret_entry {
  784. uint8_t entry_type; /* Entry type. */
  785. #define CTIO_RET_TYPE 7 /* CTIO return entry */
  786. uint8_t entry_count; /* Entry count. */
  787. uint8_t reserved_1;
  788. uint8_t entry_status; /* Entry Status. */
  789. uint32_t reserved_2;
  790. uint8_t lun; /* SCSI LUN */
  791. uint8_t initiator_id;
  792. uint8_t reserved_3;
  793. uint8_t target_id;
  794. uint32_t option_flags;
  795. uint8_t status;
  796. uint8_t scsi_status;
  797. uint8_t tag_value; /* Received queue tag message value */
  798. uint8_t tag_type; /* Received queue tag message type */
  799. uint32_t transfer_length;
  800. uint32_t residual;
  801. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  802. uint16_t dseg_count; /* Data segment count. */
  803. uint32_t dseg_0_address; /* Data segment 0 address. */
  804. uint32_t dseg_0_length; /* Data segment 0 length. */
  805. uint32_t dseg_1_address; /* Data segment 1 address. */
  806. uint16_t dseg_1_length; /* Data segment 1 length. */
  807. uint8_t sense_data[18];
  808. };
  809. /*
  810. * ISP queue - CTIO A64 entry structure definition.
  811. */
  812. struct ctio_a64_entry {
  813. uint8_t entry_type; /* Entry type. */
  814. #define CTIO_A64_TYPE 0xF /* CTIO A64 entry */
  815. uint8_t entry_count; /* Entry count. */
  816. uint8_t reserved_1;
  817. uint8_t entry_status; /* Entry Status. */
  818. uint32_t reserved_2;
  819. uint8_t lun; /* SCSI LUN */
  820. uint8_t initiator_id;
  821. uint8_t reserved_3;
  822. uint8_t target_id;
  823. uint32_t option_flags;
  824. uint8_t status;
  825. uint8_t scsi_status;
  826. uint8_t tag_value; /* Received queue tag message value */
  827. uint8_t tag_type; /* Received queue tag message type */
  828. uint32_t transfer_length;
  829. uint32_t residual;
  830. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  831. uint16_t dseg_count; /* Data segment count. */
  832. uint32_t reserved_4[2];
  833. uint32_t dseg_0_address[2]; /* Data segment 0 address. */
  834. uint32_t dseg_0_length; /* Data segment 0 length. */
  835. uint32_t dseg_1_address[2]; /* Data segment 1 address. */
  836. uint32_t dseg_1_length; /* Data segment 1 length. */
  837. };
  838. /*
  839. * ISP queue - CTIO returned entry structure definition.
  840. */
  841. struct ctio_a64_ret_entry {
  842. uint8_t entry_type; /* Entry type. */
  843. #define CTIO_A64_RET_TYPE 0xF /* CTIO A64 returned entry */
  844. uint8_t entry_count; /* Entry count. */
  845. uint8_t reserved_1;
  846. uint8_t entry_status; /* Entry Status. */
  847. uint32_t reserved_2;
  848. uint8_t lun; /* SCSI LUN */
  849. uint8_t initiator_id;
  850. uint8_t reserved_3;
  851. uint8_t target_id;
  852. uint32_t option_flags;
  853. uint8_t status;
  854. uint8_t scsi_status;
  855. uint8_t tag_value; /* Received queue tag message value */
  856. uint8_t tag_type; /* Received queue tag message type */
  857. uint32_t transfer_length;
  858. uint32_t residual;
  859. uint16_t timeout; /* 0 = 30 seconds, 0xFFFF = disable */
  860. uint16_t dseg_count; /* Data segment count. */
  861. uint16_t reserved_4[7];
  862. uint8_t sense_data[18];
  863. };
  864. /*
  865. * ISP request and response queue entry sizes
  866. */
  867. #define RESPONSE_ENTRY_SIZE (sizeof(struct response))
  868. #define REQUEST_ENTRY_SIZE (sizeof(request_t))
  869. /*
  870. * ISP status entry - completion status definitions.
  871. */
  872. #define CS_COMPLETE 0x0 /* No errors */
  873. #define CS_INCOMPLETE 0x1 /* Incomplete transfer of cmd. */
  874. #define CS_DMA 0x2 /* A DMA direction error. */
  875. #define CS_TRANSPORT 0x3 /* Transport error. */
  876. #define CS_RESET 0x4 /* SCSI bus reset occurred */
  877. #define CS_ABORTED 0x5 /* System aborted command. */
  878. #define CS_TIMEOUT 0x6 /* Timeout error. */
  879. #define CS_DATA_OVERRUN 0x7 /* Data overrun. */
  880. #define CS_COMMAND_OVERRUN 0x8 /* Command Overrun. */
  881. #define CS_STATUS_OVERRUN 0x9 /* Status Overrun. */
  882. #define CS_BAD_MSG 0xA /* Bad msg after status phase. */
  883. #define CS_NO_MSG_OUT 0xB /* No msg out after selection. */
  884. #define CS_EXTENDED_ID 0xC /* Extended ID failed. */
  885. #define CS_IDE_MSG 0xD /* Target rejected IDE msg. */
  886. #define CS_ABORT_MSG 0xE /* Target rejected abort msg. */
  887. #define CS_REJECT_MSG 0xF /* Target rejected reject msg. */
  888. #define CS_NOP_MSG 0x10 /* Target rejected NOP msg. */
  889. #define CS_PARITY_MSG 0x11 /* Target rejected parity msg. */
  890. #define CS_DEV_RESET_MSG 0x12 /* Target rejected dev rst msg. */
  891. #define CS_ID_MSG 0x13 /* Target rejected ID msg. */
  892. #define CS_FREE 0x14 /* Unexpected bus free. */
  893. #define CS_DATA_UNDERRUN 0x15 /* Data Underrun. */
  894. #define CS_TRANACTION_1 0x18 /* Transaction error 1 */
  895. #define CS_TRANACTION_2 0x19 /* Transaction error 2 */
  896. #define CS_TRANACTION_3 0x1a /* Transaction error 3 */
  897. #define CS_INV_ENTRY_TYPE 0x1b /* Invalid entry type */
  898. #define CS_DEV_QUEUE_FULL 0x1c /* Device queue full */
  899. #define CS_PHASED_SKIPPED 0x1d /* SCSI phase skipped */
  900. #define CS_ARS_FAILED 0x1e /* ARS failed */
  901. #define CS_LVD_BUS_ERROR 0x21 /* LVD bus error */
  902. #define CS_BAD_PAYLOAD 0x80 /* Driver defined */
  903. #define CS_UNKNOWN 0x81 /* Driver defined */
  904. #define CS_RETRY 0x82 /* Driver defined */
  905. /*
  906. * ISP status entry - SCSI status byte bit definitions.
  907. */
  908. #define SS_CHECK_CONDITION BIT_1
  909. #define SS_CONDITION_MET BIT_2
  910. #define SS_BUSY_CONDITION BIT_3
  911. #define SS_RESERVE_CONFLICT (BIT_4 | BIT_3)
  912. /*
  913. * ISP target entries - Option flags bit definitions.
  914. */
  915. #define OF_ENABLE_TAG BIT_1 /* Tagged queue action enable */
  916. #define OF_DATA_IN BIT_6 /* Data in to initiator */
  917. /* (data from target to initiator) */
  918. #define OF_DATA_OUT BIT_7 /* Data out from initiator */
  919. /* (data from initiator to target) */
  920. #define OF_NO_DATA (BIT_7 | BIT_6)
  921. #define OF_DISC_DISABLED BIT_15 /* Disconnects disabled */
  922. #define OF_DISABLE_SDP BIT_24 /* Disable sending save data ptr */
  923. #define OF_SEND_RDP BIT_26 /* Send restore data pointers msg */
  924. #define OF_FORCE_DISC BIT_30 /* Disconnects mandatory */
  925. #define OF_SSTS BIT_31 /* Send SCSI status */
  926. /*
  927. * BUS parameters/settings structure - UNUSED
  928. */
  929. struct bus_param {
  930. uint8_t id; /* Host adapter SCSI id */
  931. uint8_t bus_reset_delay; /* SCSI bus reset delay. */
  932. uint8_t failed_reset_count; /* number of time reset failed */
  933. uint8_t unused;
  934. uint16_t device_enables; /* Device enable bits. */
  935. uint16_t lun_disables; /* LUN disable bits. */
  936. uint16_t qtag_enables; /* Tag queue enables. */
  937. uint16_t hiwat; /* High water mark per device. */
  938. uint8_t reset_marker:1;
  939. uint8_t disable_scsi_reset:1;
  940. uint8_t scsi_bus_dead:1; /* SCSI Bus is Dead, when 5 back to back resets failed */
  941. };
  942. struct qla_driver_setup {
  943. uint32_t no_sync:1;
  944. uint32_t no_wide:1;
  945. uint32_t no_ppr:1;
  946. uint32_t no_nvram:1;
  947. uint16_t sync_mask;
  948. uint16_t wide_mask;
  949. uint16_t ppr_mask;
  950. };
  951. /*
  952. * Linux Host Adapter structure
  953. */
  954. struct scsi_qla_host {
  955. /* Linux adapter configuration data */
  956. struct Scsi_Host *host; /* pointer to host data */
  957. struct scsi_qla_host *next;
  958. struct device_reg __iomem *iobase; /* Base Memory-mapped I/O address */
  959. unsigned char __iomem *mmpbase; /* memory mapped address */
  960. unsigned long host_no;
  961. struct pci_dev *pdev;
  962. uint8_t devnum;
  963. uint8_t revision;
  964. uint8_t ports;
  965. unsigned long actthreads;
  966. unsigned long isr_count; /* Interrupt count */
  967. unsigned long spurious_int;
  968. /* Outstandings ISP commands. */
  969. struct srb *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
  970. /* BUS configuration data */
  971. struct bus_param bus_settings[MAX_BUSES];
  972. /* Received ISP mailbox data. */
  973. volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
  974. dma_addr_t request_dma; /* Physical Address */
  975. request_t *request_ring; /* Base virtual address */
  976. request_t *request_ring_ptr; /* Current address. */
  977. uint16_t req_ring_index; /* Current index. */
  978. uint16_t req_q_cnt; /* Number of available entries. */
  979. dma_addr_t response_dma; /* Physical address. */
  980. struct response *response_ring; /* Base virtual address */
  981. struct response *response_ring_ptr; /* Current address. */
  982. uint16_t rsp_ring_index; /* Current index. */
  983. struct list_head done_q; /* Done queue */
  984. struct completion *mailbox_wait;
  985. volatile struct {
  986. uint32_t online:1; /* 0 */
  987. uint32_t reset_marker:1; /* 1 */
  988. uint32_t disable_host_adapter:1; /* 2 */
  989. uint32_t reset_active:1; /* 3 */
  990. uint32_t abort_isp_active:1; /* 4 */
  991. uint32_t disable_risc_code_load:1; /* 5 */
  992. uint32_t enable_64bit_addressing:1; /* 6 */
  993. uint32_t in_reset:1; /* 7 */
  994. uint32_t ints_enabled:1;
  995. uint32_t ignore_nvram:1;
  996. #ifdef __ia64__
  997. uint32_t use_pci_vchannel:1;
  998. #endif
  999. } flags;
  1000. struct nvram nvram;
  1001. int nvram_valid;
  1002. };
  1003. #endif /* _QLA1280_H */