mv_defs.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /*
  2. * Marvell 88SE64xx/88SE94xx const head file
  3. *
  4. * Copyright 2007 Red Hat, Inc.
  5. * Copyright 2008 Marvell. <kewei@marvell.com>
  6. * Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
  7. *
  8. * This file is licensed under GPLv2.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; version 2 of the
  13. * License.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  23. * USA
  24. */
  25. #ifndef _MV_DEFS_H_
  26. #define _MV_DEFS_H_
  27. #define PCI_DEVICE_ID_ARECA_1300 0x1300
  28. #define PCI_DEVICE_ID_ARECA_1320 0x1320
  29. enum chip_flavors {
  30. chip_6320,
  31. chip_6440,
  32. chip_6485,
  33. chip_9480,
  34. chip_9180,
  35. chip_9445,
  36. chip_9485,
  37. chip_1300,
  38. chip_1320
  39. };
  40. /* driver compile-time configuration */
  41. enum driver_configuration {
  42. MVS_TX_RING_SZ = 1024, /* TX ring size (12-bit) */
  43. MVS_RX_RING_SZ = 1024, /* RX ring size (12-bit) */
  44. /* software requires power-of-2
  45. ring size */
  46. MVS_SOC_SLOTS = 64,
  47. MVS_SOC_TX_RING_SZ = MVS_SOC_SLOTS * 2,
  48. MVS_SOC_RX_RING_SZ = MVS_SOC_SLOTS * 2,
  49. MVS_SLOT_BUF_SZ = 8192, /* cmd tbl + IU + status + PRD */
  50. MVS_SSP_CMD_SZ = 64, /* SSP command table buffer size */
  51. MVS_ATA_CMD_SZ = 96, /* SATA command table buffer size */
  52. MVS_OAF_SZ = 64, /* Open address frame buffer size */
  53. MVS_QUEUE_SIZE = 64, /* Support Queue depth */
  54. MVS_SOC_CAN_QUEUE = MVS_SOC_SLOTS - 2,
  55. };
  56. /* unchangeable hardware details */
  57. enum hardware_details {
  58. MVS_MAX_PHYS = 8, /* max. possible phys */
  59. MVS_MAX_PORTS = 8, /* max. possible ports */
  60. MVS_SOC_PHYS = 4, /* soc phys */
  61. MVS_SOC_PORTS = 4, /* soc phys */
  62. MVS_MAX_DEVICES = 1024, /* max supported device */
  63. };
  64. /* peripheral registers (BAR2) */
  65. enum peripheral_registers {
  66. SPI_CTL = 0x10, /* EEPROM control */
  67. SPI_CMD = 0x14, /* EEPROM command */
  68. SPI_DATA = 0x18, /* EEPROM data */
  69. };
  70. enum peripheral_register_bits {
  71. TWSI_RDY = (1U << 7), /* EEPROM interface ready */
  72. TWSI_RD = (1U << 4), /* EEPROM read access */
  73. SPI_ADDR_MASK = 0x3ffff, /* bits 17:0 */
  74. };
  75. enum hw_register_bits {
  76. /* MVS_GBL_CTL */
  77. INT_EN = (1U << 1), /* Global int enable */
  78. HBA_RST = (1U << 0), /* HBA reset */
  79. /* MVS_GBL_INT_STAT */
  80. INT_XOR = (1U << 4), /* XOR engine event */
  81. INT_SAS_SATA = (1U << 0), /* SAS/SATA event */
  82. /* MVS_GBL_PORT_TYPE */ /* shl for ports 1-3 */
  83. SATA_TARGET = (1U << 16), /* port0 SATA target enable */
  84. MODE_AUTO_DET_PORT7 = (1U << 15), /* port0 SAS/SATA autodetect */
  85. MODE_AUTO_DET_PORT6 = (1U << 14),
  86. MODE_AUTO_DET_PORT5 = (1U << 13),
  87. MODE_AUTO_DET_PORT4 = (1U << 12),
  88. MODE_AUTO_DET_PORT3 = (1U << 11),
  89. MODE_AUTO_DET_PORT2 = (1U << 10),
  90. MODE_AUTO_DET_PORT1 = (1U << 9),
  91. MODE_AUTO_DET_PORT0 = (1U << 8),
  92. MODE_AUTO_DET_EN = MODE_AUTO_DET_PORT0 | MODE_AUTO_DET_PORT1 |
  93. MODE_AUTO_DET_PORT2 | MODE_AUTO_DET_PORT3 |
  94. MODE_AUTO_DET_PORT4 | MODE_AUTO_DET_PORT5 |
  95. MODE_AUTO_DET_PORT6 | MODE_AUTO_DET_PORT7,
  96. MODE_SAS_PORT7_MASK = (1U << 7), /* port0 SAS(1), SATA(0) mode */
  97. MODE_SAS_PORT6_MASK = (1U << 6),
  98. MODE_SAS_PORT5_MASK = (1U << 5),
  99. MODE_SAS_PORT4_MASK = (1U << 4),
  100. MODE_SAS_PORT3_MASK = (1U << 3),
  101. MODE_SAS_PORT2_MASK = (1U << 2),
  102. MODE_SAS_PORT1_MASK = (1U << 1),
  103. MODE_SAS_PORT0_MASK = (1U << 0),
  104. MODE_SAS_SATA = MODE_SAS_PORT0_MASK | MODE_SAS_PORT1_MASK |
  105. MODE_SAS_PORT2_MASK | MODE_SAS_PORT3_MASK |
  106. MODE_SAS_PORT4_MASK | MODE_SAS_PORT5_MASK |
  107. MODE_SAS_PORT6_MASK | MODE_SAS_PORT7_MASK,
  108. /* SAS_MODE value may be
  109. * dictated (in hw) by values
  110. * of SATA_TARGET & AUTO_DET
  111. */
  112. /* MVS_TX_CFG */
  113. TX_EN = (1U << 16), /* Enable TX */
  114. TX_RING_SZ_MASK = 0xfff, /* TX ring size, bits 11:0 */
  115. /* MVS_RX_CFG */
  116. RX_EN = (1U << 16), /* Enable RX */
  117. RX_RING_SZ_MASK = 0xfff, /* RX ring size, bits 11:0 */
  118. /* MVS_INT_COAL */
  119. COAL_EN = (1U << 16), /* Enable int coalescing */
  120. /* MVS_INT_STAT, MVS_INT_MASK */
  121. CINT_I2C = (1U << 31), /* I2C event */
  122. CINT_SW0 = (1U << 30), /* software event 0 */
  123. CINT_SW1 = (1U << 29), /* software event 1 */
  124. CINT_PRD_BC = (1U << 28), /* PRD BC err for read cmd */
  125. CINT_DMA_PCIE = (1U << 27), /* DMA to PCIE timeout */
  126. CINT_MEM = (1U << 26), /* int mem parity err */
  127. CINT_I2C_SLAVE = (1U << 25), /* slave I2C event */
  128. CINT_NON_SPEC_NCQ_ERROR = (1U << 25), /* Non specific NCQ error */
  129. CINT_SRS = (1U << 3), /* SRS event */
  130. CINT_CI_STOP = (1U << 1), /* cmd issue stopped */
  131. CINT_DONE = (1U << 0), /* cmd completion */
  132. /* shl for ports 1-3 */
  133. CINT_PORT_STOPPED = (1U << 16), /* port0 stopped */
  134. CINT_PORT = (1U << 8), /* port0 event */
  135. CINT_PORT_MASK_OFFSET = 8,
  136. CINT_PORT_MASK = (0xFF << CINT_PORT_MASK_OFFSET),
  137. CINT_PHY_MASK_OFFSET = 4,
  138. CINT_PHY_MASK = (0x0F << CINT_PHY_MASK_OFFSET),
  139. /* TX (delivery) ring bits */
  140. TXQ_CMD_SHIFT = 29,
  141. TXQ_CMD_SSP = 1, /* SSP protocol */
  142. TXQ_CMD_SMP = 2, /* SMP protocol */
  143. TXQ_CMD_STP = 3, /* STP/SATA protocol */
  144. TXQ_CMD_SSP_FREE_LIST = 4, /* add to SSP target free list */
  145. TXQ_CMD_SLOT_RESET = 7, /* reset command slot */
  146. TXQ_MODE_I = (1U << 28), /* mode: 0=target,1=initiator */
  147. TXQ_MODE_TARGET = 0,
  148. TXQ_MODE_INITIATOR = 1,
  149. TXQ_PRIO_HI = (1U << 27), /* priority: 0=normal, 1=high */
  150. TXQ_PRI_NORMAL = 0,
  151. TXQ_PRI_HIGH = 1,
  152. TXQ_SRS_SHIFT = 20, /* SATA register set */
  153. TXQ_SRS_MASK = 0x7f,
  154. TXQ_PHY_SHIFT = 12, /* PHY bitmap */
  155. TXQ_PHY_MASK = 0xff,
  156. TXQ_SLOT_MASK = 0xfff, /* slot number */
  157. /* RX (completion) ring bits */
  158. RXQ_GOOD = (1U << 23), /* Response good */
  159. RXQ_SLOT_RESET = (1U << 21), /* Slot reset complete */
  160. RXQ_CMD_RX = (1U << 20), /* target cmd received */
  161. RXQ_ATTN = (1U << 19), /* attention */
  162. RXQ_RSP = (1U << 18), /* response frame xfer'd */
  163. RXQ_ERR = (1U << 17), /* err info rec xfer'd */
  164. RXQ_DONE = (1U << 16), /* cmd complete */
  165. RXQ_SLOT_MASK = 0xfff, /* slot number */
  166. /* mvs_cmd_hdr bits */
  167. MCH_PRD_LEN_SHIFT = 16, /* 16-bit PRD table len */
  168. MCH_SSP_FR_TYPE_SHIFT = 13, /* SSP frame type */
  169. /* SSP initiator only */
  170. MCH_SSP_FR_CMD = 0x0, /* COMMAND frame */
  171. /* SSP initiator or target */
  172. MCH_SSP_FR_TASK = 0x1, /* TASK frame */
  173. /* SSP target only */
  174. MCH_SSP_FR_XFER_RDY = 0x4, /* XFER_RDY frame */
  175. MCH_SSP_FR_RESP = 0x5, /* RESPONSE frame */
  176. MCH_SSP_FR_READ = 0x6, /* Read DATA frame(s) */
  177. MCH_SSP_FR_READ_RESP = 0x7, /* ditto, plus RESPONSE */
  178. MCH_SSP_MODE_PASSTHRU = 1,
  179. MCH_SSP_MODE_NORMAL = 0,
  180. MCH_PASSTHRU = (1U << 12), /* pass-through (SSP) */
  181. MCH_FBURST = (1U << 11), /* first burst (SSP) */
  182. MCH_CHK_LEN = (1U << 10), /* chk xfer len (SSP) */
  183. MCH_RETRY = (1U << 9), /* tport layer retry (SSP) */
  184. MCH_PROTECTION = (1U << 8), /* protection info rec (SSP) */
  185. MCH_RESET = (1U << 7), /* Reset (STP/SATA) */
  186. MCH_FPDMA = (1U << 6), /* First party DMA (STP/SATA) */
  187. MCH_ATAPI = (1U << 5), /* ATAPI (STP/SATA) */
  188. MCH_BIST = (1U << 4), /* BIST activate (STP/SATA) */
  189. MCH_PMP_MASK = 0xf, /* PMP from cmd FIS (STP/SATA)*/
  190. CCTL_RST = (1U << 5), /* port logic reset */
  191. /* 0(LSB first), 1(MSB first) */
  192. CCTL_ENDIAN_DATA = (1U << 3), /* PRD data */
  193. CCTL_ENDIAN_RSP = (1U << 2), /* response frame */
  194. CCTL_ENDIAN_OPEN = (1U << 1), /* open address frame */
  195. CCTL_ENDIAN_CMD = (1U << 0), /* command table */
  196. /* MVS_Px_SER_CTLSTAT (per-phy control) */
  197. PHY_SSP_RST = (1U << 3), /* reset SSP link layer */
  198. PHY_BCAST_CHG = (1U << 2), /* broadcast(change) notif */
  199. PHY_RST_HARD = (1U << 1), /* hard reset + phy reset */
  200. PHY_RST = (1U << 0), /* phy reset */
  201. PHY_READY_MASK = (1U << 20),
  202. /* MVS_Px_INT_STAT, MVS_Px_INT_MASK (per-phy events) */
  203. PHYEV_DEC_ERR = (1U << 24), /* Phy Decoding Error */
  204. PHYEV_DCDR_ERR = (1U << 23), /* STP Deocder Error */
  205. PHYEV_CRC_ERR = (1U << 22), /* STP CRC Error */
  206. PHYEV_UNASSOC_FIS = (1U << 19), /* unassociated FIS rx'd */
  207. PHYEV_AN = (1U << 18), /* SATA async notification */
  208. PHYEV_BIST_ACT = (1U << 17), /* BIST activate FIS */
  209. PHYEV_SIG_FIS = (1U << 16), /* signature FIS */
  210. PHYEV_POOF = (1U << 12), /* phy ready from 1 -> 0 */
  211. PHYEV_IU_BIG = (1U << 11), /* IU too long err */
  212. PHYEV_IU_SMALL = (1U << 10), /* IU too short err */
  213. PHYEV_UNK_TAG = (1U << 9), /* unknown tag */
  214. PHYEV_BROAD_CH = (1U << 8), /* broadcast(CHANGE) */
  215. PHYEV_COMWAKE = (1U << 7), /* COMWAKE rx'd */
  216. PHYEV_PORT_SEL = (1U << 6), /* port selector present */
  217. PHYEV_HARD_RST = (1U << 5), /* hard reset rx'd */
  218. PHYEV_ID_TMOUT = (1U << 4), /* identify timeout */
  219. PHYEV_ID_FAIL = (1U << 3), /* identify failed */
  220. PHYEV_ID_DONE = (1U << 2), /* identify done */
  221. PHYEV_HARD_RST_DONE = (1U << 1), /* hard reset done */
  222. PHYEV_RDY_CH = (1U << 0), /* phy ready changed state */
  223. /* MVS_PCS */
  224. PCS_EN_SATA_REG_SHIFT = (16), /* Enable SATA Register Set */
  225. PCS_EN_PORT_XMT_SHIFT = (12), /* Enable Port Transmit */
  226. PCS_EN_PORT_XMT_SHIFT2 = (8), /* For 6485 */
  227. PCS_SATA_RETRY = (1U << 8), /* retry ctl FIS on R_ERR */
  228. PCS_RSP_RX_EN = (1U << 7), /* raw response rx */
  229. PCS_SATA_RETRY_2 = (1U << 6), /* For 9180 */
  230. PCS_SELF_CLEAR = (1U << 5), /* self-clearing int mode */
  231. PCS_FIS_RX_EN = (1U << 4), /* FIS rx enable */
  232. PCS_CMD_STOP_ERR = (1U << 3), /* cmd stop-on-err enable */
  233. PCS_CMD_RST = (1U << 1), /* reset cmd issue */
  234. PCS_CMD_EN = (1U << 0), /* enable cmd issue */
  235. /* Port n Attached Device Info */
  236. PORT_DEV_SSP_TRGT = (1U << 19),
  237. PORT_DEV_SMP_TRGT = (1U << 18),
  238. PORT_DEV_STP_TRGT = (1U << 17),
  239. PORT_DEV_SSP_INIT = (1U << 11),
  240. PORT_DEV_SMP_INIT = (1U << 10),
  241. PORT_DEV_STP_INIT = (1U << 9),
  242. PORT_PHY_ID_MASK = (0xFFU << 24),
  243. PORT_SSP_TRGT_MASK = (0x1U << 19),
  244. PORT_SSP_INIT_MASK = (0x1U << 11),
  245. PORT_DEV_TRGT_MASK = (0x7U << 17),
  246. PORT_DEV_INIT_MASK = (0x7U << 9),
  247. PORT_DEV_TYPE_MASK = (0x7U << 0),
  248. /* Port n PHY Status */
  249. PHY_RDY = (1U << 2),
  250. PHY_DW_SYNC = (1U << 1),
  251. PHY_OOB_DTCTD = (1U << 0),
  252. /* VSR */
  253. /* PHYMODE 6 (CDB) */
  254. PHY_MODE6_LATECLK = (1U << 29), /* Lock Clock */
  255. PHY_MODE6_DTL_SPEED = (1U << 27), /* Digital Loop Speed */
  256. PHY_MODE6_FC_ORDER = (1U << 26), /* Fibre Channel Mode Order*/
  257. PHY_MODE6_MUCNT_EN = (1U << 24), /* u Count Enable */
  258. PHY_MODE6_SEL_MUCNT_LEN = (1U << 22), /* Training Length Select */
  259. PHY_MODE6_SELMUPI = (1U << 20), /* Phase Multi Select (init) */
  260. PHY_MODE6_SELMUPF = (1U << 18), /* Phase Multi Select (final) */
  261. PHY_MODE6_SELMUFF = (1U << 16), /* Freq Loop Multi Sel(final) */
  262. PHY_MODE6_SELMUFI = (1U << 14), /* Freq Loop Multi Sel(init) */
  263. PHY_MODE6_FREEZE_LOOP = (1U << 12), /* Freeze Rx CDR Loop */
  264. PHY_MODE6_INT_RXFOFFS = (1U << 3), /* Rx CDR Freq Loop Enable */
  265. PHY_MODE6_FRC_RXFOFFS = (1U << 2), /* Initial Rx CDR Offset */
  266. PHY_MODE6_STAU_0D8 = (1U << 1), /* Rx CDR Freq Loop Saturate */
  267. PHY_MODE6_RXSAT_DIS = (1U << 0), /* Saturate Ctl */
  268. };
  269. /* SAS/SATA configuration port registers, aka phy registers */
  270. enum sas_sata_config_port_regs {
  271. PHYR_IDENTIFY = 0x00, /* info for IDENTIFY frame */
  272. PHYR_ADDR_LO = 0x04, /* my SAS address (low) */
  273. PHYR_ADDR_HI = 0x08, /* my SAS address (high) */
  274. PHYR_ATT_DEV_INFO = 0x0C, /* attached device info */
  275. PHYR_ATT_ADDR_LO = 0x10, /* attached dev SAS addr (low) */
  276. PHYR_ATT_ADDR_HI = 0x14, /* attached dev SAS addr (high) */
  277. PHYR_SATA_CTL = 0x18, /* SATA control */
  278. PHYR_PHY_STAT = 0x1C, /* PHY status */
  279. PHYR_SATA_SIG0 = 0x20, /*port SATA signature FIS(Byte 0-3) */
  280. PHYR_SATA_SIG1 = 0x24, /*port SATA signature FIS(Byte 4-7) */
  281. PHYR_SATA_SIG2 = 0x28, /*port SATA signature FIS(Byte 8-11) */
  282. PHYR_SATA_SIG3 = 0x2c, /*port SATA signature FIS(Byte 12-15) */
  283. PHYR_R_ERR_COUNT = 0x30, /* port R_ERR count register */
  284. PHYR_CRC_ERR_COUNT = 0x34, /* port CRC error count register */
  285. PHYR_WIDE_PORT = 0x38, /* wide port participating */
  286. PHYR_CURRENT0 = 0x80, /* current connection info 0 */
  287. PHYR_CURRENT1 = 0x84, /* current connection info 1 */
  288. PHYR_CURRENT2 = 0x88, /* current connection info 2 */
  289. CONFIG_ID_FRAME0 = 0x100, /* Port device ID frame register 0 */
  290. CONFIG_ID_FRAME1 = 0x104, /* Port device ID frame register 1 */
  291. CONFIG_ID_FRAME2 = 0x108, /* Port device ID frame register 2 */
  292. CONFIG_ID_FRAME3 = 0x10c, /* Port device ID frame register 3 */
  293. CONFIG_ID_FRAME4 = 0x110, /* Port device ID frame register 4 */
  294. CONFIG_ID_FRAME5 = 0x114, /* Port device ID frame register 5 */
  295. CONFIG_ID_FRAME6 = 0x118, /* Port device ID frame register 6 */
  296. CONFIG_ATT_ID_FRAME0 = 0x11c, /* attached ID frame register 0 */
  297. CONFIG_ATT_ID_FRAME1 = 0x120, /* attached ID frame register 1 */
  298. CONFIG_ATT_ID_FRAME2 = 0x124, /* attached ID frame register 2 */
  299. CONFIG_ATT_ID_FRAME3 = 0x128, /* attached ID frame register 3 */
  300. CONFIG_ATT_ID_FRAME4 = 0x12c, /* attached ID frame register 4 */
  301. CONFIG_ATT_ID_FRAME5 = 0x130, /* attached ID frame register 5 */
  302. CONFIG_ATT_ID_FRAME6 = 0x134, /* attached ID frame register 6 */
  303. };
  304. enum sas_cmd_port_registers {
  305. CMD_CMRST_OOB_DET = 0x100, /* COMRESET OOB detect register */
  306. CMD_CMWK_OOB_DET = 0x104, /* COMWAKE OOB detect register */
  307. CMD_CMSAS_OOB_DET = 0x108, /* COMSAS OOB detect register */
  308. CMD_BRST_OOB_DET = 0x10c, /* burst OOB detect register */
  309. CMD_OOB_SPACE = 0x110, /* OOB space control register */
  310. CMD_OOB_BURST = 0x114, /* OOB burst control register */
  311. CMD_PHY_TIMER = 0x118, /* PHY timer control register */
  312. CMD_PHY_CONFIG0 = 0x11c, /* PHY config register 0 */
  313. CMD_PHY_CONFIG1 = 0x120, /* PHY config register 1 */
  314. CMD_SAS_CTL0 = 0x124, /* SAS control register 0 */
  315. CMD_SAS_CTL1 = 0x128, /* SAS control register 1 */
  316. CMD_SAS_CTL2 = 0x12c, /* SAS control register 2 */
  317. CMD_SAS_CTL3 = 0x130, /* SAS control register 3 */
  318. CMD_ID_TEST = 0x134, /* ID test register */
  319. CMD_PL_TIMER = 0x138, /* PL timer register */
  320. CMD_WD_TIMER = 0x13c, /* WD timer register */
  321. CMD_PORT_SEL_COUNT = 0x140, /* port selector count register */
  322. CMD_APP_MEM_CTL = 0x144, /* Application Memory Control */
  323. CMD_XOR_MEM_CTL = 0x148, /* XOR Block Memory Control */
  324. CMD_DMA_MEM_CTL = 0x14c, /* DMA Block Memory Control */
  325. CMD_PORT_MEM_CTL0 = 0x150, /* Port Memory Control 0 */
  326. CMD_PORT_MEM_CTL1 = 0x154, /* Port Memory Control 1 */
  327. CMD_SATA_PORT_MEM_CTL0 = 0x158, /* SATA Port Memory Control 0 */
  328. CMD_SATA_PORT_MEM_CTL1 = 0x15c, /* SATA Port Memory Control 1 */
  329. CMD_XOR_MEM_BIST_CTL = 0x160, /* XOR Memory BIST Control */
  330. CMD_XOR_MEM_BIST_STAT = 0x164, /* XOR Memroy BIST Status */
  331. CMD_DMA_MEM_BIST_CTL = 0x168, /* DMA Memory BIST Control */
  332. CMD_DMA_MEM_BIST_STAT = 0x16c, /* DMA Memory BIST Status */
  333. CMD_PORT_MEM_BIST_CTL = 0x170, /* Port Memory BIST Control */
  334. CMD_PORT_MEM_BIST_STAT0 = 0x174, /* Port Memory BIST Status 0 */
  335. CMD_PORT_MEM_BIST_STAT1 = 0x178, /* Port Memory BIST Status 1 */
  336. CMD_STP_MEM_BIST_CTL = 0x17c, /* STP Memory BIST Control */
  337. CMD_STP_MEM_BIST_STAT0 = 0x180, /* STP Memory BIST Status 0 */
  338. CMD_STP_MEM_BIST_STAT1 = 0x184, /* STP Memory BIST Status 1 */
  339. CMD_RESET_COUNT = 0x188, /* Reset Count */
  340. CMD_MONTR_DATA_SEL = 0x18C, /* Monitor Data/Select */
  341. CMD_PLL_PHY_CONFIG = 0x190, /* PLL/PHY Configuration */
  342. CMD_PHY_CTL = 0x194, /* PHY Control and Status */
  343. CMD_PHY_TEST_COUNT0 = 0x198, /* Phy Test Count 0 */
  344. CMD_PHY_TEST_COUNT1 = 0x19C, /* Phy Test Count 1 */
  345. CMD_PHY_TEST_COUNT2 = 0x1A0, /* Phy Test Count 2 */
  346. CMD_APP_ERR_CONFIG = 0x1A4, /* Application Error Configuration */
  347. CMD_PND_FIFO_CTL0 = 0x1A8, /* Pending FIFO Control 0 */
  348. CMD_HOST_CTL = 0x1AC, /* Host Control Status */
  349. CMD_HOST_WR_DATA = 0x1B0, /* Host Write Data */
  350. CMD_HOST_RD_DATA = 0x1B4, /* Host Read Data */
  351. CMD_PHY_MODE_21 = 0x1B8, /* Phy Mode 21 */
  352. CMD_SL_MODE0 = 0x1BC, /* SL Mode 0 */
  353. CMD_SL_MODE1 = 0x1C0, /* SL Mode 1 */
  354. CMD_PND_FIFO_CTL1 = 0x1C4, /* Pending FIFO Control 1 */
  355. CMD_PORT_LAYER_TIMER1 = 0x1E0, /* Port Layer Timer 1 */
  356. CMD_LINK_TIMER = 0x1E4, /* Link Timer */
  357. };
  358. enum mvs_info_flags {
  359. MVF_PHY_PWR_FIX = (1U << 1), /* bug workaround */
  360. MVF_FLAG_SOC = (1U << 2), /* SoC integrated controllers */
  361. };
  362. enum mvs_event_flags {
  363. PHY_PLUG_EVENT = (3U),
  364. PHY_PLUG_IN = (1U << 0), /* phy plug in */
  365. PHY_PLUG_OUT = (1U << 1), /* phy plug out */
  366. EXP_BRCT_CHG = (1U << 2), /* broadcast change */
  367. };
  368. enum mvs_port_type {
  369. PORT_TGT_MASK = (1U << 5),
  370. PORT_INIT_PORT = (1U << 4),
  371. PORT_TGT_PORT = (1U << 3),
  372. PORT_INIT_TGT_PORT = (PORT_INIT_PORT | PORT_TGT_PORT),
  373. PORT_TYPE_SAS = (1U << 1),
  374. PORT_TYPE_SATA = (1U << 0),
  375. };
  376. /* Command Table Format */
  377. enum ct_format {
  378. /* SSP */
  379. SSP_F_H = 0x00,
  380. SSP_F_IU = 0x18,
  381. SSP_F_MAX = 0x4D,
  382. /* STP */
  383. STP_CMD_FIS = 0x00,
  384. STP_ATAPI_CMD = 0x40,
  385. STP_F_MAX = 0x10,
  386. /* SMP */
  387. SMP_F_T = 0x00,
  388. SMP_F_DEP = 0x01,
  389. SMP_F_MAX = 0x101,
  390. };
  391. enum status_buffer {
  392. SB_EIR_OFF = 0x00, /* Error Information Record */
  393. SB_RFB_OFF = 0x08, /* Response Frame Buffer */
  394. SB_RFB_MAX = 0x400, /* RFB size*/
  395. };
  396. enum error_info_rec {
  397. CMD_ISS_STPD = (1U << 31), /* Cmd Issue Stopped */
  398. CMD_PI_ERR = (1U << 30), /* Protection info error. see flags2 */
  399. RSP_OVER = (1U << 29), /* rsp buffer overflow */
  400. RETRY_LIM = (1U << 28), /* FIS/frame retry limit exceeded */
  401. UNK_FIS = (1U << 27), /* unknown FIS */
  402. DMA_TERM = (1U << 26), /* DMA terminate primitive rx'd */
  403. SYNC_ERR = (1U << 25), /* SYNC rx'd during frame xmit */
  404. TFILE_ERR = (1U << 24), /* SATA taskfile Error bit set */
  405. R_ERR = (1U << 23), /* SATA returned R_ERR prim */
  406. RD_OFS = (1U << 20), /* Read DATA frame invalid offset */
  407. XFER_RDY_OFS = (1U << 19), /* XFER_RDY offset error */
  408. UNEXP_XFER_RDY = (1U << 18), /* unexpected XFER_RDY error */
  409. DATA_OVER_UNDER = (1U << 16), /* data overflow/underflow */
  410. INTERLOCK = (1U << 15), /* interlock error */
  411. NAK = (1U << 14), /* NAK rx'd */
  412. ACK_NAK_TO = (1U << 13), /* ACK/NAK timeout */
  413. CXN_CLOSED = (1U << 12), /* cxn closed w/out ack/nak */
  414. OPEN_TO = (1U << 11), /* I_T nexus lost, open cxn timeout */
  415. PATH_BLOCKED = (1U << 10), /* I_T nexus lost, pathway blocked */
  416. NO_DEST = (1U << 9), /* I_T nexus lost, no destination */
  417. STP_RES_BSY = (1U << 8), /* STP resources busy */
  418. BREAK = (1U << 7), /* break received */
  419. BAD_DEST = (1U << 6), /* bad destination */
  420. BAD_PROTO = (1U << 5), /* protocol not supported */
  421. BAD_RATE = (1U << 4), /* cxn rate not supported */
  422. WRONG_DEST = (1U << 3), /* wrong destination error */
  423. CREDIT_TO = (1U << 2), /* credit timeout */
  424. WDOG_TO = (1U << 1), /* watchdog timeout */
  425. BUF_PAR = (1U << 0), /* buffer parity error */
  426. };
  427. enum error_info_rec_2 {
  428. SLOT_BSY_ERR = (1U << 31), /* Slot Busy Error */
  429. GRD_CHK_ERR = (1U << 14), /* Guard Check Error */
  430. APP_CHK_ERR = (1U << 13), /* Application Check error */
  431. REF_CHK_ERR = (1U << 12), /* Reference Check Error */
  432. USR_BLK_NM = (1U << 0), /* User Block Number */
  433. };
  434. enum pci_cfg_register_bits {
  435. PCTL_PWR_OFF = (0xFU << 24),
  436. PCTL_COM_ON = (0xFU << 20),
  437. PCTL_LINK_RST = (0xFU << 16),
  438. PCTL_LINK_OFFS = (16),
  439. PCTL_PHY_DSBL = (0xFU << 12),
  440. PCTL_PHY_DSBL_OFFS = (12),
  441. PRD_REQ_SIZE = (0x4000),
  442. PRD_REQ_MASK = (0x00007000),
  443. PLS_NEG_LINK_WD = (0x3FU << 4),
  444. PLS_NEG_LINK_WD_OFFS = 4,
  445. PLS_LINK_SPD = (0x0FU << 0),
  446. PLS_LINK_SPD_OFFS = 0,
  447. };
  448. enum open_frame_protocol {
  449. PROTOCOL_SMP = 0x0,
  450. PROTOCOL_SSP = 0x1,
  451. PROTOCOL_STP = 0x2,
  452. };
  453. /* define for response frame datapres field */
  454. enum datapres_field {
  455. NO_DATA = 0,
  456. RESPONSE_DATA = 1,
  457. SENSE_DATA = 2,
  458. };
  459. /* define task management IU */
  460. struct mvs_tmf_task{
  461. u8 tmf;
  462. u16 tag_of_task_to_be_managed;
  463. };
  464. #endif