qla3xxx.h 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. /*
  2. * QLogic QLA3xxx NIC HBA Driver
  3. * Copyright (c) 2003-2006 QLogic Corporation
  4. *
  5. * See LICENSE.qla3xxx for copyright and licensing details.
  6. */
  7. #ifndef _QLA3XXX_H_
  8. #define _QLA3XXX_H_
  9. /*
  10. * IOCB Definitions...
  11. */
  12. #pragma pack(1)
  13. #define OPCODE_OB_MAC_IOCB_FN0 0x01
  14. #define OPCODE_OB_MAC_IOCB_FN2 0x21
  15. #define OPCODE_IB_MAC_IOCB 0xF9
  16. #define OPCODE_IB_3032_MAC_IOCB 0x09
  17. #define OPCODE_IB_IP_IOCB 0xFA
  18. #define OPCODE_IB_3032_IP_IOCB 0x0A
  19. #define OPCODE_FUNC_ID_MASK 0x30
  20. #define OUTBOUND_MAC_IOCB 0x01 /* plus function bits */
  21. #define FN0_MA_BITS_MASK 0x00
  22. #define FN1_MA_BITS_MASK 0x80
  23. struct ob_mac_iocb_req {
  24. u8 opcode;
  25. u8 flags;
  26. #define OB_MAC_IOCB_REQ_MA 0xe0
  27. #define OB_MAC_IOCB_REQ_F 0x10
  28. #define OB_MAC_IOCB_REQ_X 0x08
  29. #define OB_MAC_IOCB_REQ_D 0x02
  30. #define OB_MAC_IOCB_REQ_I 0x01
  31. u8 flags1;
  32. #define OB_3032MAC_IOCB_REQ_IC 0x04
  33. #define OB_3032MAC_IOCB_REQ_TC 0x02
  34. #define OB_3032MAC_IOCB_REQ_UC 0x01
  35. u8 reserved0;
  36. u32 transaction_id; /* opaque for hardware */
  37. __le16 data_len;
  38. u8 ip_hdr_off;
  39. u8 ip_hdr_len;
  40. __le32 reserved1;
  41. __le32 reserved2;
  42. __le32 buf_addr0_low;
  43. __le32 buf_addr0_high;
  44. __le32 buf_0_len;
  45. __le32 buf_addr1_low;
  46. __le32 buf_addr1_high;
  47. __le32 buf_1_len;
  48. __le32 buf_addr2_low;
  49. __le32 buf_addr2_high;
  50. __le32 buf_2_len;
  51. __le32 reserved3;
  52. __le32 reserved4;
  53. };
  54. /*
  55. * The following constants define control bits for buffer
  56. * length fields for all IOCB's.
  57. */
  58. #define OB_MAC_IOCB_REQ_E 0x80000000 /* Last valid buffer in list. */
  59. #define OB_MAC_IOCB_REQ_C 0x40000000 /* points to an OAL. (continuation) */
  60. #define OB_MAC_IOCB_REQ_L 0x20000000 /* Auburn local address pointer. */
  61. #define OB_MAC_IOCB_REQ_R 0x10000000 /* 32-bit address pointer. */
  62. struct ob_mac_iocb_rsp {
  63. u8 opcode;
  64. u8 flags;
  65. #define OB_MAC_IOCB_RSP_P 0x08
  66. #define OB_MAC_IOCB_RSP_L 0x04
  67. #define OB_MAC_IOCB_RSP_S 0x02
  68. #define OB_MAC_IOCB_RSP_I 0x01
  69. __le16 reserved0;
  70. u32 transaction_id; /* opaque for hardware */
  71. __le32 reserved1;
  72. __le32 reserved2;
  73. };
  74. struct ib_mac_iocb_rsp {
  75. u8 opcode;
  76. #define IB_MAC_IOCB_RSP_V 0x80
  77. u8 flags;
  78. #define IB_MAC_IOCB_RSP_S 0x80
  79. #define IB_MAC_IOCB_RSP_H1 0x40
  80. #define IB_MAC_IOCB_RSP_H0 0x20
  81. #define IB_MAC_IOCB_RSP_B 0x10
  82. #define IB_MAC_IOCB_RSP_M 0x08
  83. #define IB_MAC_IOCB_RSP_MA 0x07
  84. __le16 length;
  85. __le32 reserved;
  86. __le32 ial_low;
  87. __le32 ial_high;
  88. };
  89. struct ob_ip_iocb_req {
  90. u8 opcode;
  91. __le16 flags;
  92. #define OB_IP_IOCB_REQ_O 0x100
  93. #define OB_IP_IOCB_REQ_H 0x008
  94. #define OB_IP_IOCB_REQ_U 0x004
  95. #define OB_IP_IOCB_REQ_D 0x002
  96. #define OB_IP_IOCB_REQ_I 0x001
  97. u8 reserved0;
  98. __le32 transaction_id;
  99. __le16 data_len;
  100. __le16 reserved1;
  101. __le32 hncb_ptr_low;
  102. __le32 hncb_ptr_high;
  103. __le32 buf_addr0_low;
  104. __le32 buf_addr0_high;
  105. __le32 buf_0_len;
  106. __le32 buf_addr1_low;
  107. __le32 buf_addr1_high;
  108. __le32 buf_1_len;
  109. __le32 buf_addr2_low;
  110. __le32 buf_addr2_high;
  111. __le32 buf_2_len;
  112. __le32 reserved2;
  113. __le32 reserved3;
  114. };
  115. /* defines for BufferLength fields above */
  116. #define OB_IP_IOCB_REQ_E 0x80000000
  117. #define OB_IP_IOCB_REQ_C 0x40000000
  118. #define OB_IP_IOCB_REQ_L 0x20000000
  119. #define OB_IP_IOCB_REQ_R 0x10000000
  120. struct ob_ip_iocb_rsp {
  121. u8 opcode;
  122. u8 flags;
  123. #define OB_MAC_IOCB_RSP_H 0x10
  124. #define OB_MAC_IOCB_RSP_E 0x08
  125. #define OB_MAC_IOCB_RSP_L 0x04
  126. #define OB_MAC_IOCB_RSP_S 0x02
  127. #define OB_MAC_IOCB_RSP_I 0x01
  128. __le16 reserved0;
  129. __le32 transaction_id;
  130. __le32 reserved1;
  131. __le32 reserved2;
  132. };
  133. struct ib_ip_iocb_rsp {
  134. u8 opcode;
  135. #define IB_IP_IOCB_RSP_3032_V 0x80
  136. #define IB_IP_IOCB_RSP_3032_O 0x40
  137. #define IB_IP_IOCB_RSP_3032_I 0x20
  138. #define IB_IP_IOCB_RSP_3032_R 0x10
  139. u8 flags;
  140. #define IB_IP_IOCB_RSP_S 0x80
  141. #define IB_IP_IOCB_RSP_H1 0x40
  142. #define IB_IP_IOCB_RSP_H0 0x20
  143. #define IB_IP_IOCB_RSP_B 0x10
  144. #define IB_IP_IOCB_RSP_M 0x08
  145. #define IB_IP_IOCB_RSP_MA 0x07
  146. __le16 length;
  147. __le16 checksum;
  148. #define IB_IP_IOCB_RSP_3032_ICE 0x01
  149. #define IB_IP_IOCB_RSP_3032_CE 0x02
  150. #define IB_IP_IOCB_RSP_3032_NUC 0x04
  151. #define IB_IP_IOCB_RSP_3032_UDP 0x08
  152. #define IB_IP_IOCB_RSP_3032_TCP 0x10
  153. #define IB_IP_IOCB_RSP_3032_IPE 0x20
  154. __le16 reserved;
  155. #define IB_IP_IOCB_RSP_R 0x01
  156. __le32 ial_low;
  157. __le32 ial_high;
  158. };
  159. struct net_rsp_iocb {
  160. u8 opcode;
  161. u8 flags;
  162. __le16 reserved0;
  163. __le32 reserved[3];
  164. };
  165. #pragma pack()
  166. /*
  167. * Register Definitions...
  168. */
  169. #define PORT0_PHY_ADDRESS 0x1e00
  170. #define PORT1_PHY_ADDRESS 0x1f00
  171. #define ETHERNET_CRC_SIZE 4
  172. #define MII_SCAN_REGISTER 0x00000001
  173. #define PHY_ID_0_REG 2
  174. #define PHY_ID_1_REG 3
  175. #define PHY_OUI_1_MASK 0xfc00
  176. #define PHY_MODEL_MASK 0x03f0
  177. /* Address for the Agere Phy */
  178. #define MII_AGERE_ADDR_1 0x00001000
  179. #define MII_AGERE_ADDR_2 0x00001100
  180. /* 32-bit ispControlStatus */
  181. enum {
  182. ISP_CONTROL_NP_MASK = 0x0003,
  183. ISP_CONTROL_NP_PCSR = 0x0000,
  184. ISP_CONTROL_NP_HMCR = 0x0001,
  185. ISP_CONTROL_NP_LRAMCR = 0x0002,
  186. ISP_CONTROL_NP_PSR = 0x0003,
  187. ISP_CONTROL_RI = 0x0008,
  188. ISP_CONTROL_CI = 0x0010,
  189. ISP_CONTROL_PI = 0x0020,
  190. ISP_CONTROL_IN = 0x0040,
  191. ISP_CONTROL_BE = 0x0080,
  192. ISP_CONTROL_FN_MASK = 0x0700,
  193. ISP_CONTROL_FN0_NET = 0x0400,
  194. ISP_CONTROL_FN0_SCSI = 0x0500,
  195. ISP_CONTROL_FN1_NET = 0x0600,
  196. ISP_CONTROL_FN1_SCSI = 0x0700,
  197. ISP_CONTROL_LINK_DN_0 = 0x0800,
  198. ISP_CONTROL_LINK_DN_1 = 0x1000,
  199. ISP_CONTROL_FSR = 0x2000,
  200. ISP_CONTROL_FE = 0x4000,
  201. ISP_CONTROL_SR = 0x8000,
  202. };
  203. /* 32-bit ispInterruptMaskReg */
  204. enum {
  205. ISP_IMR_ENABLE_INT = 0x0004,
  206. ISP_IMR_DISABLE_RESET_INT = 0x0008,
  207. ISP_IMR_DISABLE_CMPL_INT = 0x0010,
  208. ISP_IMR_DISABLE_PROC_INT = 0x0020,
  209. };
  210. /* 32-bit serialPortInterfaceReg */
  211. enum {
  212. ISP_SERIAL_PORT_IF_CLK = 0x0001,
  213. ISP_SERIAL_PORT_IF_CS = 0x0002,
  214. ISP_SERIAL_PORT_IF_D0 = 0x0004,
  215. ISP_SERIAL_PORT_IF_DI = 0x0008,
  216. ISP_NVRAM_MASK = (0x000F << 16),
  217. ISP_SERIAL_PORT_IF_WE = 0x0010,
  218. ISP_SERIAL_PORT_IF_NVR_MASK = 0x001F,
  219. ISP_SERIAL_PORT_IF_SCI = 0x0400,
  220. ISP_SERIAL_PORT_IF_SC0 = 0x0800,
  221. ISP_SERIAL_PORT_IF_SCE = 0x1000,
  222. ISP_SERIAL_PORT_IF_SDI = 0x2000,
  223. ISP_SERIAL_PORT_IF_SDO = 0x4000,
  224. ISP_SERIAL_PORT_IF_SDE = 0x8000,
  225. ISP_SERIAL_PORT_IF_I2C_MASK = 0xFC00,
  226. };
  227. /* semaphoreReg */
  228. enum {
  229. QL_RESOURCE_MASK_BASE_CODE = 0x7,
  230. QL_RESOURCE_BITS_BASE_CODE = 0x4,
  231. QL_DRVR_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 1),
  232. QL_DDR_RAM_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 4),
  233. QL_PHY_GIO_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 7),
  234. QL_NVRAM_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 10),
  235. QL_FLASH_SEM_BITS = (QL_RESOURCE_BITS_BASE_CODE << 13),
  236. QL_DRVR_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (1 + 16)),
  237. QL_DDR_RAM_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (4 + 16)),
  238. QL_PHY_GIO_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (7 + 16)),
  239. QL_NVRAM_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (10 + 16)),
  240. QL_FLASH_SEM_MASK = (QL_RESOURCE_MASK_BASE_CODE << (13 + 16)),
  241. };
  242. /*
  243. * QL3XXX memory-mapped registers
  244. * QL3XXX has 4 "pages" of registers, each page occupying
  245. * 256 bytes. Each page has a "common" area at the start and then
  246. * page-specific registers after that.
  247. */
  248. struct ql3xxx_common_registers {
  249. u32 MB0; /* Offset 0x00 */
  250. u32 MB1; /* Offset 0x04 */
  251. u32 MB2; /* Offset 0x08 */
  252. u32 MB3; /* Offset 0x0c */
  253. u32 MB4; /* Offset 0x10 */
  254. u32 MB5; /* Offset 0x14 */
  255. u32 MB6; /* Offset 0x18 */
  256. u32 MB7; /* Offset 0x1c */
  257. u32 flashBiosAddr;
  258. u32 flashBiosData;
  259. u32 ispControlStatus;
  260. u32 ispInterruptMaskReg;
  261. u32 serialPortInterfaceReg;
  262. u32 semaphoreReg;
  263. u32 reqQProducerIndex;
  264. u32 rspQConsumerIndex;
  265. u32 rxLargeQProducerIndex;
  266. u32 rxSmallQProducerIndex;
  267. u32 arcMadiCommand;
  268. u32 arcMadiData;
  269. };
  270. enum {
  271. EXT_HW_CONFIG_SP_MASK = 0x0006,
  272. EXT_HW_CONFIG_SP_NONE = 0x0000,
  273. EXT_HW_CONFIG_SP_BYTE_PARITY = 0x0002,
  274. EXT_HW_CONFIG_SP_ECC = 0x0004,
  275. EXT_HW_CONFIG_SP_ECCx = 0x0006,
  276. EXT_HW_CONFIG_SIZE_MASK = 0x0060,
  277. EXT_HW_CONFIG_SIZE_128M = 0x0000,
  278. EXT_HW_CONFIG_SIZE_256M = 0x0020,
  279. EXT_HW_CONFIG_SIZE_512M = 0x0040,
  280. EXT_HW_CONFIG_SIZE_INVALID = 0x0060,
  281. EXT_HW_CONFIG_PD = 0x0080,
  282. EXT_HW_CONFIG_FW = 0x0200,
  283. EXT_HW_CONFIG_US = 0x0400,
  284. EXT_HW_CONFIG_DCS_MASK = 0x1800,
  285. EXT_HW_CONFIG_DCS_9MA = 0x0000,
  286. EXT_HW_CONFIG_DCS_15MA = 0x0800,
  287. EXT_HW_CONFIG_DCS_18MA = 0x1000,
  288. EXT_HW_CONFIG_DCS_24MA = 0x1800,
  289. EXT_HW_CONFIG_DDS_MASK = 0x6000,
  290. EXT_HW_CONFIG_DDS_9MA = 0x0000,
  291. EXT_HW_CONFIG_DDS_15MA = 0x2000,
  292. EXT_HW_CONFIG_DDS_18MA = 0x4000,
  293. EXT_HW_CONFIG_DDS_24MA = 0x6000,
  294. };
  295. /* InternalChipConfig */
  296. enum {
  297. INTERNAL_CHIP_DM = 0x0001,
  298. INTERNAL_CHIP_SD = 0x0002,
  299. INTERNAL_CHIP_RAP_MASK = 0x000C,
  300. INTERNAL_CHIP_RAP_RR = 0x0000,
  301. INTERNAL_CHIP_RAP_NRM = 0x0004,
  302. INTERNAL_CHIP_RAP_ERM = 0x0008,
  303. INTERNAL_CHIP_RAP_ERMx = 0x000C,
  304. INTERNAL_CHIP_WE = 0x0010,
  305. INTERNAL_CHIP_EF = 0x0020,
  306. INTERNAL_CHIP_FR = 0x0040,
  307. INTERNAL_CHIP_FW = 0x0080,
  308. INTERNAL_CHIP_FI = 0x0100,
  309. INTERNAL_CHIP_FT = 0x0200,
  310. };
  311. /* portControl */
  312. enum {
  313. PORT_CONTROL_DS = 0x0001,
  314. PORT_CONTROL_HH = 0x0002,
  315. PORT_CONTROL_EI = 0x0004,
  316. PORT_CONTROL_ET = 0x0008,
  317. PORT_CONTROL_EF = 0x0010,
  318. PORT_CONTROL_DRM = 0x0020,
  319. PORT_CONTROL_RLB = 0x0040,
  320. PORT_CONTROL_RCB = 0x0080,
  321. PORT_CONTROL_MAC = 0x0100,
  322. PORT_CONTROL_IPV = 0x0200,
  323. PORT_CONTROL_IFP = 0x0400,
  324. PORT_CONTROL_ITP = 0x0800,
  325. PORT_CONTROL_FI = 0x1000,
  326. PORT_CONTROL_DFP = 0x2000,
  327. PORT_CONTROL_OI = 0x4000,
  328. PORT_CONTROL_CC = 0x8000,
  329. };
  330. /* portStatus */
  331. enum {
  332. PORT_STATUS_SM0 = 0x0001,
  333. PORT_STATUS_SM1 = 0x0002,
  334. PORT_STATUS_X = 0x0008,
  335. PORT_STATUS_DL = 0x0080,
  336. PORT_STATUS_IC = 0x0200,
  337. PORT_STATUS_MRC = 0x0400,
  338. PORT_STATUS_NL = 0x0800,
  339. PORT_STATUS_REV_ID_MASK = 0x7000,
  340. PORT_STATUS_REV_ID_1 = 0x1000,
  341. PORT_STATUS_REV_ID_2 = 0x2000,
  342. PORT_STATUS_REV_ID_3 = 0x3000,
  343. PORT_STATUS_64 = 0x8000,
  344. PORT_STATUS_UP0 = 0x10000,
  345. PORT_STATUS_AC0 = 0x20000,
  346. PORT_STATUS_AE0 = 0x40000,
  347. PORT_STATUS_UP1 = 0x100000,
  348. PORT_STATUS_AC1 = 0x200000,
  349. PORT_STATUS_AE1 = 0x400000,
  350. PORT_STATUS_F0_ENABLED = 0x1000000,
  351. PORT_STATUS_F1_ENABLED = 0x2000000,
  352. PORT_STATUS_F2_ENABLED = 0x4000000,
  353. PORT_STATUS_F3_ENABLED = 0x8000000,
  354. };
  355. /* macMIIMgmtControlReg */
  356. enum {
  357. MAC_ADDR_INDIRECT_PTR_REG_RP_MASK = 0x0003,
  358. MAC_ADDR_INDIRECT_PTR_REG_RP_PRI_LWR = 0x0000,
  359. MAC_ADDR_INDIRECT_PTR_REG_RP_PRI_UPR = 0x0001,
  360. MAC_ADDR_INDIRECT_PTR_REG_RP_SEC_LWR = 0x0002,
  361. MAC_ADDR_INDIRECT_PTR_REG_RP_SEC_UPR = 0x0003,
  362. MAC_ADDR_INDIRECT_PTR_REG_PR = 0x0008,
  363. MAC_ADDR_INDIRECT_PTR_REG_SS = 0x0010,
  364. MAC_ADDR_INDIRECT_PTR_REG_SE = 0x0020,
  365. MAC_ADDR_INDIRECT_PTR_REG_SP = 0x0040,
  366. MAC_ADDR_INDIRECT_PTR_REG_PE = 0x0080,
  367. };
  368. /* macMIIMgmtControlReg */
  369. enum {
  370. MAC_MII_CONTROL_RC = 0x0001,
  371. MAC_MII_CONTROL_SC = 0x0002,
  372. MAC_MII_CONTROL_AS = 0x0004,
  373. MAC_MII_CONTROL_NP = 0x0008,
  374. MAC_MII_CONTROL_CLK_SEL_MASK = 0x0070,
  375. MAC_MII_CONTROL_CLK_SEL_DIV2 = 0x0000,
  376. MAC_MII_CONTROL_CLK_SEL_DIV4 = 0x0010,
  377. MAC_MII_CONTROL_CLK_SEL_DIV6 = 0x0020,
  378. MAC_MII_CONTROL_CLK_SEL_DIV8 = 0x0030,
  379. MAC_MII_CONTROL_CLK_SEL_DIV10 = 0x0040,
  380. MAC_MII_CONTROL_CLK_SEL_DIV14 = 0x0050,
  381. MAC_MII_CONTROL_CLK_SEL_DIV20 = 0x0060,
  382. MAC_MII_CONTROL_CLK_SEL_DIV28 = 0x0070,
  383. MAC_MII_CONTROL_RM = 0x8000,
  384. };
  385. /* macMIIStatusReg */
  386. enum {
  387. MAC_MII_STATUS_BSY = 0x0001,
  388. MAC_MII_STATUS_SC = 0x0002,
  389. MAC_MII_STATUS_NV = 0x0004,
  390. };
  391. enum {
  392. MAC_CONFIG_REG_PE = 0x0001,
  393. MAC_CONFIG_REG_TF = 0x0002,
  394. MAC_CONFIG_REG_RF = 0x0004,
  395. MAC_CONFIG_REG_FD = 0x0008,
  396. MAC_CONFIG_REG_GM = 0x0010,
  397. MAC_CONFIG_REG_LB = 0x0020,
  398. MAC_CONFIG_REG_SR = 0x8000,
  399. };
  400. enum {
  401. MAC_HALF_DUPLEX_REG_ED = 0x10000,
  402. MAC_HALF_DUPLEX_REG_NB = 0x20000,
  403. MAC_HALF_DUPLEX_REG_BNB = 0x40000,
  404. MAC_HALF_DUPLEX_REG_ALT = 0x80000,
  405. };
  406. enum {
  407. IP_ADDR_INDEX_REG_MASK = 0x000f,
  408. IP_ADDR_INDEX_REG_FUNC_0_PRI = 0x0000,
  409. IP_ADDR_INDEX_REG_FUNC_0_SEC = 0x0001,
  410. IP_ADDR_INDEX_REG_FUNC_1_PRI = 0x0002,
  411. IP_ADDR_INDEX_REG_FUNC_1_SEC = 0x0003,
  412. IP_ADDR_INDEX_REG_FUNC_2_PRI = 0x0004,
  413. IP_ADDR_INDEX_REG_FUNC_2_SEC = 0x0005,
  414. IP_ADDR_INDEX_REG_FUNC_3_PRI = 0x0006,
  415. IP_ADDR_INDEX_REG_FUNC_3_SEC = 0x0007,
  416. IP_ADDR_INDEX_REG_6 = 0x0008,
  417. IP_ADDR_INDEX_REG_OFFSET_MASK = 0x0030,
  418. IP_ADDR_INDEX_REG_E = 0x0040,
  419. };
  420. enum {
  421. QL3032_PORT_CONTROL_DS = 0x0001,
  422. QL3032_PORT_CONTROL_HH = 0x0002,
  423. QL3032_PORT_CONTROL_EIv6 = 0x0004,
  424. QL3032_PORT_CONTROL_EIv4 = 0x0008,
  425. QL3032_PORT_CONTROL_ET = 0x0010,
  426. QL3032_PORT_CONTROL_EF = 0x0020,
  427. QL3032_PORT_CONTROL_DRM = 0x0040,
  428. QL3032_PORT_CONTROL_RLB = 0x0080,
  429. QL3032_PORT_CONTROL_RCB = 0x0100,
  430. QL3032_PORT_CONTROL_KIE = 0x0200,
  431. };
  432. enum {
  433. PROBE_MUX_ADDR_REG_MUX_SEL_MASK = 0x003f,
  434. PROBE_MUX_ADDR_REG_SYSCLK = 0x0000,
  435. PROBE_MUX_ADDR_REG_PCICLK = 0x0040,
  436. PROBE_MUX_ADDR_REG_NRXCLK = 0x0080,
  437. PROBE_MUX_ADDR_REG_CPUCLK = 0x00C0,
  438. PROBE_MUX_ADDR_REG_MODULE_SEL_MASK = 0x3f00,
  439. PROBE_MUX_ADDR_REG_UP = 0x4000,
  440. PROBE_MUX_ADDR_REG_RE = 0x8000,
  441. };
  442. enum {
  443. STATISTICS_INDEX_REG_MASK = 0x01ff,
  444. STATISTICS_INDEX_REG_MAC0_TX_FRAME = 0x0000,
  445. STATISTICS_INDEX_REG_MAC0_TX_BYTES = 0x0001,
  446. STATISTICS_INDEX_REG_MAC0_TX_STAT1 = 0x0002,
  447. STATISTICS_INDEX_REG_MAC0_TX_STAT2 = 0x0003,
  448. STATISTICS_INDEX_REG_MAC0_TX_STAT3 = 0x0004,
  449. STATISTICS_INDEX_REG_MAC0_TX_STAT4 = 0x0005,
  450. STATISTICS_INDEX_REG_MAC0_TX_STAT5 = 0x0006,
  451. STATISTICS_INDEX_REG_MAC0_RX_FRAME = 0x0007,
  452. STATISTICS_INDEX_REG_MAC0_RX_BYTES = 0x0008,
  453. STATISTICS_INDEX_REG_MAC0_RX_STAT1 = 0x0009,
  454. STATISTICS_INDEX_REG_MAC0_RX_STAT2 = 0x000a,
  455. STATISTICS_INDEX_REG_MAC0_RX_STAT3 = 0x000b,
  456. STATISTICS_INDEX_REG_MAC0_RX_ERR_CRC = 0x000c,
  457. STATISTICS_INDEX_REG_MAC0_RX_ERR_ENC = 0x000d,
  458. STATISTICS_INDEX_REG_MAC0_RX_ERR_LEN = 0x000e,
  459. STATISTICS_INDEX_REG_MAC0_RX_STAT4 = 0x000f,
  460. STATISTICS_INDEX_REG_MAC1_TX_FRAME = 0x0010,
  461. STATISTICS_INDEX_REG_MAC1_TX_BYTES = 0x0011,
  462. STATISTICS_INDEX_REG_MAC1_TX_STAT1 = 0x0012,
  463. STATISTICS_INDEX_REG_MAC1_TX_STAT2 = 0x0013,
  464. STATISTICS_INDEX_REG_MAC1_TX_STAT3 = 0x0014,
  465. STATISTICS_INDEX_REG_MAC1_TX_STAT4 = 0x0015,
  466. STATISTICS_INDEX_REG_MAC1_TX_STAT5 = 0x0016,
  467. STATISTICS_INDEX_REG_MAC1_RX_FRAME = 0x0017,
  468. STATISTICS_INDEX_REG_MAC1_RX_BYTES = 0x0018,
  469. STATISTICS_INDEX_REG_MAC1_RX_STAT1 = 0x0019,
  470. STATISTICS_INDEX_REG_MAC1_RX_STAT2 = 0x001a,
  471. STATISTICS_INDEX_REG_MAC1_RX_STAT3 = 0x001b,
  472. STATISTICS_INDEX_REG_MAC1_RX_ERR_CRC = 0x001c,
  473. STATISTICS_INDEX_REG_MAC1_RX_ERR_ENC = 0x001d,
  474. STATISTICS_INDEX_REG_MAC1_RX_ERR_LEN = 0x001e,
  475. STATISTICS_INDEX_REG_MAC1_RX_STAT4 = 0x001f,
  476. STATISTICS_INDEX_REG_IP_TX_PKTS = 0x0020,
  477. STATISTICS_INDEX_REG_IP_TX_BYTES = 0x0021,
  478. STATISTICS_INDEX_REG_IP_TX_FRAG = 0x0022,
  479. STATISTICS_INDEX_REG_IP_RX_PKTS = 0x0023,
  480. STATISTICS_INDEX_REG_IP_RX_BYTES = 0x0024,
  481. STATISTICS_INDEX_REG_IP_RX_FRAG = 0x0025,
  482. STATISTICS_INDEX_REG_IP_DGRM_REASSEMBLY = 0x0026,
  483. STATISTICS_INDEX_REG_IP_V6_RX_PKTS = 0x0027,
  484. STATISTICS_INDEX_REG_IP_RX_PKTERR = 0x0028,
  485. STATISTICS_INDEX_REG_IP_REASSEMBLY_ERR = 0x0029,
  486. STATISTICS_INDEX_REG_TCP_TX_SEG = 0x0030,
  487. STATISTICS_INDEX_REG_TCP_TX_BYTES = 0x0031,
  488. STATISTICS_INDEX_REG_TCP_RX_SEG = 0x0032,
  489. STATISTICS_INDEX_REG_TCP_RX_BYTES = 0x0033,
  490. STATISTICS_INDEX_REG_TCP_TIMER_EXP = 0x0034,
  491. STATISTICS_INDEX_REG_TCP_RX_ACK = 0x0035,
  492. STATISTICS_INDEX_REG_TCP_TX_ACK = 0x0036,
  493. STATISTICS_INDEX_REG_TCP_RX_ERR = 0x0037,
  494. STATISTICS_INDEX_REG_TCP_RX_WIN_PROBE = 0x0038,
  495. STATISTICS_INDEX_REG_TCP_ECC_ERR_CORR = 0x003f,
  496. };
  497. enum {
  498. PORT_FATAL_ERROR_STATUS_OFB_RE_MAC0 = 0x00000001,
  499. PORT_FATAL_ERROR_STATUS_OFB_RE_MAC1 = 0x00000002,
  500. PORT_FATAL_ERROR_STATUS_OFB_WE = 0x00000004,
  501. PORT_FATAL_ERROR_STATUS_IFB_RE = 0x00000008,
  502. PORT_FATAL_ERROR_STATUS_IFB_WE_MAC0 = 0x00000010,
  503. PORT_FATAL_ERROR_STATUS_IFB_WE_MAC1 = 0x00000020,
  504. PORT_FATAL_ERROR_STATUS_ODE_RE = 0x00000040,
  505. PORT_FATAL_ERROR_STATUS_ODE_WE = 0x00000080,
  506. PORT_FATAL_ERROR_STATUS_IDE_RE = 0x00000100,
  507. PORT_FATAL_ERROR_STATUS_IDE_WE = 0x00000200,
  508. PORT_FATAL_ERROR_STATUS_SDE_RE = 0x00000400,
  509. PORT_FATAL_ERROR_STATUS_SDE_WE = 0x00000800,
  510. PORT_FATAL_ERROR_STATUS_BLE = 0x00001000,
  511. PORT_FATAL_ERROR_STATUS_SPE = 0x00002000,
  512. PORT_FATAL_ERROR_STATUS_EP0 = 0x00004000,
  513. PORT_FATAL_ERROR_STATUS_EP1 = 0x00008000,
  514. PORT_FATAL_ERROR_STATUS_ICE = 0x00010000,
  515. PORT_FATAL_ERROR_STATUS_ILE = 0x00020000,
  516. PORT_FATAL_ERROR_STATUS_OPE = 0x00040000,
  517. PORT_FATAL_ERROR_STATUS_TA = 0x00080000,
  518. PORT_FATAL_ERROR_STATUS_MA = 0x00100000,
  519. PORT_FATAL_ERROR_STATUS_SCE = 0x00200000,
  520. PORT_FATAL_ERROR_STATUS_RPE = 0x00400000,
  521. PORT_FATAL_ERROR_STATUS_MPE = 0x00800000,
  522. PORT_FATAL_ERROR_STATUS_OCE = 0x01000000,
  523. };
  524. /*
  525. * port control and status page - page 0
  526. */
  527. struct ql3xxx_port_registers {
  528. struct ql3xxx_common_registers CommonRegs;
  529. u32 ExternalHWConfig;
  530. u32 InternalChipConfig;
  531. u32 portControl;
  532. u32 portStatus;
  533. u32 macAddrIndirectPtrReg;
  534. u32 macAddrDataReg;
  535. u32 macMIIMgmtControlReg;
  536. u32 macMIIMgmtAddrReg;
  537. u32 macMIIMgmtDataReg;
  538. u32 macMIIStatusReg;
  539. u32 mac0ConfigReg;
  540. u32 mac0IpgIfgReg;
  541. u32 mac0HalfDuplexReg;
  542. u32 mac0MaxFrameLengthReg;
  543. u32 mac0PauseThresholdReg;
  544. u32 mac1ConfigReg;
  545. u32 mac1IpgIfgReg;
  546. u32 mac1HalfDuplexReg;
  547. u32 mac1MaxFrameLengthReg;
  548. u32 mac1PauseThresholdReg;
  549. u32 ipAddrIndexReg;
  550. u32 ipAddrDataReg;
  551. u32 ipReassemblyTimeout;
  552. u32 tcpMaxWindow;
  553. u32 currentTcpTimestamp[2];
  554. u32 internalRamRWAddrReg;
  555. u32 internalRamWDataReg;
  556. u32 reclaimedBufferAddrRegLow;
  557. u32 reclaimedBufferAddrRegHigh;
  558. u32 tcpConfiguration;
  559. u32 functionControl;
  560. u32 fpgaRevID;
  561. u32 localRamAddr;
  562. u32 localRamDataAutoIncr;
  563. u32 localRamDataNonIncr;
  564. u32 gpOutput;
  565. u32 gpInput;
  566. u32 probeMuxAddr;
  567. u32 probeMuxData;
  568. u32 statisticsIndexReg;
  569. u32 statisticsReadDataRegAutoIncr;
  570. u32 statisticsReadDataRegNoIncr;
  571. u32 PortFatalErrStatus;
  572. };
  573. /*
  574. * port host memory config page - page 1
  575. */
  576. struct ql3xxx_host_memory_registers {
  577. struct ql3xxx_common_registers CommonRegs;
  578. u32 reserved[12];
  579. /* Network Request Queue */
  580. u32 reqConsumerIndex;
  581. u32 reqConsumerIndexAddrLow;
  582. u32 reqConsumerIndexAddrHigh;
  583. u32 reqBaseAddrLow;
  584. u32 reqBaseAddrHigh;
  585. u32 reqLength;
  586. /* Network Completion Queue */
  587. u32 rspProducerIndex;
  588. u32 rspProducerIndexAddrLow;
  589. u32 rspProducerIndexAddrHigh;
  590. u32 rspBaseAddrLow;
  591. u32 rspBaseAddrHigh;
  592. u32 rspLength;
  593. /* RX Large Buffer Queue */
  594. u32 rxLargeQConsumerIndex;
  595. u32 rxLargeQBaseAddrLow;
  596. u32 rxLargeQBaseAddrHigh;
  597. u32 rxLargeQLength;
  598. u32 rxLargeBufferLength;
  599. /* RX Small Buffer Queue */
  600. u32 rxSmallQConsumerIndex;
  601. u32 rxSmallQBaseAddrLow;
  602. u32 rxSmallQBaseAddrHigh;
  603. u32 rxSmallQLength;
  604. u32 rxSmallBufferLength;
  605. };
  606. /*
  607. * port local RAM page - page 2
  608. */
  609. struct ql3xxx_local_ram_registers {
  610. struct ql3xxx_common_registers CommonRegs;
  611. u32 bufletSize;
  612. u32 maxBufletCount;
  613. u32 currentBufletCount;
  614. u32 reserved;
  615. u32 freeBufletThresholdLow;
  616. u32 freeBufletThresholdHigh;
  617. u32 ipHashTableBase;
  618. u32 ipHashTableCount;
  619. u32 tcpHashTableBase;
  620. u32 tcpHashTableCount;
  621. u32 ncbBase;
  622. u32 maxNcbCount;
  623. u32 currentNcbCount;
  624. u32 drbBase;
  625. u32 maxDrbCount;
  626. u32 currentDrbCount;
  627. };
  628. /*
  629. * definitions for Semaphore bits in Semaphore/Serial NVRAM interface register
  630. */
  631. #define LS_64BITS(x) (u32)(0xffffffff & ((u64)x))
  632. #define MS_64BITS(x) (u32)(0xffffffff & (((u64)x)>>16>>16) )
  633. /*
  634. * I/O register
  635. */
  636. enum {
  637. CONTROL_REG = 0,
  638. STATUS_REG = 1,
  639. PHY_STAT_LINK_UP = 0x0004,
  640. PHY_CTRL_LOOPBACK = 0x4000,
  641. PETBI_CONTROL_REG = 0x00,
  642. PETBI_CTRL_ALL_PARAMS = 0x7140,
  643. PETBI_CTRL_SOFT_RESET = 0x8000,
  644. PETBI_CTRL_AUTO_NEG = 0x1000,
  645. PETBI_CTRL_RESTART_NEG = 0x0200,
  646. PETBI_CTRL_FULL_DUPLEX = 0x0100,
  647. PETBI_CTRL_SPEED_1000 = 0x0040,
  648. PETBI_STATUS_REG = 0x01,
  649. PETBI_STAT_NEG_DONE = 0x0020,
  650. PETBI_STAT_LINK_UP = 0x0004,
  651. PETBI_NEG_ADVER = 0x04,
  652. PETBI_NEG_PAUSE = 0x0080,
  653. PETBI_NEG_PAUSE_MASK = 0x0180,
  654. PETBI_NEG_DUPLEX = 0x0020,
  655. PETBI_NEG_DUPLEX_MASK = 0x0060,
  656. PETBI_NEG_PARTNER = 0x05,
  657. PETBI_NEG_ERROR_MASK = 0x3000,
  658. PETBI_EXPANSION_REG = 0x06,
  659. PETBI_EXP_PAGE_RX = 0x0002,
  660. PHY_GIG_CONTROL = 9,
  661. PHY_GIG_ENABLE_MAN = 0x1000, /* Enable Master/Slave Manual Config*/
  662. PHY_GIG_SET_MASTER = 0x0800, /* Set Master (slave if clear)*/
  663. PHY_GIG_ALL_PARAMS = 0x0300,
  664. PHY_GIG_ADV_1000F = 0x0200,
  665. PHY_GIG_ADV_1000H = 0x0100,
  666. PHY_NEG_ADVER = 4,
  667. PHY_NEG_ALL_PARAMS = 0x0fe0,
  668. PHY_NEG_ASY_PAUSE = 0x0800,
  669. PHY_NEG_SYM_PAUSE = 0x0400,
  670. PHY_NEG_ADV_SPEED = 0x01e0,
  671. PHY_NEG_ADV_100F = 0x0100,
  672. PHY_NEG_ADV_100H = 0x0080,
  673. PHY_NEG_ADV_10F = 0x0040,
  674. PHY_NEG_ADV_10H = 0x0020,
  675. PETBI_TBI_CTRL = 0x11,
  676. PETBI_TBI_RESET = 0x8000,
  677. PETBI_TBI_AUTO_SENSE = 0x0100,
  678. PETBI_TBI_SERDES_MODE = 0x0010,
  679. PETBI_TBI_SERDES_WRAP = 0x0002,
  680. AUX_CONTROL_STATUS = 0x1c,
  681. PHY_AUX_NEG_DONE = 0x8000,
  682. PHY_NEG_PARTNER = 5,
  683. PHY_AUX_DUPLEX_STAT = 0x0020,
  684. PHY_AUX_SPEED_STAT = 0x0018,
  685. PHY_AUX_NO_HW_STRAP = 0x0004,
  686. PHY_AUX_RESET_STICK = 0x0002,
  687. PHY_NEG_PAUSE = 0x0400,
  688. PHY_CTRL_SOFT_RESET = 0x8000,
  689. PHY_CTRL_AUTO_NEG = 0x1000,
  690. PHY_CTRL_RESTART_NEG = 0x0200,
  691. };
  692. enum {
  693. /* AM29LV Flash definitions */
  694. FM93C56A_START = 0x1,
  695. /* Commands */
  696. FM93C56A_READ = 0x2,
  697. FM93C56A_WEN = 0x0,
  698. FM93C56A_WRITE = 0x1,
  699. FM93C56A_WRITE_ALL = 0x0,
  700. FM93C56A_WDS = 0x0,
  701. FM93C56A_ERASE = 0x3,
  702. FM93C56A_ERASE_ALL = 0x0,
  703. /* Command Extensions */
  704. FM93C56A_WEN_EXT = 0x3,
  705. FM93C56A_WRITE_ALL_EXT = 0x1,
  706. FM93C56A_WDS_EXT = 0x0,
  707. FM93C56A_ERASE_ALL_EXT = 0x2,
  708. /* Special Bits */
  709. FM93C56A_READ_DUMMY_BITS = 1,
  710. FM93C56A_READY = 0,
  711. FM93C56A_BUSY = 1,
  712. FM93C56A_CMD_BITS = 2,
  713. /* AM29LV Flash definitions */
  714. FM93C56A_SIZE_8 = 0x100,
  715. FM93C56A_SIZE_16 = 0x80,
  716. FM93C66A_SIZE_8 = 0x200,
  717. FM93C66A_SIZE_16 = 0x100,
  718. FM93C86A_SIZE_16 = 0x400,
  719. /* Address Bits */
  720. FM93C56A_NO_ADDR_BITS_16 = 8,
  721. FM93C56A_NO_ADDR_BITS_8 = 9,
  722. FM93C86A_NO_ADDR_BITS_16 = 10,
  723. /* Data Bits */
  724. FM93C56A_DATA_BITS_16 = 16,
  725. FM93C56A_DATA_BITS_8 = 8,
  726. };
  727. enum {
  728. /* Auburn Bits */
  729. AUBURN_EEPROM_DI = 0x8,
  730. AUBURN_EEPROM_DI_0 = 0x0,
  731. AUBURN_EEPROM_DI_1 = 0x8,
  732. AUBURN_EEPROM_DO = 0x4,
  733. AUBURN_EEPROM_DO_0 = 0x0,
  734. AUBURN_EEPROM_DO_1 = 0x4,
  735. AUBURN_EEPROM_CS = 0x2,
  736. AUBURN_EEPROM_CS_0 = 0x0,
  737. AUBURN_EEPROM_CS_1 = 0x2,
  738. AUBURN_EEPROM_CLK_RISE = 0x1,
  739. AUBURN_EEPROM_CLK_FALL = 0x0,
  740. };
  741. enum {EEPROM_SIZE = FM93C86A_SIZE_16,
  742. EEPROM_NO_ADDR_BITS = FM93C86A_NO_ADDR_BITS_16,
  743. EEPROM_NO_DATA_BITS = FM93C56A_DATA_BITS_16,
  744. };
  745. /*
  746. * MAC Config data structure
  747. */
  748. struct eeprom_port_cfg {
  749. u16 etherMtu_mac;
  750. u16 pauseThreshold_mac;
  751. u16 resumeThreshold_mac;
  752. u16 portConfiguration;
  753. #define PORT_CONFIG_DEFAULT 0xf700
  754. #define PORT_CONFIG_AUTO_NEG_ENABLED 0x8000
  755. #define PORT_CONFIG_SYM_PAUSE_ENABLED 0x4000
  756. #define PORT_CONFIG_FULL_DUPLEX_ENABLED 0x2000
  757. #define PORT_CONFIG_HALF_DUPLEX_ENABLED 0x1000
  758. #define PORT_CONFIG_1000MB_SPEED 0x0400
  759. #define PORT_CONFIG_100MB_SPEED 0x0200
  760. #define PORT_CONFIG_10MB_SPEED 0x0100
  761. #define PORT_CONFIG_LINK_SPEED_MASK 0x0F00
  762. u16 reserved[12];
  763. };
  764. /*
  765. * BIOS data structure
  766. */
  767. struct eeprom_bios_cfg {
  768. u16 SpinDlyEn:1, disBios:1, EnMemMap:1, EnSelectBoot:1, Reserved:12;
  769. u8 bootID0:7, boodID0Valid:1;
  770. u8 bootLun0[8];
  771. u8 bootID1:7, boodID1Valid:1;
  772. u8 bootLun1[8];
  773. u16 MaxLunsTrgt;
  774. u8 reserved[10];
  775. };
  776. /*
  777. * Function Specific Data structure
  778. */
  779. struct eeprom_function_cfg {
  780. u8 reserved[30];
  781. u16 macAddress[3];
  782. u16 macAddressSecondary[3];
  783. u16 subsysVendorId;
  784. u16 subsysDeviceId;
  785. };
  786. /*
  787. * EEPROM format
  788. */
  789. struct eeprom_data {
  790. u8 asicId[4];
  791. u16 version_and_numPorts; /* together to avoid endianness crap */
  792. u16 boardId;
  793. #define EEPROM_BOARDID_STR_SIZE 16
  794. #define EEPROM_SERIAL_NUM_SIZE 16
  795. u8 boardIdStr[16];
  796. u8 serialNumber[16];
  797. u16 extHwConfig;
  798. struct eeprom_port_cfg macCfg_port0;
  799. struct eeprom_port_cfg macCfg_port1;
  800. u16 bufletSize;
  801. u16 bufletCount;
  802. u16 tcpWindowThreshold50;
  803. u16 tcpWindowThreshold25;
  804. u16 tcpWindowThreshold0;
  805. u16 ipHashTableBaseHi;
  806. u16 ipHashTableBaseLo;
  807. u16 ipHashTableSize;
  808. u16 tcpHashTableBaseHi;
  809. u16 tcpHashTableBaseLo;
  810. u16 tcpHashTableSize;
  811. u16 ncbTableBaseHi;
  812. u16 ncbTableBaseLo;
  813. u16 ncbTableSize;
  814. u16 drbTableBaseHi;
  815. u16 drbTableBaseLo;
  816. u16 drbTableSize;
  817. u16 reserved_142[4];
  818. u16 ipReassemblyTimeout;
  819. u16 tcpMaxWindowSize;
  820. u16 ipSecurity;
  821. #define IPSEC_CONFIG_PRESENT 0x0001
  822. u8 reserved_156[294];
  823. u16 qDebug[8];
  824. struct eeprom_function_cfg funcCfg_fn0;
  825. u16 reserved_510;
  826. u8 oemSpace[432];
  827. struct eeprom_bios_cfg biosCfg_fn1;
  828. struct eeprom_function_cfg funcCfg_fn1;
  829. u16 reserved_1022;
  830. u8 reserved_1024[464];
  831. struct eeprom_function_cfg funcCfg_fn2;
  832. u16 reserved_1534;
  833. u8 reserved_1536[432];
  834. struct eeprom_bios_cfg biosCfg_fn3;
  835. struct eeprom_function_cfg funcCfg_fn3;
  836. u16 checksum;
  837. };
  838. /*
  839. * General definitions...
  840. */
  841. /*
  842. * Below are a number compiler switches for controlling driver behavior.
  843. * Some are not supported under certain conditions and are notated as such.
  844. */
  845. #define QL3XXX_VENDOR_ID 0x1077
  846. #define QL3022_DEVICE_ID 0x3022
  847. #define QL3032_DEVICE_ID 0x3032
  848. /* MTU & Frame Size stuff */
  849. #define NORMAL_MTU_SIZE ETH_DATA_LEN
  850. #define JUMBO_MTU_SIZE 9000
  851. #define VLAN_ID_LEN 2
  852. /* Request Queue Related Definitions */
  853. #define NUM_REQ_Q_ENTRIES 256 /* so that 64 * 64 = 4096 (1 page) */
  854. /* Response Queue Related Definitions */
  855. #define NUM_RSP_Q_ENTRIES 256 /* so that 256 * 16 = 4096 (1 page) */
  856. /* Transmit and Receive Buffers */
  857. #define NUM_LBUFQ_ENTRIES 128
  858. #define JUMBO_NUM_LBUFQ_ENTRIES 32
  859. #define NUM_SBUFQ_ENTRIES 64
  860. #define QL_SMALL_BUFFER_SIZE 32
  861. #define QL_ADDR_ELE_PER_BUFQ_ENTRY \
  862. (sizeof(struct lrg_buf_q_entry) / sizeof(struct bufq_addr_element))
  863. /* Each send has at least control block. This is how many we keep. */
  864. #define NUM_SMALL_BUFFERS NUM_SBUFQ_ENTRIES * QL_ADDR_ELE_PER_BUFQ_ENTRY
  865. #define QL_HEADER_SPACE 32 /* make header space at top of skb. */
  866. /*
  867. * Large & Small Buffers for Receives
  868. */
  869. struct lrg_buf_q_entry {
  870. __le32 addr0_lower;
  871. #define IAL_LAST_ENTRY 0x00000001
  872. #define IAL_CONT_ENTRY 0x00000002
  873. #define IAL_FLAG_MASK 0x00000003
  874. __le32 addr0_upper;
  875. __le32 addr1_lower;
  876. __le32 addr1_upper;
  877. __le32 addr2_lower;
  878. __le32 addr2_upper;
  879. __le32 addr3_lower;
  880. __le32 addr3_upper;
  881. __le32 addr4_lower;
  882. __le32 addr4_upper;
  883. __le32 addr5_lower;
  884. __le32 addr5_upper;
  885. __le32 addr6_lower;
  886. __le32 addr6_upper;
  887. __le32 addr7_lower;
  888. __le32 addr7_upper;
  889. };
  890. struct bufq_addr_element {
  891. __le32 addr_low;
  892. __le32 addr_high;
  893. };
  894. #define QL_NO_RESET 0
  895. #define QL_DO_RESET 1
  896. enum link_state_t {
  897. LS_UNKNOWN = 0,
  898. LS_DOWN,
  899. LS_DEGRADE,
  900. LS_RECOVER,
  901. LS_UP,
  902. };
  903. struct ql_rcv_buf_cb {
  904. struct ql_rcv_buf_cb *next;
  905. struct sk_buff *skb;
  906. DEFINE_DMA_UNMAP_ADDR(mapaddr);
  907. DEFINE_DMA_UNMAP_LEN(maplen);
  908. __le32 buf_phy_addr_low;
  909. __le32 buf_phy_addr_high;
  910. int index;
  911. };
  912. /*
  913. * Original IOCB has 3 sg entries:
  914. * first points to skb-data area
  915. * second points to first frag
  916. * third points to next oal.
  917. * OAL has 5 entries:
  918. * 1 thru 4 point to frags
  919. * fifth points to next oal.
  920. */
  921. #define MAX_OAL_CNT ((MAX_SKB_FRAGS-1)/4 + 1)
  922. struct oal_entry {
  923. __le32 dma_lo;
  924. __le32 dma_hi;
  925. __le32 len;
  926. #define OAL_LAST_ENTRY 0x80000000 /* Last valid buffer in list. */
  927. #define OAL_CONT_ENTRY 0x40000000 /* points to an OAL. (continuation) */
  928. };
  929. struct oal {
  930. struct oal_entry oal_entry[5];
  931. };
  932. struct map_list {
  933. DEFINE_DMA_UNMAP_ADDR(mapaddr);
  934. DEFINE_DMA_UNMAP_LEN(maplen);
  935. };
  936. struct ql_tx_buf_cb {
  937. struct sk_buff *skb;
  938. struct ob_mac_iocb_req *queue_entry ;
  939. int seg_count;
  940. struct oal *oal;
  941. struct map_list map[MAX_SKB_FRAGS+1];
  942. };
  943. /* definitions for type field */
  944. #define QL_BUF_TYPE_MACIOCB 0x01
  945. #define QL_BUF_TYPE_IPIOCB 0x02
  946. #define QL_BUF_TYPE_TCPIOCB 0x03
  947. /* qdev->flags definitions. */
  948. enum { QL_RESET_DONE = 1, /* Reset finished. */
  949. QL_RESET_ACTIVE = 2, /* Waiting for reset to finish. */
  950. QL_RESET_START = 3, /* Please reset the chip. */
  951. QL_RESET_PER_SCSI = 4, /* SCSI driver requests reset. */
  952. QL_TX_TIMEOUT = 5, /* Timeout in progress. */
  953. QL_LINK_MASTER = 6, /* This driver controls the link. */
  954. QL_ADAPTER_UP = 7, /* Adapter has been brought up. */
  955. QL_THREAD_UP = 8, /* This flag is available. */
  956. QL_LINK_UP = 9, /* Link Status. */
  957. QL_ALLOC_REQ_RSP_Q_DONE = 10,
  958. QL_ALLOC_BUFQS_DONE = 11,
  959. QL_ALLOC_SMALL_BUF_DONE = 12,
  960. QL_LINK_OPTICAL = 13,
  961. QL_MSI_ENABLED = 14,
  962. };
  963. /*
  964. * ql3_adapter - The main Adapter structure definition.
  965. * This structure has all fields relevant to the hardware.
  966. */
  967. struct ql3_adapter {
  968. u32 reserved_00;
  969. unsigned long flags;
  970. /* PCI Configuration information for this device */
  971. struct pci_dev *pdev;
  972. struct net_device *ndev; /* Parent NET device */
  973. struct napi_struct napi;
  974. /* Hardware information */
  975. u8 chip_rev_id;
  976. u8 pci_slot;
  977. u8 pci_width;
  978. u8 pci_x;
  979. u32 msi;
  980. int index;
  981. struct timer_list adapter_timer; /* timer used for various functions */
  982. spinlock_t adapter_lock;
  983. spinlock_t hw_lock;
  984. /* PCI Bus Relative Register Addresses */
  985. u8 __iomem *mmap_virt_base; /* stores return value from ioremap() */
  986. struct ql3xxx_port_registers __iomem *mem_map_registers;
  987. u32 current_page; /* tracks current register page */
  988. u32 msg_enable;
  989. u8 reserved_01[2];
  990. u8 reserved_02[2];
  991. /* Page for Shadow Registers */
  992. void *shadow_reg_virt_addr;
  993. dma_addr_t shadow_reg_phy_addr;
  994. /* Net Request Queue */
  995. u32 req_q_size;
  996. u32 reserved_03;
  997. struct ob_mac_iocb_req *req_q_virt_addr;
  998. dma_addr_t req_q_phy_addr;
  999. u16 req_producer_index;
  1000. u16 reserved_04;
  1001. u16 *preq_consumer_index;
  1002. u32 req_consumer_index_phy_addr_high;
  1003. u32 req_consumer_index_phy_addr_low;
  1004. atomic_t tx_count;
  1005. struct ql_tx_buf_cb tx_buf[NUM_REQ_Q_ENTRIES];
  1006. /* Net Response Queue */
  1007. u32 rsp_q_size;
  1008. u32 eeprom_cmd_data;
  1009. struct net_rsp_iocb *rsp_q_virt_addr;
  1010. dma_addr_t rsp_q_phy_addr;
  1011. struct net_rsp_iocb *rsp_current;
  1012. u16 rsp_consumer_index;
  1013. u16 reserved_06;
  1014. volatile __le32 *prsp_producer_index;
  1015. u32 rsp_producer_index_phy_addr_high;
  1016. u32 rsp_producer_index_phy_addr_low;
  1017. /* Large Buffer Queue */
  1018. u32 lrg_buf_q_alloc_size;
  1019. u32 lrg_buf_q_size;
  1020. void *lrg_buf_q_alloc_virt_addr;
  1021. void *lrg_buf_q_virt_addr;
  1022. dma_addr_t lrg_buf_q_alloc_phy_addr;
  1023. dma_addr_t lrg_buf_q_phy_addr;
  1024. u32 lrg_buf_q_producer_index;
  1025. u32 lrg_buf_release_cnt;
  1026. struct bufq_addr_element *lrg_buf_next_free;
  1027. u32 num_large_buffers;
  1028. u32 num_lbufq_entries;
  1029. /* Large (Receive) Buffers */
  1030. struct ql_rcv_buf_cb *lrg_buf;
  1031. struct ql_rcv_buf_cb *lrg_buf_free_head;
  1032. struct ql_rcv_buf_cb *lrg_buf_free_tail;
  1033. u32 lrg_buf_free_count;
  1034. u32 lrg_buffer_len;
  1035. u32 lrg_buf_index;
  1036. u32 lrg_buf_skb_check;
  1037. /* Small Buffer Queue */
  1038. u32 small_buf_q_alloc_size;
  1039. u32 small_buf_q_size;
  1040. u32 small_buf_q_producer_index;
  1041. void *small_buf_q_alloc_virt_addr;
  1042. void *small_buf_q_virt_addr;
  1043. dma_addr_t small_buf_q_alloc_phy_addr;
  1044. dma_addr_t small_buf_q_phy_addr;
  1045. u32 small_buf_index;
  1046. /* Small (Receive) Buffers */
  1047. void *small_buf_virt_addr;
  1048. dma_addr_t small_buf_phy_addr;
  1049. u32 small_buf_phy_addr_low;
  1050. u32 small_buf_phy_addr_high;
  1051. u32 small_buf_release_cnt;
  1052. u32 small_buf_total_size;
  1053. struct eeprom_data nvram_data;
  1054. u32 port_link_state;
  1055. /* 4022 specific */
  1056. u32 mac_index; /* Driver's MAC number can be 0 or 1 for first and second networking functions respectively */
  1057. u32 PHYAddr; /* Address of PHY 0x1e00 Port 0 and 0x1f00 Port 1 */
  1058. u32 mac_ob_opcode; /* Opcode to use on mac transmission */
  1059. u32 mb_bit_mask; /* MA Bits mask to use on transmission */
  1060. u32 numPorts;
  1061. struct workqueue_struct *workqueue;
  1062. struct delayed_work reset_work;
  1063. struct delayed_work tx_timeout_work;
  1064. struct delayed_work link_state_work;
  1065. u32 max_frame_size;
  1066. u32 device_id;
  1067. u16 phyType;
  1068. };
  1069. #endif /* _QLA3XXX_H_ */