pm80xx_hwi.h 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665
  1. /*
  2. * PMC-Sierra SPCv/ve 8088/8089 SAS/SATA based host adapters driver
  3. *
  4. * Copyright (c) 2008-2009 USI Co., Ltd.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions, and the following disclaimer,
  12. * without modification.
  13. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  14. * substantially similar to the "NO WARRANTY" disclaimer below
  15. * ("Disclaimer") and any redistribution must be conditioned upon
  16. * including a substantially similar Disclaimer requirement for further
  17. * binary redistribution.
  18. * 3. Neither the names of the above-listed copyright holders nor the names
  19. * of any contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * Alternatively, this software may be distributed under the terms of the
  23. * GNU General Public License ("GPL") version 2 as published by the Free
  24. * Software Foundation.
  25. *
  26. * NO WARRANTY
  27. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  28. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  29. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  30. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  31. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  33. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  34. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  35. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  36. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  37. * POSSIBILITY OF SUCH DAMAGES.
  38. *
  39. */
  40. #ifndef _PMC8001_REG_H_
  41. #define _PMC8001_REG_H_
  42. #include <linux/types.h>
  43. #include <scsi/libsas.h>
  44. /* for Request Opcode of IOMB */
  45. #define OPC_INB_ECHO 1 /* 0x000 */
  46. #define OPC_INB_PHYSTART 4 /* 0x004 */
  47. #define OPC_INB_PHYSTOP 5 /* 0x005 */
  48. #define OPC_INB_SSPINIIOSTART 6 /* 0x006 */
  49. #define OPC_INB_SSPINITMSTART 7 /* 0x007 */
  50. /* 0x8 RESV IN SPCv */
  51. #define OPC_INB_RSVD 8 /* 0x008 */
  52. #define OPC_INB_DEV_HANDLE_ACCEPT 9 /* 0x009 */
  53. #define OPC_INB_SSPTGTIOSTART 10 /* 0x00A */
  54. #define OPC_INB_SSPTGTRSPSTART 11 /* 0x00B */
  55. /* 0xC, 0xD, 0xE removed in SPCv */
  56. #define OPC_INB_SSP_ABORT 15 /* 0x00F */
  57. #define OPC_INB_DEREG_DEV_HANDLE 16 /* 0x010 */
  58. #define OPC_INB_GET_DEV_HANDLE 17 /* 0x011 */
  59. #define OPC_INB_SMP_REQUEST 18 /* 0x012 */
  60. /* 0x13 SMP_RESPONSE is removed in SPCv */
  61. #define OPC_INB_SMP_ABORT 20 /* 0x014 */
  62. /* 0x16 RESV IN SPCv */
  63. #define OPC_INB_RSVD1 22 /* 0x016 */
  64. #define OPC_INB_SATA_HOST_OPSTART 23 /* 0x017 */
  65. #define OPC_INB_SATA_ABORT 24 /* 0x018 */
  66. #define OPC_INB_LOCAL_PHY_CONTROL 25 /* 0x019 */
  67. /* 0x1A RESV IN SPCv */
  68. #define OPC_INB_RSVD2 26 /* 0x01A */
  69. #define OPC_INB_FW_FLASH_UPDATE 32 /* 0x020 */
  70. #define OPC_INB_GPIO 34 /* 0x022 */
  71. #define OPC_INB_SAS_DIAG_MODE_START_END 35 /* 0x023 */
  72. #define OPC_INB_SAS_DIAG_EXECUTE 36 /* 0x024 */
  73. /* 0x25 RESV IN SPCv */
  74. #define OPC_INB_RSVD3 37 /* 0x025 */
  75. #define OPC_INB_GET_TIME_STAMP 38 /* 0x026 */
  76. #define OPC_INB_PORT_CONTROL 39 /* 0x027 */
  77. #define OPC_INB_GET_NVMD_DATA 40 /* 0x028 */
  78. #define OPC_INB_SET_NVMD_DATA 41 /* 0x029 */
  79. #define OPC_INB_SET_DEVICE_STATE 42 /* 0x02A */
  80. #define OPC_INB_GET_DEVICE_STATE 43 /* 0x02B */
  81. #define OPC_INB_SET_DEV_INFO 44 /* 0x02C */
  82. /* 0x2D RESV IN SPCv */
  83. #define OPC_INB_RSVD4 45 /* 0x02D */
  84. #define OPC_INB_SGPIO_REGISTER 46 /* 0x02E */
  85. #define OPC_INB_PCIE_DIAG_EXEC 47 /* 0x02F */
  86. #define OPC_INB_SET_CONTROLLER_CONFIG 48 /* 0x030 */
  87. #define OPC_INB_GET_CONTROLLER_CONFIG 49 /* 0x031 */
  88. #define OPC_INB_REG_DEV 50 /* 0x032 */
  89. #define OPC_INB_SAS_HW_EVENT_ACK 51 /* 0x033 */
  90. #define OPC_INB_GET_DEVICE_INFO 52 /* 0x034 */
  91. #define OPC_INB_GET_PHY_PROFILE 53 /* 0x035 */
  92. #define OPC_INB_FLASH_OP_EXT 54 /* 0x036 */
  93. #define OPC_INB_SET_PHY_PROFILE 55 /* 0x037 */
  94. #define OPC_INB_KEK_MANAGEMENT 256 /* 0x100 */
  95. #define OPC_INB_DEK_MANAGEMENT 257 /* 0x101 */
  96. #define OPC_INB_SSP_INI_DIF_ENC_IO 258 /* 0x102 */
  97. #define OPC_INB_SATA_DIF_ENC_IO 259 /* 0x103 */
  98. /* for Response Opcode of IOMB */
  99. #define OPC_OUB_ECHO 1 /* 0x001 */
  100. #define OPC_OUB_RSVD 4 /* 0x004 */
  101. #define OPC_OUB_SSP_COMP 5 /* 0x005 */
  102. #define OPC_OUB_SMP_COMP 6 /* 0x006 */
  103. #define OPC_OUB_LOCAL_PHY_CNTRL 7 /* 0x007 */
  104. #define OPC_OUB_RSVD1 10 /* 0x00A */
  105. #define OPC_OUB_DEREG_DEV 11 /* 0x00B */
  106. #define OPC_OUB_GET_DEV_HANDLE 12 /* 0x00C */
  107. #define OPC_OUB_SATA_COMP 13 /* 0x00D */
  108. #define OPC_OUB_SATA_EVENT 14 /* 0x00E */
  109. #define OPC_OUB_SSP_EVENT 15 /* 0x00F */
  110. #define OPC_OUB_RSVD2 16 /* 0x010 */
  111. /* 0x11 - SMP_RECEIVED Notification removed in SPCv*/
  112. #define OPC_OUB_SSP_RECV_EVENT 18 /* 0x012 */
  113. #define OPC_OUB_RSVD3 19 /* 0x013 */
  114. #define OPC_OUB_FW_FLASH_UPDATE 20 /* 0x014 */
  115. #define OPC_OUB_GPIO_RESPONSE 22 /* 0x016 */
  116. #define OPC_OUB_GPIO_EVENT 23 /* 0x017 */
  117. #define OPC_OUB_GENERAL_EVENT 24 /* 0x018 */
  118. #define OPC_OUB_SSP_ABORT_RSP 26 /* 0x01A */
  119. #define OPC_OUB_SATA_ABORT_RSP 27 /* 0x01B */
  120. #define OPC_OUB_SAS_DIAG_MODE_START_END 28 /* 0x01C */
  121. #define OPC_OUB_SAS_DIAG_EXECUTE 29 /* 0x01D */
  122. #define OPC_OUB_GET_TIME_STAMP 30 /* 0x01E */
  123. #define OPC_OUB_RSVD4 31 /* 0x01F */
  124. #define OPC_OUB_PORT_CONTROL 32 /* 0x020 */
  125. #define OPC_OUB_SKIP_ENTRY 33 /* 0x021 */
  126. #define OPC_OUB_SMP_ABORT_RSP 34 /* 0x022 */
  127. #define OPC_OUB_GET_NVMD_DATA 35 /* 0x023 */
  128. #define OPC_OUB_SET_NVMD_DATA 36 /* 0x024 */
  129. #define OPC_OUB_DEVICE_HANDLE_REMOVAL 37 /* 0x025 */
  130. #define OPC_OUB_SET_DEVICE_STATE 38 /* 0x026 */
  131. #define OPC_OUB_GET_DEVICE_STATE 39 /* 0x027 */
  132. #define OPC_OUB_SET_DEV_INFO 40 /* 0x028 */
  133. #define OPC_OUB_RSVD5 41 /* 0x029 */
  134. #define OPC_OUB_HW_EVENT 1792 /* 0x700 */
  135. #define OPC_OUB_DEV_HANDLE_ARRIV 1824 /* 0x720 */
  136. #define OPC_OUB_THERM_HW_EVENT 1840 /* 0x730 */
  137. #define OPC_OUB_SGPIO_RESP 2094 /* 0x82E */
  138. #define OPC_OUB_PCIE_DIAG_EXECUTE 2095 /* 0x82F */
  139. #define OPC_OUB_DEV_REGIST 2098 /* 0x832 */
  140. #define OPC_OUB_SAS_HW_EVENT_ACK 2099 /* 0x833 */
  141. #define OPC_OUB_GET_DEVICE_INFO 2100 /* 0x834 */
  142. /* spcv specific commands */
  143. #define OPC_OUB_PHY_START_RESP 2052 /* 0x804 */
  144. #define OPC_OUB_PHY_STOP_RESP 2053 /* 0x805 */
  145. #define OPC_OUB_SET_CONTROLLER_CONFIG 2096 /* 0x830 */
  146. #define OPC_OUB_GET_CONTROLLER_CONFIG 2097 /* 0x831 */
  147. #define OPC_OUB_GET_PHY_PROFILE 2101 /* 0x835 */
  148. #define OPC_OUB_FLASH_OP_EXT 2102 /* 0x836 */
  149. #define OPC_OUB_SET_PHY_PROFILE 2103 /* 0x837 */
  150. #define OPC_OUB_KEK_MANAGEMENT_RESP 2304 /* 0x900 */
  151. #define OPC_OUB_DEK_MANAGEMENT_RESP 2305 /* 0x901 */
  152. #define OPC_OUB_SSP_COALESCED_COMP_RESP 2306 /* 0x902 */
  153. /* for phy start*/
  154. #define SSC_DISABLE_15 (0x01 << 16)
  155. #define SSC_DISABLE_30 (0x02 << 16)
  156. #define SSC_DISABLE_60 (0x04 << 16)
  157. #define SAS_ASE (0x01 << 15)
  158. #define SPINHOLD_DISABLE (0x00 << 14)
  159. #define SPINHOLD_ENABLE (0x01 << 14)
  160. #define LINKMODE_SAS (0x01 << 12)
  161. #define LINKMODE_DSATA (0x02 << 12)
  162. #define LINKMODE_AUTO (0x03 << 12)
  163. #define LINKRATE_15 (0x01 << 8)
  164. #define LINKRATE_30 (0x02 << 8)
  165. #define LINKRATE_60 (0x04 << 8)
  166. #define LINKRATE_120 (0x08 << 8)
  167. /*phy_stop*/
  168. #define PHY_STOP_SUCCESS 0x00
  169. #define PHY_STOP_ERR_DEVICE_ATTACHED 0x1046
  170. /* phy_profile */
  171. #define SAS_PHY_ANALOG_SETTINGS_PAGE 0x04
  172. #define PHY_DWORD_LENGTH 0xC
  173. /* Thermal related */
  174. #define THERMAL_ENABLE 0x1
  175. #define THERMAL_LOG_ENABLE 0x1
  176. #define THERMAL_PAGE_CODE_7H 0x6
  177. #define THERMAL_PAGE_CODE_8H 0x7
  178. #define LTEMPHIL 70
  179. #define RTEMPHIL 100
  180. /* Encryption info */
  181. #define SCRATCH_PAD3_ENC_DISABLED 0x00000000
  182. #define SCRATCH_PAD3_ENC_DIS_ERR 0x00000001
  183. #define SCRATCH_PAD3_ENC_ENA_ERR 0x00000002
  184. #define SCRATCH_PAD3_ENC_READY 0x00000003
  185. #define SCRATCH_PAD3_ENC_MASK SCRATCH_PAD3_ENC_READY
  186. #define SCRATCH_PAD3_XTS_ENABLED (1 << 14)
  187. #define SCRATCH_PAD3_SMA_ENABLED (1 << 4)
  188. #define SCRATCH_PAD3_SMB_ENABLED (1 << 5)
  189. #define SCRATCH_PAD3_SMF_ENABLED 0
  190. #define SCRATCH_PAD3_SM_MASK 0x000000F0
  191. #define SCRATCH_PAD3_ERR_CODE 0x00FF0000
  192. #define SEC_MODE_SMF 0x0
  193. #define SEC_MODE_SMA 0x100
  194. #define SEC_MODE_SMB 0x200
  195. #define CIPHER_MODE_ECB 0x00000001
  196. #define CIPHER_MODE_XTS 0x00000002
  197. #define KEK_MGMT_SUBOP_KEYCARDUPDATE 0x4
  198. /* SAS protocol timer configuration page */
  199. #define SAS_PROTOCOL_TIMER_CONFIG_PAGE 0x04
  200. #define STP_MCT_TMO 32
  201. #define SSP_MCT_TMO 32
  202. #define SAS_MAX_OPEN_TIME 5
  203. #define SMP_MAX_CONN_TIMER 0xFF
  204. #define STP_FRM_TIMER 0
  205. #define STP_IDLE_TIME 5 /* 5 us; controller default */
  206. #define SAS_MFD 0
  207. #define SAS_OPNRJT_RTRY_INTVL 2
  208. #define SAS_DOPNRJT_RTRY_TMO 128
  209. #define SAS_COPNRJT_RTRY_TMO 128
  210. #define SPCV_DOORBELL_CLEAR_TIMEOUT (30 * 50) /* 30 sec */
  211. #define SPC_DOORBELL_CLEAR_TIMEOUT (15 * 50) /* 15 sec */
  212. /*
  213. Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
  214. Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128
  215. is DOPNRJT_RTRY_TMO
  216. */
  217. #define SAS_DOPNRJT_RTRY_THR 23438
  218. #define SAS_COPNRJT_RTRY_THR 23438
  219. #define SAS_MAX_AIP 0x200000
  220. #define IT_NEXUS_TIMEOUT 0x7D0
  221. #define PORT_RECOVERY_TIMEOUT ((IT_NEXUS_TIMEOUT/100) + 30)
  222. /* Port recovery timeout, 10000 ms for PM8006 controller */
  223. #define CHIP_8006_PORT_RECOVERY_TIMEOUT 0x640000
  224. #ifdef __LITTLE_ENDIAN_BITFIELD
  225. struct sas_identify_frame_local {
  226. /* Byte 0 */
  227. u8 frame_type:4;
  228. u8 dev_type:3;
  229. u8 _un0:1;
  230. /* Byte 1 */
  231. u8 _un1;
  232. /* Byte 2 */
  233. union {
  234. struct {
  235. u8 _un20:1;
  236. u8 smp_iport:1;
  237. u8 stp_iport:1;
  238. u8 ssp_iport:1;
  239. u8 _un247:4;
  240. };
  241. u8 initiator_bits;
  242. };
  243. /* Byte 3 */
  244. union {
  245. struct {
  246. u8 _un30:1;
  247. u8 smp_tport:1;
  248. u8 stp_tport:1;
  249. u8 ssp_tport:1;
  250. u8 _un347:4;
  251. };
  252. u8 target_bits;
  253. };
  254. /* Byte 4 - 11 */
  255. u8 _un4_11[8];
  256. /* Byte 12 - 19 */
  257. u8 sas_addr[SAS_ADDR_SIZE];
  258. /* Byte 20 */
  259. u8 phy_id;
  260. u8 _un21_27[7];
  261. } __packed;
  262. #elif defined(__BIG_ENDIAN_BITFIELD)
  263. struct sas_identify_frame_local {
  264. /* Byte 0 */
  265. u8 _un0:1;
  266. u8 dev_type:3;
  267. u8 frame_type:4;
  268. /* Byte 1 */
  269. u8 _un1;
  270. /* Byte 2 */
  271. union {
  272. struct {
  273. u8 _un247:4;
  274. u8 ssp_iport:1;
  275. u8 stp_iport:1;
  276. u8 smp_iport:1;
  277. u8 _un20:1;
  278. };
  279. u8 initiator_bits;
  280. };
  281. /* Byte 3 */
  282. union {
  283. struct {
  284. u8 _un347:4;
  285. u8 ssp_tport:1;
  286. u8 stp_tport:1;
  287. u8 smp_tport:1;
  288. u8 _un30:1;
  289. };
  290. u8 target_bits;
  291. };
  292. /* Byte 4 - 11 */
  293. u8 _un4_11[8];
  294. /* Byte 12 - 19 */
  295. u8 sas_addr[SAS_ADDR_SIZE];
  296. /* Byte 20 */
  297. u8 phy_id;
  298. u8 _un21_27[7];
  299. } __packed;
  300. #else
  301. #error "Bitfield order not defined!"
  302. #endif
  303. struct mpi_msg_hdr {
  304. __le32 header; /* Bits [11:0] - Message operation code */
  305. /* Bits [15:12] - Message Category */
  306. /* Bits [21:16] - Outboundqueue ID for the
  307. operation completion message */
  308. /* Bits [23:22] - Reserved */
  309. /* Bits [28:24] - Buffer Count, indicates how
  310. many buffer are allocated for the massage */
  311. /* Bits [30:29] - Reserved */
  312. /* Bits [31] - Message Valid bit */
  313. } __attribute__((packed, aligned(4)));
  314. /*
  315. * brief the data structure of PHY Start Command
  316. * use to describe enable the phy (128 bytes)
  317. */
  318. struct phy_start_req {
  319. __le32 tag;
  320. __le32 ase_sh_lm_slr_phyid;
  321. struct sas_identify_frame_local sas_identify; /* 28 Bytes */
  322. __le32 spasti;
  323. u32 reserved[21];
  324. } __attribute__((packed, aligned(4)));
  325. /*
  326. * brief the data structure of PHY Start Command
  327. * use to disable the phy (128 bytes)
  328. */
  329. struct phy_stop_req {
  330. __le32 tag;
  331. __le32 phy_id;
  332. u32 reserved[29];
  333. } __attribute__((packed, aligned(4)));
  334. /* set device bits fis - device to host */
  335. struct set_dev_bits_fis {
  336. u8 fis_type; /* 0xA1*/
  337. u8 n_i_pmport;
  338. /* b7 : n Bit. Notification bit. If set device needs attention. */
  339. /* b6 : i Bit. Interrupt Bit */
  340. /* b5-b4: reserved2 */
  341. /* b3-b0: PM Port */
  342. u8 status;
  343. u8 error;
  344. u32 _r_a;
  345. } __attribute__ ((packed));
  346. /* PIO setup FIS - device to host */
  347. struct pio_setup_fis {
  348. u8 fis_type; /* 0x5f */
  349. u8 i_d_pmPort;
  350. /* b7 : reserved */
  351. /* b6 : i bit. Interrupt bit */
  352. /* b5 : d bit. data transfer direction. set to 1 for device to host
  353. xfer */
  354. /* b4 : reserved */
  355. /* b3-b0: PM Port */
  356. u8 status;
  357. u8 error;
  358. u8 lbal;
  359. u8 lbam;
  360. u8 lbah;
  361. u8 device;
  362. u8 lbal_exp;
  363. u8 lbam_exp;
  364. u8 lbah_exp;
  365. u8 _r_a;
  366. u8 sector_count;
  367. u8 sector_count_exp;
  368. u8 _r_b;
  369. u8 e_status;
  370. u8 _r_c[2];
  371. u8 transfer_count;
  372. } __attribute__ ((packed));
  373. /*
  374. * brief the data structure of SATA Completion Response
  375. * use to describe the sata task response (64 bytes)
  376. */
  377. struct sata_completion_resp {
  378. __le32 tag;
  379. __le32 status;
  380. __le32 param;
  381. u32 sata_resp[12];
  382. } __attribute__((packed, aligned(4)));
  383. /*
  384. * brief the data structure of SAS HW Event Notification
  385. * use to alert the host about the hardware event(64 bytes)
  386. */
  387. /* updated outbound struct for spcv */
  388. struct hw_event_resp {
  389. __le32 lr_status_evt_portid;
  390. __le32 evt_param;
  391. __le32 phyid_npip_portstate;
  392. struct sas_identify_frame sas_identify;
  393. struct dev_to_host_fis sata_fis;
  394. } __attribute__((packed, aligned(4)));
  395. /*
  396. * brief the data structure for thermal event notification
  397. */
  398. struct thermal_hw_event {
  399. __le32 thermal_event;
  400. __le32 rht_lht;
  401. } __attribute__((packed, aligned(4)));
  402. /*
  403. * brief the data structure of REGISTER DEVICE Command
  404. * use to describe MPI REGISTER DEVICE Command (64 bytes)
  405. */
  406. struct reg_dev_req {
  407. __le32 tag;
  408. __le32 phyid_portid;
  409. __le32 dtype_dlr_mcn_ir_retry;
  410. __le32 firstburstsize_ITNexustimeout;
  411. u8 sas_addr[SAS_ADDR_SIZE];
  412. __le32 upper_device_id;
  413. u32 reserved[24];
  414. } __attribute__((packed, aligned(4)));
  415. /*
  416. * brief the data structure of DEREGISTER DEVICE Command
  417. * use to request spc to remove all internal resources associated
  418. * with the device id (64 bytes)
  419. */
  420. struct dereg_dev_req {
  421. __le32 tag;
  422. __le32 device_id;
  423. u32 reserved[29];
  424. } __attribute__((packed, aligned(4)));
  425. /*
  426. * brief the data structure of DEVICE_REGISTRATION Response
  427. * use to notify the completion of the device registration (64 bytes)
  428. */
  429. struct dev_reg_resp {
  430. __le32 tag;
  431. __le32 status;
  432. __le32 device_id;
  433. u32 reserved[12];
  434. } __attribute__((packed, aligned(4)));
  435. /*
  436. * brief the data structure of Local PHY Control Command
  437. * use to issue PHY CONTROL to local phy (64 bytes)
  438. */
  439. struct local_phy_ctl_req {
  440. __le32 tag;
  441. __le32 phyop_phyid;
  442. u32 reserved1[29];
  443. } __attribute__((packed, aligned(4)));
  444. /**
  445. * brief the data structure of Local Phy Control Response
  446. * use to describe MPI Local Phy Control Response (64 bytes)
  447. */
  448. struct local_phy_ctl_resp {
  449. __le32 tag;
  450. __le32 phyop_phyid;
  451. __le32 status;
  452. u32 reserved[12];
  453. } __attribute__((packed, aligned(4)));
  454. #define OP_BITS 0x0000FF00
  455. #define ID_BITS 0x000000FF
  456. /*
  457. * brief the data structure of PORT Control Command
  458. * use to control port properties (64 bytes)
  459. */
  460. struct port_ctl_req {
  461. __le32 tag;
  462. __le32 portop_portid;
  463. __le32 param0;
  464. __le32 param1;
  465. u32 reserved1[27];
  466. } __attribute__((packed, aligned(4)));
  467. /*
  468. * brief the data structure of HW Event Ack Command
  469. * use to acknowledge receive HW event (64 bytes)
  470. */
  471. struct hw_event_ack_req {
  472. __le32 tag;
  473. __le32 phyid_sea_portid;
  474. __le32 param0;
  475. __le32 param1;
  476. u32 reserved1[27];
  477. } __attribute__((packed, aligned(4)));
  478. /*
  479. * brief the data structure of PHY_START Response Command
  480. * indicates the completion of PHY_START command (64 bytes)
  481. */
  482. struct phy_start_resp {
  483. __le32 tag;
  484. __le32 status;
  485. __le32 phyid;
  486. u32 reserved[12];
  487. } __attribute__((packed, aligned(4)));
  488. /*
  489. * brief the data structure of PHY_STOP Response Command
  490. * indicates the completion of PHY_STOP command (64 bytes)
  491. */
  492. struct phy_stop_resp {
  493. __le32 tag;
  494. __le32 status;
  495. __le32 phyid;
  496. u32 reserved[12];
  497. } __attribute__((packed, aligned(4)));
  498. /*
  499. * brief the data structure of SSP Completion Response
  500. * use to indicate a SSP Completion (n bytes)
  501. */
  502. struct ssp_completion_resp {
  503. __le32 tag;
  504. __le32 status;
  505. __le32 param;
  506. __le32 ssptag_rescv_rescpad;
  507. struct ssp_response_iu ssp_resp_iu;
  508. __le32 residual_count;
  509. } __attribute__((packed, aligned(4)));
  510. #define SSP_RESCV_BIT 0x00010000
  511. /*
  512. * brief the data structure of SATA EVNET response
  513. * use to indicate a SATA Completion (64 bytes)
  514. */
  515. struct sata_event_resp {
  516. __le32 tag;
  517. __le32 event;
  518. __le32 port_id;
  519. __le32 device_id;
  520. u32 reserved;
  521. __le32 event_param0;
  522. __le32 event_param1;
  523. __le32 sata_addr_h32;
  524. __le32 sata_addr_l32;
  525. __le32 e_udt1_udt0_crc;
  526. __le32 e_udt5_udt4_udt3_udt2;
  527. __le32 a_udt1_udt0_crc;
  528. __le32 a_udt5_udt4_udt3_udt2;
  529. __le32 hwdevid_diferr;
  530. __le32 err_framelen_byteoffset;
  531. __le32 err_dataframe;
  532. } __attribute__((packed, aligned(4)));
  533. /*
  534. * brief the data structure of SSP EVNET esponse
  535. * use to indicate a SSP Completion (64 bytes)
  536. */
  537. struct ssp_event_resp {
  538. __le32 tag;
  539. __le32 event;
  540. __le32 port_id;
  541. __le32 device_id;
  542. __le32 ssp_tag;
  543. __le32 event_param0;
  544. __le32 event_param1;
  545. __le32 sas_addr_h32;
  546. __le32 sas_addr_l32;
  547. __le32 e_udt1_udt0_crc;
  548. __le32 e_udt5_udt4_udt3_udt2;
  549. __le32 a_udt1_udt0_crc;
  550. __le32 a_udt5_udt4_udt3_udt2;
  551. __le32 hwdevid_diferr;
  552. __le32 err_framelen_byteoffset;
  553. __le32 err_dataframe;
  554. } __attribute__((packed, aligned(4)));
  555. /**
  556. * brief the data structure of General Event Notification Response
  557. * use to describe MPI General Event Notification Response (64 bytes)
  558. */
  559. struct general_event_resp {
  560. __le32 status;
  561. __le32 inb_IOMB_payload[14];
  562. } __attribute__((packed, aligned(4)));
  563. #define GENERAL_EVENT_PAYLOAD 14
  564. #define OPCODE_BITS 0x00000fff
  565. /*
  566. * brief the data structure of SMP Request Command
  567. * use to describe MPI SMP REQUEST Command (64 bytes)
  568. */
  569. struct smp_req {
  570. __le32 tag;
  571. __le32 device_id;
  572. __le32 len_ip_ir;
  573. /* Bits [0] - Indirect response */
  574. /* Bits [1] - Indirect Payload */
  575. /* Bits [15:2] - Reserved */
  576. /* Bits [23:16] - direct payload Len */
  577. /* Bits [31:24] - Reserved */
  578. u8 smp_req16[16];
  579. union {
  580. u8 smp_req[32];
  581. struct {
  582. __le64 long_req_addr;/* sg dma address, LE */
  583. __le32 long_req_size;/* LE */
  584. u32 _r_a;
  585. __le64 long_resp_addr;/* sg dma address, LE */
  586. __le32 long_resp_size;/* LE */
  587. u32 _r_b;
  588. } long_smp_req;/* sequencer extension */
  589. };
  590. __le32 rsvd[16];
  591. } __attribute__((packed, aligned(4)));
  592. /*
  593. * brief the data structure of SMP Completion Response
  594. * use to describe MPI SMP Completion Response (64 bytes)
  595. */
  596. struct smp_completion_resp {
  597. __le32 tag;
  598. __le32 status;
  599. __le32 param;
  600. u8 _r_a[252];
  601. } __attribute__((packed, aligned(4)));
  602. /*
  603. *brief the data structure of SSP SMP SATA Abort Command
  604. * use to describe MPI SSP SMP & SATA Abort Command (64 bytes)
  605. */
  606. struct task_abort_req {
  607. __le32 tag;
  608. __le32 device_id;
  609. __le32 tag_to_abort;
  610. __le32 abort_all;
  611. u32 reserved[27];
  612. } __attribute__((packed, aligned(4)));
  613. /**
  614. * brief the data structure of SSP SATA SMP Abort Response
  615. * use to describe SSP SMP & SATA Abort Response ( 64 bytes)
  616. */
  617. struct task_abort_resp {
  618. __le32 tag;
  619. __le32 status;
  620. __le32 scp;
  621. u32 reserved[12];
  622. } __attribute__((packed, aligned(4)));
  623. /**
  624. * brief the data structure of SAS Diagnostic Start/End Command
  625. * use to describe MPI SAS Diagnostic Start/End Command (64 bytes)
  626. */
  627. struct sas_diag_start_end_req {
  628. __le32 tag;
  629. __le32 operation_phyid;
  630. u32 reserved[29];
  631. } __attribute__((packed, aligned(4)));
  632. /**
  633. * brief the data structure of SAS Diagnostic Execute Command
  634. * use to describe MPI SAS Diagnostic Execute Command (64 bytes)
  635. */
  636. struct sas_diag_execute_req {
  637. __le32 tag;
  638. __le32 cmdtype_cmddesc_phyid;
  639. __le32 pat1_pat2;
  640. __le32 threshold;
  641. __le32 codepat_errmsk;
  642. __le32 pmon;
  643. __le32 pERF1CTL;
  644. u32 reserved[24];
  645. } __attribute__((packed, aligned(4)));
  646. #define SAS_DIAG_PARAM_BYTES 24
  647. /*
  648. * brief the data structure of Set Device State Command
  649. * use to describe MPI Set Device State Command (64 bytes)
  650. */
  651. struct set_dev_state_req {
  652. __le32 tag;
  653. __le32 device_id;
  654. __le32 nds;
  655. u32 reserved[28];
  656. } __attribute__((packed, aligned(4)));
  657. /*
  658. * brief the data structure of SATA Start Command
  659. * use to describe MPI SATA IO Start Command (64 bytes)
  660. * Note: This structure is common for normal / encryption I/O
  661. */
  662. struct sata_start_req {
  663. __le32 tag;
  664. __le32 device_id;
  665. __le32 data_len;
  666. __le32 ncqtag_atap_dir_m_dad;
  667. struct host_to_dev_fis sata_fis;
  668. u32 reserved1;
  669. u32 reserved2; /* dword 11. rsvd for normal I/O. */
  670. /* EPLE Descl for enc I/O */
  671. u32 addr_low; /* dword 12. rsvd for enc I/O */
  672. u32 addr_high; /* dword 13. reserved for enc I/O */
  673. __le32 len; /* dword 14: length for normal I/O. */
  674. /* EPLE Desch for enc I/O */
  675. __le32 esgl; /* dword 15. rsvd for enc I/O */
  676. __le32 atapi_scsi_cdb[4]; /* dword 16-19. rsvd for enc I/O */
  677. /* The below fields are reserved for normal I/O */
  678. __le32 key_index_mode; /* dword 20 */
  679. __le32 sector_cnt_enss;/* dword 21 */
  680. __le32 keytagl; /* dword 22 */
  681. __le32 keytagh; /* dword 23 */
  682. __le32 twk_val0; /* dword 24 */
  683. __le32 twk_val1; /* dword 25 */
  684. __le32 twk_val2; /* dword 26 */
  685. __le32 twk_val3; /* dword 27 */
  686. __le32 enc_addr_low; /* dword 28. Encryption SGL address high */
  687. __le32 enc_addr_high; /* dword 29. Encryption SGL address low */
  688. __le32 enc_len; /* dword 30. Encryption length */
  689. __le32 enc_esgl; /* dword 31. Encryption esgl bit */
  690. } __attribute__((packed, aligned(4)));
  691. /**
  692. * brief the data structure of SSP INI TM Start Command
  693. * use to describe MPI SSP INI TM Start Command (64 bytes)
  694. */
  695. struct ssp_ini_tm_start_req {
  696. __le32 tag;
  697. __le32 device_id;
  698. __le32 relate_tag;
  699. __le32 tmf;
  700. u8 lun[8];
  701. __le32 ds_ads_m;
  702. u32 reserved[24];
  703. } __attribute__((packed, aligned(4)));
  704. struct ssp_info_unit {
  705. u8 lun[8];/* SCSI Logical Unit Number */
  706. u8 reserved1;/* reserved */
  707. u8 efb_prio_attr;
  708. /* B7 : enabledFirstBurst */
  709. /* B6-3 : taskPriority */
  710. /* B2-0 : taskAttribute */
  711. u8 reserved2; /* reserved */
  712. u8 additional_cdb_len;
  713. /* B7-2 : additional_cdb_len */
  714. /* B1-0 : reserved */
  715. u8 cdb[16];/* The SCSI CDB up to 16 bytes length */
  716. } __attribute__((packed, aligned(4)));
  717. /**
  718. * brief the data structure of SSP INI IO Start Command
  719. * use to describe MPI SSP INI IO Start Command (64 bytes)
  720. * Note: This structure is common for normal / encryption I/O
  721. */
  722. struct ssp_ini_io_start_req {
  723. __le32 tag;
  724. __le32 device_id;
  725. __le32 data_len;
  726. __le32 dad_dir_m_tlr;
  727. struct ssp_info_unit ssp_iu;
  728. __le32 addr_low; /* dword 12: sgl low for normal I/O. */
  729. /* epl_descl for encryption I/O */
  730. __le32 addr_high; /* dword 13: sgl hi for normal I/O */
  731. /* dpl_descl for encryption I/O */
  732. __le32 len; /* dword 14: len for normal I/O. */
  733. /* edpl_desch for encryption I/O */
  734. __le32 esgl; /* dword 15: ESGL bit for normal I/O. */
  735. /* user defined tag mask for enc I/O */
  736. /* The below fields are reserved for normal I/O */
  737. u8 udt[12]; /* dword 16-18 */
  738. __le32 sectcnt_ios; /* dword 19 */
  739. __le32 key_cmode; /* dword 20 */
  740. __le32 ks_enss; /* dword 21 */
  741. __le32 keytagl; /* dword 22 */
  742. __le32 keytagh; /* dword 23 */
  743. __le32 twk_val0; /* dword 24 */
  744. __le32 twk_val1; /* dword 25 */
  745. __le32 twk_val2; /* dword 26 */
  746. __le32 twk_val3; /* dword 27 */
  747. __le32 enc_addr_low; /* dword 28: Encryption sgl addr low */
  748. __le32 enc_addr_high; /* dword 29: Encryption sgl addr hi */
  749. __le32 enc_len; /* dword 30: Encryption length */
  750. __le32 enc_esgl; /* dword 31: ESGL bit for encryption */
  751. } __attribute__((packed, aligned(4)));
  752. /**
  753. * brief the data structure for SSP_INI_DIF_ENC_IO COMMAND
  754. * use to initiate SSP I/O operation with optional DIF/ENC
  755. */
  756. struct ssp_dif_enc_io_req {
  757. __le32 tag;
  758. __le32 device_id;
  759. __le32 data_len;
  760. __le32 dirMTlr;
  761. __le32 sspiu0;
  762. __le32 sspiu1;
  763. __le32 sspiu2;
  764. __le32 sspiu3;
  765. __le32 sspiu4;
  766. __le32 sspiu5;
  767. __le32 sspiu6;
  768. __le32 epl_des;
  769. __le32 dpl_desl_ndplr;
  770. __le32 dpl_desh;
  771. __le32 uum_uuv_bss_difbits;
  772. u8 udt[12];
  773. __le32 sectcnt_ios;
  774. __le32 key_cmode;
  775. __le32 ks_enss;
  776. __le32 keytagl;
  777. __le32 keytagh;
  778. __le32 twk_val0;
  779. __le32 twk_val1;
  780. __le32 twk_val2;
  781. __le32 twk_val3;
  782. __le32 addr_low;
  783. __le32 addr_high;
  784. __le32 len;
  785. __le32 esgl;
  786. } __attribute__((packed, aligned(4)));
  787. /**
  788. * brief the data structure of Firmware download
  789. * use to describe MPI FW DOWNLOAD Command (64 bytes)
  790. */
  791. struct fw_flash_Update_req {
  792. __le32 tag;
  793. __le32 cur_image_offset;
  794. __le32 cur_image_len;
  795. __le32 total_image_len;
  796. u32 reserved0[7];
  797. __le32 sgl_addr_lo;
  798. __le32 sgl_addr_hi;
  799. __le32 len;
  800. __le32 ext_reserved;
  801. u32 reserved1[16];
  802. } __attribute__((packed, aligned(4)));
  803. #define FWFLASH_IOMB_RESERVED_LEN 0x07
  804. /**
  805. * brief the data structure of FW_FLASH_UPDATE Response
  806. * use to describe MPI FW_FLASH_UPDATE Response (64 bytes)
  807. *
  808. */
  809. struct fw_flash_Update_resp {
  810. __le32 tag;
  811. __le32 status;
  812. u32 reserved[13];
  813. } __attribute__((packed, aligned(4)));
  814. /**
  815. * brief the data structure of Get NVM Data Command
  816. * use to get data from NVM in HBA(64 bytes)
  817. */
  818. struct get_nvm_data_req {
  819. __le32 tag;
  820. __le32 len_ir_vpdd;
  821. __le32 vpd_offset;
  822. u32 reserved[8];
  823. __le32 resp_addr_lo;
  824. __le32 resp_addr_hi;
  825. __le32 resp_len;
  826. u32 reserved1[17];
  827. } __attribute__((packed, aligned(4)));
  828. struct set_nvm_data_req {
  829. __le32 tag;
  830. __le32 len_ir_vpdd;
  831. __le32 vpd_offset;
  832. u32 reserved[8];
  833. __le32 resp_addr_lo;
  834. __le32 resp_addr_hi;
  835. __le32 resp_len;
  836. u32 reserved1[17];
  837. } __attribute__((packed, aligned(4)));
  838. /**
  839. * brief the data structure for SET CONTROLLER CONFIG COMMAND
  840. * use to modify controller configuration
  841. */
  842. struct set_ctrl_cfg_req {
  843. __le32 tag;
  844. __le32 cfg_pg[14];
  845. u32 reserved[16];
  846. } __attribute__((packed, aligned(4)));
  847. /**
  848. * brief the data structure for GET CONTROLLER CONFIG COMMAND
  849. * use to get controller configuration page
  850. */
  851. struct get_ctrl_cfg_req {
  852. __le32 tag;
  853. __le32 pgcd;
  854. __le32 int_vec;
  855. u32 reserved[28];
  856. } __attribute__((packed, aligned(4)));
  857. /**
  858. * brief the data structure for KEK_MANAGEMENT COMMAND
  859. * use for KEK management
  860. */
  861. struct kek_mgmt_req {
  862. __le32 tag;
  863. __le32 new_curidx_ksop;
  864. u32 reserved;
  865. __le32 kblob[12];
  866. u32 reserved1[16];
  867. } __attribute__((packed, aligned(4)));
  868. /**
  869. * brief the data structure for DEK_MANAGEMENT COMMAND
  870. * use for DEK management
  871. */
  872. struct dek_mgmt_req {
  873. __le32 tag;
  874. __le32 kidx_dsop;
  875. __le32 dekidx;
  876. __le32 addr_l;
  877. __le32 addr_h;
  878. __le32 nent;
  879. __le32 dbf_tblsize;
  880. u32 reserved[24];
  881. } __attribute__((packed, aligned(4)));
  882. /**
  883. * brief the data structure for SET PHY PROFILE COMMAND
  884. * use to retrive phy specific information
  885. */
  886. struct set_phy_profile_req {
  887. __le32 tag;
  888. __le32 ppc_phyid;
  889. __le32 reserved[29];
  890. } __attribute__((packed, aligned(4)));
  891. /**
  892. * brief the data structure for GET PHY PROFILE COMMAND
  893. * use to retrive phy specific information
  894. */
  895. struct get_phy_profile_req {
  896. __le32 tag;
  897. __le32 ppc_phyid;
  898. __le32 profile[29];
  899. } __attribute__((packed, aligned(4)));
  900. /**
  901. * brief the data structure for EXT FLASH PARTITION
  902. * use to manage ext flash partition
  903. */
  904. struct ext_flash_partition_req {
  905. __le32 tag;
  906. __le32 cmd;
  907. __le32 offset;
  908. __le32 len;
  909. u32 reserved[7];
  910. __le32 addr_low;
  911. __le32 addr_high;
  912. __le32 len1;
  913. __le32 ext;
  914. u32 reserved1[16];
  915. } __attribute__((packed, aligned(4)));
  916. #define TWI_DEVICE 0x0
  917. #define C_SEEPROM 0x1
  918. #define VPD_FLASH 0x4
  919. #define AAP1_RDUMP 0x5
  920. #define IOP_RDUMP 0x6
  921. #define EXPAN_ROM 0x7
  922. #define IPMode 0x80000000
  923. #define NVMD_TYPE 0x0000000F
  924. #define NVMD_STAT 0x0000FFFF
  925. #define NVMD_LEN 0xFF000000
  926. /**
  927. * brief the data structure of Get NVMD Data Response
  928. * use to describe MPI Get NVMD Data Response (64 bytes)
  929. */
  930. struct get_nvm_data_resp {
  931. __le32 tag;
  932. __le32 ir_tda_bn_dps_das_nvm;
  933. __le32 dlen_status;
  934. __le32 nvm_data[12];
  935. } __attribute__((packed, aligned(4)));
  936. /**
  937. * brief the data structure of SAS Diagnostic Start/End Response
  938. * use to describe MPI SAS Diagnostic Start/End Response (64 bytes)
  939. *
  940. */
  941. struct sas_diag_start_end_resp {
  942. __le32 tag;
  943. __le32 status;
  944. u32 reserved[13];
  945. } __attribute__((packed, aligned(4)));
  946. /**
  947. * brief the data structure of SAS Diagnostic Execute Response
  948. * use to describe MPI SAS Diagnostic Execute Response (64 bytes)
  949. *
  950. */
  951. struct sas_diag_execute_resp {
  952. __le32 tag;
  953. __le32 cmdtype_cmddesc_phyid;
  954. __le32 Status;
  955. __le32 ReportData;
  956. u32 reserved[11];
  957. } __attribute__((packed, aligned(4)));
  958. /**
  959. * brief the data structure of Set Device State Response
  960. * use to describe MPI Set Device State Response (64 bytes)
  961. *
  962. */
  963. struct set_dev_state_resp {
  964. __le32 tag;
  965. __le32 status;
  966. __le32 device_id;
  967. __le32 pds_nds;
  968. u32 reserved[11];
  969. } __attribute__((packed, aligned(4)));
  970. /* new outbound structure for spcv - begins */
  971. /**
  972. * brief the data structure for SET CONTROLLER CONFIG COMMAND
  973. * use to modify controller configuration
  974. */
  975. struct set_ctrl_cfg_resp {
  976. __le32 tag;
  977. __le32 status;
  978. __le32 err_qlfr_pgcd;
  979. u32 reserved[12];
  980. } __attribute__((packed, aligned(4)));
  981. struct get_ctrl_cfg_resp {
  982. __le32 tag;
  983. __le32 status;
  984. __le32 err_qlfr;
  985. __le32 confg_page[12];
  986. } __attribute__((packed, aligned(4)));
  987. struct kek_mgmt_resp {
  988. __le32 tag;
  989. __le32 status;
  990. __le32 kidx_new_curr_ksop;
  991. __le32 err_qlfr;
  992. u32 reserved[11];
  993. } __attribute__((packed, aligned(4)));
  994. struct dek_mgmt_resp {
  995. __le32 tag;
  996. __le32 status;
  997. __le32 kekidx_tbls_dsop;
  998. __le32 dekidx;
  999. __le32 err_qlfr;
  1000. u32 reserved[10];
  1001. } __attribute__((packed, aligned(4)));
  1002. struct get_phy_profile_resp {
  1003. __le32 tag;
  1004. __le32 status;
  1005. __le32 ppc_phyid;
  1006. __le32 ppc_specific_rsp[12];
  1007. } __attribute__((packed, aligned(4)));
  1008. struct flash_op_ext_resp {
  1009. __le32 tag;
  1010. __le32 cmd;
  1011. __le32 status;
  1012. __le32 epart_size;
  1013. __le32 epart_sect_size;
  1014. u32 reserved[10];
  1015. } __attribute__((packed, aligned(4)));
  1016. struct set_phy_profile_resp {
  1017. __le32 tag;
  1018. __le32 status;
  1019. __le32 ppc_phyid;
  1020. __le32 ppc_specific_rsp[12];
  1021. } __attribute__((packed, aligned(4)));
  1022. struct ssp_coalesced_comp_resp {
  1023. __le32 coal_cnt;
  1024. __le32 tag0;
  1025. __le32 ssp_tag0;
  1026. __le32 tag1;
  1027. __le32 ssp_tag1;
  1028. __le32 add_tag_ssp_tag[10];
  1029. } __attribute__((packed, aligned(4)));
  1030. /* new outbound structure for spcv - ends */
  1031. /* brief data structure for SAS protocol timer configuration page.
  1032. *
  1033. */
  1034. struct SASProtocolTimerConfig {
  1035. __le32 pageCode; /* 0 */
  1036. __le32 MST_MSI; /* 1 */
  1037. __le32 STP_SSP_MCT_TMO; /* 2 */
  1038. __le32 STP_FRM_TMO; /* 3 */
  1039. __le32 STP_IDLE_TMO; /* 4 */
  1040. __le32 OPNRJT_RTRY_INTVL; /* 5 */
  1041. __le32 Data_Cmd_OPNRJT_RTRY_TMO; /* 6 */
  1042. __le32 Data_Cmd_OPNRJT_RTRY_THR; /* 7 */
  1043. __le32 MAX_AIP; /* 8 */
  1044. } __attribute__((packed, aligned(4)));
  1045. typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;
  1046. #define NDS_BITS 0x0F
  1047. #define PDS_BITS 0xF0
  1048. /*
  1049. * HW Events type
  1050. */
  1051. #define HW_EVENT_RESET_START 0x01
  1052. #define HW_EVENT_CHIP_RESET_COMPLETE 0x02
  1053. #define HW_EVENT_PHY_STOP_STATUS 0x03
  1054. #define HW_EVENT_SAS_PHY_UP 0x04
  1055. #define HW_EVENT_SATA_PHY_UP 0x05
  1056. #define HW_EVENT_SATA_SPINUP_HOLD 0x06
  1057. #define HW_EVENT_PHY_DOWN 0x07
  1058. #define HW_EVENT_PORT_INVALID 0x08
  1059. #define HW_EVENT_BROADCAST_CHANGE 0x09
  1060. #define HW_EVENT_PHY_ERROR 0x0A
  1061. #define HW_EVENT_BROADCAST_SES 0x0B
  1062. #define HW_EVENT_INBOUND_CRC_ERROR 0x0C
  1063. #define HW_EVENT_HARD_RESET_RECEIVED 0x0D
  1064. #define HW_EVENT_MALFUNCTION 0x0E
  1065. #define HW_EVENT_ID_FRAME_TIMEOUT 0x0F
  1066. #define HW_EVENT_BROADCAST_EXP 0x10
  1067. #define HW_EVENT_PHY_START_STATUS 0x11
  1068. #define HW_EVENT_LINK_ERR_INVALID_DWORD 0x12
  1069. #define HW_EVENT_LINK_ERR_DISPARITY_ERROR 0x13
  1070. #define HW_EVENT_LINK_ERR_CODE_VIOLATION 0x14
  1071. #define HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH 0x15
  1072. #define HW_EVENT_LINK_ERR_PHY_RESET_FAILED 0x16
  1073. #define HW_EVENT_PORT_RECOVERY_TIMER_TMO 0x17
  1074. #define HW_EVENT_PORT_RECOVER 0x18
  1075. #define HW_EVENT_PORT_RESET_TIMER_TMO 0x19
  1076. #define HW_EVENT_PORT_RESET_COMPLETE 0x20
  1077. #define EVENT_BROADCAST_ASYNCH_EVENT 0x21
  1078. /* port state */
  1079. #define PORT_NOT_ESTABLISHED 0x00
  1080. #define PORT_VALID 0x01
  1081. #define PORT_LOSTCOMM 0x02
  1082. #define PORT_IN_RESET 0x04
  1083. #define PORT_3RD_PARTY_RESET 0x07
  1084. #define PORT_INVALID 0x08
  1085. /*
  1086. * SSP/SMP/SATA IO Completion Status values
  1087. */
  1088. #define IO_SUCCESS 0x00
  1089. #define IO_ABORTED 0x01
  1090. #define IO_OVERFLOW 0x02
  1091. #define IO_UNDERFLOW 0x03
  1092. #define IO_FAILED 0x04
  1093. #define IO_ABORT_RESET 0x05
  1094. #define IO_NOT_VALID 0x06
  1095. #define IO_NO_DEVICE 0x07
  1096. #define IO_ILLEGAL_PARAMETER 0x08
  1097. #define IO_LINK_FAILURE 0x09
  1098. #define IO_PROG_ERROR 0x0A
  1099. #define IO_EDC_IN_ERROR 0x0B
  1100. #define IO_EDC_OUT_ERROR 0x0C
  1101. #define IO_ERROR_HW_TIMEOUT 0x0D
  1102. #define IO_XFER_ERROR_BREAK 0x0E
  1103. #define IO_XFER_ERROR_PHY_NOT_READY 0x0F
  1104. #define IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED 0x10
  1105. #define IO_OPEN_CNX_ERROR_ZONE_VIOLATION 0x11
  1106. #define IO_OPEN_CNX_ERROR_BREAK 0x12
  1107. #define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS 0x13
  1108. #define IO_OPEN_CNX_ERROR_BAD_DESTINATION 0x14
  1109. #define IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED 0x15
  1110. #define IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY 0x16
  1111. #define IO_OPEN_CNX_ERROR_WRONG_DESTINATION 0x17
  1112. /* This error code 0x18 is not used on SPCv */
  1113. #define IO_OPEN_CNX_ERROR_UNKNOWN_ERROR 0x18
  1114. #define IO_XFER_ERROR_NAK_RECEIVED 0x19
  1115. #define IO_XFER_ERROR_ACK_NAK_TIMEOUT 0x1A
  1116. #define IO_XFER_ERROR_PEER_ABORTED 0x1B
  1117. #define IO_XFER_ERROR_RX_FRAME 0x1C
  1118. #define IO_XFER_ERROR_DMA 0x1D
  1119. #define IO_XFER_ERROR_CREDIT_TIMEOUT 0x1E
  1120. #define IO_XFER_ERROR_SATA_LINK_TIMEOUT 0x1F
  1121. #define IO_XFER_ERROR_SATA 0x20
  1122. /* This error code 0x22 is not used on SPCv */
  1123. #define IO_XFER_ERROR_ABORTED_DUE_TO_SRST 0x22
  1124. #define IO_XFER_ERROR_REJECTED_NCQ_MODE 0x21
  1125. #define IO_XFER_ERROR_ABORTED_NCQ_MODE 0x23
  1126. #define IO_XFER_OPEN_RETRY_TIMEOUT 0x24
  1127. /* This error code 0x25 is not used on SPCv */
  1128. #define IO_XFER_SMP_RESP_CONNECTION_ERROR 0x25
  1129. #define IO_XFER_ERROR_UNEXPECTED_PHASE 0x26
  1130. #define IO_XFER_ERROR_XFER_RDY_OVERRUN 0x27
  1131. #define IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED 0x28
  1132. #define IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT 0x30
  1133. /* The following error code 0x31 and 0x32 are not using (obsolete) */
  1134. #define IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK 0x31
  1135. #define IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK 0x32
  1136. #define IO_XFER_ERROR_OFFSET_MISMATCH 0x34
  1137. #define IO_XFER_ERROR_XFER_ZERO_DATA_LEN 0x35
  1138. #define IO_XFER_CMD_FRAME_ISSUED 0x36
  1139. #define IO_ERROR_INTERNAL_SMP_RESOURCE 0x37
  1140. #define IO_PORT_IN_RESET 0x38
  1141. #define IO_DS_NON_OPERATIONAL 0x39
  1142. #define IO_DS_IN_RECOVERY 0x3A
  1143. #define IO_TM_TAG_NOT_FOUND 0x3B
  1144. #define IO_XFER_PIO_SETUP_ERROR 0x3C
  1145. #define IO_SSP_EXT_IU_ZERO_LEN_ERROR 0x3D
  1146. #define IO_DS_IN_ERROR 0x3E
  1147. #define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY 0x3F
  1148. #define IO_ABORT_IN_PROGRESS 0x40
  1149. #define IO_ABORT_DELAYED 0x41
  1150. #define IO_INVALID_LENGTH 0x42
  1151. /********** additional response event values *****************/
  1152. #define IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT 0x43
  1153. #define IO_XFER_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED 0x44
  1154. #define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO 0x45
  1155. #define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST 0x46
  1156. #define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE 0x47
  1157. #define IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED 0x48
  1158. #define IO_DS_INVALID 0x49
  1159. #define IO_FATAL_ERROR 0x51
  1160. /* WARNING: the value is not contiguous from here */
  1161. #define IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR 0x52
  1162. #define IO_XFER_DMA_ACTIVATE_TIMEOUT 0x53
  1163. #define IO_XFER_ERROR_INTERNAL_CRC_ERROR 0x54
  1164. #define MPI_IO_RQE_BUSY_FULL 0x55
  1165. #define IO_XFER_ERR_EOB_DATA_OVERRUN 0x56
  1166. #define IO_XFER_ERROR_INVALID_SSP_RSP_FRAME 0x57
  1167. #define IO_OPEN_CNX_ERROR_OPEN_PREEMPTED 0x58
  1168. #define MPI_ERR_IO_RESOURCE_UNAVAILABLE 0x1004
  1169. #define MPI_ERR_ATAPI_DEVICE_BUSY 0x1024
  1170. #define IO_XFR_ERROR_DEK_KEY_CACHE_MISS 0x2040
  1171. /*
  1172. * An encryption IO request failed due to DEK Key Tag mismatch.
  1173. * The key tag supplied in the encryption IOMB does not match with
  1174. * the Key Tag in the referenced DEK Entry.
  1175. */
  1176. #define IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH 0x2041
  1177. #define IO_XFR_ERROR_CIPHER_MODE_INVALID 0x2042
  1178. /*
  1179. * An encryption I/O request failed because the initial value (IV)
  1180. * in the unwrapped DEK blob didn't match the IV used to unwrap it.
  1181. */
  1182. #define IO_XFR_ERROR_DEK_IV_MISMATCH 0x2043
  1183. /* An encryption I/O request failed due to an internal RAM ECC or
  1184. * interface error while unwrapping the DEK. */
  1185. #define IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR 0x2044
  1186. /* An encryption I/O request failed due to an internal RAM ECC or
  1187. * interface error while unwrapping the DEK. */
  1188. #define IO_XFR_ERROR_INTERNAL_RAM 0x2045
  1189. /*
  1190. * An encryption I/O request failed
  1191. * because the DEK index specified in the I/O was outside the bounds of
  1192. * the total number of entries in the host DEK table.
  1193. */
  1194. #define IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS0x2046
  1195. /* define DIF IO response error status code */
  1196. #define IO_XFR_ERROR_DIF_MISMATCH 0x3000
  1197. #define IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH 0x3001
  1198. #define IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH 0x3002
  1199. #define IO_XFR_ERROR_DIF_CRC_MISMATCH 0x3003
  1200. /* define operator management response status and error qualifier code */
  1201. #define OPR_MGMT_OP_NOT_SUPPORTED 0x2060
  1202. #define OPR_MGMT_MPI_ENC_ERR_OPR_PARAM_ILLEGAL 0x2061
  1203. #define OPR_MGMT_MPI_ENC_ERR_OPR_ID_NOT_FOUND 0x2062
  1204. #define OPR_MGMT_MPI_ENC_ERR_OPR_ROLE_NOT_MATCH 0x2063
  1205. #define OPR_MGMT_MPI_ENC_ERR_OPR_MAX_NUM_EXCEEDED 0x2064
  1206. #define OPR_MGMT_MPI_ENC_ERR_KEK_UNWRAP_FAIL 0x2022
  1207. #define OPR_MGMT_MPI_ENC_ERR_NVRAM_OPERATION_FAILURE 0x2023
  1208. /***************** additional response event values ***************/
  1209. /* WARNING: This error code must always be the last number.
  1210. * If you add error code, modify this code also
  1211. * It is used as an index
  1212. */
  1213. #define IO_ERROR_UNKNOWN_GENERIC 0x2023
  1214. /* MSGU CONFIGURATION TABLE*/
  1215. #define SPCv_MSGU_CFG_TABLE_UPDATE 0x001
  1216. #define SPCv_MSGU_CFG_TABLE_RESET 0x002
  1217. #define SPCv_MSGU_CFG_TABLE_FREEZE 0x004
  1218. #define SPCv_MSGU_CFG_TABLE_UNFREEZE 0x008
  1219. #define MSGU_IBDB_SET 0x00
  1220. #define MSGU_HOST_INT_STATUS 0x08
  1221. #define MSGU_HOST_INT_MASK 0x0C
  1222. #define MSGU_IOPIB_INT_STATUS 0x18
  1223. #define MSGU_IOPIB_INT_MASK 0x1C
  1224. #define MSGU_IBDB_CLEAR 0x20
  1225. #define MSGU_MSGU_CONTROL 0x24
  1226. #define MSGU_ODR 0x20
  1227. #define MSGU_ODCR 0x28
  1228. #define MSGU_ODMR 0x30
  1229. #define MSGU_ODMR_U 0x34
  1230. #define MSGU_ODMR_CLR 0x38
  1231. #define MSGU_ODMR_CLR_U 0x3C
  1232. #define MSGU_OD_RSVD 0x40
  1233. #define MSGU_SCRATCH_PAD_0 0x44
  1234. #define MSGU_SCRATCH_PAD_1 0x48
  1235. #define MSGU_SCRATCH_PAD_2 0x4C
  1236. #define MSGU_SCRATCH_PAD_3 0x50
  1237. #define MSGU_HOST_SCRATCH_PAD_0 0x54
  1238. #define MSGU_HOST_SCRATCH_PAD_1 0x58
  1239. #define MSGU_HOST_SCRATCH_PAD_2 0x5C
  1240. #define MSGU_HOST_SCRATCH_PAD_3 0x60
  1241. #define MSGU_HOST_SCRATCH_PAD_4 0x64
  1242. #define MSGU_HOST_SCRATCH_PAD_5 0x68
  1243. #define MSGU_SCRATCH_PAD_RSVD_0 0x6C
  1244. #define MSGU_SCRATCH_PAD_RSVD_1 0x70
  1245. #define MSGU_SCRATCHPAD1_RAAE_STATE_ERR(x) ((x & 0x3) == 0x2)
  1246. #define MSGU_SCRATCHPAD1_ILA_STATE_ERR(x) (((x >> 2) & 0x3) == 0x2)
  1247. #define MSGU_SCRATCHPAD1_BOOTLDR_STATE_ERR(x) ((((x >> 4) & 0x7) == 0x7) || \
  1248. (((x >> 4) & 0x7) == 0x4))
  1249. #define MSGU_SCRATCHPAD1_IOP0_STATE_ERR(x) (((x >> 10) & 0x3) == 0x2)
  1250. #define MSGU_SCRATCHPAD1_IOP1_STATE_ERR(x) (((x >> 12) & 0x3) == 0x2)
  1251. #define MSGU_SCRATCHPAD1_STATE_FATAL_ERROR(x) \
  1252. (MSGU_SCRATCHPAD1_RAAE_STATE_ERR(x) || \
  1253. MSGU_SCRATCHPAD1_ILA_STATE_ERR(x) || \
  1254. MSGU_SCRATCHPAD1_BOOTLDR_STATE_ERR(x) || \
  1255. MSGU_SCRATCHPAD1_IOP0_STATE_ERR(x) || \
  1256. MSGU_SCRATCHPAD1_IOP1_STATE_ERR(x))
  1257. /* bit definition for ODMR register */
  1258. #define ODMR_MASK_ALL 0xFFFFFFFF/* mask all
  1259. interrupt vector */
  1260. #define ODMR_CLEAR_ALL 0 /* clear all
  1261. interrupt vector */
  1262. /* bit definition for ODCR register */
  1263. #define ODCR_CLEAR_ALL 0xFFFFFFFF /* mask all
  1264. interrupt vector*/
  1265. /* MSIX Interupts */
  1266. #define MSIX_TABLE_OFFSET 0x2000
  1267. #define MSIX_TABLE_ELEMENT_SIZE 0x10
  1268. #define MSIX_INTERRUPT_CONTROL_OFFSET 0xC
  1269. #define MSIX_TABLE_BASE (MSIX_TABLE_OFFSET + \
  1270. MSIX_INTERRUPT_CONTROL_OFFSET)
  1271. #define MSIX_INTERRUPT_DISABLE 0x1
  1272. #define MSIX_INTERRUPT_ENABLE 0x0
  1273. /* state definition for Scratch Pad1 register */
  1274. #define SCRATCH_PAD_RAAE_READY 0x3
  1275. #define SCRATCH_PAD_ILA_READY 0xC
  1276. #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0
  1277. #define SCRATCH_PAD_IOP0_READY 0xC00
  1278. #define SCRATCH_PAD_IOP1_READY 0x3000
  1279. #define SCRATCH_PAD_MIPSALL_READY_16PORT (SCRATCH_PAD_IOP1_READY | \
  1280. SCRATCH_PAD_IOP0_READY | \
  1281. SCRATCH_PAD_ILA_READY | \
  1282. SCRATCH_PAD_RAAE_READY)
  1283. #define SCRATCH_PAD_MIPSALL_READY_8PORT (SCRATCH_PAD_IOP0_READY | \
  1284. SCRATCH_PAD_ILA_READY | \
  1285. SCRATCH_PAD_RAAE_READY)
  1286. /* boot loader state */
  1287. #define SCRATCH_PAD1_BOOTSTATE_MASK 0x70 /* Bit 4-6 */
  1288. #define SCRATCH_PAD1_BOOTSTATE_SUCESS 0x0 /* Load successful */
  1289. #define SCRATCH_PAD1_BOOTSTATE_HDA_SEEPROM 0x10 /* HDA SEEPROM */
  1290. #define SCRATCH_PAD1_BOOTSTATE_HDA_BOOTSTRAP 0x20 /* HDA BootStrap Pins */
  1291. #define SCRATCH_PAD1_BOOTSTATE_HDA_SOFTRESET 0x30 /* HDA Soft Reset */
  1292. #define SCRATCH_PAD1_BOOTSTATE_CRIT_ERROR 0x40 /* HDA critical error */
  1293. #define SCRATCH_PAD1_BOOTSTATE_R1 0x50 /* Reserved */
  1294. #define SCRATCH_PAD1_BOOTSTATE_R2 0x60 /* Reserved */
  1295. #define SCRATCH_PAD1_BOOTSTATE_FATAL 0x70 /* Fatal Error */
  1296. /* state definition for Scratch Pad2 register */
  1297. #define SCRATCH_PAD2_POR 0x00 /* power on state */
  1298. #define SCRATCH_PAD2_SFR 0x01 /* soft reset state */
  1299. #define SCRATCH_PAD2_ERR 0x02 /* error state */
  1300. #define SCRATCH_PAD2_RDY 0x03 /* ready state */
  1301. #define SCRATCH_PAD2_FWRDY_RST 0x04 /* FW rdy for soft reset flag */
  1302. #define SCRATCH_PAD2_IOPRDY_RST 0x08 /* IOP ready for soft reset */
  1303. #define SCRATCH_PAD2_STATE_MASK 0xFFFFFFF4 /* ScratchPad 2
  1304. Mask, bit1-0 State */
  1305. #define SCRATCH_PAD2_RESERVED 0x000003FC/* Scratch Pad1
  1306. Reserved bit 2 to 9 */
  1307. #define SCRATCH_PAD_ERROR_MASK 0xFFFFFC00 /* Error mask bits */
  1308. #define SCRATCH_PAD_STATE_MASK 0x00000003 /* State Mask bits */
  1309. /*state definition for Scratchpad Rsvd 0, Offset 0x6C, Non-fatal*/
  1310. #define NON_FATAL_SPBC_LBUS_ECC_ERR 0x70000001
  1311. #define NON_FATAL_BDMA_ERR 0xE0000001
  1312. #define NON_FATAL_THERM_OVERTEMP_ERR 0x80000001
  1313. /* main configuration offset - byte offset */
  1314. #define MAIN_SIGNATURE_OFFSET 0x00 /* DWORD 0x00 */
  1315. #define MAIN_INTERFACE_REVISION 0x04 /* DWORD 0x01 */
  1316. #define MAIN_FW_REVISION 0x08 /* DWORD 0x02 */
  1317. #define MAIN_MAX_OUTSTANDING_IO_OFFSET 0x0C /* DWORD 0x03 */
  1318. #define MAIN_MAX_SGL_OFFSET 0x10 /* DWORD 0x04 */
  1319. #define MAIN_CNTRL_CAP_OFFSET 0x14 /* DWORD 0x05 */
  1320. #define MAIN_GST_OFFSET 0x18 /* DWORD 0x06 */
  1321. #define MAIN_IBQ_OFFSET 0x1C /* DWORD 0x07 */
  1322. #define MAIN_OBQ_OFFSET 0x20 /* DWORD 0x08 */
  1323. #define MAIN_IQNPPD_HPPD_OFFSET 0x24 /* DWORD 0x09 */
  1324. /* 0x28 - 0x4C - RSVD */
  1325. #define MAIN_EVENT_CRC_CHECK 0x48 /* DWORD 0x12 */
  1326. #define MAIN_EVENT_LOG_ADDR_HI 0x50 /* DWORD 0x14 */
  1327. #define MAIN_EVENT_LOG_ADDR_LO 0x54 /* DWORD 0x15 */
  1328. #define MAIN_EVENT_LOG_BUFF_SIZE 0x58 /* DWORD 0x16 */
  1329. #define MAIN_EVENT_LOG_OPTION 0x5C /* DWORD 0x17 */
  1330. #define MAIN_PCS_EVENT_LOG_ADDR_HI 0x60 /* DWORD 0x18 */
  1331. #define MAIN_PCS_EVENT_LOG_ADDR_LO 0x64 /* DWORD 0x19 */
  1332. #define MAIN_PCS_EVENT_LOG_BUFF_SIZE 0x68 /* DWORD 0x1A */
  1333. #define MAIN_PCS_EVENT_LOG_OPTION 0x6C /* DWORD 0x1B */
  1334. #define MAIN_FATAL_ERROR_INTERRUPT 0x70 /* DWORD 0x1C */
  1335. #define MAIN_FATAL_ERROR_RDUMP0_OFFSET 0x74 /* DWORD 0x1D */
  1336. #define MAIN_FATAL_ERROR_RDUMP0_LENGTH 0x78 /* DWORD 0x1E */
  1337. #define MAIN_FATAL_ERROR_RDUMP1_OFFSET 0x7C /* DWORD 0x1F */
  1338. #define MAIN_FATAL_ERROR_RDUMP1_LENGTH 0x80 /* DWORD 0x20 */
  1339. #define MAIN_GPIO_LED_FLAGS_OFFSET 0x84 /* DWORD 0x21 */
  1340. #define MAIN_ANALOG_SETUP_OFFSET 0x88 /* DWORD 0x22 */
  1341. #define MAIN_INT_VECTOR_TABLE_OFFSET 0x8C /* DWORD 0x23 */
  1342. #define MAIN_SAS_PHY_ATTR_TABLE_OFFSET 0x90 /* DWORD 0x24 */
  1343. #define MAIN_PORT_RECOVERY_TIMER 0x94 /* DWORD 0x25 */
  1344. #define MAIN_INT_REASSERTION_DELAY 0x98 /* DWORD 0x26 */
  1345. #define MAIN_MPI_ILA_RELEASE_TYPE 0xA4 /* DWORD 0x29 */
  1346. #define MAIN_MPI_INACTIVE_FW_VERSION 0XB0 /* DWORD 0x2C */
  1347. /* Gereral Status Table offset - byte offset */
  1348. #define GST_GSTLEN_MPIS_OFFSET 0x00
  1349. #define GST_IQ_FREEZE_STATE0_OFFSET 0x04
  1350. #define GST_IQ_FREEZE_STATE1_OFFSET 0x08
  1351. #define GST_MSGUTCNT_OFFSET 0x0C
  1352. #define GST_IOPTCNT_OFFSET 0x10
  1353. /* 0x14 - 0x34 - RSVD */
  1354. #define GST_GPIO_INPUT_VAL 0x38
  1355. /* 0x3c - 0x40 - RSVD */
  1356. #define GST_RERRINFO_OFFSET0 0x44
  1357. #define GST_RERRINFO_OFFSET1 0x48
  1358. #define GST_RERRINFO_OFFSET2 0x4c
  1359. #define GST_RERRINFO_OFFSET3 0x50
  1360. #define GST_RERRINFO_OFFSET4 0x54
  1361. #define GST_RERRINFO_OFFSET5 0x58
  1362. #define GST_RERRINFO_OFFSET6 0x5c
  1363. #define GST_RERRINFO_OFFSET7 0x60
  1364. /* General Status Table - MPI state */
  1365. #define GST_MPI_STATE_UNINIT 0x00
  1366. #define GST_MPI_STATE_INIT 0x01
  1367. #define GST_MPI_STATE_TERMINATION 0x02
  1368. #define GST_MPI_STATE_ERROR 0x03
  1369. #define GST_MPI_STATE_MASK 0x07
  1370. /* Per SAS PHY Attributes */
  1371. #define PSPA_PHYSTATE0_OFFSET 0x00 /* Dword V */
  1372. #define PSPA_OB_HW_EVENT_PID0_OFFSET 0x04 /* DWORD V+1 */
  1373. #define PSPA_PHYSTATE1_OFFSET 0x08 /* Dword V+2 */
  1374. #define PSPA_OB_HW_EVENT_PID1_OFFSET 0x0C /* DWORD V+3 */
  1375. #define PSPA_PHYSTATE2_OFFSET 0x10 /* Dword V+4 */
  1376. #define PSPA_OB_HW_EVENT_PID2_OFFSET 0x14 /* DWORD V+5 */
  1377. #define PSPA_PHYSTATE3_OFFSET 0x18 /* Dword V+6 */
  1378. #define PSPA_OB_HW_EVENT_PID3_OFFSET 0x1C /* DWORD V+7 */
  1379. #define PSPA_PHYSTATE4_OFFSET 0x20 /* Dword V+8 */
  1380. #define PSPA_OB_HW_EVENT_PID4_OFFSET 0x24 /* DWORD V+9 */
  1381. #define PSPA_PHYSTATE5_OFFSET 0x28 /* Dword V+10 */
  1382. #define PSPA_OB_HW_EVENT_PID5_OFFSET 0x2C /* DWORD V+11 */
  1383. #define PSPA_PHYSTATE6_OFFSET 0x30 /* Dword V+12 */
  1384. #define PSPA_OB_HW_EVENT_PID6_OFFSET 0x34 /* DWORD V+13 */
  1385. #define PSPA_PHYSTATE7_OFFSET 0x38 /* Dword V+14 */
  1386. #define PSPA_OB_HW_EVENT_PID7_OFFSET 0x3C /* DWORD V+15 */
  1387. #define PSPA_PHYSTATE8_OFFSET 0x40 /* DWORD V+16 */
  1388. #define PSPA_OB_HW_EVENT_PID8_OFFSET 0x44 /* DWORD V+17 */
  1389. #define PSPA_PHYSTATE9_OFFSET 0x48 /* DWORD V+18 */
  1390. #define PSPA_OB_HW_EVENT_PID9_OFFSET 0x4C /* DWORD V+19 */
  1391. #define PSPA_PHYSTATE10_OFFSET 0x50 /* DWORD V+20 */
  1392. #define PSPA_OB_HW_EVENT_PID10_OFFSET 0x54 /* DWORD V+21 */
  1393. #define PSPA_PHYSTATE11_OFFSET 0x58 /* DWORD V+22 */
  1394. #define PSPA_OB_HW_EVENT_PID11_OFFSET 0x5C /* DWORD V+23 */
  1395. #define PSPA_PHYSTATE12_OFFSET 0x60 /* DWORD V+24 */
  1396. #define PSPA_OB_HW_EVENT_PID12_OFFSET 0x64 /* DWORD V+25 */
  1397. #define PSPA_PHYSTATE13_OFFSET 0x68 /* DWORD V+26 */
  1398. #define PSPA_OB_HW_EVENT_PID13_OFFSET 0x6c /* DWORD V+27 */
  1399. #define PSPA_PHYSTATE14_OFFSET 0x70 /* DWORD V+28 */
  1400. #define PSPA_OB_HW_EVENT_PID14_OFFSET 0x74 /* DWORD V+29 */
  1401. #define PSPA_PHYSTATE15_OFFSET 0x78 /* DWORD V+30 */
  1402. #define PSPA_OB_HW_EVENT_PID15_OFFSET 0x7c /* DWORD V+31 */
  1403. /* end PSPA */
  1404. /* inbound queue configuration offset - byte offset */
  1405. #define IB_PROPERITY_OFFSET 0x00
  1406. #define IB_BASE_ADDR_HI_OFFSET 0x04
  1407. #define IB_BASE_ADDR_LO_OFFSET 0x08
  1408. #define IB_CI_BASE_ADDR_HI_OFFSET 0x0C
  1409. #define IB_CI_BASE_ADDR_LO_OFFSET 0x10
  1410. #define IB_PIPCI_BAR 0x14
  1411. #define IB_PIPCI_BAR_OFFSET 0x18
  1412. #define IB_RESERVED_OFFSET 0x1C
  1413. /* outbound queue configuration offset - byte offset */
  1414. #define OB_PROPERITY_OFFSET 0x00
  1415. #define OB_BASE_ADDR_HI_OFFSET 0x04
  1416. #define OB_BASE_ADDR_LO_OFFSET 0x08
  1417. #define OB_PI_BASE_ADDR_HI_OFFSET 0x0C
  1418. #define OB_PI_BASE_ADDR_LO_OFFSET 0x10
  1419. #define OB_CIPCI_BAR 0x14
  1420. #define OB_CIPCI_BAR_OFFSET 0x18
  1421. #define OB_INTERRUPT_COALES_OFFSET 0x1C
  1422. #define OB_DYNAMIC_COALES_OFFSET 0x20
  1423. #define OB_PROPERTY_INT_ENABLE 0x40000000
  1424. #define MBIC_NMI_ENABLE_VPE0_IOP 0x000418
  1425. #define MBIC_NMI_ENABLE_VPE0_AAP1 0x000418
  1426. /* PCIE registers - BAR2(0x18), BAR1(win) 0x010000 */
  1427. #define PCIE_EVENT_INTERRUPT_ENABLE 0x003040
  1428. #define PCIE_EVENT_INTERRUPT 0x003044
  1429. #define PCIE_ERROR_INTERRUPT_ENABLE 0x003048
  1430. #define PCIE_ERROR_INTERRUPT 0x00304C
  1431. /* SPCV soft reset */
  1432. #define SPC_REG_SOFT_RESET 0x00001000
  1433. #define SPCv_NORMAL_RESET_VALUE 0x1
  1434. #define SPCv_SOFT_RESET_READ_MASK 0xC0
  1435. #define SPCv_SOFT_RESET_NO_RESET 0x0
  1436. #define SPCv_SOFT_RESET_NORMAL_RESET_OCCURED 0x40
  1437. #define SPCv_SOFT_RESET_HDA_MODE_OCCURED 0x80
  1438. #define SPCv_SOFT_RESET_CHIP_RESET_OCCURED 0xC0
  1439. /* signature definition for host scratch pad0 register */
  1440. #define SPC_SOFT_RESET_SIGNATURE 0x252acbcd
  1441. /* Signature for Soft Reset */
  1442. /* SPC Reset register - BAR4(0x20), BAR2(win) (need dynamic mapping) */
  1443. #define SPC_REG_RESET 0x000000/* reset register */
  1444. /* bit definition for SPC_RESET register */
  1445. #define SPC_REG_RESET_OSSP 0x00000001
  1446. #define SPC_REG_RESET_RAAE 0x00000002
  1447. #define SPC_REG_RESET_PCS_SPBC 0x00000004
  1448. #define SPC_REG_RESET_PCS_IOP_SS 0x00000008
  1449. #define SPC_REG_RESET_PCS_AAP1_SS 0x00000010
  1450. #define SPC_REG_RESET_PCS_AAP2_SS 0x00000020
  1451. #define SPC_REG_RESET_PCS_LM 0x00000040
  1452. #define SPC_REG_RESET_PCS 0x00000080
  1453. #define SPC_REG_RESET_GSM 0x00000100
  1454. #define SPC_REG_RESET_DDR2 0x00010000
  1455. #define SPC_REG_RESET_BDMA_CORE 0x00020000
  1456. #define SPC_REG_RESET_BDMA_SXCBI 0x00040000
  1457. #define SPC_REG_RESET_PCIE_AL_SXCBI 0x00080000
  1458. #define SPC_REG_RESET_PCIE_PWR 0x00100000
  1459. #define SPC_REG_RESET_PCIE_SFT 0x00200000
  1460. #define SPC_REG_RESET_PCS_SXCBI 0x00400000
  1461. #define SPC_REG_RESET_LMS_SXCBI 0x00800000
  1462. #define SPC_REG_RESET_PMIC_SXCBI 0x01000000
  1463. #define SPC_REG_RESET_PMIC_CORE 0x02000000
  1464. #define SPC_REG_RESET_PCIE_PC_SXCBI 0x04000000
  1465. #define SPC_REG_RESET_DEVICE 0x80000000
  1466. /* registers for BAR Shifting - BAR2(0x18), BAR1(win) */
  1467. #define SPCV_IBW_AXI_TRANSLATION_LOW 0x001010
  1468. #define MBIC_AAP1_ADDR_BASE 0x060000
  1469. #define MBIC_IOP_ADDR_BASE 0x070000
  1470. #define GSM_ADDR_BASE 0x0700000
  1471. /* Dynamic map through Bar4 - 0x00700000 */
  1472. #define GSM_CONFIG_RESET 0x00000000
  1473. #define RAM_ECC_DB_ERR 0x00000018
  1474. #define GSM_READ_ADDR_PARITY_INDIC 0x00000058
  1475. #define GSM_WRITE_ADDR_PARITY_INDIC 0x00000060
  1476. #define GSM_WRITE_DATA_PARITY_INDIC 0x00000068
  1477. #define GSM_READ_ADDR_PARITY_CHECK 0x00000038
  1478. #define GSM_WRITE_ADDR_PARITY_CHECK 0x00000040
  1479. #define GSM_WRITE_DATA_PARITY_CHECK 0x00000048
  1480. #define RB6_ACCESS_REG 0x6A0000
  1481. #define HDAC_EXEC_CMD 0x0002
  1482. #define HDA_C_PA 0xcb
  1483. #define HDA_SEQ_ID_BITS 0x00ff0000
  1484. #define HDA_GSM_OFFSET_BITS 0x00FFFFFF
  1485. #define HDA_GSM_CMD_OFFSET_BITS 0x42C0
  1486. #define HDA_GSM_RSP_OFFSET_BITS 0x42E0
  1487. #define MBIC_AAP1_ADDR_BASE 0x060000
  1488. #define MBIC_IOP_ADDR_BASE 0x070000
  1489. #define GSM_ADDR_BASE 0x0700000
  1490. #define SPC_TOP_LEVEL_ADDR_BASE 0x000000
  1491. #define GSM_CONFIG_RESET_VALUE 0x00003b00
  1492. #define GPIO_ADDR_BASE 0x00090000
  1493. #define GPIO_GPIO_0_0UTPUT_CTL_OFFSET 0x0000010c
  1494. /* RB6 offset */
  1495. #define SPC_RB6_OFFSET 0x80C0
  1496. /* Magic number of soft reset for RB6 */
  1497. #define RB6_MAGIC_NUMBER_RST 0x1234
  1498. /* Device Register status */
  1499. #define DEVREG_SUCCESS 0x00
  1500. #define DEVREG_FAILURE_OUT_OF_RESOURCE 0x01
  1501. #define DEVREG_FAILURE_DEVICE_ALREADY_REGISTERED 0x02
  1502. #define DEVREG_FAILURE_INVALID_PHY_ID 0x03
  1503. #define DEVREG_FAILURE_PHY_ID_ALREADY_REGISTERED 0x04
  1504. #define DEVREG_FAILURE_PORT_ID_OUT_OF_RANGE 0x05
  1505. #define DEVREG_FAILURE_PORT_NOT_VALID_STATE 0x06
  1506. #define DEVREG_FAILURE_DEVICE_TYPE_NOT_VALID 0x07
  1507. #define MEMBASE_II_SHIFT_REGISTER 0x1010
  1508. #endif
  1509. /**
  1510. * As we know sleep (1~20) ms may result in sleep longer than ~20 ms, hence we
  1511. * choose 20 ms interval.
  1512. */
  1513. #define FW_READY_INTERVAL 20