tehuti.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /*
  2. * Tehuti Networks(R) Network Driver
  3. * Copyright (C) 2007 Tehuti Networks Ltd. All rights reserved
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. */
  10. #ifndef _TEHUTI_H
  11. #define _TEHUTI_H
  12. #include <linux/module.h>
  13. #include <linux/kernel.h>
  14. #include <linux/netdevice.h>
  15. #include <linux/etherdevice.h>
  16. #include <linux/pci.h>
  17. #include <linux/delay.h>
  18. #include <linux/ethtool.h>
  19. #include <linux/mii.h>
  20. #include <linux/crc32.h>
  21. #include <linux/uaccess.h>
  22. #include <linux/in.h>
  23. #include <linux/ip.h>
  24. #include <linux/tcp.h>
  25. #include <linux/sched.h>
  26. #include <linux/tty.h>
  27. #include <linux/if_vlan.h>
  28. #include <linux/interrupt.h>
  29. #include <linux/vmalloc.h>
  30. #include <asm/byteorder.h>
  31. /* Compile Time Switches */
  32. /* start */
  33. #define BDX_TSO
  34. #define BDX_LLTX
  35. #define BDX_DELAY_WPTR
  36. /* #define BDX_MSI */
  37. /* end */
  38. #if !defined CONFIG_PCI_MSI
  39. # undef BDX_MSI
  40. #endif
  41. #define BDX_DEF_MSG_ENABLE (NETIF_MSG_DRV | \
  42. NETIF_MSG_PROBE | \
  43. NETIF_MSG_LINK)
  44. /* ioctl ops */
  45. #define BDX_OP_READ 1
  46. #define BDX_OP_WRITE 2
  47. /* RX copy break size */
  48. #define BDX_COPYBREAK 257
  49. #define DRIVER_AUTHOR "Tehuti Networks(R)"
  50. #define BDX_DRV_DESC "Tehuti Networks(R) Network Driver"
  51. #define BDX_DRV_NAME "tehuti"
  52. #define BDX_NIC_NAME "Tehuti 10 Giga TOE SmartNIC"
  53. #define BDX_NIC2PORT_NAME "Tehuti 2-Port 10 Giga TOE SmartNIC"
  54. #define BDX_DRV_VERSION "7.29.3"
  55. #ifdef BDX_MSI
  56. # define BDX_MSI_STRING "msi "
  57. #else
  58. # define BDX_MSI_STRING ""
  59. #endif
  60. /* netdev tx queue len for Luxor. default value is, btw, 1000
  61. * ifcontig eth1 txqueuelen 3000 - to change it at runtime */
  62. #define BDX_NDEV_TXQ_LEN 3000
  63. #define FIFO_SIZE 4096
  64. #define FIFO_EXTRA_SPACE 1024
  65. #define MIN(x, y) ((x) < (y) ? (x) : (y))
  66. #if BITS_PER_LONG == 64
  67. # define H32_64(x) (u32) ((u64)(x) >> 32)
  68. # define L32_64(x) (u32) ((u64)(x) & 0xffffffff)
  69. #elif BITS_PER_LONG == 32
  70. # define H32_64(x) 0
  71. # define L32_64(x) ((u32) (x))
  72. #else /* BITS_PER_LONG == ?? */
  73. # error BITS_PER_LONG is undefined. Must be 64 or 32
  74. #endif /* BITS_PER_LONG */
  75. #ifdef __BIG_ENDIAN
  76. # define CPU_CHIP_SWAP32(x) swab32(x)
  77. # define CPU_CHIP_SWAP16(x) swab16(x)
  78. #else
  79. # define CPU_CHIP_SWAP32(x) (x)
  80. # define CPU_CHIP_SWAP16(x) (x)
  81. #endif
  82. #define READ_REG(pp, reg) readl(pp->pBdxRegs + reg)
  83. #define WRITE_REG(pp, reg, val) writel(val, pp->pBdxRegs + reg)
  84. #ifndef DMA_64BIT_MASK
  85. # define DMA_64BIT_MASK 0xffffffffffffffffULL
  86. #endif
  87. #ifndef DMA_32BIT_MASK
  88. # define DMA_32BIT_MASK 0x00000000ffffffffULL
  89. #endif
  90. #ifndef NET_IP_ALIGN
  91. # define NET_IP_ALIGN 2
  92. #endif
  93. #ifndef NETDEV_TX_OK
  94. # define NETDEV_TX_OK 0
  95. #endif
  96. #define LUXOR_MAX_PORT 2
  97. #define BDX_MAX_RX_DONE 150
  98. #define BDX_TXF_DESC_SZ 16
  99. #define BDX_MAX_TX_LEVEL (priv->txd_fifo0.m.memsz - 16)
  100. #define BDX_MIN_TX_LEVEL 256
  101. #define BDX_NO_UPD_PACKETS 40
  102. struct pci_nic {
  103. int port_num;
  104. void __iomem *regs;
  105. int irq_type;
  106. struct bdx_priv *priv[LUXOR_MAX_PORT];
  107. };
  108. enum { IRQ_INTX, IRQ_MSI, IRQ_MSIX };
  109. #define PCK_TH_MULT 128
  110. #define INT_COAL_MULT 2
  111. #define BITS_MASK(nbits) ((1<<nbits)-1)
  112. #define GET_BITS_SHIFT(x, nbits, nshift) (((x)>>nshift)&BITS_MASK(nbits))
  113. #define BITS_SHIFT_MASK(nbits, nshift) (BITS_MASK(nbits)<<nshift)
  114. #define BITS_SHIFT_VAL(x, nbits, nshift) (((x)&BITS_MASK(nbits))<<nshift)
  115. #define BITS_SHIFT_CLEAR(x, nbits, nshift) \
  116. ((x)&(~BITS_SHIFT_MASK(nbits, nshift)))
  117. #define GET_INT_COAL(x) GET_BITS_SHIFT(x, 15, 0)
  118. #define GET_INT_COAL_RC(x) GET_BITS_SHIFT(x, 1, 15)
  119. #define GET_RXF_TH(x) GET_BITS_SHIFT(x, 4, 16)
  120. #define GET_PCK_TH(x) GET_BITS_SHIFT(x, 4, 20)
  121. #define INT_REG_VAL(coal, coal_rc, rxf_th, pck_th) \
  122. ((coal)|((coal_rc)<<15)|((rxf_th)<<16)|((pck_th)<<20))
  123. struct fifo {
  124. dma_addr_t da; /* physical address of fifo (used by HW) */
  125. char *va; /* virtual address of fifo (used by SW) */
  126. u32 rptr, wptr; /* cached values of RPTR and WPTR registers,
  127. they're 32 bits on both 32 and 64 archs */
  128. u16 reg_CFG0, reg_CFG1;
  129. u16 reg_RPTR, reg_WPTR;
  130. u16 memsz; /* memory size allocated for fifo */
  131. u16 size_mask;
  132. u16 pktsz; /* skb packet size to allocate */
  133. u16 rcvno; /* number of buffers that come from this RXF */
  134. };
  135. struct txf_fifo {
  136. struct fifo m; /* minimal set of variables used by all fifos */
  137. };
  138. struct txd_fifo {
  139. struct fifo m; /* minimal set of variables used by all fifos */
  140. };
  141. struct rxf_fifo {
  142. struct fifo m; /* minimal set of variables used by all fifos */
  143. };
  144. struct rxd_fifo {
  145. struct fifo m; /* minimal set of variables used by all fifos */
  146. };
  147. struct rx_map {
  148. u64 dma;
  149. struct sk_buff *skb;
  150. };
  151. struct rxdb {
  152. int *stack;
  153. struct rx_map *elems;
  154. int nelem;
  155. int top;
  156. };
  157. union bdx_dma_addr {
  158. dma_addr_t dma;
  159. struct sk_buff *skb;
  160. };
  161. /* Entry in the db.
  162. * if len == 0 addr is dma
  163. * if len != 0 addr is skb */
  164. struct tx_map {
  165. union bdx_dma_addr addr;
  166. int len;
  167. };
  168. /* tx database - implemented as circular fifo buffer*/
  169. struct txdb {
  170. struct tx_map *start; /* points to the first element */
  171. struct tx_map *end; /* points just AFTER the last element */
  172. struct tx_map *rptr; /* points to the next element to read */
  173. struct tx_map *wptr; /* points to the next element to write */
  174. int size; /* number of elements in the db */
  175. };
  176. /*Internal stats structure*/
  177. struct bdx_stats {
  178. u64 InUCast; /* 0x7200 */
  179. u64 InMCast; /* 0x7210 */
  180. u64 InBCast; /* 0x7220 */
  181. u64 InPkts; /* 0x7230 */
  182. u64 InErrors; /* 0x7240 */
  183. u64 InDropped; /* 0x7250 */
  184. u64 FrameTooLong; /* 0x7260 */
  185. u64 FrameSequenceErrors; /* 0x7270 */
  186. u64 InVLAN; /* 0x7280 */
  187. u64 InDroppedDFE; /* 0x7290 */
  188. u64 InDroppedIntFull; /* 0x72A0 */
  189. u64 InFrameAlignErrors; /* 0x72B0 */
  190. /* 0x72C0-0x72E0 RSRV */
  191. u64 OutUCast; /* 0x72F0 */
  192. u64 OutMCast; /* 0x7300 */
  193. u64 OutBCast; /* 0x7310 */
  194. u64 OutPkts; /* 0x7320 */
  195. /* 0x7330-0x7360 RSRV */
  196. u64 OutVLAN; /* 0x7370 */
  197. u64 InUCastOctects; /* 0x7380 */
  198. u64 OutUCastOctects; /* 0x7390 */
  199. /* 0x73A0-0x73B0 RSRV */
  200. u64 InBCastOctects; /* 0x73C0 */
  201. u64 OutBCastOctects; /* 0x73D0 */
  202. u64 InOctects; /* 0x73E0 */
  203. u64 OutOctects; /* 0x73F0 */
  204. };
  205. struct bdx_priv {
  206. void __iomem *pBdxRegs;
  207. struct net_device *ndev;
  208. struct napi_struct napi;
  209. /* RX FIFOs: 1 for data (full) descs, and 2 for free descs */
  210. struct rxd_fifo rxd_fifo0;
  211. struct rxf_fifo rxf_fifo0;
  212. struct rxdb *rxdb; /* rx dbs to store skb pointers */
  213. int napi_stop;
  214. struct vlan_group *vlgrp;
  215. /* Tx FIFOs: 1 for data desc, 1 for empty (acks) desc */
  216. struct txd_fifo txd_fifo0;
  217. struct txf_fifo txf_fifo0;
  218. struct txdb txdb;
  219. int tx_level;
  220. #ifdef BDX_DELAY_WPTR
  221. int tx_update_mark;
  222. int tx_noupd;
  223. #endif
  224. spinlock_t tx_lock; /* NETIF_F_LLTX mode */
  225. /* rarely used */
  226. u8 port;
  227. u32 msg_enable;
  228. int stats_flag;
  229. struct bdx_stats hw_stats;
  230. struct net_device_stats net_stats;
  231. struct pci_dev *pdev;
  232. struct pci_nic *nic;
  233. u8 txd_size;
  234. u8 txf_size;
  235. u8 rxd_size;
  236. u8 rxf_size;
  237. u32 rdintcm;
  238. u32 tdintcm;
  239. };
  240. /* RX FREE descriptor - 64bit*/
  241. struct rxf_desc {
  242. u32 info; /* Buffer Count + Info - described below */
  243. u32 va_lo; /* VAdr[31:0] */
  244. u32 va_hi; /* VAdr[63:32] */
  245. u32 pa_lo; /* PAdr[31:0] */
  246. u32 pa_hi; /* PAdr[63:32] */
  247. u32 len; /* Buffer Length */
  248. };
  249. #define GET_RXD_BC(x) GET_BITS_SHIFT((x), 5, 0)
  250. #define GET_RXD_RXFQ(x) GET_BITS_SHIFT((x), 2, 8)
  251. #define GET_RXD_TO(x) GET_BITS_SHIFT((x), 1, 15)
  252. #define GET_RXD_TYPE(x) GET_BITS_SHIFT((x), 4, 16)
  253. #define GET_RXD_ERR(x) GET_BITS_SHIFT((x), 6, 21)
  254. #define GET_RXD_RXP(x) GET_BITS_SHIFT((x), 1, 27)
  255. #define GET_RXD_PKT_ID(x) GET_BITS_SHIFT((x), 3, 28)
  256. #define GET_RXD_VTAG(x) GET_BITS_SHIFT((x), 1, 31)
  257. #define GET_RXD_VLAN_ID(x) GET_BITS_SHIFT((x), 12, 0)
  258. #define GET_RXD_VLAN_TCI(x) GET_BITS_SHIFT((x), 16, 0)
  259. #define GET_RXD_CFI(x) GET_BITS_SHIFT((x), 1, 12)
  260. #define GET_RXD_PRIO(x) GET_BITS_SHIFT((x), 3, 13)
  261. struct rxd_desc {
  262. u32 rxd_val1;
  263. u16 len;
  264. u16 rxd_vlan;
  265. u32 va_lo;
  266. u32 va_hi;
  267. };
  268. /* PBL describes each virtual buffer to be */
  269. /* transmitted from the host.*/
  270. struct pbl {
  271. u32 pa_lo;
  272. u32 pa_hi;
  273. u32 len;
  274. };
  275. /* First word for TXD descriptor. It means: type = 3 for regular Tx packet,
  276. * hw_csum = 7 for ip+udp+tcp hw checksums */
  277. #define TXD_W1_VAL(bc, checksum, vtag, lgsnd, vlan_id) \
  278. ((bc) | ((checksum)<<5) | ((vtag)<<8) | \
  279. ((lgsnd)<<9) | (0x30000) | ((vlan_id)<<20))
  280. struct txd_desc {
  281. u32 txd_val1;
  282. u16 mss;
  283. u16 length;
  284. u32 va_lo;
  285. u32 va_hi;
  286. struct pbl pbl[0]; /* Fragments */
  287. } __attribute__ ((packed));
  288. /* Register region size */
  289. #define BDX_REGS_SIZE 0x1000
  290. /* Registers from 0x0000-0x00fc were remapped to 0x4000-0x40fc */
  291. #define regTXD_CFG1_0 0x4000
  292. #define regRXF_CFG1_0 0x4010
  293. #define regRXD_CFG1_0 0x4020
  294. #define regTXF_CFG1_0 0x4030
  295. #define regTXD_CFG0_0 0x4040
  296. #define regRXF_CFG0_0 0x4050
  297. #define regRXD_CFG0_0 0x4060
  298. #define regTXF_CFG0_0 0x4070
  299. #define regTXD_WPTR_0 0x4080
  300. #define regRXF_WPTR_0 0x4090
  301. #define regRXD_WPTR_0 0x40A0
  302. #define regTXF_WPTR_0 0x40B0
  303. #define regTXD_RPTR_0 0x40C0
  304. #define regRXF_RPTR_0 0x40D0
  305. #define regRXD_RPTR_0 0x40E0
  306. #define regTXF_RPTR_0 0x40F0
  307. #define regTXF_RPTR_3 0x40FC
  308. /* hardware versioning */
  309. #define FW_VER 0x5010
  310. #define SROM_VER 0x5020
  311. #define FPGA_VER 0x5030
  312. #define FPGA_SEED 0x5040
  313. /* Registers from 0x0100-0x0150 were remapped to 0x5100-0x5150 */
  314. #define regISR regISR0
  315. #define regISR0 0x5100
  316. #define regIMR regIMR0
  317. #define regIMR0 0x5110
  318. #define regRDINTCM0 0x5120
  319. #define regRDINTCM2 0x5128
  320. #define regTDINTCM0 0x5130
  321. #define regISR_MSK0 0x5140
  322. #define regINIT_SEMAPHORE 0x5170
  323. #define regINIT_STATUS 0x5180
  324. #define regMAC_LNK_STAT 0x0200
  325. #define MAC_LINK_STAT 0x4 /* Link state */
  326. #define regGMAC_RXF_A 0x1240
  327. #define regUNC_MAC0_A 0x1250
  328. #define regUNC_MAC1_A 0x1260
  329. #define regUNC_MAC2_A 0x1270
  330. #define regVLAN_0 0x1800
  331. #define regMAX_FRAME_A 0x12C0
  332. #define regRX_MAC_MCST0 0x1A80
  333. #define regRX_MAC_MCST1 0x1A84
  334. #define MAC_MCST_NUM 15
  335. #define regRX_MCST_HASH0 0x1A00
  336. #define MAC_MCST_HASH_NUM 8
  337. #define regVPC 0x2300
  338. #define regVIC 0x2320
  339. #define regVGLB 0x2340
  340. #define regCLKPLL 0x5000
  341. /*for 10G only*/
  342. #define regREVISION 0x6000
  343. #define regSCRATCH 0x6004
  344. #define regCTRLST 0x6008
  345. #define regMAC_ADDR_0 0x600C
  346. #define regMAC_ADDR_1 0x6010
  347. #define regFRM_LENGTH 0x6014
  348. #define regPAUSE_QUANT 0x6018
  349. #define regRX_FIFO_SECTION 0x601C
  350. #define regTX_FIFO_SECTION 0x6020
  351. #define regRX_FULLNESS 0x6024
  352. #define regTX_FULLNESS 0x6028
  353. #define regHASHTABLE 0x602C
  354. #define regMDIO_ST 0x6030
  355. #define regMDIO_CTL 0x6034
  356. #define regMDIO_DATA 0x6038
  357. #define regMDIO_ADDR 0x603C
  358. #define regRST_PORT 0x7000
  359. #define regDIS_PORT 0x7010
  360. #define regRST_QU 0x7020
  361. #define regDIS_QU 0x7030
  362. #define regCTRLST_TX_ENA 0x0001
  363. #define regCTRLST_RX_ENA 0x0002
  364. #define regCTRLST_PRM_ENA 0x0010
  365. #define regCTRLST_PAD_ENA 0x0020
  366. #define regCTRLST_BASE (regCTRLST_PAD_ENA|regCTRLST_PRM_ENA)
  367. #define regRX_FLT 0x1400
  368. /* TXD TXF RXF RXD CONFIG 0x0000 --- 0x007c*/
  369. #define TX_RX_CFG1_BASE 0xffffffff /*0-31 */
  370. #define TX_RX_CFG0_BASE 0xfffff000 /*31:12 */
  371. #define TX_RX_CFG0_RSVD 0x0ffc /*11:2 */
  372. #define TX_RX_CFG0_SIZE 0x0003 /*1:0 */
  373. /* TXD TXF RXF RXD WRITE 0x0080 --- 0x00BC */
  374. #define TXF_WPTR_WR_PTR 0x7ff8 /*14:3 */
  375. /* TXD TXF RXF RXD READ 0x00CO --- 0x00FC */
  376. #define TXF_RPTR_RD_PTR 0x7ff8 /*14:3 */
  377. #define TXF_WPTR_MASK 0x7ff0 /* last 4 bits are dropped
  378. * size is rounded to 16 */
  379. /* regISR 0x0100 */
  380. /* regIMR 0x0110 */
  381. #define IMR_INPROG 0x80000000 /*31 */
  382. #define IR_LNKCHG1 0x10000000 /*28 */
  383. #define IR_LNKCHG0 0x08000000 /*27 */
  384. #define IR_GPIO 0x04000000 /*26 */
  385. #define IR_RFRSH 0x02000000 /*25 */
  386. #define IR_RSVD 0x01000000 /*24 */
  387. #define IR_SWI 0x00800000 /*23 */
  388. #define IR_RX_FREE_3 0x00400000 /*22 */
  389. #define IR_RX_FREE_2 0x00200000 /*21 */
  390. #define IR_RX_FREE_1 0x00100000 /*20 */
  391. #define IR_RX_FREE_0 0x00080000 /*19 */
  392. #define IR_TX_FREE_3 0x00040000 /*18 */
  393. #define IR_TX_FREE_2 0x00020000 /*17 */
  394. #define IR_TX_FREE_1 0x00010000 /*16 */
  395. #define IR_TX_FREE_0 0x00008000 /*15 */
  396. #define IR_RX_DESC_3 0x00004000 /*14 */
  397. #define IR_RX_DESC_2 0x00002000 /*13 */
  398. #define IR_RX_DESC_1 0x00001000 /*12 */
  399. #define IR_RX_DESC_0 0x00000800 /*11 */
  400. #define IR_PSE 0x00000400 /*10 */
  401. #define IR_TMR3 0x00000200 /*9 */
  402. #define IR_TMR2 0x00000100 /*8 */
  403. #define IR_TMR1 0x00000080 /*7 */
  404. #define IR_TMR0 0x00000040 /*6 */
  405. #define IR_VNT 0x00000020 /*5 */
  406. #define IR_RxFL 0x00000010 /*4 */
  407. #define IR_SDPERR 0x00000008 /*3 */
  408. #define IR_TR 0x00000004 /*2 */
  409. #define IR_PCIE_LINK 0x00000002 /*1 */
  410. #define IR_PCIE_TOUT 0x00000001 /*0 */
  411. #define IR_EXTRA (IR_RX_FREE_0 | IR_LNKCHG0 | IR_PSE | \
  412. IR_TMR0 | IR_PCIE_LINK | IR_PCIE_TOUT)
  413. #define IR_RUN (IR_EXTRA | IR_RX_DESC_0 | IR_TX_FREE_0)
  414. #define IR_ALL 0xfdfffff7
  415. #define IR_LNKCHG0_ofst 27
  416. #define GMAC_RX_FILTER_OSEN 0x1000 /* shared OS enable */
  417. #define GMAC_RX_FILTER_TXFC 0x0400 /* Tx flow control */
  418. #define GMAC_RX_FILTER_RSV0 0x0200 /* reserved */
  419. #define GMAC_RX_FILTER_FDA 0x0100 /* filter out direct address */
  420. #define GMAC_RX_FILTER_AOF 0x0080 /* accept over run */
  421. #define GMAC_RX_FILTER_ACF 0x0040 /* accept control frames */
  422. #define GMAC_RX_FILTER_ARUNT 0x0020 /* accept under run */
  423. #define GMAC_RX_FILTER_ACRC 0x0010 /* accept crc error */
  424. #define GMAC_RX_FILTER_AM 0x0008 /* accept multicast */
  425. #define GMAC_RX_FILTER_AB 0x0004 /* accept broadcast */
  426. #define GMAC_RX_FILTER_PRM 0x0001 /* [0:1] promiscous mode */
  427. #define MAX_FRAME_AB_VAL 0x3fff /* 13:0 */
  428. #define CLKPLL_PLLLKD 0x0200 /*9 */
  429. #define CLKPLL_RSTEND 0x0100 /*8 */
  430. #define CLKPLL_SFTRST 0x0001 /*0 */
  431. #define CLKPLL_LKD (CLKPLL_PLLLKD|CLKPLL_RSTEND)
  432. /*
  433. * PCI-E Device Control Register (Offset 0x88)
  434. * Source: Luxor Data Sheet, 7.1.3.3.3
  435. */
  436. #define PCI_DEV_CTRL_REG 0x88
  437. #define GET_DEV_CTRL_MAXPL(x) GET_BITS_SHIFT(x, 3, 5)
  438. #define GET_DEV_CTRL_MRRS(x) GET_BITS_SHIFT(x, 3, 12)
  439. /*
  440. * PCI-E Link Status Register (Offset 0x92)
  441. * Source: Luxor Data Sheet, 7.1.3.3.7
  442. */
  443. #define PCI_LINK_STATUS_REG 0x92
  444. #define GET_LINK_STATUS_LANES(x) GET_BITS_SHIFT(x, 6, 4)
  445. /* Debugging Macros */
  446. #define ERR(fmt, args...) printk(KERN_ERR fmt, ## args)
  447. #define DBG2(fmt, args...) \
  448. printk(KERN_ERR "%s:%-5d: " fmt, __func__, __LINE__, ## args)
  449. #define BDX_ASSERT(x) BUG_ON(x)
  450. #ifdef DEBUG
  451. #define ENTER do { \
  452. printk(KERN_ERR "%s:%-5d: ENTER\n", __func__, __LINE__); \
  453. } while (0)
  454. #define RET(args...) do { \
  455. printk(KERN_ERR "%s:%-5d: RETURN\n", __func__, __LINE__); \
  456. return args; } while (0)
  457. #define DBG(fmt, args...) \
  458. printk(KERN_ERR "%s:%-5d: " fmt, __func__, __LINE__, ## args)
  459. #else
  460. #define ENTER do { } while (0)
  461. #define RET(args...) return args
  462. #define DBG(fmt, args...) do { } while (0)
  463. #endif
  464. #endif /* _BDX__H */