1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 1999 - 2010 Intel Corporation.
4 * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD.
6 * This code was derived from the Intel e1000e Linux driver.
12 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14 #include <linux/mii.h>
15 #include <linux/delay.h>
16 #include <linux/pci.h>
17 #include <linux/netdevice.h>
18 #include <linux/etherdevice.h>
19 #include <linux/ethtool.h>
20 #include <linux/vmalloc.h>
26 * pch_gbe_regs_mac_adr - Structure holding values of mac address registers
27 * @high Denotes the 1st to 4th byte from the initial of MAC address
28 * @low Denotes the 5th to 6th byte from the initial of MAC address
30 struct pch_gbe_regs_mac_adr
{
35 * pch_udc_regs - Structure holding values of MAC registers
61 struct pch_gbe_regs_mac_adr mac_adr
[16];
90 /* Interrupt Status */
91 /* Interrupt Status Hold */
92 /* Interrupt Enable */
93 #define PCH_GBE_INT_RX_DMA_CMPLT 0x00000001 /* Receive DMA Transfer Complete */
94 #define PCH_GBE_INT_RX_VALID 0x00000002 /* MAC Normal Receive Complete */
95 #define PCH_GBE_INT_RX_FRAME_ERR 0x00000004 /* Receive frame error */
96 #define PCH_GBE_INT_RX_FIFO_ERR 0x00000008 /* Receive FIFO Overflow */
97 #define PCH_GBE_INT_RX_DMA_ERR 0x00000010 /* Receive DMA Transfer Error */
98 #define PCH_GBE_INT_RX_DSC_EMP 0x00000020 /* Receive Descriptor Empty */
99 #define PCH_GBE_INT_TX_CMPLT 0x00000100 /* MAC Transmission Complete */
100 #define PCH_GBE_INT_TX_DMA_CMPLT 0x00000200 /* DMA Transfer Complete */
101 #define PCH_GBE_INT_TX_FIFO_ERR 0x00000400 /* Transmission FIFO underflow. */
102 #define PCH_GBE_INT_TX_DMA_ERR 0x00000800 /* Transmission DMA Error */
103 #define PCH_GBE_INT_PAUSE_CMPLT 0x00001000 /* Pause Transmission complete */
104 #define PCH_GBE_INT_MIIM_CMPLT 0x00010000 /* MIIM I/F Read completion */
105 #define PCH_GBE_INT_PHY_INT 0x00100000 /* Interruption from PHY */
106 #define PCH_GBE_INT_WOL_DET 0x01000000 /* Wake On LAN Event detection. */
107 #define PCH_GBE_INT_TCPIP_ERR 0x10000000 /* TCP/IP Accelerator Error */
110 #define PCH_GBE_MODE_MII_ETHER 0x00000000 /* GIGA Ethernet Mode [MII] */
111 #define PCH_GBE_MODE_GMII_ETHER 0x80000000 /* GIGA Ethernet Mode [GMII] */
112 #define PCH_GBE_MODE_HALF_DUPLEX 0x00000000 /* Duplex Mode [half duplex] */
113 #define PCH_GBE_MODE_FULL_DUPLEX 0x40000000 /* Duplex Mode [full duplex] */
114 #define PCH_GBE_MODE_FR_BST 0x04000000 /* Frame bursting is done */
117 #define PCH_GBE_ALL_RST 0x80000000 /* All reset */
118 #define PCH_GBE_TX_RST 0x00008000 /* TX MAC, TX FIFO, TX DMA reset */
119 #define PCH_GBE_RX_RST 0x00004000 /* RX MAC, RX FIFO, RX DMA reset */
121 /* TCP/IP Accelerator Control */
122 #define PCH_GBE_EX_LIST_EN 0x00000008 /* External List Enable */
123 #define PCH_GBE_RX_TCPIPACC_OFF 0x00000004 /* RX TCP/IP ACC Disabled */
124 #define PCH_GBE_TX_TCPIPACC_EN 0x00000002 /* TX TCP/IP ACC Enable */
125 #define PCH_GBE_RX_TCPIPACC_EN 0x00000001 /* RX TCP/IP ACC Enable */
128 #define PCH_GBE_MRE_MAC_RX_EN 0x00000001 /* MAC Receive Enable */
130 /* RX Flow Control */
131 #define PCH_GBE_FL_CTRL_EN 0x80000000 /* Pause packet is enabled */
133 /* Pause Packet Request */
134 #define PCH_GBE_PS_PKT_RQ 0x80000000 /* Pause packet Request */
137 #define PCH_GBE_ADD_FIL_EN 0x80000000 /* Address Filtering Enable */
138 /* Multicast Filtering Enable */
139 #define PCH_GBE_MLT_FIL_EN 0x40000000
140 /* Receive Almost Empty Threshold */
141 #define PCH_GBE_RH_ALM_EMP_4 0x00000000 /* 4 words */
142 #define PCH_GBE_RH_ALM_EMP_8 0x00004000 /* 8 words */
143 #define PCH_GBE_RH_ALM_EMP_16 0x00008000 /* 16 words */
144 #define PCH_GBE_RH_ALM_EMP_32 0x0000C000 /* 32 words */
145 /* Receive Almost Full Threshold */
146 #define PCH_GBE_RH_ALM_FULL_4 0x00000000 /* 4 words */
147 #define PCH_GBE_RH_ALM_FULL_8 0x00001000 /* 8 words */
148 #define PCH_GBE_RH_ALM_FULL_16 0x00002000 /* 16 words */
149 #define PCH_GBE_RH_ALM_FULL_32 0x00003000 /* 32 words */
150 /* RX FIFO Read Trigger Threshold */
151 #define PCH_GBE_RH_RD_TRG_4 0x00000000 /* 4 words */
152 #define PCH_GBE_RH_RD_TRG_8 0x00000200 /* 8 words */
153 #define PCH_GBE_RH_RD_TRG_16 0x00000400 /* 16 words */
154 #define PCH_GBE_RH_RD_TRG_32 0x00000600 /* 32 words */
155 #define PCH_GBE_RH_RD_TRG_64 0x00000800 /* 64 words */
156 #define PCH_GBE_RH_RD_TRG_128 0x00000A00 /* 128 words */
157 #define PCH_GBE_RH_RD_TRG_256 0x00000C00 /* 256 words */
158 #define PCH_GBE_RH_RD_TRG_512 0x00000E00 /* 512 words */
160 /* Receive Descriptor bit definitions */
161 #define PCH_GBE_RXD_ACC_STAT_BCAST 0x00000400
162 #define PCH_GBE_RXD_ACC_STAT_MCAST 0x00000200
163 #define PCH_GBE_RXD_ACC_STAT_UCAST 0x00000100
164 #define PCH_GBE_RXD_ACC_STAT_TCPIPOK 0x000000C0
165 #define PCH_GBE_RXD_ACC_STAT_IPOK 0x00000080
166 #define PCH_GBE_RXD_ACC_STAT_TCPOK 0x00000040
167 #define PCH_GBE_RXD_ACC_STAT_IP6ERR 0x00000020
168 #define PCH_GBE_RXD_ACC_STAT_OFLIST 0x00000010
169 #define PCH_GBE_RXD_ACC_STAT_TYPEIP 0x00000008
170 #define PCH_GBE_RXD_ACC_STAT_MACL 0x00000004
171 #define PCH_GBE_RXD_ACC_STAT_PPPOE 0x00000002
172 #define PCH_GBE_RXD_ACC_STAT_VTAGT 0x00000001
173 #define PCH_GBE_RXD_GMAC_STAT_PAUSE 0x0200
174 #define PCH_GBE_RXD_GMAC_STAT_MARBR 0x0100
175 #define PCH_GBE_RXD_GMAC_STAT_MARMLT 0x0080
176 #define PCH_GBE_RXD_GMAC_STAT_MARIND 0x0040
177 #define PCH_GBE_RXD_GMAC_STAT_MARNOTMT 0x0020
178 #define PCH_GBE_RXD_GMAC_STAT_TLONG 0x0010
179 #define PCH_GBE_RXD_GMAC_STAT_TSHRT 0x0008
180 #define PCH_GBE_RXD_GMAC_STAT_NOTOCTAL 0x0004
181 #define PCH_GBE_RXD_GMAC_STAT_NBLERR 0x0002
182 #define PCH_GBE_RXD_GMAC_STAT_CRCERR 0x0001
184 /* Transmit Descriptor bit definitions */
185 #define PCH_GBE_TXD_CTRL_TCPIP_ACC_OFF 0x0008
186 #define PCH_GBE_TXD_CTRL_ITAG 0x0004
187 #define PCH_GBE_TXD_CTRL_ICRC 0x0002
188 #define PCH_GBE_TXD_CTRL_APAD 0x0001
189 #define PCH_GBE_TXD_WORDS_SHIFT 2
190 #define PCH_GBE_TXD_GMAC_STAT_CMPLT 0x2000
191 #define PCH_GBE_TXD_GMAC_STAT_ABT 0x1000
192 #define PCH_GBE_TXD_GMAC_STAT_EXCOL 0x0800
193 #define PCH_GBE_TXD_GMAC_STAT_SNGCOL 0x0400
194 #define PCH_GBE_TXD_GMAC_STAT_MLTCOL 0x0200
195 #define PCH_GBE_TXD_GMAC_STAT_CRSER 0x0100
196 #define PCH_GBE_TXD_GMAC_STAT_TLNG 0x0080
197 #define PCH_GBE_TXD_GMAC_STAT_TSHRT 0x0040
198 #define PCH_GBE_TXD_GMAC_STAT_LTCOL 0x0020
199 #define PCH_GBE_TXD_GMAC_STAT_TFUNDFLW 0x0010
200 #define PCH_GBE_TXD_GMAC_STAT_RTYCNT_MASK 0x000F
203 #define PCH_GBE_TM_NO_RTRY 0x80000000 /* No Retransmission */
204 #define PCH_GBE_TM_LONG_PKT 0x40000000 /* Long Packt TX Enable */
205 #define PCH_GBE_TM_ST_AND_FD 0x20000000 /* Stare and Forward */
206 #define PCH_GBE_TM_SHORT_PKT 0x10000000 /* Short Packet TX Enable */
207 #define PCH_GBE_TM_LTCOL_RETX 0x08000000 /* Retransmission at Late Collision */
208 /* Frame Start Threshold */
209 #define PCH_GBE_TM_TH_TX_STRT_4 0x00000000 /* 4 words */
210 #define PCH_GBE_TM_TH_TX_STRT_8 0x00004000 /* 8 words */
211 #define PCH_GBE_TM_TH_TX_STRT_16 0x00008000 /* 16 words */
212 #define PCH_GBE_TM_TH_TX_STRT_32 0x0000C000 /* 32 words */
213 /* Transmit Almost Empty Threshold */
214 #define PCH_GBE_TM_TH_ALM_EMP_4 0x00000000 /* 4 words */
215 #define PCH_GBE_TM_TH_ALM_EMP_8 0x00000800 /* 8 words */
216 #define PCH_GBE_TM_TH_ALM_EMP_16 0x00001000 /* 16 words */
217 #define PCH_GBE_TM_TH_ALM_EMP_32 0x00001800 /* 32 words */
218 #define PCH_GBE_TM_TH_ALM_EMP_64 0x00002000 /* 64 words */
219 #define PCH_GBE_TM_TH_ALM_EMP_128 0x00002800 /* 128 words */
220 #define PCH_GBE_TM_TH_ALM_EMP_256 0x00003000 /* 256 words */
221 #define PCH_GBE_TM_TH_ALM_EMP_512 0x00003800 /* 512 words */
222 /* Transmit Almost Full Threshold */
223 #define PCH_GBE_TM_TH_ALM_FULL_4 0x00000000 /* 4 words */
224 #define PCH_GBE_TM_TH_ALM_FULL_8 0x00000200 /* 8 words */
225 #define PCH_GBE_TM_TH_ALM_FULL_16 0x00000400 /* 16 words */
226 #define PCH_GBE_TM_TH_ALM_FULL_32 0x00000600 /* 32 words */
229 #define PCH_GBE_RF_ALM_FULL 0x80000000 /* RX FIFO is almost full. */
230 #define PCH_GBE_RF_ALM_EMP 0x40000000 /* RX FIFO is almost empty. */
231 #define PCH_GBE_RF_RD_TRG 0x20000000 /* Become more than RH_RD_TRG. */
232 #define PCH_GBE_RF_STRWD 0x1FFE0000 /* The word count of RX FIFO. */
233 #define PCH_GBE_RF_RCVING 0x00010000 /* Stored in RX FIFO. */
235 /* MAC Address Mask */
236 #define PCH_GBE_BUSY 0x80000000
239 #define PCH_GBE_MIIM_OPER_WRITE 0x04000000
240 #define PCH_GBE_MIIM_OPER_READ 0x00000000
241 #define PCH_GBE_MIIM_OPER_READY 0x04000000
242 #define PCH_GBE_MIIM_PHY_ADDR_SHIFT 21
243 #define PCH_GBE_MIIM_REG_ADDR_SHIFT 16
246 #define PCH_GBE_LINK_UP 0x80000008
247 #define PCH_GBE_RXC_SPEED_MSK 0x00000006
248 #define PCH_GBE_RXC_SPEED_2_5M 0x00000000 /* 2.5MHz */
249 #define PCH_GBE_RXC_SPEED_25M 0x00000002 /* 25MHz */
250 #define PCH_GBE_RXC_SPEED_125M 0x00000004 /* 100MHz */
251 #define PCH_GBE_DUPLEX_FULL 0x00000001
254 #define PCH_GBE_CRS_SEL 0x00000010
255 #define PCH_GBE_RGMII_RATE_125M 0x00000000
256 #define PCH_GBE_RGMII_RATE_25M 0x00000008
257 #define PCH_GBE_RGMII_RATE_2_5M 0x0000000C
258 #define PCH_GBE_RGMII_MODE_GMII 0x00000000
259 #define PCH_GBE_RGMII_MODE_RGMII 0x00000002
260 #define PCH_GBE_CHIP_TYPE_EXTERNAL 0x00000000
261 #define PCH_GBE_CHIP_TYPE_INTERNAL 0x00000001
264 #define PCH_GBE_RX_DMA_EN 0x00000002 /* Enables Receive DMA */
265 #define PCH_GBE_TX_DMA_EN 0x00000001 /* Enables Transmission DMA */
268 #define PCH_GBE_IDLE_CHECK 0xFFFFFFFE
270 /* Wake On LAN Status */
271 #define PCH_GBE_WLS_BR 0x00000008 /* Broadcas Address */
272 #define PCH_GBE_WLS_MLT 0x00000004 /* Multicast Address */
274 /* The Frame registered in Address Recognizer */
275 #define PCH_GBE_WLS_IND 0x00000002
276 #define PCH_GBE_WLS_MP 0x00000001 /* Magic packet Address */
278 /* Wake On LAN Control */
279 #define PCH_GBE_WLC_WOL_MODE 0x00010000
280 #define PCH_GBE_WLC_IGN_TLONG 0x00000100
281 #define PCH_GBE_WLC_IGN_TSHRT 0x00000080
282 #define PCH_GBE_WLC_IGN_OCTER 0x00000040
283 #define PCH_GBE_WLC_IGN_NBLER 0x00000020
284 #define PCH_GBE_WLC_IGN_CRCER 0x00000010
285 #define PCH_GBE_WLC_BR 0x00000008
286 #define PCH_GBE_WLC_MLT 0x00000004
287 #define PCH_GBE_WLC_IND 0x00000002
288 #define PCH_GBE_WLC_MP 0x00000001
290 /* Wake On LAN Address Mask */
291 #define PCH_GBE_WLA_BUSY 0x80000000
295 /* TX/RX descriptor defines */
296 #define PCH_GBE_MAX_TXD 4096
297 #define PCH_GBE_DEFAULT_TXD 256
298 #define PCH_GBE_MIN_TXD 8
299 #define PCH_GBE_MAX_RXD 4096
300 #define PCH_GBE_DEFAULT_RXD 256
301 #define PCH_GBE_MIN_RXD 8
303 /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
304 #define PCH_GBE_TX_DESC_MULTIPLE 8
305 #define PCH_GBE_RX_DESC_MULTIPLE 8
307 /* Read/Write operation is done through MII Management IF */
308 #define PCH_GBE_HAL_MIIM_READ ((u32)0x00000000)
309 #define PCH_GBE_HAL_MIIM_WRITE ((u32)0x04000000)
311 /* flow control values */
312 #define PCH_GBE_FC_NONE 0
313 #define PCH_GBE_FC_RX_PAUSE 1
314 #define PCH_GBE_FC_TX_PAUSE 2
315 #define PCH_GBE_FC_FULL 3
316 #define PCH_GBE_FC_DEFAULT PCH_GBE_FC_FULL
319 * struct pch_gbe_mac_info - MAC information
320 * @addr[6]: Store the MAC address
321 * @fc: Mode of flow control
322 * @fc_autoneg: Auto negotiation enable for flow control setting
323 * @tx_fc_enable: Enable flag of Transmit flow control
324 * @max_frame_size: Max transmit frame size
325 * @min_frame_size: Min transmit frame size
326 * @autoneg: Auto negotiation enable
327 * @link_speed: Link speed
328 * @link_duplex: Link duplex
330 struct pch_gbe_mac_info
{
343 * struct pch_gbe_phy_info - PHY information
345 * @id: PHY's identifier
346 * @revision: PHY's revision
347 * @reset_delay_us: HW reset delay time[us]
348 * @autoneg_advertised: Autoneg advertised
350 struct pch_gbe_phy_info
{
355 u16 autoneg_advertised
;
359 * @ingroup Gigabit Ether driver Layer
361 * @brief Hardware information
366 struct pch_gbe_regs __iomem
*reg
;
367 spinlock_t miim_lock
;
369 struct pch_gbe_mac_info mac
;
370 struct pch_gbe_phy_info phy
;
374 * struct pch_gbe_rx_desc - Receive Descriptor
375 * @buffer_addr: RX Frame Buffer Address
376 * @tcp_ip_status: TCP/IP Accelerator Status
377 * @rx_words_eob: RX word count and Byte position
378 * @gbec_status: GMAC Status
379 * @dma_status: DMA Status
380 * @reserved1: Reserved
381 * @reserved2: Reserved
383 struct pch_gbe_rx_desc
{
394 * struct pch_gbe_tx_desc - Transmit Descriptor
395 * @buffer_addr: TX Frame Buffer Address
396 * @length: Data buffer length
397 * @reserved1: Reserved
398 * @tx_words_eob: TX word count and Byte position
399 * @tx_frame_ctrl: TX Frame Control
400 * @dma_status: DMA Status
401 * @reserved2: Reserved
402 * @gbec_status: GMAC Status
404 struct pch_gbe_tx_desc
{
417 * struct pch_gbe_buffer - Buffer information
418 * @skb: pointer to a socket buffer
420 * @time_stamp: time stamp
423 struct pch_gbe_buffer
{
426 unsigned char *rx_buffer
;
427 unsigned long time_stamp
;
433 * struct pch_gbe_tx_ring - tx ring information
434 * @desc: pointer to the descriptor ring memory
435 * @dma: physical address of the descriptor ring
436 * @size: length of descriptor ring in bytes
437 * @count: number of descriptors in the ring
438 * @next_to_use: next descriptor to associate a buffer with
439 * @next_to_clean: next descriptor to check for DD status bit
440 * @buffer_info: array of buffer information structs
442 struct pch_gbe_tx_ring
{
443 struct pch_gbe_tx_desc
*desc
;
447 unsigned int next_to_use
;
448 unsigned int next_to_clean
;
449 struct pch_gbe_buffer
*buffer_info
;
453 * struct pch_gbe_rx_ring - rx ring information
454 * @desc: pointer to the descriptor ring memory
455 * @dma: physical address of the descriptor ring
456 * @size: length of descriptor ring in bytes
457 * @count: number of descriptors in the ring
458 * @next_to_use: next descriptor to associate a buffer with
459 * @next_to_clean: next descriptor to check for DD status bit
460 * @buffer_info: array of buffer information structs
462 struct pch_gbe_rx_ring
{
463 struct pch_gbe_rx_desc
*desc
;
465 unsigned char *rx_buff_pool
;
466 dma_addr_t rx_buff_pool_logic
;
467 unsigned int rx_buff_pool_size
;
470 unsigned int next_to_use
;
471 unsigned int next_to_clean
;
472 struct pch_gbe_buffer
*buffer_info
;
476 * struct pch_gbe_hw_stats - Statistics counters collected by the MAC
477 * @rx_packets: total packets received
478 * @tx_packets: total packets transmitted
479 * @rx_bytes: total bytes received
480 * @tx_bytes: total bytes transmitted
481 * @rx_errors: bad packets received
482 * @tx_errors: packet transmit problems
483 * @rx_dropped: no space in Linux buffers
484 * @tx_dropped: no space available in Linux
485 * @multicast: multicast packets received
486 * @collisions: collisions
487 * @rx_crc_errors: received packet with crc error
488 * @rx_frame_errors: received frame alignment error
489 * @rx_alloc_buff_failed: allocate failure of a receive buffer
490 * @tx_length_errors: transmit length error
491 * @tx_aborted_errors: transmit aborted error
492 * @tx_carrier_errors: transmit carrier error
493 * @tx_timeout_count: Number of transmit timeout
494 * @tx_restart_count: Number of transmit restert
495 * @intr_rx_dsc_empty_count: Interrupt count of receive descriptor empty
496 * @intr_rx_frame_err_count: Interrupt count of receive frame error
497 * @intr_rx_fifo_err_count: Interrupt count of receive FIFO error
498 * @intr_rx_dma_err_count: Interrupt count of receive DMA error
499 * @intr_tx_fifo_err_count: Interrupt count of transmit FIFO error
500 * @intr_tx_dma_err_count: Interrupt count of transmit DMA error
501 * @intr_tcpip_err_count: Interrupt count of TCP/IP Accelerator
503 struct pch_gbe_hw_stats
{
516 u32 rx_alloc_buff_failed
;
517 u32 tx_length_errors
;
518 u32 tx_aborted_errors
;
519 u32 tx_carrier_errors
;
520 u32 tx_timeout_count
;
521 u32 tx_restart_count
;
522 u32 intr_rx_dsc_empty_count
;
523 u32 intr_rx_frame_err_count
;
524 u32 intr_rx_fifo_err_count
;
525 u32 intr_rx_dma_err_count
;
526 u32 intr_tx_fifo_err_count
;
527 u32 intr_tx_dma_err_count
;
528 u32 intr_tcpip_err_count
;
532 * struct pch_gbe_privdata - PCI Device ID driver data
533 * @phy_tx_clk_delay: Bool, configure the PHY TX delay in software
534 * @phy_disable_hibernate: Bool, disable PHY hibernation
535 * @platform_init: Platform initialization callback, called from
536 * probe, prior to PHY initialization.
538 struct pch_gbe_privdata
{
539 bool phy_tx_clk_delay
;
540 bool phy_disable_hibernate
;
541 int (*platform_init
)(struct pci_dev
*pdev
);
545 * struct pch_gbe_adapter - board specific private data structure
546 * @stats_lock: Spinlock structure for status
547 * @ethtool_lock: Spinlock structure for ethtool
548 * @irq_sem: Semaphore for interrupt
549 * @netdev: Pointer of network device structure
550 * @pdev: Pointer of pci device structure
551 * @polling_netdev: Pointer of polling network device structure
552 * @napi: NAPI structure
553 * @hw: Pointer of hardware structure
554 * @stats: Hardware status
555 * @reset_task: Reset task
556 * @mii: MII information structure
557 * @watchdog_timer: Watchdog timer list
558 * @wake_up_evt: Wake up event
559 * @config_space: Configuration space
560 * @msg_enable: Driver message level
561 * @led_status: LED status
562 * @tx_ring: Pointer of Tx descriptor ring structure
563 * @rx_ring: Pointer of Rx descriptor ring structure
564 * @rx_buffer_len: Receive buffer length
565 * @tx_queue_len: Transmit queue length
566 * @pch_gbe_privdata: PCI Device ID driver_data
569 struct pch_gbe_adapter
{
570 spinlock_t stats_lock
;
571 spinlock_t ethtool_lock
;
573 struct net_device
*netdev
;
574 struct pci_dev
*pdev
;
576 struct net_device
*polling_netdev
;
577 struct napi_struct napi
;
578 struct pch_gbe_hw hw
;
579 struct pch_gbe_hw_stats stats
;
580 struct work_struct reset_task
;
581 struct mii_if_info mii
;
582 struct timer_list watchdog_timer
;
585 unsigned long led_status
;
586 struct pch_gbe_tx_ring
*tx_ring
;
587 struct pch_gbe_rx_ring
*rx_ring
;
588 unsigned long rx_buffer_len
;
589 unsigned long tx_queue_len
;
593 struct pci_dev
*ptp_pdev
;
594 struct pch_gbe_privdata
*pdata
;
597 #define pch_gbe_hw_to_adapter(hw) container_of(hw, struct pch_gbe_adapter, hw)
599 extern const char pch_driver_version
[];
602 int pch_gbe_up(struct pch_gbe_adapter
*adapter
);
603 void pch_gbe_down(struct pch_gbe_adapter
*adapter
);
604 void pch_gbe_reinit_locked(struct pch_gbe_adapter
*adapter
);
605 void pch_gbe_reset(struct pch_gbe_adapter
*adapter
);
606 int pch_gbe_setup_tx_resources(struct pch_gbe_adapter
*adapter
,
607 struct pch_gbe_tx_ring
*txdr
);
608 int pch_gbe_setup_rx_resources(struct pch_gbe_adapter
*adapter
,
609 struct pch_gbe_rx_ring
*rxdr
);
610 void pch_gbe_free_tx_resources(struct pch_gbe_adapter
*adapter
,
611 struct pch_gbe_tx_ring
*tx_ring
);
612 void pch_gbe_free_rx_resources(struct pch_gbe_adapter
*adapter
,
613 struct pch_gbe_rx_ring
*rx_ring
);
614 void pch_gbe_update_stats(struct pch_gbe_adapter
*adapter
);
615 u32
pch_ch_control_read(struct pci_dev
*pdev
);
616 void pch_ch_control_write(struct pci_dev
*pdev
, u32 val
);
617 u32
pch_ch_event_read(struct pci_dev
*pdev
);
618 void pch_ch_event_write(struct pci_dev
*pdev
, u32 val
);
619 u32
pch_src_uuid_lo_read(struct pci_dev
*pdev
);
620 u32
pch_src_uuid_hi_read(struct pci_dev
*pdev
);
621 u64
pch_rx_snap_read(struct pci_dev
*pdev
);
622 u64
pch_tx_snap_read(struct pci_dev
*pdev
);
623 int pch_set_station_address(u8
*addr
, struct pci_dev
*pdev
);
625 /* pch_gbe_param.c */
626 void pch_gbe_check_options(struct pch_gbe_adapter
*adapter
);
628 /* pch_gbe_ethtool.c */
629 void pch_gbe_set_ethtool_ops(struct net_device
*netdev
);
632 s32
pch_gbe_mac_force_mac_fc(struct pch_gbe_hw
*hw
);
633 u16
pch_gbe_mac_ctrl_miim(struct pch_gbe_hw
*hw
, u32 addr
, u32 dir
, u32 reg
,
635 #endif /* _PCH_GBE_H_ */