qla3xxx.h 30 KB

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