qla3xxx.h 30 KB

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