aic94xx_dump.c 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. /*
  2. * Aic94xx SAS/SATA driver dump interface.
  3. *
  4. * Copyright (C) 2004 Adaptec, Inc. All rights reserved.
  5. * Copyright (C) 2004 David Chaw <david_chaw@adaptec.com>
  6. * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
  7. *
  8. * This file is licensed under GPLv2.
  9. *
  10. * This file is part of the aic94xx driver.
  11. *
  12. * The aic94xx driver is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; version 2 of the
  15. * License.
  16. *
  17. * The aic94xx driver is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with the aic94xx driver; if not, write to the Free Software
  24. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  25. *
  26. * 2005/07/14/LT Complete overhaul of this file. Update pages, register
  27. * locations, names, etc. Make use of macros. Print more information.
  28. * Print all cseq and lseq mip and mdp.
  29. *
  30. */
  31. #include <linux/pci.h>
  32. #include "aic94xx.h"
  33. #include "aic94xx_reg.h"
  34. #include "aic94xx_reg_def.h"
  35. #include "aic94xx_sas.h"
  36. #include "aic94xx_dump.h"
  37. #ifdef ASD_DEBUG
  38. #define MD(x) (1 << (x))
  39. #define MODE_COMMON (1 << 31)
  40. #define MODE_0_7 (0xFF)
  41. static const struct lseq_cio_regs {
  42. char *name;
  43. u32 offs;
  44. u8 width;
  45. u32 mode;
  46. } LSEQmCIOREGS[] = {
  47. {"LmMnSCBPTR", 0x20, 16, MD(0)|MD(1)|MD(2)|MD(3)|MD(4) },
  48. {"LmMnDDBPTR", 0x22, 16, MD(0)|MD(1)|MD(2)|MD(3)|MD(4) },
  49. {"LmREQMBX", 0x30, 32, MODE_COMMON },
  50. {"LmRSPMBX", 0x34, 32, MODE_COMMON },
  51. {"LmMnINT", 0x38, 32, MODE_0_7 },
  52. {"LmMnINTEN", 0x3C, 32, MODE_0_7 },
  53. {"LmXMTPRIMD", 0x40, 32, MODE_COMMON },
  54. {"LmXMTPRIMCS", 0x44, 8, MODE_COMMON },
  55. {"LmCONSTAT", 0x45, 8, MODE_COMMON },
  56. {"LmMnDMAERRS", 0x46, 8, MD(0)|MD(1) },
  57. {"LmMnSGDMAERRS", 0x47, 8, MD(0)|MD(1) },
  58. {"LmMnEXPHDRP", 0x48, 8, MD(0) },
  59. {"LmMnSASAALIGN", 0x48, 8, MD(1) },
  60. {"LmMnMSKHDRP", 0x49, 8, MD(0) },
  61. {"LmMnSTPALIGN", 0x49, 8, MD(1) },
  62. {"LmMnRCVHDRP", 0x4A, 8, MD(0) },
  63. {"LmMnXMTHDRP", 0x4A, 8, MD(1) },
  64. {"LmALIGNMODE", 0x4B, 8, MD(1) },
  65. {"LmMnEXPRCVCNT", 0x4C, 32, MD(0) },
  66. {"LmMnXMTCNT", 0x4C, 32, MD(1) },
  67. {"LmMnCURRTAG", 0x54, 16, MD(0) },
  68. {"LmMnPREVTAG", 0x56, 16, MD(0) },
  69. {"LmMnACKOFS", 0x58, 8, MD(1) },
  70. {"LmMnXFRLVL", 0x59, 8, MD(0)|MD(1) },
  71. {"LmMnSGDMACTL", 0x5A, 8, MD(0)|MD(1) },
  72. {"LmMnSGDMASTAT", 0x5B, 8, MD(0)|MD(1) },
  73. {"LmMnDDMACTL", 0x5C, 8, MD(0)|MD(1) },
  74. {"LmMnDDMASTAT", 0x5D, 8, MD(0)|MD(1) },
  75. {"LmMnDDMAMODE", 0x5E, 16, MD(0)|MD(1) },
  76. {"LmMnPIPECTL", 0x61, 8, MD(0)|MD(1) },
  77. {"LmMnACTSCB", 0x62, 16, MD(0)|MD(1) },
  78. {"LmMnSGBHADR", 0x64, 8, MD(0)|MD(1) },
  79. {"LmMnSGBADR", 0x65, 8, MD(0)|MD(1) },
  80. {"LmMnSGDCNT", 0x66, 8, MD(0)|MD(1) },
  81. {"LmMnSGDMADR", 0x68, 32, MD(0)|MD(1) },
  82. {"LmMnSGDMADR", 0x6C, 32, MD(0)|MD(1) },
  83. {"LmMnXFRCNT", 0x70, 32, MD(0)|MD(1) },
  84. {"LmMnXMTCRC", 0x74, 32, MD(1) },
  85. {"LmCURRTAG", 0x74, 16, MD(0) },
  86. {"LmPREVTAG", 0x76, 16, MD(0) },
  87. {"LmMnDPSEL", 0x7B, 8, MD(0)|MD(1) },
  88. {"LmDPTHSTAT", 0x7C, 8, MODE_COMMON },
  89. {"LmMnHOLDLVL", 0x7D, 8, MD(0) },
  90. {"LmMnSATAFS", 0x7E, 8, MD(1) },
  91. {"LmMnCMPLTSTAT", 0x7F, 8, MD(0)|MD(1) },
  92. {"LmPRMSTAT0", 0x80, 32, MODE_COMMON },
  93. {"LmPRMSTAT1", 0x84, 32, MODE_COMMON },
  94. {"LmGPRMINT", 0x88, 8, MODE_COMMON },
  95. {"LmMnCURRSCB", 0x8A, 16, MD(0) },
  96. {"LmPRMICODE", 0x8C, 32, MODE_COMMON },
  97. {"LmMnRCVCNT", 0x90, 16, MD(0) },
  98. {"LmMnBUFSTAT", 0x92, 16, MD(0) },
  99. {"LmMnXMTHDRSIZE",0x92, 8, MD(1) },
  100. {"LmMnXMTSIZE", 0x93, 8, MD(1) },
  101. {"LmMnTGTXFRCNT", 0x94, 32, MD(0) },
  102. {"LmMnEXPROFS", 0x98, 32, MD(0) },
  103. {"LmMnXMTROFS", 0x98, 32, MD(1) },
  104. {"LmMnRCVROFS", 0x9C, 32, MD(0) },
  105. {"LmCONCTL", 0xA0, 16, MODE_COMMON },
  106. {"LmBITLTIMER", 0xA2, 16, MODE_COMMON },
  107. {"LmWWNLOW", 0xA8, 32, MODE_COMMON },
  108. {"LmWWNHIGH", 0xAC, 32, MODE_COMMON },
  109. {"LmMnFRMERR", 0xB0, 32, MD(0) },
  110. {"LmMnFRMERREN", 0xB4, 32, MD(0) },
  111. {"LmAWTIMER", 0xB8, 16, MODE_COMMON },
  112. {"LmAWTCTL", 0xBA, 8, MODE_COMMON },
  113. {"LmMnHDRCMPS", 0xC0, 32, MD(0) },
  114. {"LmMnXMTSTAT", 0xC4, 8, MD(1) },
  115. {"LmHWTSTATEN", 0xC5, 8, MODE_COMMON },
  116. {"LmMnRRDYRC", 0xC6, 8, MD(0) },
  117. {"LmMnRRDYTC", 0xC6, 8, MD(1) },
  118. {"LmHWTSTAT", 0xC7, 8, MODE_COMMON },
  119. {"LmMnDATABUFADR",0xC8, 16, MD(0)|MD(1) },
  120. {"LmDWSSTATUS", 0xCB, 8, MODE_COMMON },
  121. {"LmMnACTSTAT", 0xCE, 16, MD(0)|MD(1) },
  122. {"LmMnREQSCB", 0xD2, 16, MD(0)|MD(1) },
  123. {"LmXXXPRIM", 0xD4, 32, MODE_COMMON },
  124. {"LmRCVASTAT", 0xD9, 8, MODE_COMMON },
  125. {"LmINTDIS1", 0xDA, 8, MODE_COMMON },
  126. {"LmPSTORESEL", 0xDB, 8, MODE_COMMON },
  127. {"LmPSTORE", 0xDC, 32, MODE_COMMON },
  128. {"LmPRIMSTAT0EN", 0xE0, 32, MODE_COMMON },
  129. {"LmPRIMSTAT1EN", 0xE4, 32, MODE_COMMON },
  130. {"LmDONETCTL", 0xF2, 16, MODE_COMMON },
  131. {NULL, 0, 0, 0 }
  132. };
  133. /*
  134. static struct lseq_cio_regs LSEQmOOBREGS[] = {
  135. {"OOB_BFLTR" ,0x100, 8, MD(5)},
  136. {"OOB_INIT_MIN" ,0x102,16, MD(5)},
  137. {"OOB_INIT_MAX" ,0x104,16, MD(5)},
  138. {"OOB_INIT_NEG" ,0x106,16, MD(5)},
  139. {"OOB_SAS_MIN" ,0x108,16, MD(5)},
  140. {"OOB_SAS_MAX" ,0x10A,16, MD(5)},
  141. {"OOB_SAS_NEG" ,0x10C,16, MD(5)},
  142. {"OOB_WAKE_MIN" ,0x10E,16, MD(5)},
  143. {"OOB_WAKE_MAX" ,0x110,16, MD(5)},
  144. {"OOB_WAKE_NEG" ,0x112,16, MD(5)},
  145. {"OOB_IDLE_MAX" ,0x114,16, MD(5)},
  146. {"OOB_BURST_MAX" ,0x116,16, MD(5)},
  147. {"OOB_XMIT_BURST" ,0x118, 8, MD(5)},
  148. {"OOB_SEND_PAIRS" ,0x119, 8, MD(5)},
  149. {"OOB_INIT_IDLE" ,0x11A, 8, MD(5)},
  150. {"OOB_INIT_NEGO" ,0x11C, 8, MD(5)},
  151. {"OOB_SAS_IDLE" ,0x11E, 8, MD(5)},
  152. {"OOB_SAS_NEGO" ,0x120, 8, MD(5)},
  153. {"OOB_WAKE_IDLE" ,0x122, 8, MD(5)},
  154. {"OOB_WAKE_NEGO" ,0x124, 8, MD(5)},
  155. {"OOB_DATA_KBITS" ,0x126, 8, MD(5)},
  156. {"OOB_BURST_DATA" ,0x128,32, MD(5)},
  157. {"OOB_ALIGN_0_DATA" ,0x12C,32, MD(5)},
  158. {"OOB_ALIGN_1_DATA" ,0x130,32, MD(5)},
  159. {"OOB_SYNC_DATA" ,0x134,32, MD(5)},
  160. {"OOB_D10_2_DATA" ,0x138,32, MD(5)},
  161. {"OOB_PHY_RST_CNT" ,0x13C,32, MD(5)},
  162. {"OOB_SIG_GEN" ,0x140, 8, MD(5)},
  163. {"OOB_XMIT" ,0x141, 8, MD(5)},
  164. {"FUNCTION_MAKS" ,0x142, 8, MD(5)},
  165. {"OOB_MODE" ,0x143, 8, MD(5)},
  166. {"CURRENT_STATUS" ,0x144, 8, MD(5)},
  167. {"SPEED_MASK" ,0x145, 8, MD(5)},
  168. {"PRIM_COUNT" ,0x146, 8, MD(5)},
  169. {"OOB_SIGNALS" ,0x148, 8, MD(5)},
  170. {"OOB_DATA_DET" ,0x149, 8, MD(5)},
  171. {"OOB_TIME_OUT" ,0x14C, 8, MD(5)},
  172. {"OOB_TIMER_ENABLE" ,0x14D, 8, MD(5)},
  173. {"OOB_STATUS" ,0x14E, 8, MD(5)},
  174. {"HOT_PLUG_DELAY" ,0x150, 8, MD(5)},
  175. {"RCD_DELAY" ,0x151, 8, MD(5)},
  176. {"COMSAS_TIMER" ,0x152, 8, MD(5)},
  177. {"SNTT_DELAY" ,0x153, 8, MD(5)},
  178. {"SPD_CHNG_DELAY" ,0x154, 8, MD(5)},
  179. {"SNLT_DELAY" ,0x155, 8, MD(5)},
  180. {"SNWT_DELAY" ,0x156, 8, MD(5)},
  181. {"ALIGN_DELAY" ,0x157, 8, MD(5)},
  182. {"INT_ENABLE_0" ,0x158, 8, MD(5)},
  183. {"INT_ENABLE_1" ,0x159, 8, MD(5)},
  184. {"INT_ENABLE_2" ,0x15A, 8, MD(5)},
  185. {"INT_ENABLE_3" ,0x15B, 8, MD(5)},
  186. {"OOB_TEST_REG" ,0x15C, 8, MD(5)},
  187. {"PHY_CONTROL_0" ,0x160, 8, MD(5)},
  188. {"PHY_CONTROL_1" ,0x161, 8, MD(5)},
  189. {"PHY_CONTROL_2" ,0x162, 8, MD(5)},
  190. {"PHY_CONTROL_3" ,0x163, 8, MD(5)},
  191. {"PHY_OOB_CAL_TX" ,0x164, 8, MD(5)},
  192. {"PHY_OOB_CAL_RX" ,0x165, 8, MD(5)},
  193. {"OOB_PHY_CAL_TX" ,0x166, 8, MD(5)},
  194. {"OOB_PHY_CAL_RX" ,0x167, 8, MD(5)},
  195. {"PHY_CONTROL_4" ,0x168, 8, MD(5)},
  196. {"PHY_TEST" ,0x169, 8, MD(5)},
  197. {"PHY_PWR_CTL" ,0x16A, 8, MD(5)},
  198. {"PHY_PWR_DELAY" ,0x16B, 8, MD(5)},
  199. {"OOB_SM_CON" ,0x16C, 8, MD(5)},
  200. {"ADDR_TRAP_1" ,0x16D, 8, MD(5)},
  201. {"ADDR_NEXT_1" ,0x16E, 8, MD(5)},
  202. {"NEXT_ST_1" ,0x16F, 8, MD(5)},
  203. {"OOB_SM_STATE" ,0x170, 8, MD(5)},
  204. {"ADDR_TRAP_2" ,0x171, 8, MD(5)},
  205. {"ADDR_NEXT_2" ,0x172, 8, MD(5)},
  206. {"NEXT_ST_2" ,0x173, 8, MD(5)},
  207. {NULL, 0, 0, 0 }
  208. };
  209. */
  210. #define STR_8BIT " %30s[0x%04x]:0x%02x\n"
  211. #define STR_16BIT " %30s[0x%04x]:0x%04x\n"
  212. #define STR_32BIT " %30s[0x%04x]:0x%08x\n"
  213. #define STR_64BIT " %30s[0x%04x]:0x%llx\n"
  214. #define PRINT_REG_8bit(_ha, _n, _r) asd_printk(STR_8BIT, #_n, _n, \
  215. asd_read_reg_byte(_ha, _r))
  216. #define PRINT_REG_16bit(_ha, _n, _r) asd_printk(STR_16BIT, #_n, _n, \
  217. asd_read_reg_word(_ha, _r))
  218. #define PRINT_REG_32bit(_ha, _n, _r) asd_printk(STR_32BIT, #_n, _n, \
  219. asd_read_reg_dword(_ha, _r))
  220. #define PRINT_CREG_8bit(_ha, _n) asd_printk(STR_8BIT, #_n, _n, \
  221. asd_read_reg_byte(_ha, C##_n))
  222. #define PRINT_CREG_16bit(_ha, _n) asd_printk(STR_16BIT, #_n, _n, \
  223. asd_read_reg_word(_ha, C##_n))
  224. #define PRINT_CREG_32bit(_ha, _n) asd_printk(STR_32BIT, #_n, _n, \
  225. asd_read_reg_dword(_ha, C##_n))
  226. #define MSTR_8BIT " Mode:%02d %30s[0x%04x]:0x%02x\n"
  227. #define MSTR_16BIT " Mode:%02d %30s[0x%04x]:0x%04x\n"
  228. #define MSTR_32BIT " Mode:%02d %30s[0x%04x]:0x%08x\n"
  229. #define PRINT_MREG_8bit(_ha, _m, _n, _r) asd_printk(MSTR_8BIT, _m, #_n, _n, \
  230. asd_read_reg_byte(_ha, _r))
  231. #define PRINT_MREG_16bit(_ha, _m, _n, _r) asd_printk(MSTR_16BIT, _m, #_n, _n, \
  232. asd_read_reg_word(_ha, _r))
  233. #define PRINT_MREG_32bit(_ha, _m, _n, _r) asd_printk(MSTR_32BIT, _m, #_n, _n, \
  234. asd_read_reg_dword(_ha, _r))
  235. /* can also be used for MD when the register is mode aware already */
  236. #define PRINT_MIS_byte(_ha, _n) asd_printk(STR_8BIT, #_n,CSEQ_##_n-CMAPPEDSCR,\
  237. asd_read_reg_byte(_ha, CSEQ_##_n))
  238. #define PRINT_MIS_word(_ha, _n) asd_printk(STR_16BIT,#_n,CSEQ_##_n-CMAPPEDSCR,\
  239. asd_read_reg_word(_ha, CSEQ_##_n))
  240. #define PRINT_MIS_dword(_ha, _n) \
  241. asd_printk(STR_32BIT,#_n,CSEQ_##_n-CMAPPEDSCR,\
  242. asd_read_reg_dword(_ha, CSEQ_##_n))
  243. #define PRINT_MIS_qword(_ha, _n) \
  244. asd_printk(STR_64BIT, #_n,CSEQ_##_n-CMAPPEDSCR, \
  245. (unsigned long long)(((u64)asd_read_reg_dword(_ha, CSEQ_##_n)) \
  246. | (((u64)asd_read_reg_dword(_ha, (CSEQ_##_n)+4))<<32)))
  247. #define CMDP_REG(_n, _m) (_m*(CSEQ_PAGE_SIZE*2)+CSEQ_##_n)
  248. #define PRINT_CMDP_word(_ha, _n) \
  249. asd_printk("%20s 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", \
  250. #_n, \
  251. asd_read_reg_word(_ha, CMDP_REG(_n, 0)), \
  252. asd_read_reg_word(_ha, CMDP_REG(_n, 1)), \
  253. asd_read_reg_word(_ha, CMDP_REG(_n, 2)), \
  254. asd_read_reg_word(_ha, CMDP_REG(_n, 3)), \
  255. asd_read_reg_word(_ha, CMDP_REG(_n, 4)), \
  256. asd_read_reg_word(_ha, CMDP_REG(_n, 5)), \
  257. asd_read_reg_word(_ha, CMDP_REG(_n, 6)), \
  258. asd_read_reg_word(_ha, CMDP_REG(_n, 7)))
  259. #define PRINT_CMDP_byte(_ha, _n) \
  260. asd_printk("%20s 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x 0x%04x\n", \
  261. #_n, \
  262. asd_read_reg_byte(_ha, CMDP_REG(_n, 0)), \
  263. asd_read_reg_byte(_ha, CMDP_REG(_n, 1)), \
  264. asd_read_reg_byte(_ha, CMDP_REG(_n, 2)), \
  265. asd_read_reg_byte(_ha, CMDP_REG(_n, 3)), \
  266. asd_read_reg_byte(_ha, CMDP_REG(_n, 4)), \
  267. asd_read_reg_byte(_ha, CMDP_REG(_n, 5)), \
  268. asd_read_reg_byte(_ha, CMDP_REG(_n, 6)), \
  269. asd_read_reg_byte(_ha, CMDP_REG(_n, 7)))
  270. static void asd_dump_cseq_state(struct asd_ha_struct *asd_ha)
  271. {
  272. int mode;
  273. asd_printk("CSEQ STATE\n");
  274. asd_printk("ARP2 REGISTERS\n");
  275. PRINT_CREG_32bit(asd_ha, ARP2CTL);
  276. PRINT_CREG_32bit(asd_ha, ARP2INT);
  277. PRINT_CREG_32bit(asd_ha, ARP2INTEN);
  278. PRINT_CREG_8bit(asd_ha, MODEPTR);
  279. PRINT_CREG_8bit(asd_ha, ALTMODE);
  280. PRINT_CREG_8bit(asd_ha, FLAG);
  281. PRINT_CREG_8bit(asd_ha, ARP2INTCTL);
  282. PRINT_CREG_16bit(asd_ha, STACK);
  283. PRINT_CREG_16bit(asd_ha, PRGMCNT);
  284. PRINT_CREG_16bit(asd_ha, ACCUM);
  285. PRINT_CREG_16bit(asd_ha, SINDEX);
  286. PRINT_CREG_16bit(asd_ha, DINDEX);
  287. PRINT_CREG_8bit(asd_ha, SINDIR);
  288. PRINT_CREG_8bit(asd_ha, DINDIR);
  289. PRINT_CREG_8bit(asd_ha, JUMLDIR);
  290. PRINT_CREG_8bit(asd_ha, ARP2HALTCODE);
  291. PRINT_CREG_16bit(asd_ha, CURRADDR);
  292. PRINT_CREG_16bit(asd_ha, LASTADDR);
  293. PRINT_CREG_16bit(asd_ha, NXTLADDR);
  294. asd_printk("IOP REGISTERS\n");
  295. PRINT_REG_32bit(asd_ha, BISTCTL1, CBISTCTL);
  296. PRINT_CREG_32bit(asd_ha, MAPPEDSCR);
  297. asd_printk("CIO REGISTERS\n");
  298. for (mode = 0; mode < 9; mode++)
  299. PRINT_MREG_16bit(asd_ha, mode, MnSCBPTR, CMnSCBPTR(mode));
  300. PRINT_MREG_16bit(asd_ha, 15, MnSCBPTR, CMnSCBPTR(15));
  301. for (mode = 0; mode < 9; mode++)
  302. PRINT_MREG_16bit(asd_ha, mode, MnDDBPTR, CMnDDBPTR(mode));
  303. PRINT_MREG_16bit(asd_ha, 15, MnDDBPTR, CMnDDBPTR(15));
  304. for (mode = 0; mode < 8; mode++)
  305. PRINT_MREG_32bit(asd_ha, mode, MnREQMBX, CMnREQMBX(mode));
  306. for (mode = 0; mode < 8; mode++)
  307. PRINT_MREG_32bit(asd_ha, mode, MnRSPMBX, CMnRSPMBX(mode));
  308. for (mode = 0; mode < 8; mode++)
  309. PRINT_MREG_32bit(asd_ha, mode, MnINT, CMnINT(mode));
  310. for (mode = 0; mode < 8; mode++)
  311. PRINT_MREG_32bit(asd_ha, mode, MnINTEN, CMnINTEN(mode));
  312. PRINT_CREG_8bit(asd_ha, SCRATCHPAGE);
  313. for (mode = 0; mode < 8; mode++)
  314. PRINT_MREG_8bit(asd_ha, mode, MnSCRATCHPAGE,
  315. CMnSCRATCHPAGE(mode));
  316. PRINT_REG_32bit(asd_ha, CLINKCON, CLINKCON);
  317. PRINT_REG_8bit(asd_ha, CCONMSK, CCONMSK);
  318. PRINT_REG_8bit(asd_ha, CCONEXIST, CCONEXIST);
  319. PRINT_REG_16bit(asd_ha, CCONMODE, CCONMODE);
  320. PRINT_REG_32bit(asd_ha, CTIMERCALC, CTIMERCALC);
  321. PRINT_REG_8bit(asd_ha, CINTDIS, CINTDIS);
  322. asd_printk("SCRATCH MEMORY\n");
  323. asd_printk("MIP 4 >>>>>\n");
  324. PRINT_MIS_word(asd_ha, Q_EXE_HEAD);
  325. PRINT_MIS_word(asd_ha, Q_EXE_TAIL);
  326. PRINT_MIS_word(asd_ha, Q_DONE_HEAD);
  327. PRINT_MIS_word(asd_ha, Q_DONE_TAIL);
  328. PRINT_MIS_word(asd_ha, Q_SEND_HEAD);
  329. PRINT_MIS_word(asd_ha, Q_SEND_TAIL);
  330. PRINT_MIS_word(asd_ha, Q_DMA2CHIM_HEAD);
  331. PRINT_MIS_word(asd_ha, Q_DMA2CHIM_TAIL);
  332. PRINT_MIS_word(asd_ha, Q_COPY_HEAD);
  333. PRINT_MIS_word(asd_ha, Q_COPY_TAIL);
  334. PRINT_MIS_word(asd_ha, REG0);
  335. PRINT_MIS_word(asd_ha, REG1);
  336. PRINT_MIS_dword(asd_ha, REG2);
  337. PRINT_MIS_byte(asd_ha, LINK_CTL_Q_MAP);
  338. PRINT_MIS_byte(asd_ha, MAX_CSEQ_MODE);
  339. PRINT_MIS_byte(asd_ha, FREE_LIST_HACK_COUNT);
  340. asd_printk("MIP 5 >>>>\n");
  341. PRINT_MIS_qword(asd_ha, EST_NEXUS_REQ_QUEUE);
  342. PRINT_MIS_qword(asd_ha, EST_NEXUS_REQ_COUNT);
  343. PRINT_MIS_word(asd_ha, Q_EST_NEXUS_HEAD);
  344. PRINT_MIS_word(asd_ha, Q_EST_NEXUS_TAIL);
  345. PRINT_MIS_word(asd_ha, NEED_EST_NEXUS_SCB);
  346. PRINT_MIS_byte(asd_ha, EST_NEXUS_REQ_HEAD);
  347. PRINT_MIS_byte(asd_ha, EST_NEXUS_REQ_TAIL);
  348. PRINT_MIS_byte(asd_ha, EST_NEXUS_SCB_OFFSET);
  349. asd_printk("MIP 6 >>>>\n");
  350. PRINT_MIS_word(asd_ha, INT_ROUT_RET_ADDR0);
  351. PRINT_MIS_word(asd_ha, INT_ROUT_RET_ADDR1);
  352. PRINT_MIS_word(asd_ha, INT_ROUT_SCBPTR);
  353. PRINT_MIS_byte(asd_ha, INT_ROUT_MODE);
  354. PRINT_MIS_byte(asd_ha, ISR_SCRATCH_FLAGS);
  355. PRINT_MIS_word(asd_ha, ISR_SAVE_SINDEX);
  356. PRINT_MIS_word(asd_ha, ISR_SAVE_DINDEX);
  357. PRINT_MIS_word(asd_ha, Q_MONIRTT_HEAD);
  358. PRINT_MIS_word(asd_ha, Q_MONIRTT_TAIL);
  359. PRINT_MIS_byte(asd_ha, FREE_SCB_MASK);
  360. PRINT_MIS_word(asd_ha, BUILTIN_FREE_SCB_HEAD);
  361. PRINT_MIS_word(asd_ha, BUILTIN_FREE_SCB_TAIL);
  362. PRINT_MIS_word(asd_ha, EXTENDED_FREE_SCB_HEAD);
  363. PRINT_MIS_word(asd_ha, EXTENDED_FREE_SCB_TAIL);
  364. asd_printk("MIP 7 >>>>\n");
  365. PRINT_MIS_qword(asd_ha, EMPTY_REQ_QUEUE);
  366. PRINT_MIS_qword(asd_ha, EMPTY_REQ_COUNT);
  367. PRINT_MIS_word(asd_ha, Q_EMPTY_HEAD);
  368. PRINT_MIS_word(asd_ha, Q_EMPTY_TAIL);
  369. PRINT_MIS_word(asd_ha, NEED_EMPTY_SCB);
  370. PRINT_MIS_byte(asd_ha, EMPTY_REQ_HEAD);
  371. PRINT_MIS_byte(asd_ha, EMPTY_REQ_TAIL);
  372. PRINT_MIS_byte(asd_ha, EMPTY_SCB_OFFSET);
  373. PRINT_MIS_word(asd_ha, PRIMITIVE_DATA);
  374. PRINT_MIS_dword(asd_ha, TIMEOUT_CONST);
  375. asd_printk("MDP 0 >>>>\n");
  376. asd_printk("%-20s %6s %6s %6s %6s %6s %6s %6s %6s\n",
  377. "Mode: ", "0", "1", "2", "3", "4", "5", "6", "7");
  378. PRINT_CMDP_word(asd_ha, LRM_SAVE_SINDEX);
  379. PRINT_CMDP_word(asd_ha, LRM_SAVE_SCBPTR);
  380. PRINT_CMDP_word(asd_ha, Q_LINK_HEAD);
  381. PRINT_CMDP_word(asd_ha, Q_LINK_TAIL);
  382. PRINT_CMDP_byte(asd_ha, LRM_SAVE_SCRPAGE);
  383. asd_printk("MDP 0 Mode 8 >>>>\n");
  384. PRINT_MIS_word(asd_ha, RET_ADDR);
  385. PRINT_MIS_word(asd_ha, RET_SCBPTR);
  386. PRINT_MIS_word(asd_ha, SAVE_SCBPTR);
  387. PRINT_MIS_word(asd_ha, EMPTY_TRANS_CTX);
  388. PRINT_MIS_word(asd_ha, RESP_LEN);
  389. PRINT_MIS_word(asd_ha, TMF_SCBPTR);
  390. PRINT_MIS_word(asd_ha, GLOBAL_PREV_SCB);
  391. PRINT_MIS_word(asd_ha, GLOBAL_HEAD);
  392. PRINT_MIS_word(asd_ha, CLEAR_LU_HEAD);
  393. PRINT_MIS_byte(asd_ha, TMF_OPCODE);
  394. PRINT_MIS_byte(asd_ha, SCRATCH_FLAGS);
  395. PRINT_MIS_word(asd_ha, HSB_SITE);
  396. PRINT_MIS_word(asd_ha, FIRST_INV_SCB_SITE);
  397. PRINT_MIS_word(asd_ha, FIRST_INV_DDB_SITE);
  398. asd_printk("MDP 1 Mode 8 >>>>\n");
  399. PRINT_MIS_qword(asd_ha, LUN_TO_CLEAR);
  400. PRINT_MIS_qword(asd_ha, LUN_TO_CHECK);
  401. asd_printk("MDP 2 Mode 8 >>>>\n");
  402. PRINT_MIS_qword(asd_ha, HQ_NEW_POINTER);
  403. PRINT_MIS_qword(asd_ha, HQ_DONE_BASE);
  404. PRINT_MIS_dword(asd_ha, HQ_DONE_POINTER);
  405. PRINT_MIS_byte(asd_ha, HQ_DONE_PASS);
  406. }
  407. #define PRINT_LREG_8bit(_h, _lseq, _n) \
  408. asd_printk(STR_8BIT, #_n, _n, asd_read_reg_byte(_h, Lm##_n(_lseq)))
  409. #define PRINT_LREG_16bit(_h, _lseq, _n) \
  410. asd_printk(STR_16BIT, #_n, _n, asd_read_reg_word(_h, Lm##_n(_lseq)))
  411. #define PRINT_LREG_32bit(_h, _lseq, _n) \
  412. asd_printk(STR_32BIT, #_n, _n, asd_read_reg_dword(_h, Lm##_n(_lseq)))
  413. #define PRINT_LMIP_byte(_h, _lseq, _n) \
  414. asd_printk(STR_8BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
  415. asd_read_reg_byte(_h, LmSEQ_##_n(_lseq)))
  416. #define PRINT_LMIP_word(_h, _lseq, _n) \
  417. asd_printk(STR_16BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
  418. asd_read_reg_word(_h, LmSEQ_##_n(_lseq)))
  419. #define PRINT_LMIP_dword(_h, _lseq, _n) \
  420. asd_printk(STR_32BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
  421. asd_read_reg_dword(_h, LmSEQ_##_n(_lseq)))
  422. #define PRINT_LMIP_qword(_h, _lseq, _n) \
  423. asd_printk(STR_64BIT, #_n, LmSEQ_##_n(_lseq)-LmSCRATCH(_lseq), \
  424. (unsigned long long)(((unsigned long long) \
  425. asd_read_reg_dword(_h, LmSEQ_##_n(_lseq))) \
  426. | (((unsigned long long) \
  427. asd_read_reg_dword(_h, LmSEQ_##_n(_lseq)+4))<<32)))
  428. static void asd_print_lseq_cio_reg(struct asd_ha_struct *asd_ha,
  429. u32 lseq_cio_addr, int i)
  430. {
  431. switch (LSEQmCIOREGS[i].width) {
  432. case 8:
  433. asd_printk("%20s[0x%x]: 0x%02x\n", LSEQmCIOREGS[i].name,
  434. LSEQmCIOREGS[i].offs,
  435. asd_read_reg_byte(asd_ha, lseq_cio_addr +
  436. LSEQmCIOREGS[i].offs));
  437. break;
  438. case 16:
  439. asd_printk("%20s[0x%x]: 0x%04x\n", LSEQmCIOREGS[i].name,
  440. LSEQmCIOREGS[i].offs,
  441. asd_read_reg_word(asd_ha, lseq_cio_addr +
  442. LSEQmCIOREGS[i].offs));
  443. break;
  444. case 32:
  445. asd_printk("%20s[0x%x]: 0x%08x\n", LSEQmCIOREGS[i].name,
  446. LSEQmCIOREGS[i].offs,
  447. asd_read_reg_dword(asd_ha, lseq_cio_addr +
  448. LSEQmCIOREGS[i].offs));
  449. break;
  450. }
  451. }
  452. static void asd_dump_lseq_state(struct asd_ha_struct *asd_ha, int lseq)
  453. {
  454. u32 moffs;
  455. int mode;
  456. asd_printk("LSEQ %d STATE\n", lseq);
  457. asd_printk("LSEQ%d: ARP2 REGISTERS\n", lseq);
  458. PRINT_LREG_32bit(asd_ha, lseq, ARP2CTL);
  459. PRINT_LREG_32bit(asd_ha, lseq, ARP2INT);
  460. PRINT_LREG_32bit(asd_ha, lseq, ARP2INTEN);
  461. PRINT_LREG_8bit(asd_ha, lseq, MODEPTR);
  462. PRINT_LREG_8bit(asd_ha, lseq, ALTMODE);
  463. PRINT_LREG_8bit(asd_ha, lseq, FLAG);
  464. PRINT_LREG_8bit(asd_ha, lseq, ARP2INTCTL);
  465. PRINT_LREG_16bit(asd_ha, lseq, STACK);
  466. PRINT_LREG_16bit(asd_ha, lseq, PRGMCNT);
  467. PRINT_LREG_16bit(asd_ha, lseq, ACCUM);
  468. PRINT_LREG_16bit(asd_ha, lseq, SINDEX);
  469. PRINT_LREG_16bit(asd_ha, lseq, DINDEX);
  470. PRINT_LREG_8bit(asd_ha, lseq, SINDIR);
  471. PRINT_LREG_8bit(asd_ha, lseq, DINDIR);
  472. PRINT_LREG_8bit(asd_ha, lseq, JUMLDIR);
  473. PRINT_LREG_8bit(asd_ha, lseq, ARP2HALTCODE);
  474. PRINT_LREG_16bit(asd_ha, lseq, CURRADDR);
  475. PRINT_LREG_16bit(asd_ha, lseq, LASTADDR);
  476. PRINT_LREG_16bit(asd_ha, lseq, NXTLADDR);
  477. asd_printk("LSEQ%d: IOP REGISTERS\n", lseq);
  478. PRINT_LREG_32bit(asd_ha, lseq, MODECTL);
  479. PRINT_LREG_32bit(asd_ha, lseq, DBGMODE);
  480. PRINT_LREG_32bit(asd_ha, lseq, CONTROL);
  481. PRINT_REG_32bit(asd_ha, BISTCTL0, LmBISTCTL0(lseq));
  482. PRINT_REG_32bit(asd_ha, BISTCTL1, LmBISTCTL1(lseq));
  483. asd_printk("LSEQ%d: CIO REGISTERS\n", lseq);
  484. asd_printk("Mode common:\n");
  485. for (mode = 0; mode < 8; mode++) {
  486. u32 lseq_cio_addr = LmSEQ_PHY_BASE(mode, lseq);
  487. int i;
  488. for (i = 0; LSEQmCIOREGS[i].name; i++)
  489. if (LSEQmCIOREGS[i].mode == MODE_COMMON)
  490. asd_print_lseq_cio_reg(asd_ha,lseq_cio_addr,i);
  491. }
  492. asd_printk("Mode unique:\n");
  493. for (mode = 0; mode < 8; mode++) {
  494. u32 lseq_cio_addr = LmSEQ_PHY_BASE(mode, lseq);
  495. int i;
  496. asd_printk("Mode %d\n", mode);
  497. for (i = 0; LSEQmCIOREGS[i].name; i++) {
  498. if (!(LSEQmCIOREGS[i].mode & (1 << mode)))
  499. continue;
  500. asd_print_lseq_cio_reg(asd_ha, lseq_cio_addr, i);
  501. }
  502. }
  503. asd_printk("SCRATCH MEMORY\n");
  504. asd_printk("LSEQ%d MIP 0 >>>>\n", lseq);
  505. PRINT_LMIP_word(asd_ha, lseq, Q_TGTXFR_HEAD);
  506. PRINT_LMIP_word(asd_ha, lseq, Q_TGTXFR_TAIL);
  507. PRINT_LMIP_byte(asd_ha, lseq, LINK_NUMBER);
  508. PRINT_LMIP_byte(asd_ha, lseq, SCRATCH_FLAGS);
  509. PRINT_LMIP_dword(asd_ha, lseq, CONNECTION_STATE);
  510. PRINT_LMIP_word(asd_ha, lseq, CONCTL);
  511. PRINT_LMIP_byte(asd_ha, lseq, CONSTAT);
  512. PRINT_LMIP_byte(asd_ha, lseq, CONNECTION_MODES);
  513. PRINT_LMIP_word(asd_ha, lseq, REG1_ISR);
  514. PRINT_LMIP_word(asd_ha, lseq, REG2_ISR);
  515. PRINT_LMIP_word(asd_ha, lseq, REG3_ISR);
  516. PRINT_LMIP_qword(asd_ha, lseq,REG0_ISR);
  517. asd_printk("LSEQ%d MIP 1 >>>>\n", lseq);
  518. PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR0);
  519. PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR1);
  520. PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR2);
  521. PRINT_LMIP_word(asd_ha, lseq, EST_NEXUS_SCBPTR3);
  522. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE0);
  523. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE1);
  524. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE2);
  525. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_OPCODE3);
  526. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_HEAD);
  527. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_SCB_TAIL);
  528. PRINT_LMIP_byte(asd_ha, lseq, EST_NEXUS_BUF_AVAIL);
  529. PRINT_LMIP_dword(asd_ha, lseq, TIMEOUT_CONST);
  530. PRINT_LMIP_word(asd_ha, lseq, ISR_SAVE_SINDEX);
  531. PRINT_LMIP_word(asd_ha, lseq, ISR_SAVE_DINDEX);
  532. asd_printk("LSEQ%d MIP 2 >>>>\n", lseq);
  533. PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR0);
  534. PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR1);
  535. PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR2);
  536. PRINT_LMIP_word(asd_ha, lseq, EMPTY_SCB_PTR3);
  537. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD0);
  538. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD1);
  539. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD2);
  540. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_OPCD3);
  541. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_HEAD);
  542. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_SCB_TAIL);
  543. PRINT_LMIP_byte(asd_ha, lseq, EMPTY_BUFS_AVAIL);
  544. asd_printk("LSEQ%d MIP 3 >>>>\n", lseq);
  545. PRINT_LMIP_dword(asd_ha, lseq, DEV_PRES_TMR_TOUT_CONST);
  546. PRINT_LMIP_dword(asd_ha, lseq, SATA_INTERLOCK_TIMEOUT);
  547. PRINT_LMIP_dword(asd_ha, lseq, SRST_ASSERT_TIMEOUT);
  548. PRINT_LMIP_dword(asd_ha, lseq, RCV_FIS_TIMEOUT);
  549. PRINT_LMIP_dword(asd_ha, lseq, ONE_MILLISEC_TIMEOUT);
  550. PRINT_LMIP_dword(asd_ha, lseq, TEN_MS_COMINIT_TIMEOUT);
  551. PRINT_LMIP_dword(asd_ha, lseq, SMP_RCV_TIMEOUT);
  552. for (mode = 0; mode < 3; mode++) {
  553. asd_printk("LSEQ%d MDP 0 MODE %d >>>>\n", lseq, mode);
  554. moffs = mode * LSEQ_MODE_SCRATCH_SIZE;
  555. asd_printk(STR_16BIT, "RET_ADDR", 0,
  556. asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR(lseq)
  557. + moffs));
  558. asd_printk(STR_16BIT, "REG0_MODE", 2,
  559. asd_read_reg_word(asd_ha, LmSEQ_REG0_MODE(lseq)
  560. + moffs));
  561. asd_printk(STR_16BIT, "MODE_FLAGS", 4,
  562. asd_read_reg_word(asd_ha, LmSEQ_MODE_FLAGS(lseq)
  563. + moffs));
  564. asd_printk(STR_16BIT, "RET_ADDR2", 0x6,
  565. asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR2(lseq)
  566. + moffs));
  567. asd_printk(STR_16BIT, "RET_ADDR1", 0x8,
  568. asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR1(lseq)
  569. + moffs));
  570. asd_printk(STR_8BIT, "OPCODE_TO_CSEQ", 0xB,
  571. asd_read_reg_byte(asd_ha, LmSEQ_OPCODE_TO_CSEQ(lseq)
  572. + moffs));
  573. asd_printk(STR_16BIT, "DATA_TO_CSEQ", 0xC,
  574. asd_read_reg_word(asd_ha, LmSEQ_DATA_TO_CSEQ(lseq)
  575. + moffs));
  576. }
  577. asd_printk("LSEQ%d MDP 0 MODE 5 >>>>\n", lseq);
  578. moffs = LSEQ_MODE5_PAGE0_OFFSET;
  579. asd_printk(STR_16BIT, "RET_ADDR", 0,
  580. asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR(lseq) + moffs));
  581. asd_printk(STR_16BIT, "REG0_MODE", 2,
  582. asd_read_reg_word(asd_ha, LmSEQ_REG0_MODE(lseq) + moffs));
  583. asd_printk(STR_16BIT, "MODE_FLAGS", 4,
  584. asd_read_reg_word(asd_ha, LmSEQ_MODE_FLAGS(lseq) + moffs));
  585. asd_printk(STR_16BIT, "RET_ADDR2", 0x6,
  586. asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR2(lseq) + moffs));
  587. asd_printk(STR_16BIT, "RET_ADDR1", 0x8,
  588. asd_read_reg_word(asd_ha, LmSEQ_RET_ADDR1(lseq) + moffs));
  589. asd_printk(STR_8BIT, "OPCODE_TO_CSEQ", 0xB,
  590. asd_read_reg_byte(asd_ha, LmSEQ_OPCODE_TO_CSEQ(lseq) + moffs));
  591. asd_printk(STR_16BIT, "DATA_TO_CSEQ", 0xC,
  592. asd_read_reg_word(asd_ha, LmSEQ_DATA_TO_CSEQ(lseq) + moffs));
  593. asd_printk("LSEQ%d MDP 0 MODE 0 >>>>\n", lseq);
  594. PRINT_LMIP_word(asd_ha, lseq, FIRST_INV_DDB_SITE);
  595. PRINT_LMIP_word(asd_ha, lseq, EMPTY_TRANS_CTX);
  596. PRINT_LMIP_word(asd_ha, lseq, RESP_LEN);
  597. PRINT_LMIP_word(asd_ha, lseq, FIRST_INV_SCB_SITE);
  598. PRINT_LMIP_dword(asd_ha, lseq, INTEN_SAVE);
  599. PRINT_LMIP_byte(asd_ha, lseq, LINK_RST_FRM_LEN);
  600. PRINT_LMIP_byte(asd_ha, lseq, LINK_RST_PROTOCOL);
  601. PRINT_LMIP_byte(asd_ha, lseq, RESP_STATUS);
  602. PRINT_LMIP_byte(asd_ha, lseq, LAST_LOADED_SGE);
  603. PRINT_LMIP_byte(asd_ha, lseq, SAVE_SCBPTR);
  604. asd_printk("LSEQ%d MDP 0 MODE 1 >>>>\n", lseq);
  605. PRINT_LMIP_word(asd_ha, lseq, Q_XMIT_HEAD);
  606. PRINT_LMIP_word(asd_ha, lseq, M1_EMPTY_TRANS_CTX);
  607. PRINT_LMIP_word(asd_ha, lseq, INI_CONN_TAG);
  608. PRINT_LMIP_byte(asd_ha, lseq, FAILED_OPEN_STATUS);
  609. PRINT_LMIP_byte(asd_ha, lseq, XMIT_REQUEST_TYPE);
  610. PRINT_LMIP_byte(asd_ha, lseq, M1_RESP_STATUS);
  611. PRINT_LMIP_byte(asd_ha, lseq, M1_LAST_LOADED_SGE);
  612. PRINT_LMIP_word(asd_ha, lseq, M1_SAVE_SCBPTR);
  613. asd_printk("LSEQ%d MDP 0 MODE 2 >>>>\n", lseq);
  614. PRINT_LMIP_word(asd_ha, lseq, PORT_COUNTER);
  615. PRINT_LMIP_word(asd_ha, lseq, PM_TABLE_PTR);
  616. PRINT_LMIP_word(asd_ha, lseq, SATA_INTERLOCK_TMR_SAVE);
  617. PRINT_LMIP_word(asd_ha, lseq, IP_BITL);
  618. PRINT_LMIP_word(asd_ha, lseq, COPY_SMP_CONN_TAG);
  619. PRINT_LMIP_byte(asd_ha, lseq, P0M2_OFFS1AH);
  620. asd_printk("LSEQ%d MDP 0 MODE 4/5 >>>>\n", lseq);
  621. PRINT_LMIP_byte(asd_ha, lseq, SAVED_OOB_STATUS);
  622. PRINT_LMIP_byte(asd_ha, lseq, SAVED_OOB_MODE);
  623. PRINT_LMIP_word(asd_ha, lseq, Q_LINK_HEAD);
  624. PRINT_LMIP_byte(asd_ha, lseq, LINK_RST_ERR);
  625. PRINT_LMIP_byte(asd_ha, lseq, SAVED_OOB_SIGNALS);
  626. PRINT_LMIP_byte(asd_ha, lseq, SAS_RESET_MODE);
  627. PRINT_LMIP_byte(asd_ha, lseq, LINK_RESET_RETRY_COUNT);
  628. PRINT_LMIP_byte(asd_ha, lseq, NUM_LINK_RESET_RETRIES);
  629. PRINT_LMIP_word(asd_ha, lseq, OOB_INT_ENABLES);
  630. PRINT_LMIP_word(asd_ha, lseq, NOTIFY_TIMER_TIMEOUT);
  631. PRINT_LMIP_word(asd_ha, lseq, NOTIFY_TIMER_DOWN_COUNT);
  632. asd_printk("LSEQ%d MDP 1 MODE 0 >>>>\n", lseq);
  633. PRINT_LMIP_qword(asd_ha, lseq, SG_LIST_PTR_ADDR0);
  634. PRINT_LMIP_qword(asd_ha, lseq, SG_LIST_PTR_ADDR1);
  635. asd_printk("LSEQ%d MDP 1 MODE 1 >>>>\n", lseq);
  636. PRINT_LMIP_qword(asd_ha, lseq, M1_SG_LIST_PTR_ADDR0);
  637. PRINT_LMIP_qword(asd_ha, lseq, M1_SG_LIST_PTR_ADDR1);
  638. asd_printk("LSEQ%d MDP 1 MODE 2 >>>>\n", lseq);
  639. PRINT_LMIP_dword(asd_ha, lseq, INVALID_DWORD_COUNT);
  640. PRINT_LMIP_dword(asd_ha, lseq, DISPARITY_ERROR_COUNT);
  641. PRINT_LMIP_dword(asd_ha, lseq, LOSS_OF_SYNC_COUNT);
  642. asd_printk("LSEQ%d MDP 1 MODE 4/5 >>>>\n", lseq);
  643. PRINT_LMIP_dword(asd_ha, lseq, FRAME_TYPE_MASK);
  644. PRINT_LMIP_dword(asd_ha, lseq, HASHED_SRC_ADDR_MASK_PRINT);
  645. PRINT_LMIP_byte(asd_ha, lseq, NUM_FILL_BYTES_MASK);
  646. PRINT_LMIP_word(asd_ha, lseq, TAG_MASK);
  647. PRINT_LMIP_word(asd_ha, lseq, TARGET_PORT_XFER_TAG);
  648. PRINT_LMIP_dword(asd_ha, lseq, DATA_OFFSET);
  649. asd_printk("LSEQ%d MDP 2 MODE 0 >>>>\n", lseq);
  650. PRINT_LMIP_dword(asd_ha, lseq, SMP_RCV_TIMER_TERM_TS);
  651. PRINT_LMIP_byte(asd_ha, lseq, DEVICE_BITS);
  652. PRINT_LMIP_word(asd_ha, lseq, SDB_DDB);
  653. PRINT_LMIP_word(asd_ha, lseq, SDB_NUM_TAGS);
  654. PRINT_LMIP_word(asd_ha, lseq, SDB_CURR_TAG);
  655. asd_printk("LSEQ%d MDP 2 MODE 1 >>>>\n", lseq);
  656. PRINT_LMIP_qword(asd_ha, lseq, TX_ID_ADDR_FRAME);
  657. PRINT_LMIP_dword(asd_ha, lseq, OPEN_TIMER_TERM_TS);
  658. PRINT_LMIP_dword(asd_ha, lseq, SRST_AS_TIMER_TERM_TS);
  659. PRINT_LMIP_dword(asd_ha, lseq, LAST_LOADED_SG_EL);
  660. asd_printk("LSEQ%d MDP 2 MODE 2 >>>>\n", lseq);
  661. PRINT_LMIP_dword(asd_ha, lseq, CLOSE_TIMER_TERM_TS);
  662. PRINT_LMIP_dword(asd_ha, lseq, BREAK_TIMER_TERM_TS);
  663. PRINT_LMIP_dword(asd_ha, lseq, DWS_RESET_TIMER_TERM_TS);
  664. PRINT_LMIP_dword(asd_ha, lseq, SATA_INTERLOCK_TIMER_TERM_TS);
  665. PRINT_LMIP_dword(asd_ha, lseq, MCTL_TIMER_TERM_TS);
  666. asd_printk("LSEQ%d MDP 2 MODE 4/5 >>>>\n", lseq);
  667. PRINT_LMIP_dword(asd_ha, lseq, COMINIT_TIMER_TERM_TS);
  668. PRINT_LMIP_dword(asd_ha, lseq, RCV_ID_TIMER_TERM_TS);
  669. PRINT_LMIP_dword(asd_ha, lseq, RCV_FIS_TIMER_TERM_TS);
  670. PRINT_LMIP_dword(asd_ha, lseq, DEV_PRES_TIMER_TERM_TS);
  671. }
  672. #if 0
  673. /**
  674. * asd_dump_ddb_site -- dump a CSEQ DDB site
  675. * @asd_ha: pointer to host adapter structure
  676. * @site_no: site number of interest
  677. */
  678. void asd_dump_target_ddb(struct asd_ha_struct *asd_ha, u16 site_no)
  679. {
  680. if (site_no >= asd_ha->hw_prof.max_ddbs)
  681. return;
  682. #define DDB_FIELDB(__name) \
  683. asd_ddbsite_read_byte(asd_ha, site_no, \
  684. offsetof(struct asd_ddb_ssp_smp_target_port, __name))
  685. #define DDB2_FIELDB(__name) \
  686. asd_ddbsite_read_byte(asd_ha, site_no, \
  687. offsetof(struct asd_ddb_stp_sata_target_port, __name))
  688. #define DDB_FIELDW(__name) \
  689. asd_ddbsite_read_word(asd_ha, site_no, \
  690. offsetof(struct asd_ddb_ssp_smp_target_port, __name))
  691. #define DDB_FIELDD(__name) \
  692. asd_ddbsite_read_dword(asd_ha, site_no, \
  693. offsetof(struct asd_ddb_ssp_smp_target_port, __name))
  694. asd_printk("DDB: 0x%02x\n", site_no);
  695. asd_printk("conn_type: 0x%02x\n", DDB_FIELDB(conn_type));
  696. asd_printk("conn_rate: 0x%02x\n", DDB_FIELDB(conn_rate));
  697. asd_printk("init_conn_tag: 0x%04x\n", be16_to_cpu(DDB_FIELDW(init_conn_tag)));
  698. asd_printk("send_queue_head: 0x%04x\n", be16_to_cpu(DDB_FIELDW(send_queue_head)));
  699. asd_printk("sq_suspended: 0x%02x\n", DDB_FIELDB(sq_suspended));
  700. asd_printk("DDB Type: 0x%02x\n", DDB_FIELDB(ddb_type));
  701. asd_printk("AWT Default: 0x%04x\n", DDB_FIELDW(awt_def));
  702. asd_printk("compat_features: 0x%02x\n", DDB_FIELDB(compat_features));
  703. asd_printk("Pathway Blocked Count: 0x%02x\n",
  704. DDB_FIELDB(pathway_blocked_count));
  705. asd_printk("arb_wait_time: 0x%04x\n", DDB_FIELDW(arb_wait_time));
  706. asd_printk("more_compat_features: 0x%08x\n",
  707. DDB_FIELDD(more_compat_features));
  708. asd_printk("Conn Mask: 0x%02x\n", DDB_FIELDB(conn_mask));
  709. asd_printk("flags: 0x%02x\n", DDB_FIELDB(flags));
  710. asd_printk("flags2: 0x%02x\n", DDB2_FIELDB(flags2));
  711. asd_printk("ExecQ Tail: 0x%04x\n",DDB_FIELDW(exec_queue_tail));
  712. asd_printk("SendQ Tail: 0x%04x\n",DDB_FIELDW(send_queue_tail));
  713. asd_printk("Active Task Count: 0x%04x\n",
  714. DDB_FIELDW(active_task_count));
  715. asd_printk("ITNL Reason: 0x%02x\n", DDB_FIELDB(itnl_reason));
  716. asd_printk("ITNL Timeout Const: 0x%04x\n", DDB_FIELDW(itnl_timeout));
  717. asd_printk("ITNL timestamp: 0x%08x\n", DDB_FIELDD(itnl_timestamp));
  718. }
  719. void asd_dump_ddb_0(struct asd_ha_struct *asd_ha)
  720. {
  721. #define DDB0_FIELDB(__name) \
  722. asd_ddbsite_read_byte(asd_ha, 0, \
  723. offsetof(struct asd_ddb_seq_shared, __name))
  724. #define DDB0_FIELDW(__name) \
  725. asd_ddbsite_read_word(asd_ha, 0, \
  726. offsetof(struct asd_ddb_seq_shared, __name))
  727. #define DDB0_FIELDD(__name) \
  728. asd_ddbsite_read_dword(asd_ha,0 , \
  729. offsetof(struct asd_ddb_seq_shared, __name))
  730. #define DDB0_FIELDA(__name, _o) \
  731. asd_ddbsite_read_byte(asd_ha, 0, \
  732. offsetof(struct asd_ddb_seq_shared, __name)+_o)
  733. asd_printk("DDB: 0\n");
  734. asd_printk("q_free_ddb_head:%04x\n", DDB0_FIELDW(q_free_ddb_head));
  735. asd_printk("q_free_ddb_tail:%04x\n", DDB0_FIELDW(q_free_ddb_tail));
  736. asd_printk("q_free_ddb_cnt:%04x\n", DDB0_FIELDW(q_free_ddb_cnt));
  737. asd_printk("q_used_ddb_head:%04x\n", DDB0_FIELDW(q_used_ddb_head));
  738. asd_printk("q_used_ddb_tail:%04x\n", DDB0_FIELDW(q_used_ddb_tail));
  739. asd_printk("shared_mem_lock:%04x\n", DDB0_FIELDW(shared_mem_lock));
  740. asd_printk("smp_conn_tag:%04x\n", DDB0_FIELDW(smp_conn_tag));
  741. asd_printk("est_nexus_buf_cnt:%04x\n", DDB0_FIELDW(est_nexus_buf_cnt));
  742. asd_printk("est_nexus_buf_thresh:%04x\n",
  743. DDB0_FIELDW(est_nexus_buf_thresh));
  744. asd_printk("conn_not_active:%02x\n", DDB0_FIELDB(conn_not_active));
  745. asd_printk("phy_is_up:%02x\n", DDB0_FIELDB(phy_is_up));
  746. asd_printk("port_map_by_links:%02x %02x %02x %02x "
  747. "%02x %02x %02x %02x\n",
  748. DDB0_FIELDA(port_map_by_links, 0),
  749. DDB0_FIELDA(port_map_by_links, 1),
  750. DDB0_FIELDA(port_map_by_links, 2),
  751. DDB0_FIELDA(port_map_by_links, 3),
  752. DDB0_FIELDA(port_map_by_links, 4),
  753. DDB0_FIELDA(port_map_by_links, 5),
  754. DDB0_FIELDA(port_map_by_links, 6),
  755. DDB0_FIELDA(port_map_by_links, 7));
  756. }
  757. static void asd_dump_scb_site(struct asd_ha_struct *asd_ha, u16 site_no)
  758. {
  759. #define SCB_FIELDB(__name) \
  760. asd_scbsite_read_byte(asd_ha, site_no, sizeof(struct scb_header) \
  761. + offsetof(struct initiate_ssp_task, __name))
  762. #define SCB_FIELDW(__name) \
  763. asd_scbsite_read_word(asd_ha, site_no, sizeof(struct scb_header) \
  764. + offsetof(struct initiate_ssp_task, __name))
  765. #define SCB_FIELDD(__name) \
  766. asd_scbsite_read_dword(asd_ha, site_no, sizeof(struct scb_header) \
  767. + offsetof(struct initiate_ssp_task, __name))
  768. asd_printk("Total Xfer Len: 0x%08x.\n", SCB_FIELDD(total_xfer_len));
  769. asd_printk("Frame Type: 0x%02x.\n", SCB_FIELDB(ssp_frame.frame_type));
  770. asd_printk("Tag: 0x%04x.\n", SCB_FIELDW(ssp_frame.tag));
  771. asd_printk("Target Port Xfer Tag: 0x%04x.\n",
  772. SCB_FIELDW(ssp_frame.tptt));
  773. asd_printk("Data Offset: 0x%08x.\n", SCB_FIELDW(ssp_frame.data_offs));
  774. asd_printk("Retry Count: 0x%02x.\n", SCB_FIELDB(retry_count));
  775. }
  776. /**
  777. * asd_dump_scb_sites -- dump currently used CSEQ SCB sites
  778. * @asd_ha: pointer to host adapter struct
  779. */
  780. void asd_dump_scb_sites(struct asd_ha_struct *asd_ha)
  781. {
  782. u16 site_no;
  783. for (site_no = 0; site_no < asd_ha->hw_prof.max_scbs; site_no++) {
  784. u8 opcode;
  785. if (!SCB_SITE_VALID(site_no))
  786. continue;
  787. /* We are only interested in SCB sites currently used.
  788. */
  789. opcode = asd_scbsite_read_byte(asd_ha, site_no,
  790. offsetof(struct scb_header,
  791. opcode));
  792. if (opcode == 0xFF)
  793. continue;
  794. asd_printk("\nSCB: 0x%x\n", site_no);
  795. asd_dump_scb_site(asd_ha, site_no);
  796. }
  797. }
  798. #endif /* 0 */
  799. /**
  800. * ads_dump_seq_state -- dump CSEQ and LSEQ states
  801. * @asd_ha: pointer to host adapter structure
  802. * @lseq_mask: mask of LSEQs of interest
  803. */
  804. void asd_dump_seq_state(struct asd_ha_struct *asd_ha, u8 lseq_mask)
  805. {
  806. int lseq;
  807. asd_dump_cseq_state(asd_ha);
  808. if (lseq_mask != 0)
  809. for_each_sequencer(lseq_mask, lseq_mask, lseq)
  810. asd_dump_lseq_state(asd_ha, lseq);
  811. }
  812. void asd_dump_frame_rcvd(struct asd_phy *phy,
  813. struct done_list_struct *dl)
  814. {
  815. unsigned long flags;
  816. int i;
  817. switch ((dl->status_block[1] & 0x70) >> 3) {
  818. case SAS_PROTOCOL_STP:
  819. ASD_DPRINTK("STP proto device-to-host FIS:\n");
  820. break;
  821. default:
  822. case SAS_PROTOCOL_SSP:
  823. ASD_DPRINTK("SAS proto IDENTIFY:\n");
  824. break;
  825. }
  826. spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags);
  827. for (i = 0; i < phy->sas_phy.frame_rcvd_size; i+=4)
  828. ASD_DPRINTK("%02x: %02x %02x %02x %02x\n",
  829. i,
  830. phy->frame_rcvd[i],
  831. phy->frame_rcvd[i+1],
  832. phy->frame_rcvd[i+2],
  833. phy->frame_rcvd[i+3]);
  834. spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags);
  835. }
  836. #if 0
  837. static void asd_dump_scb(struct asd_ascb *ascb, int ind)
  838. {
  839. asd_printk("scb%d: vaddr: 0x%p, dma_handle: 0x%llx, next: 0x%llx, "
  840. "index:%d, opcode:0x%02x\n",
  841. ind, ascb->dma_scb.vaddr,
  842. (unsigned long long)ascb->dma_scb.dma_handle,
  843. (unsigned long long)
  844. le64_to_cpu(ascb->scb->header.next_scb),
  845. le16_to_cpu(ascb->scb->header.index),
  846. ascb->scb->header.opcode);
  847. }
  848. void asd_dump_scb_list(struct asd_ascb *ascb, int num)
  849. {
  850. int i = 0;
  851. asd_printk("dumping %d scbs:\n", num);
  852. asd_dump_scb(ascb, i++);
  853. --num;
  854. if (num > 0 && !list_empty(&ascb->list)) {
  855. struct list_head *el;
  856. list_for_each(el, &ascb->list) {
  857. struct asd_ascb *s = list_entry(el, struct asd_ascb,
  858. list);
  859. asd_dump_scb(s, i++);
  860. if (--num <= 0)
  861. break;
  862. }
  863. }
  864. }
  865. #endif /* 0 */
  866. #endif /* ASD_DEBUG */