qla_nx2.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * QLogic Fibre Channel HBA Driver
  3. * Copyright (c) 2003-2014 QLogic Corporation
  4. *
  5. * See LICENSE.qla2xxx for copyright and licensing details.
  6. */
  7. #ifndef __QLA_NX2_H
  8. #define __QLA_NX2_H
  9. #define QSNT_ACK_TOV 30
  10. #define INTENT_TO_RECOVER 0x01
  11. #define PROCEED_TO_RECOVER 0x02
  12. #define IDC_LOCK_RECOVERY_OWNER_MASK 0x3C
  13. #define IDC_LOCK_RECOVERY_STATE_MASK 0x3
  14. #define IDC_LOCK_RECOVERY_STATE_SHIFT_BITS 2
  15. #define QLA8044_DRV_LOCK_MSLEEP 200
  16. #define QLA8044_ADDR_DDR_NET (0x0000000000000000ULL)
  17. #define QLA8044_ADDR_DDR_NET_MAX (0x000000000fffffffULL)
  18. #define MD_MIU_TEST_AGT_WRDATA_LO 0x410000A0
  19. #define MD_MIU_TEST_AGT_WRDATA_HI 0x410000A4
  20. #define MD_MIU_TEST_AGT_WRDATA_ULO 0x410000B0
  21. #define MD_MIU_TEST_AGT_WRDATA_UHI 0x410000B4
  22. #define MD_MIU_TEST_AGT_RDDATA_LO 0x410000A8
  23. #define MD_MIU_TEST_AGT_RDDATA_HI 0x410000AC
  24. #define MD_MIU_TEST_AGT_RDDATA_ULO 0x410000B8
  25. #define MD_MIU_TEST_AGT_RDDATA_UHI 0x410000BC
  26. /* MIU_TEST_AGT_CTRL flags. work for SIU as well */
  27. #define MIU_TA_CTL_WRITE_ENABLE (MIU_TA_CTL_WRITE | MIU_TA_CTL_ENABLE)
  28. #define MIU_TA_CTL_WRITE_START (MIU_TA_CTL_WRITE | MIU_TA_CTL_ENABLE | \
  29. MIU_TA_CTL_START)
  30. #define MIU_TA_CTL_START_ENABLE (MIU_TA_CTL_START | MIU_TA_CTL_ENABLE)
  31. /* Imbus address bit used to indicate a host address. This bit is
  32. * eliminated by the pcie bar and bar select before presentation
  33. * over pcie. */
  34. /* host memory via IMBUS */
  35. #define QLA8044_P2_ADDR_PCIE (0x0000000800000000ULL)
  36. #define QLA8044_P3_ADDR_PCIE (0x0000008000000000ULL)
  37. #define QLA8044_ADDR_PCIE_MAX (0x0000000FFFFFFFFFULL)
  38. #define QLA8044_ADDR_OCM0 (0x0000000200000000ULL)
  39. #define QLA8044_ADDR_OCM0_MAX (0x00000002000fffffULL)
  40. #define QLA8044_ADDR_OCM1 (0x0000000200400000ULL)
  41. #define QLA8044_ADDR_OCM1_MAX (0x00000002004fffffULL)
  42. #define QLA8044_ADDR_QDR_NET (0x0000000300000000ULL)
  43. #define QLA8044_P2_ADDR_QDR_NET_MAX (0x00000003001fffffULL)
  44. #define QLA8044_P3_ADDR_QDR_NET_MAX (0x0000000303ffffffULL)
  45. #define QLA8044_ADDR_QDR_NET_MAX (0x0000000307ffffffULL)
  46. #define QLA8044_PCI_CRBSPACE ((unsigned long)0x06000000)
  47. #define QLA8044_PCI_DIRECT_CRB ((unsigned long)0x04400000)
  48. #define QLA8044_PCI_CAMQM ((unsigned long)0x04800000)
  49. #define QLA8044_PCI_CAMQM_MAX ((unsigned long)0x04ffffff)
  50. #define QLA8044_PCI_DDR_NET ((unsigned long)0x00000000)
  51. #define QLA8044_PCI_QDR_NET ((unsigned long)0x04000000)
  52. #define QLA8044_PCI_QDR_NET_MAX ((unsigned long)0x043fffff)
  53. /* PCI Windowing for DDR regions. */
  54. static inline bool addr_in_range(u64 addr, u64 low, u64 high)
  55. {
  56. return addr <= high && addr >= low;
  57. }
  58. /* Indirectly Mapped Registers */
  59. #define QLA8044_FLASH_SPI_STATUS 0x2808E010
  60. #define QLA8044_FLASH_SPI_CONTROL 0x2808E014
  61. #define QLA8044_FLASH_STATUS 0x42100004
  62. #define QLA8044_FLASH_CONTROL 0x42110004
  63. #define QLA8044_FLASH_ADDR 0x42110008
  64. #define QLA8044_FLASH_WRDATA 0x4211000C
  65. #define QLA8044_FLASH_RDDATA 0x42110018
  66. #define QLA8044_FLASH_DIRECT_WINDOW 0x42110030
  67. #define QLA8044_FLASH_DIRECT_DATA(DATA) (0x42150000 | (0x0000FFFF&DATA))
  68. /* Flash access regs */
  69. #define QLA8044_FLASH_LOCK 0x3850
  70. #define QLA8044_FLASH_UNLOCK 0x3854
  71. #define QLA8044_FLASH_LOCK_ID 0x3500
  72. /* Driver Lock regs */
  73. #define QLA8044_DRV_LOCK 0x3868
  74. #define QLA8044_DRV_UNLOCK 0x386C
  75. #define QLA8044_DRV_LOCK_ID 0x3504
  76. #define QLA8044_DRV_LOCKRECOVERY 0x379C
  77. /* IDC version */
  78. #define QLA8044_IDC_VER_MAJ_VALUE 0x1
  79. #define QLA8044_IDC_VER_MIN_VALUE 0x0
  80. /* IDC Registers : Driver Coexistence Defines */
  81. #define QLA8044_CRB_IDC_VER_MAJOR 0x3780
  82. #define QLA8044_CRB_IDC_VER_MINOR 0x3798
  83. #define QLA8044_IDC_DRV_AUDIT 0x3794
  84. #define QLA8044_SRE_SHIM_CONTROL 0x0D200284
  85. #define QLA8044_PORT0_RXB_PAUSE_THRS 0x0B2003A4
  86. #define QLA8044_PORT1_RXB_PAUSE_THRS 0x0B2013A4
  87. #define QLA8044_PORT0_RXB_TC_MAX_CELL 0x0B200388
  88. #define QLA8044_PORT1_RXB_TC_MAX_CELL 0x0B201388
  89. #define QLA8044_PORT0_RXB_TC_STATS 0x0B20039C
  90. #define QLA8044_PORT1_RXB_TC_STATS 0x0B20139C
  91. #define QLA8044_PORT2_IFB_PAUSE_THRS 0x0B200704
  92. #define QLA8044_PORT3_IFB_PAUSE_THRS 0x0B201704
  93. /* set value to pause threshold value */
  94. #define QLA8044_SET_PAUSE_VAL 0x0
  95. #define QLA8044_SET_TC_MAX_CELL_VAL 0x03FF03FF
  96. #define QLA8044_PEG_HALT_STATUS1 0x34A8
  97. #define QLA8044_PEG_HALT_STATUS2 0x34AC
  98. #define QLA8044_PEG_ALIVE_COUNTER 0x34B0 /* FW_HEARTBEAT */
  99. #define QLA8044_FW_CAPABILITIES 0x3528
  100. #define QLA8044_CRB_DRV_ACTIVE 0x3788 /* IDC_DRV_PRESENCE */
  101. #define QLA8044_CRB_DEV_STATE 0x3784 /* IDC_DEV_STATE */
  102. #define QLA8044_CRB_DRV_STATE 0x378C /* IDC_DRV_ACK */
  103. #define QLA8044_CRB_DRV_SCRATCH 0x3548
  104. #define QLA8044_CRB_DEV_PART_INFO1 0x37E0
  105. #define QLA8044_CRB_DEV_PART_INFO2 0x37E4
  106. #define QLA8044_FW_VER_MAJOR 0x3550
  107. #define QLA8044_FW_VER_MINOR 0x3554
  108. #define QLA8044_FW_VER_SUB 0x3558
  109. #define QLA8044_NPAR_STATE 0x359C
  110. #define QLA8044_FW_IMAGE_VALID 0x35FC
  111. #define QLA8044_CMDPEG_STATE 0x3650
  112. #define QLA8044_ASIC_TEMP 0x37B4
  113. #define QLA8044_FW_API 0x356C
  114. #define QLA8044_DRV_OP_MODE 0x3570
  115. #define QLA8044_CRB_WIN_BASE 0x3800
  116. #define QLA8044_CRB_WIN_FUNC(f) (QLA8044_CRB_WIN_BASE+((f)*4))
  117. #define QLA8044_SEM_LOCK_BASE 0x3840
  118. #define QLA8044_SEM_UNLOCK_BASE 0x3844
  119. #define QLA8044_SEM_LOCK_FUNC(f) (QLA8044_SEM_LOCK_BASE+((f)*8))
  120. #define QLA8044_SEM_UNLOCK_FUNC(f) (QLA8044_SEM_UNLOCK_BASE+((f)*8))
  121. #define QLA8044_LINK_STATE(f) (0x3698+((f) > 7 ? 4 : 0))
  122. #define QLA8044_LINK_SPEED(f) (0x36E0+(((f) >> 2) * 4))
  123. #define QLA8044_MAX_LINK_SPEED(f) (0x36F0+(((f) / 4) * 4))
  124. #define QLA8044_LINK_SPEED_FACTOR 10
  125. #define QLA8044_FUN7_ACTIVE_INDEX 0x80
  126. /* FLASH API Defines */
  127. #define QLA8044_FLASH_MAX_WAIT_USEC 100
  128. #define QLA8044_FLASH_LOCK_TIMEOUT 10000
  129. #define QLA8044_FLASH_SECTOR_SIZE 65536
  130. #define QLA8044_DRV_LOCK_TIMEOUT 2000
  131. #define QLA8044_FLASH_SECTOR_ERASE_CMD 0xdeadbeef
  132. #define QLA8044_FLASH_WRITE_CMD 0xdacdacda
  133. #define QLA8044_FLASH_BUFFER_WRITE_CMD 0xcadcadca
  134. #define QLA8044_FLASH_READ_RETRY_COUNT 2000
  135. #define QLA8044_FLASH_STATUS_READY 0x6
  136. #define QLA8044_FLASH_BUFFER_WRITE_MIN 2
  137. #define QLA8044_FLASH_BUFFER_WRITE_MAX 64
  138. #define QLA8044_FLASH_STATUS_REG_POLL_DELAY 1
  139. #define QLA8044_ERASE_MODE 1
  140. #define QLA8044_WRITE_MODE 2
  141. #define QLA8044_DWORD_WRITE_MODE 3
  142. #define QLA8044_GLOBAL_RESET 0x38CC
  143. #define QLA8044_WILDCARD 0x38F0
  144. #define QLA8044_INFORMANT 0x38FC
  145. #define QLA8044_HOST_MBX_CTRL 0x3038
  146. #define QLA8044_FW_MBX_CTRL 0x303C
  147. #define QLA8044_BOOTLOADER_ADDR 0x355C
  148. #define QLA8044_BOOTLOADER_SIZE 0x3560
  149. #define QLA8044_FW_IMAGE_ADDR 0x3564
  150. #define QLA8044_MBX_INTR_ENABLE 0x1000
  151. #define QLA8044_MBX_INTR_MASK 0x1200
  152. /* IDC Control Register bit defines */
  153. #define DONTRESET_BIT0 0x1
  154. #define GRACEFUL_RESET_BIT1 0x2
  155. /* ISP8044 PEG_HALT_STATUS1 bits */
  156. #define QLA8044_HALT_STATUS_INFORMATIONAL (0x1 << 29)
  157. #define QLA8044_HALT_STATUS_FW_RESET (0x2 << 29)
  158. #define QLA8044_HALT_STATUS_UNRECOVERABLE (0x4 << 29)
  159. /* Firmware image definitions */
  160. #define QLA8044_BOOTLOADER_FLASH_ADDR 0x10000
  161. #define QLA8044_BOOT_FROM_FLASH 0
  162. #define QLA8044_IDC_PARAM_ADDR 0x3e8020
  163. /* FLASH related definitions */
  164. #define QLA8044_OPTROM_BURST_SIZE 0x100
  165. #define QLA8044_MAX_OPTROM_BURST_DWORDS (QLA8044_OPTROM_BURST_SIZE / 4)
  166. #define QLA8044_MIN_OPTROM_BURST_DWORDS 2
  167. #define QLA8044_SECTOR_SIZE (64 * 1024)
  168. #define QLA8044_FLASH_SPI_CTL 0x4
  169. #define QLA8044_FLASH_FIRST_TEMP_VAL 0x00800000
  170. #define QLA8044_FLASH_SECOND_TEMP_VAL 0x00800001
  171. #define QLA8044_FLASH_FIRST_MS_PATTERN 0x43
  172. #define QLA8044_FLASH_SECOND_MS_PATTERN 0x7F
  173. #define QLA8044_FLASH_LAST_MS_PATTERN 0x7D
  174. #define QLA8044_FLASH_STATUS_WRITE_DEF_SIG 0xFD0100
  175. #define QLA8044_FLASH_SECOND_ERASE_MS_VAL 0x5
  176. #define QLA8044_FLASH_ERASE_SIG 0xFD0300
  177. #define QLA8044_FLASH_LAST_ERASE_MS_VAL 0x3D
  178. /* Reset template definitions */
  179. #define QLA8044_MAX_RESET_SEQ_ENTRIES 16
  180. #define QLA8044_RESTART_TEMPLATE_SIZE 0x2000
  181. #define QLA8044_RESET_TEMPLATE_ADDR 0x4F0000
  182. #define QLA8044_RESET_SEQ_VERSION 0x0101
  183. /* Reset template entry opcodes */
  184. #define OPCODE_NOP 0x0000
  185. #define OPCODE_WRITE_LIST 0x0001
  186. #define OPCODE_READ_WRITE_LIST 0x0002
  187. #define OPCODE_POLL_LIST 0x0004
  188. #define OPCODE_POLL_WRITE_LIST 0x0008
  189. #define OPCODE_READ_MODIFY_WRITE 0x0010
  190. #define OPCODE_SEQ_PAUSE 0x0020
  191. #define OPCODE_SEQ_END 0x0040
  192. #define OPCODE_TMPL_END 0x0080
  193. #define OPCODE_POLL_READ_LIST 0x0100
  194. /* Template Header */
  195. #define RESET_TMPLT_HDR_SIGNATURE 0xCAFE
  196. #define QLA8044_IDC_DRV_CTRL 0x3790
  197. #define AF_8044_NO_FW_DUMP 27 /* 0x08000000 */
  198. #define MINIDUMP_SIZE_36K 36864
  199. struct qla8044_reset_template_hdr {
  200. uint16_t version;
  201. uint16_t signature;
  202. uint16_t size;
  203. uint16_t entries;
  204. uint16_t hdr_size;
  205. uint16_t checksum;
  206. uint16_t init_seq_offset;
  207. uint16_t start_seq_offset;
  208. } __packed;
  209. /* Common Entry Header. */
  210. struct qla8044_reset_entry_hdr {
  211. uint16_t cmd;
  212. uint16_t size;
  213. uint16_t count;
  214. uint16_t delay;
  215. } __packed;
  216. /* Generic poll entry type. */
  217. struct qla8044_poll {
  218. uint32_t test_mask;
  219. uint32_t test_value;
  220. } __packed;
  221. /* Read modify write entry type. */
  222. struct qla8044_rmw {
  223. uint32_t test_mask;
  224. uint32_t xor_value;
  225. uint32_t or_value;
  226. uint8_t shl;
  227. uint8_t shr;
  228. uint8_t index_a;
  229. uint8_t rsvd;
  230. } __packed;
  231. /* Generic Entry Item with 2 DWords. */
  232. struct qla8044_entry {
  233. uint32_t arg1;
  234. uint32_t arg2;
  235. } __packed;
  236. /* Generic Entry Item with 4 DWords.*/
  237. struct qla8044_quad_entry {
  238. uint32_t dr_addr;
  239. uint32_t dr_value;
  240. uint32_t ar_addr;
  241. uint32_t ar_value;
  242. } __packed;
  243. struct qla8044_reset_template {
  244. int seq_index;
  245. int seq_error;
  246. int array_index;
  247. uint32_t array[QLA8044_MAX_RESET_SEQ_ENTRIES];
  248. uint8_t *buff;
  249. uint8_t *stop_offset;
  250. uint8_t *start_offset;
  251. uint8_t *init_offset;
  252. struct qla8044_reset_template_hdr *hdr;
  253. uint8_t seq_end;
  254. uint8_t template_end;
  255. };
  256. /* Driver_code is for driver to write some info about the entry
  257. * currently not used.
  258. */
  259. struct qla8044_minidump_entry_hdr {
  260. uint32_t entry_type;
  261. uint32_t entry_size;
  262. uint32_t entry_capture_size;
  263. struct {
  264. uint8_t entry_capture_mask;
  265. uint8_t entry_code;
  266. uint8_t driver_code;
  267. uint8_t driver_flags;
  268. } d_ctrl;
  269. } __packed;
  270. /* Read CRB entry header */
  271. struct qla8044_minidump_entry_crb {
  272. struct qla8044_minidump_entry_hdr h;
  273. uint32_t addr;
  274. struct {
  275. uint8_t addr_stride;
  276. uint8_t state_index_a;
  277. uint16_t poll_timeout;
  278. } crb_strd;
  279. uint32_t data_size;
  280. uint32_t op_count;
  281. struct {
  282. uint8_t opcode;
  283. uint8_t state_index_v;
  284. uint8_t shl;
  285. uint8_t shr;
  286. } crb_ctrl;
  287. uint32_t value_1;
  288. uint32_t value_2;
  289. uint32_t value_3;
  290. } __packed;
  291. struct qla8044_minidump_entry_cache {
  292. struct qla8044_minidump_entry_hdr h;
  293. uint32_t tag_reg_addr;
  294. struct {
  295. uint16_t tag_value_stride;
  296. uint16_t init_tag_value;
  297. } addr_ctrl;
  298. uint32_t data_size;
  299. uint32_t op_count;
  300. uint32_t control_addr;
  301. struct {
  302. uint16_t write_value;
  303. uint8_t poll_mask;
  304. uint8_t poll_wait;
  305. } cache_ctrl;
  306. uint32_t read_addr;
  307. struct {
  308. uint8_t read_addr_stride;
  309. uint8_t read_addr_cnt;
  310. uint16_t rsvd_1;
  311. } read_ctrl;
  312. } __packed;
  313. /* Read OCM */
  314. struct qla8044_minidump_entry_rdocm {
  315. struct qla8044_minidump_entry_hdr h;
  316. uint32_t rsvd_0;
  317. uint32_t rsvd_1;
  318. uint32_t data_size;
  319. uint32_t op_count;
  320. uint32_t rsvd_2;
  321. uint32_t rsvd_3;
  322. uint32_t read_addr;
  323. uint32_t read_addr_stride;
  324. } __packed;
  325. /* Read Memory */
  326. struct qla8044_minidump_entry_rdmem {
  327. struct qla8044_minidump_entry_hdr h;
  328. uint32_t rsvd[6];
  329. uint32_t read_addr;
  330. uint32_t read_data_size;
  331. };
  332. /* Read Memory: For Pex-DMA */
  333. struct qla8044_minidump_entry_rdmem_pex_dma {
  334. struct qla8044_minidump_entry_hdr h;
  335. uint32_t desc_card_addr;
  336. uint16_t dma_desc_cmd;
  337. uint8_t rsvd[2];
  338. uint32_t start_dma_cmd;
  339. uint8_t rsvd2[12];
  340. uint32_t read_addr;
  341. uint32_t read_data_size;
  342. } __packed;
  343. /* Read ROM */
  344. struct qla8044_minidump_entry_rdrom {
  345. struct qla8044_minidump_entry_hdr h;
  346. uint32_t rsvd[6];
  347. uint32_t read_addr;
  348. uint32_t read_data_size;
  349. } __packed;
  350. /* Mux entry */
  351. struct qla8044_minidump_entry_mux {
  352. struct qla8044_minidump_entry_hdr h;
  353. uint32_t select_addr;
  354. uint32_t rsvd_0;
  355. uint32_t data_size;
  356. uint32_t op_count;
  357. uint32_t select_value;
  358. uint32_t select_value_stride;
  359. uint32_t read_addr;
  360. uint32_t rsvd_1;
  361. } __packed;
  362. /* Queue entry */
  363. struct qla8044_minidump_entry_queue {
  364. struct qla8044_minidump_entry_hdr h;
  365. uint32_t select_addr;
  366. struct {
  367. uint16_t queue_id_stride;
  368. uint16_t rsvd_0;
  369. } q_strd;
  370. uint32_t data_size;
  371. uint32_t op_count;
  372. uint32_t rsvd_1;
  373. uint32_t rsvd_2;
  374. uint32_t read_addr;
  375. struct {
  376. uint8_t read_addr_stride;
  377. uint8_t read_addr_cnt;
  378. uint16_t rsvd_3;
  379. } rd_strd;
  380. } __packed;
  381. /* POLLRD Entry */
  382. struct qla8044_minidump_entry_pollrd {
  383. struct qla8044_minidump_entry_hdr h;
  384. uint32_t select_addr;
  385. uint32_t read_addr;
  386. uint32_t select_value;
  387. uint16_t select_value_stride;
  388. uint16_t op_count;
  389. uint32_t poll_wait;
  390. uint32_t poll_mask;
  391. uint32_t data_size;
  392. uint32_t rsvd_1;
  393. } __packed;
  394. struct qla8044_minidump_entry_rddfe {
  395. struct qla8044_minidump_entry_hdr h;
  396. uint32_t addr_1;
  397. uint32_t value;
  398. uint8_t stride;
  399. uint8_t stride2;
  400. uint16_t count;
  401. uint32_t poll;
  402. uint32_t mask;
  403. uint32_t modify_mask;
  404. uint32_t data_size;
  405. uint32_t rsvd;
  406. } __packed;
  407. struct qla8044_minidump_entry_rdmdio {
  408. struct qla8044_minidump_entry_hdr h;
  409. uint32_t addr_1;
  410. uint32_t addr_2;
  411. uint32_t value_1;
  412. uint8_t stride_1;
  413. uint8_t stride_2;
  414. uint16_t count;
  415. uint32_t poll;
  416. uint32_t mask;
  417. uint32_t value_2;
  418. uint32_t data_size;
  419. } __packed;
  420. struct qla8044_minidump_entry_pollwr {
  421. struct qla8044_minidump_entry_hdr h;
  422. uint32_t addr_1;
  423. uint32_t addr_2;
  424. uint32_t value_1;
  425. uint32_t value_2;
  426. uint32_t poll;
  427. uint32_t mask;
  428. uint32_t data_size;
  429. uint32_t rsvd;
  430. } __packed;
  431. /* RDMUX2 Entry */
  432. struct qla8044_minidump_entry_rdmux2 {
  433. struct qla8044_minidump_entry_hdr h;
  434. uint32_t select_addr_1;
  435. uint32_t select_addr_2;
  436. uint32_t select_value_1;
  437. uint32_t select_value_2;
  438. uint32_t op_count;
  439. uint32_t select_value_mask;
  440. uint32_t read_addr;
  441. uint8_t select_value_stride;
  442. uint8_t data_size;
  443. uint8_t rsvd[2];
  444. } __packed;
  445. /* POLLRDMWR Entry */
  446. struct qla8044_minidump_entry_pollrdmwr {
  447. struct qla8044_minidump_entry_hdr h;
  448. uint32_t addr_1;
  449. uint32_t addr_2;
  450. uint32_t value_1;
  451. uint32_t value_2;
  452. uint32_t poll_wait;
  453. uint32_t poll_mask;
  454. uint32_t modify_mask;
  455. uint32_t data_size;
  456. } __packed;
  457. /* IDC additional information */
  458. struct qla8044_idc_information {
  459. uint32_t request_desc; /* IDC request descriptor */
  460. uint32_t info1; /* IDC additional info */
  461. uint32_t info2; /* IDC additional info */
  462. uint32_t info3; /* IDC additional info */
  463. } __packed;
  464. enum qla_regs {
  465. QLA8044_PEG_HALT_STATUS1_INDEX = 0,
  466. QLA8044_PEG_HALT_STATUS2_INDEX,
  467. QLA8044_PEG_ALIVE_COUNTER_INDEX,
  468. QLA8044_CRB_DRV_ACTIVE_INDEX,
  469. QLA8044_CRB_DEV_STATE_INDEX,
  470. QLA8044_CRB_DRV_STATE_INDEX,
  471. QLA8044_CRB_DRV_SCRATCH_INDEX,
  472. QLA8044_CRB_DEV_PART_INFO_INDEX,
  473. QLA8044_CRB_DRV_IDC_VERSION_INDEX,
  474. QLA8044_FW_VERSION_MAJOR_INDEX,
  475. QLA8044_FW_VERSION_MINOR_INDEX,
  476. QLA8044_FW_VERSION_SUB_INDEX,
  477. QLA8044_CRB_CMDPEG_STATE_INDEX,
  478. QLA8044_CRB_TEMP_STATE_INDEX,
  479. } __packed;
  480. #define CRB_REG_INDEX_MAX 14
  481. #define CRB_CMDPEG_CHECK_RETRY_COUNT 60
  482. #define CRB_CMDPEG_CHECK_DELAY 500
  483. static const uint32_t qla8044_reg_tbl[] = {
  484. QLA8044_PEG_HALT_STATUS1,
  485. QLA8044_PEG_HALT_STATUS2,
  486. QLA8044_PEG_ALIVE_COUNTER,
  487. QLA8044_CRB_DRV_ACTIVE,
  488. QLA8044_CRB_DEV_STATE,
  489. QLA8044_CRB_DRV_STATE,
  490. QLA8044_CRB_DRV_SCRATCH,
  491. QLA8044_CRB_DEV_PART_INFO1,
  492. QLA8044_CRB_IDC_VER_MAJOR,
  493. QLA8044_FW_VER_MAJOR,
  494. QLA8044_FW_VER_MINOR,
  495. QLA8044_FW_VER_SUB,
  496. QLA8044_CMDPEG_STATE,
  497. QLA8044_ASIC_TEMP,
  498. };
  499. /* MiniDump Structures */
  500. /* Driver_code is for driver to write some info about the entry
  501. * currently not used.
  502. */
  503. #define QLA8044_SS_OCM_WNDREG_INDEX 3
  504. #define QLA8044_DBG_STATE_ARRAY_LEN 16
  505. #define QLA8044_DBG_CAP_SIZE_ARRAY_LEN 8
  506. #define QLA8044_DBG_RSVD_ARRAY_LEN 8
  507. #define QLA8044_DBG_OCM_WNDREG_ARRAY_LEN 16
  508. #define QLA8044_SS_PCI_INDEX 0
  509. #define QLA8044_RDDFE 38
  510. #define QLA8044_RDMDIO 39
  511. #define QLA8044_POLLWR 40
  512. struct qla8044_minidump_template_hdr {
  513. uint32_t entry_type;
  514. uint32_t first_entry_offset;
  515. uint32_t size_of_template;
  516. uint32_t capture_debug_level;
  517. uint32_t num_of_entries;
  518. uint32_t version;
  519. uint32_t driver_timestamp;
  520. uint32_t checksum;
  521. uint32_t driver_capture_mask;
  522. uint32_t driver_info_word2;
  523. uint32_t driver_info_word3;
  524. uint32_t driver_info_word4;
  525. uint32_t saved_state_array[QLA8044_DBG_STATE_ARRAY_LEN];
  526. uint32_t capture_size_array[QLA8044_DBG_CAP_SIZE_ARRAY_LEN];
  527. uint32_t ocm_window_reg[QLA8044_DBG_OCM_WNDREG_ARRAY_LEN];
  528. };
  529. struct qla8044_pex_dma_descriptor {
  530. struct {
  531. uint32_t read_data_size; /* 0-23: size, 24-31: rsvd */
  532. uint8_t rsvd[2];
  533. uint16_t dma_desc_cmd;
  534. } cmd;
  535. uint64_t src_addr;
  536. uint64_t dma_bus_addr; /*0-3: desc-cmd, 4-7: pci-func, 8-15: desc-cmd*/
  537. uint8_t rsvd[24];
  538. } __packed;
  539. #endif