qla3xxx.h 33 KB

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