qla3xxx.h 33 KB

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