mirror of
				https://github.com/AetherDroid/android_kernel_samsung_on5xelte.git
				synced 2025-10-30 23:58:51 +01:00 
			
		
		
		
	Fixed MTP to work with TWRP
This commit is contained in:
		
						commit
						f6dfaef42e
					
				
					 50820 changed files with 20846062 additions and 0 deletions
				
			
		
							
								
								
									
										1418
									
								
								drivers/net/ethernet/intel/e1000e/80003es2lan.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1418
									
								
								drivers/net/ethernet/intel/e1000e/80003es2lan.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										88
									
								
								drivers/net/ethernet/intel/e1000e/80003es2lan.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								drivers/net/ethernet/intel/e1000e/80003es2lan.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,88 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_80003ES2LAN_H_ | ||||
| #define _E1000E_80003ES2LAN_H_ | ||||
| 
 | ||||
| #define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL	0x00 | ||||
| #define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL	0x02 | ||||
| #define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL	0x10 | ||||
| #define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE	0x1F | ||||
| 
 | ||||
| #define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS	0x0008 | ||||
| #define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS	0x0800 | ||||
| #define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING	0x0010 | ||||
| 
 | ||||
| #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004 | ||||
| #define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT	0x0000 | ||||
| #define E1000_KMRNCTRLSTA_OPMODE_E_IDLE		0x2000 | ||||
| 
 | ||||
| #define E1000_KMRNCTRLSTA_OPMODE_MASK		0x000C | ||||
| #define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO	0x0004 | ||||
| 
 | ||||
| #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00	/* Gig Carry Extend Padding */ | ||||
| #define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN	0x00010000 | ||||
| 
 | ||||
| #define DEFAULT_TIPG_IPGT_1000_80003ES2LAN	0x8 | ||||
| #define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN	0x9 | ||||
| 
 | ||||
| /* GG82563 PHY Specific Status Register (Page 0, Register 16 */ | ||||
| #define GG82563_PSCR_POLARITY_REVERSAL_DISABLE	0x0002	/* 1=Reversal Dis */ | ||||
| #define GG82563_PSCR_CROSSOVER_MODE_MASK	0x0060 | ||||
| #define GG82563_PSCR_CROSSOVER_MODE_MDI		0x0000	/* 00=Manual MDI */ | ||||
| #define GG82563_PSCR_CROSSOVER_MODE_MDIX	0x0020	/* 01=Manual MDIX */ | ||||
| #define GG82563_PSCR_CROSSOVER_MODE_AUTO	0x0060	/* 11=Auto crossover */ | ||||
| 
 | ||||
| /* PHY Specific Control Register 2 (Page 0, Register 26) */ | ||||
| #define GG82563_PSCR2_REVERSE_AUTO_NEG		0x2000	/* 1=Reverse Auto-Neg */ | ||||
| 
 | ||||
| /* MAC Specific Control Register (Page 2, Register 21) */ | ||||
| /* Tx clock speed for Link Down and 1000BASE-T for the following speeds */ | ||||
| #define GG82563_MSCR_TX_CLK_MASK		0x0007 | ||||
| #define GG82563_MSCR_TX_CLK_10MBPS_2_5		0x0004 | ||||
| #define GG82563_MSCR_TX_CLK_100MBPS_25		0x0005 | ||||
| #define GG82563_MSCR_TX_CLK_1000MBPS_25		0x0007 | ||||
| 
 | ||||
| #define GG82563_MSCR_ASSERT_CRS_ON_TX		0x0010	/* 1=Assert */ | ||||
| 
 | ||||
| /* DSP Distance Register (Page 5, Register 26)
 | ||||
|  * 0 = <50M | ||||
|  * 1 = 50-80M | ||||
|  * 2 = 80-100M | ||||
|  * 3 = 110-140M | ||||
|  * 4 = >140M | ||||
|  */ | ||||
| #define GG82563_DSPD_CABLE_LENGTH		0x0007 | ||||
| 
 | ||||
| /* Kumeran Mode Control Register (Page 193, Register 16) */ | ||||
| #define GG82563_KMCR_PASS_FALSE_CARRIER		0x0800 | ||||
| 
 | ||||
| /* Max number of times Kumeran read/write should be validated */ | ||||
| #define GG82563_MAX_KMRN_RETRY			0x5 | ||||
| 
 | ||||
| /* Power Management Control Register (Page 193, Register 20) */ | ||||
| /* 1=Enable SERDES Electrical Idle */ | ||||
| #define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE	0x0001 | ||||
| 
 | ||||
| /* In-Band Control Register (Page 194, Register 18) */ | ||||
| #define GG82563_ICR_DIS_PADDING			0x0010	/* Disable Padding */ | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										2063
									
								
								drivers/net/ethernet/intel/e1000e/82571.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2063
									
								
								drivers/net/ethernet/intel/e1000e/82571.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										53
									
								
								drivers/net/ethernet/intel/e1000e/82571.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								drivers/net/ethernet/intel/e1000e/82571.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_82571_H_ | ||||
| #define _E1000E_82571_H_ | ||||
| 
 | ||||
| #define ID_LED_RESERVED_F746	0xF746 | ||||
| #define ID_LED_DEFAULT_82573	((ID_LED_DEF1_DEF2 << 12) | \ | ||||
| 				 (ID_LED_OFF1_ON2  <<  8) | \ | ||||
| 				 (ID_LED_DEF1_DEF2 <<  4) | \ | ||||
| 				 (ID_LED_DEF1_DEF2)) | ||||
| 
 | ||||
| #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX	0x08000000 | ||||
| #define AN_RETRY_COUNT		5	/* Autoneg Retry Count value */ | ||||
| 
 | ||||
| /* Intr Throttling - RW */ | ||||
| #define E1000_EITR_82574(_n)	(0x000E8 + (0x4 * (_n))) | ||||
| 
 | ||||
| #define E1000_EIAC_82574	0x000DC	/* Ext. Interrupt Auto Clear - RW */ | ||||
| #define E1000_EIAC_MASK_82574	0x01F00000 | ||||
| 
 | ||||
| #define E1000_IVAR_INT_ALLOC_VALID	0x8 | ||||
| 
 | ||||
| /* Manageability Operation Mode mask */ | ||||
| #define E1000_NVM_INIT_CTRL2_MNGM	0x6000 | ||||
| 
 | ||||
| #define E1000_BASE1000T_STATUS		10 | ||||
| #define E1000_IDLE_ERROR_COUNT_MASK	0xFF | ||||
| #define E1000_RECEIVE_ERROR_COUNTER	21 | ||||
| #define E1000_RECEIVE_ERROR_MAX		0xFFFF | ||||
| bool e1000_check_phy_82574(struct e1000_hw *hw); | ||||
| bool e1000e_get_laa_state_82571(struct e1000_hw *hw); | ||||
| void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										37
									
								
								drivers/net/ethernet/intel/e1000e/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								drivers/net/ethernet/intel/e1000e/Makefile
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| ################################################################################
 | ||||
| #
 | ||||
| # Intel PRO/1000 Linux driver
 | ||||
| # Copyright(c) 1999 - 2014 Intel Corporation.
 | ||||
| #
 | ||||
| # This program is free software; you can redistribute it and/or modify it
 | ||||
| # under the terms and conditions of the GNU General Public License,
 | ||||
| # version 2, as published by the Free Software Foundation.
 | ||||
| #
 | ||||
| # This program is distributed in the hope it will be useful, but WITHOUT
 | ||||
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 | ||||
| # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 | ||||
| # more details.
 | ||||
| #
 | ||||
| # You should have received a copy of the GNU General Public License
 | ||||
| # along with this program; if not, see <http://www.gnu.org/licenses/>.
 | ||||
| #
 | ||||
| # The full GNU General Public License is included in this distribution in
 | ||||
| # the file called "COPYING".
 | ||||
| #
 | ||||
| # Contact Information:
 | ||||
| # Linux NICS <linux.nics@intel.com>
 | ||||
| # e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
 | ||||
| # Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 | ||||
| #
 | ||||
| ################################################################################
 | ||||
| 
 | ||||
| #
 | ||||
| # Makefile for the Intel(R) PRO/1000 ethernet driver
 | ||||
| #
 | ||||
| 
 | ||||
| obj-$(CONFIG_E1000E) += e1000e.o | ||||
| 
 | ||||
| e1000e-objs := 82571.o ich8lan.o 80003es2lan.o \
 | ||||
| 	       mac.o manage.o nvm.o phy.o \
 | ||||
| 	       param.o ethtool.o netdev.o ptp.o | ||||
| 
 | ||||
							
								
								
									
										799
									
								
								drivers/net/ethernet/intel/e1000e/defines.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										799
									
								
								drivers/net/ethernet/intel/e1000e/defines.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,799 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000_DEFINES_H_ | ||||
| #define _E1000_DEFINES_H_ | ||||
| 
 | ||||
| /* Number of Transmit and Receive Descriptors must be a multiple of 8 */ | ||||
| #define REQ_TX_DESCRIPTOR_MULTIPLE  8 | ||||
| #define REQ_RX_DESCRIPTOR_MULTIPLE  8 | ||||
| 
 | ||||
| /* Definitions for power management and wakeup registers */ | ||||
| /* Wake Up Control */ | ||||
| #define E1000_WUC_APME		0x00000001	/* APM Enable */ | ||||
| #define E1000_WUC_PME_EN	0x00000002	/* PME Enable */ | ||||
| #define E1000_WUC_PME_STATUS	0x00000004	/* PME Status */ | ||||
| #define E1000_WUC_APMPME	0x00000008	/* Assert PME on APM Wakeup */ | ||||
| #define E1000_WUC_PHY_WAKE	0x00000100	/* if PHY supports wakeup */ | ||||
| 
 | ||||
| /* Wake Up Filter Control */ | ||||
| #define E1000_WUFC_LNKC 0x00000001 /* Link Status Change Wakeup Enable */ | ||||
| #define E1000_WUFC_MAG  0x00000002 /* Magic Packet Wakeup Enable */ | ||||
| #define E1000_WUFC_EX   0x00000004 /* Directed Exact Wakeup Enable */ | ||||
| #define E1000_WUFC_MC   0x00000008 /* Directed Multicast Wakeup Enable */ | ||||
| #define E1000_WUFC_BC   0x00000010 /* Broadcast Wakeup Enable */ | ||||
| #define E1000_WUFC_ARP  0x00000020 /* ARP Request Packet Wakeup Enable */ | ||||
| 
 | ||||
| /* Wake Up Status */ | ||||
| #define E1000_WUS_LNKC         E1000_WUFC_LNKC | ||||
| #define E1000_WUS_MAG          E1000_WUFC_MAG | ||||
| #define E1000_WUS_EX           E1000_WUFC_EX | ||||
| #define E1000_WUS_MC           E1000_WUFC_MC | ||||
| #define E1000_WUS_BC           E1000_WUFC_BC | ||||
| 
 | ||||
| /* Extended Device Control */ | ||||
| #define E1000_CTRL_EXT_LPCD  0x00000004     /* LCD Power Cycle Done */ | ||||
| #define E1000_CTRL_EXT_SDP3_DATA 0x00000080 /* Value of SW Definable Pin 3 */ | ||||
| #define E1000_CTRL_EXT_FORCE_SMBUS 0x00000800 /* Force SMBus mode */ | ||||
| #define E1000_CTRL_EXT_EE_RST    0x00002000 /* Reinitialize from EEPROM */ | ||||
| #define E1000_CTRL_EXT_SPD_BYPS  0x00008000 /* Speed Select Bypass */ | ||||
| #define E1000_CTRL_EXT_RO_DIS    0x00020000 /* Relaxed Ordering disable */ | ||||
| #define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */ | ||||
| #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000 | ||||
| #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES  0x00C00000 | ||||
| #define E1000_CTRL_EXT_EIAME          0x01000000 | ||||
| #define E1000_CTRL_EXT_DRV_LOAD       0x10000000 /* Driver loaded bit for FW */ | ||||
| #define E1000_CTRL_EXT_IAME		0x08000000 /* Int ACK Auto-mask */ | ||||
| #define E1000_CTRL_EXT_PBA_CLR        0x80000000 /* PBA Clear */ | ||||
| #define E1000_CTRL_EXT_LSECCK         0x00001000 | ||||
| #define E1000_CTRL_EXT_PHYPDEN        0x00100000 | ||||
| 
 | ||||
| /* Receive Descriptor bit definitions */ | ||||
| #define E1000_RXD_STAT_DD       0x01    /* Descriptor Done */ | ||||
| #define E1000_RXD_STAT_EOP      0x02    /* End of Packet */ | ||||
| #define E1000_RXD_STAT_IXSM     0x04    /* Ignore checksum */ | ||||
| #define E1000_RXD_STAT_VP       0x08    /* IEEE VLAN Packet */ | ||||
| #define E1000_RXD_STAT_UDPCS    0x10    /* UDP xsum calculated */ | ||||
| #define E1000_RXD_STAT_TCPCS    0x20    /* TCP xsum calculated */ | ||||
| #define E1000_RXD_ERR_CE        0x01    /* CRC Error */ | ||||
| #define E1000_RXD_ERR_SE        0x02    /* Symbol Error */ | ||||
| #define E1000_RXD_ERR_SEQ       0x04    /* Sequence Error */ | ||||
| #define E1000_RXD_ERR_CXE       0x10    /* Carrier Extension Error */ | ||||
| #define E1000_RXD_ERR_TCPE      0x20    /* TCP/UDP Checksum Error */ | ||||
| #define E1000_RXD_ERR_IPE       0x40    /* IP Checksum Error */ | ||||
| #define E1000_RXD_ERR_RXE       0x80    /* Rx Data Error */ | ||||
| #define E1000_RXD_SPC_VLAN_MASK 0x0FFF  /* VLAN ID is in lower 12 bits */ | ||||
| 
 | ||||
| #define E1000_RXDEXT_STATERR_TST   0x00000100	/* Time Stamp taken */ | ||||
| #define E1000_RXDEXT_STATERR_CE    0x01000000 | ||||
| #define E1000_RXDEXT_STATERR_SE    0x02000000 | ||||
| #define E1000_RXDEXT_STATERR_SEQ   0x04000000 | ||||
| #define E1000_RXDEXT_STATERR_CXE   0x10000000 | ||||
| #define E1000_RXDEXT_STATERR_RXE   0x80000000 | ||||
| 
 | ||||
| /* mask to determine if packets should be dropped due to frame errors */ | ||||
| #define E1000_RXD_ERR_FRAME_ERR_MASK ( \ | ||||
| 	E1000_RXD_ERR_CE  |		\ | ||||
| 	E1000_RXD_ERR_SE  |		\ | ||||
| 	E1000_RXD_ERR_SEQ |		\ | ||||
| 	E1000_RXD_ERR_CXE |		\ | ||||
| 	E1000_RXD_ERR_RXE) | ||||
| 
 | ||||
| /* Same mask, but for extended and packet split descriptors */ | ||||
| #define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \ | ||||
| 	E1000_RXDEXT_STATERR_CE  |	\ | ||||
| 	E1000_RXDEXT_STATERR_SE  |	\ | ||||
| 	E1000_RXDEXT_STATERR_SEQ |	\ | ||||
| 	E1000_RXDEXT_STATERR_CXE |	\ | ||||
| 	E1000_RXDEXT_STATERR_RXE) | ||||
| 
 | ||||
| #define E1000_MRQC_RSS_FIELD_MASK              0xFFFF0000 | ||||
| #define E1000_MRQC_RSS_FIELD_IPV4_TCP          0x00010000 | ||||
| #define E1000_MRQC_RSS_FIELD_IPV4              0x00020000 | ||||
| #define E1000_MRQC_RSS_FIELD_IPV6_TCP_EX       0x00040000 | ||||
| #define E1000_MRQC_RSS_FIELD_IPV6              0x00100000 | ||||
| #define E1000_MRQC_RSS_FIELD_IPV6_TCP          0x00200000 | ||||
| 
 | ||||
| #define E1000_RXDPS_HDRSTAT_HDRSP              0x00008000 | ||||
| 
 | ||||
| /* Management Control */ | ||||
| #define E1000_MANC_SMBUS_EN      0x00000001 /* SMBus Enabled - RO */ | ||||
| #define E1000_MANC_ASF_EN        0x00000002 /* ASF Enabled - RO */ | ||||
| #define E1000_MANC_ARP_EN        0x00002000 /* Enable ARP Request Filtering */ | ||||
| #define E1000_MANC_RCV_TCO_EN    0x00020000 /* Receive TCO Packets Enabled */ | ||||
| #define E1000_MANC_BLK_PHY_RST_ON_IDE   0x00040000 /* Block phy resets */ | ||||
| /* Enable MAC address filtering */ | ||||
| #define E1000_MANC_EN_MAC_ADDR_FILTER   0x00100000 | ||||
| /* Enable MNG packets to host memory */ | ||||
| #define E1000_MANC_EN_MNG2HOST   0x00200000 | ||||
| 
 | ||||
| #define E1000_MANC2H_PORT_623    0x00000020 /* Port 0x26f */ | ||||
| #define E1000_MANC2H_PORT_664    0x00000040 /* Port 0x298 */ | ||||
| #define E1000_MDEF_PORT_623      0x00000800 /* Port 0x26f */ | ||||
| #define E1000_MDEF_PORT_664      0x00000400 /* Port 0x298 */ | ||||
| 
 | ||||
| /* Receive Control */ | ||||
| #define E1000_RCTL_EN             0x00000002    /* enable */ | ||||
| #define E1000_RCTL_SBP            0x00000004    /* store bad packet */ | ||||
| #define E1000_RCTL_UPE            0x00000008    /* unicast promiscuous enable */ | ||||
| #define E1000_RCTL_MPE            0x00000010    /* multicast promiscuous enab */ | ||||
| #define E1000_RCTL_LPE            0x00000020    /* long packet enable */ | ||||
| #define E1000_RCTL_LBM_NO         0x00000000    /* no loopback mode */ | ||||
| #define E1000_RCTL_LBM_MAC        0x00000040    /* MAC loopback mode */ | ||||
| #define E1000_RCTL_LBM_TCVR       0x000000C0    /* tcvr loopback mode */ | ||||
| #define E1000_RCTL_DTYP_PS        0x00000400    /* Packet Split descriptor */ | ||||
| #define E1000_RCTL_RDMTS_HALF     0x00000000    /* Rx desc min threshold size */ | ||||
| #define E1000_RCTL_MO_SHIFT       12            /* multicast offset shift */ | ||||
| #define E1000_RCTL_MO_3           0x00003000    /* multicast offset 15:4 */ | ||||
| #define E1000_RCTL_BAM            0x00008000    /* broadcast enable */ | ||||
| /* these buffer sizes are valid if E1000_RCTL_BSEX is 0 */ | ||||
| #define E1000_RCTL_SZ_2048        0x00000000    /* Rx buffer size 2048 */ | ||||
| #define E1000_RCTL_SZ_1024        0x00010000    /* Rx buffer size 1024 */ | ||||
| #define E1000_RCTL_SZ_512         0x00020000    /* Rx buffer size 512 */ | ||||
| #define E1000_RCTL_SZ_256         0x00030000    /* Rx buffer size 256 */ | ||||
| /* these buffer sizes are valid if E1000_RCTL_BSEX is 1 */ | ||||
| #define E1000_RCTL_SZ_16384       0x00010000    /* Rx buffer size 16384 */ | ||||
| #define E1000_RCTL_SZ_8192        0x00020000    /* Rx buffer size 8192 */ | ||||
| #define E1000_RCTL_SZ_4096        0x00030000    /* Rx buffer size 4096 */ | ||||
| #define E1000_RCTL_VFE            0x00040000    /* vlan filter enable */ | ||||
| #define E1000_RCTL_CFIEN          0x00080000    /* canonical form enable */ | ||||
| #define E1000_RCTL_CFI            0x00100000    /* canonical form indicator */ | ||||
| #define E1000_RCTL_DPF            0x00400000    /* Discard Pause Frames */ | ||||
| #define E1000_RCTL_PMCF           0x00800000    /* pass MAC control frames */ | ||||
| #define E1000_RCTL_BSEX           0x02000000    /* Buffer size extension */ | ||||
| #define E1000_RCTL_SECRC          0x04000000    /* Strip Ethernet CRC */ | ||||
| 
 | ||||
| /* Use byte values for the following shift parameters
 | ||||
|  * Usage: | ||||
|  *     psrctl |= (((ROUNDUP(value0, 128) >> E1000_PSRCTL_BSIZE0_SHIFT) & | ||||
|  *                  E1000_PSRCTL_BSIZE0_MASK) | | ||||
|  *                ((ROUNDUP(value1, 1024) >> E1000_PSRCTL_BSIZE1_SHIFT) & | ||||
|  *                  E1000_PSRCTL_BSIZE1_MASK) | | ||||
|  *                ((ROUNDUP(value2, 1024) << E1000_PSRCTL_BSIZE2_SHIFT) & | ||||
|  *                  E1000_PSRCTL_BSIZE2_MASK) | | ||||
|  *                ((ROUNDUP(value3, 1024) << E1000_PSRCTL_BSIZE3_SHIFT) |; | ||||
|  *                  E1000_PSRCTL_BSIZE3_MASK)) | ||||
|  * where value0 = [128..16256],  default=256 | ||||
|  *       value1 = [1024..64512], default=4096 | ||||
|  *       value2 = [0..64512],    default=4096 | ||||
|  *       value3 = [0..64512],    default=0 | ||||
|  */ | ||||
| 
 | ||||
| #define E1000_PSRCTL_BSIZE0_MASK   0x0000007F | ||||
| #define E1000_PSRCTL_BSIZE1_MASK   0x00003F00 | ||||
| #define E1000_PSRCTL_BSIZE2_MASK   0x003F0000 | ||||
| #define E1000_PSRCTL_BSIZE3_MASK   0x3F000000 | ||||
| 
 | ||||
| #define E1000_PSRCTL_BSIZE0_SHIFT  7            /* Shift _right_ 7 */ | ||||
| #define E1000_PSRCTL_BSIZE1_SHIFT  2            /* Shift _right_ 2 */ | ||||
| #define E1000_PSRCTL_BSIZE2_SHIFT  6            /* Shift _left_ 6 */ | ||||
| #define E1000_PSRCTL_BSIZE3_SHIFT 14            /* Shift _left_ 14 */ | ||||
| 
 | ||||
| /* SWFW_SYNC Definitions */ | ||||
| #define E1000_SWFW_EEP_SM   0x1 | ||||
| #define E1000_SWFW_PHY0_SM  0x2 | ||||
| #define E1000_SWFW_PHY1_SM  0x4 | ||||
| #define E1000_SWFW_CSR_SM   0x8 | ||||
| 
 | ||||
| /* Device Control */ | ||||
| #define E1000_CTRL_FD       0x00000001  /* Full duplex.0=half; 1=full */ | ||||
| #define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master requests */ | ||||
| #define E1000_CTRL_LRST     0x00000008  /* Link reset. 0=normal,1=reset */ | ||||
| #define E1000_CTRL_ASDE     0x00000020  /* Auto-speed detect enable */ | ||||
| #define E1000_CTRL_SLU      0x00000040  /* Set link up (Force Link) */ | ||||
| #define E1000_CTRL_ILOS     0x00000080  /* Invert Loss-Of Signal */ | ||||
| #define E1000_CTRL_SPD_SEL  0x00000300  /* Speed Select Mask */ | ||||
| #define E1000_CTRL_SPD_10   0x00000000  /* Force 10Mb */ | ||||
| #define E1000_CTRL_SPD_100  0x00000100  /* Force 100Mb */ | ||||
| #define E1000_CTRL_SPD_1000 0x00000200  /* Force 1Gb */ | ||||
| #define E1000_CTRL_FRCSPD   0x00000800  /* Force Speed */ | ||||
| #define E1000_CTRL_FRCDPX   0x00001000  /* Force Duplex */ | ||||
| #define E1000_CTRL_LANPHYPC_OVERRIDE 0x00010000 /* SW control of LANPHYPC */ | ||||
| #define E1000_CTRL_LANPHYPC_VALUE    0x00020000 /* SW value of LANPHYPC */ | ||||
| #define E1000_CTRL_MEHE     0x00080000  /* Memory Error Handling Enable */ | ||||
| #define E1000_CTRL_SWDPIN0  0x00040000  /* SWDPIN 0 value */ | ||||
| #define E1000_CTRL_SWDPIN1  0x00080000  /* SWDPIN 1 value */ | ||||
| #define E1000_CTRL_ADVD3WUC 0x00100000  /* D3 WUC */ | ||||
| #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ | ||||
| #define E1000_CTRL_SWDPIO0  0x00400000  /* SWDPIN 0 Input or output */ | ||||
| #define E1000_CTRL_RST      0x04000000  /* Global reset */ | ||||
| #define E1000_CTRL_RFCE     0x08000000  /* Receive Flow Control enable */ | ||||
| #define E1000_CTRL_TFCE     0x10000000  /* Transmit flow control enable */ | ||||
| #define E1000_CTRL_VME      0x40000000  /* IEEE VLAN mode enable */ | ||||
| #define E1000_CTRL_PHY_RST  0x80000000  /* PHY Reset */ | ||||
| 
 | ||||
| #define E1000_PCS_LCTL_FORCE_FCTRL	0x80 | ||||
| 
 | ||||
| #define E1000_PCS_LSTS_AN_COMPLETE	0x10000 | ||||
| 
 | ||||
| /* Device Status */ | ||||
| #define E1000_STATUS_FD         0x00000001      /* Full duplex.0=half,1=full */ | ||||
| #define E1000_STATUS_LU         0x00000002      /* Link up.0=no,1=link */ | ||||
| #define E1000_STATUS_FUNC_MASK  0x0000000C      /* PCI Function Mask */ | ||||
| #define E1000_STATUS_FUNC_SHIFT 2 | ||||
| #define E1000_STATUS_FUNC_1     0x00000004      /* Function 1 */ | ||||
| #define E1000_STATUS_TXOFF      0x00000010      /* transmission paused */ | ||||
| #define E1000_STATUS_SPEED_MASK 0x000000C0 | ||||
| #define E1000_STATUS_SPEED_10   0x00000000      /* Speed 10Mb/s */ | ||||
| #define E1000_STATUS_SPEED_100  0x00000040      /* Speed 100Mb/s */ | ||||
| #define E1000_STATUS_SPEED_1000 0x00000080      /* Speed 1000Mb/s */ | ||||
| #define E1000_STATUS_LAN_INIT_DONE 0x00000200   /* Lan Init Completion by NVM */ | ||||
| #define E1000_STATUS_PHYRA      0x00000400      /* PHY Reset Asserted */ | ||||
| #define E1000_STATUS_GIO_MASTER_ENABLE	0x00080000	/* Master Req status */ | ||||
| 
 | ||||
| #define HALF_DUPLEX 1 | ||||
| #define FULL_DUPLEX 2 | ||||
| 
 | ||||
| #define ADVERTISE_10_HALF                 0x0001 | ||||
| #define ADVERTISE_10_FULL                 0x0002 | ||||
| #define ADVERTISE_100_HALF                0x0004 | ||||
| #define ADVERTISE_100_FULL                0x0008 | ||||
| #define ADVERTISE_1000_HALF               0x0010 /* Not used, just FYI */ | ||||
| #define ADVERTISE_1000_FULL               0x0020 | ||||
| 
 | ||||
| /* 1000/H is not supported, nor spec-compliant. */ | ||||
| #define E1000_ALL_SPEED_DUPLEX	( \ | ||||
| 	ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ | ||||
| 	ADVERTISE_100_FULL | ADVERTISE_1000_FULL) | ||||
| #define E1000_ALL_NOT_GIG	( \ | ||||
| 	ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \ | ||||
| 	ADVERTISE_100_FULL) | ||||
| #define E1000_ALL_100_SPEED	(ADVERTISE_100_HALF | ADVERTISE_100_FULL) | ||||
| #define E1000_ALL_10_SPEED	(ADVERTISE_10_HALF | ADVERTISE_10_FULL) | ||||
| #define E1000_ALL_HALF_DUPLEX	(ADVERTISE_10_HALF | ADVERTISE_100_HALF) | ||||
| 
 | ||||
| #define AUTONEG_ADVERTISE_SPEED_DEFAULT   E1000_ALL_SPEED_DUPLEX | ||||
| 
 | ||||
| /* LED Control */ | ||||
| #define E1000_PHY_LED0_MODE_MASK          0x00000007 | ||||
| #define E1000_PHY_LED0_IVRT               0x00000008 | ||||
| #define E1000_PHY_LED0_MASK               0x0000001F | ||||
| 
 | ||||
| #define E1000_LEDCTL_LED0_MODE_MASK       0x0000000F | ||||
| #define E1000_LEDCTL_LED0_MODE_SHIFT      0 | ||||
| #define E1000_LEDCTL_LED0_IVRT            0x00000040 | ||||
| #define E1000_LEDCTL_LED0_BLINK           0x00000080 | ||||
| 
 | ||||
| #define E1000_LEDCTL_MODE_LINK_UP       0x2 | ||||
| #define E1000_LEDCTL_MODE_LED_ON        0xE | ||||
| #define E1000_LEDCTL_MODE_LED_OFF       0xF | ||||
| 
 | ||||
| /* Transmit Descriptor bit definitions */ | ||||
| #define E1000_TXD_DTYP_D     0x00100000 /* Data Descriptor */ | ||||
| #define E1000_TXD_POPTS_IXSM 0x01       /* Insert IP checksum */ | ||||
| #define E1000_TXD_POPTS_TXSM 0x02       /* Insert TCP/UDP checksum */ | ||||
| #define E1000_TXD_CMD_EOP    0x01000000 /* End of Packet */ | ||||
| #define E1000_TXD_CMD_IFCS   0x02000000 /* Insert FCS (Ethernet CRC) */ | ||||
| #define E1000_TXD_CMD_IC     0x04000000 /* Insert Checksum */ | ||||
| #define E1000_TXD_CMD_RS     0x08000000 /* Report Status */ | ||||
| #define E1000_TXD_CMD_RPS    0x10000000 /* Report Packet Sent */ | ||||
| #define E1000_TXD_CMD_DEXT   0x20000000 /* Descriptor extension (0 = legacy) */ | ||||
| #define E1000_TXD_CMD_VLE    0x40000000 /* Add VLAN tag */ | ||||
| #define E1000_TXD_CMD_IDE    0x80000000 /* Enable Tidv register */ | ||||
| #define E1000_TXD_STAT_DD    0x00000001 /* Descriptor Done */ | ||||
| #define E1000_TXD_STAT_EC    0x00000002 /* Excess Collisions */ | ||||
| #define E1000_TXD_STAT_LC    0x00000004 /* Late Collisions */ | ||||
| #define E1000_TXD_STAT_TU    0x00000008 /* Transmit underrun */ | ||||
| #define E1000_TXD_CMD_TCP    0x01000000 /* TCP packet */ | ||||
| #define E1000_TXD_CMD_IP     0x02000000 /* IP packet */ | ||||
| #define E1000_TXD_CMD_TSE    0x04000000 /* TCP Seg enable */ | ||||
| #define E1000_TXD_STAT_TC    0x00000004 /* Tx Underrun */ | ||||
| #define E1000_TXD_EXTCMD_TSTAMP	0x00000010 /* IEEE1588 Timestamp packet */ | ||||
| 
 | ||||
| /* Transmit Control */ | ||||
| #define E1000_TCTL_EN     0x00000002    /* enable Tx */ | ||||
| #define E1000_TCTL_PSP    0x00000008    /* pad short packets */ | ||||
| #define E1000_TCTL_CT     0x00000ff0    /* collision threshold */ | ||||
| #define E1000_TCTL_COLD   0x003ff000    /* collision distance */ | ||||
| #define E1000_TCTL_RTLC   0x01000000    /* Re-transmit on late collision */ | ||||
| #define E1000_TCTL_MULR   0x10000000    /* Multiple request support */ | ||||
| 
 | ||||
| /* SerDes Control */ | ||||
| #define E1000_SCTL_DISABLE_SERDES_LOOPBACK 0x0400 | ||||
| #define E1000_SCTL_ENABLE_SERDES_LOOPBACK	0x0410 | ||||
| 
 | ||||
| /* Receive Checksum Control */ | ||||
| #define E1000_RXCSUM_TUOFL     0x00000200   /* TCP / UDP checksum offload */ | ||||
| #define E1000_RXCSUM_IPPCSE    0x00001000   /* IP payload checksum enable */ | ||||
| #define E1000_RXCSUM_PCSD      0x00002000   /* packet checksum disabled */ | ||||
| 
 | ||||
| /* Header split receive */ | ||||
| #define E1000_RFCTL_NFSW_DIS            0x00000040 | ||||
| #define E1000_RFCTL_NFSR_DIS            0x00000080 | ||||
| #define E1000_RFCTL_ACK_DIS             0x00001000 | ||||
| #define E1000_RFCTL_EXTEN               0x00008000 | ||||
| #define E1000_RFCTL_IPV6_EX_DIS         0x00010000 | ||||
| #define E1000_RFCTL_NEW_IPV6_EXT_DIS    0x00020000 | ||||
| 
 | ||||
| /* Collision related configuration parameters */ | ||||
| #define E1000_COLLISION_THRESHOLD       15 | ||||
| #define E1000_CT_SHIFT                  4 | ||||
| #define E1000_COLLISION_DISTANCE        63 | ||||
| #define E1000_COLD_SHIFT                12 | ||||
| 
 | ||||
| /* Default values for the transmit IPG register */ | ||||
| #define DEFAULT_82543_TIPG_IPGT_COPPER 8 | ||||
| 
 | ||||
| #define E1000_TIPG_IPGT_MASK  0x000003FF | ||||
| 
 | ||||
| #define DEFAULT_82543_TIPG_IPGR1 8 | ||||
| #define E1000_TIPG_IPGR1_SHIFT  10 | ||||
| 
 | ||||
| #define DEFAULT_82543_TIPG_IPGR2 6 | ||||
| #define DEFAULT_80003ES2LAN_TIPG_IPGR2 7 | ||||
| #define E1000_TIPG_IPGR2_SHIFT  20 | ||||
| 
 | ||||
| #define MAX_JUMBO_FRAME_SIZE    0x3F00 | ||||
| #define E1000_TX_PTR_GAP		0x1F | ||||
| 
 | ||||
| /* Extended Configuration Control and Size */ | ||||
| #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP      0x00000020 | ||||
| #define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE       0x00000001 | ||||
| #define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE       0x00000008 | ||||
| #define E1000_EXTCNF_CTRL_SWFLAG                 0x00000020 | ||||
| #define E1000_EXTCNF_CTRL_GATE_PHY_CFG           0x00000080 | ||||
| #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK   0x00FF0000 | ||||
| #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT          16 | ||||
| #define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK   0x0FFF0000 | ||||
| #define E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT          16 | ||||
| 
 | ||||
| #define E1000_PHY_CTRL_D0A_LPLU           0x00000002 | ||||
| #define E1000_PHY_CTRL_NOND0A_LPLU        0x00000004 | ||||
| #define E1000_PHY_CTRL_NOND0A_GBE_DISABLE 0x00000008 | ||||
| #define E1000_PHY_CTRL_GBE_DISABLE        0x00000040 | ||||
| 
 | ||||
| #define E1000_KABGTXD_BGSQLBIAS           0x00050000 | ||||
| 
 | ||||
| /* Low Power IDLE Control */ | ||||
| #define E1000_LPIC_LPIET_SHIFT		24	/* Low Power Idle Entry Time */ | ||||
| 
 | ||||
| /* PBA constants */ | ||||
| #define E1000_PBA_8K  0x0008    /* 8KB */ | ||||
| #define E1000_PBA_16K 0x0010    /* 16KB */ | ||||
| 
 | ||||
| #define E1000_PBA_RXA_MASK	0xFFFF | ||||
| 
 | ||||
| #define E1000_PBS_16K E1000_PBA_16K | ||||
| 
 | ||||
| /* Uncorrectable/correctable ECC Error counts and enable bits */ | ||||
| #define E1000_PBECCSTS_CORR_ERR_CNT_MASK	0x000000FF | ||||
| #define E1000_PBECCSTS_UNCORR_ERR_CNT_MASK	0x0000FF00 | ||||
| #define E1000_PBECCSTS_UNCORR_ERR_CNT_SHIFT	8 | ||||
| #define E1000_PBECCSTS_ECC_ENABLE		0x00010000 | ||||
| 
 | ||||
| #define IFS_MAX       80 | ||||
| #define IFS_MIN       40 | ||||
| #define IFS_RATIO     4 | ||||
| #define IFS_STEP      10 | ||||
| #define MIN_NUM_XMITS 1000 | ||||
| 
 | ||||
| /* SW Semaphore Register */ | ||||
| #define E1000_SWSM_SMBI         0x00000001 /* Driver Semaphore bit */ | ||||
| #define E1000_SWSM_SWESMBI      0x00000002 /* FW Semaphore bit */ | ||||
| #define E1000_SWSM_DRV_LOAD     0x00000008 /* Driver Loaded Bit */ | ||||
| 
 | ||||
| #define E1000_SWSM2_LOCK        0x00000002 /* Secondary driver semaphore bit */ | ||||
| 
 | ||||
| /* Interrupt Cause Read */ | ||||
| #define E1000_ICR_TXDW          0x00000001 /* Transmit desc written back */ | ||||
| #define E1000_ICR_LSC           0x00000004 /* Link Status Change */ | ||||
| #define E1000_ICR_RXSEQ         0x00000008 /* Rx sequence error */ | ||||
| #define E1000_ICR_RXDMT0        0x00000010 /* Rx desc min. threshold (0) */ | ||||
| #define E1000_ICR_RXT0          0x00000080 /* Rx timer intr (ring 0) */ | ||||
| #define E1000_ICR_ECCER         0x00400000 /* Uncorrectable ECC Error */ | ||||
| /* If this bit asserted, the driver should claim the interrupt */ | ||||
| #define E1000_ICR_INT_ASSERTED	0x80000000 | ||||
| #define E1000_ICR_RXQ0          0x00100000 /* Rx Queue 0 Interrupt */ | ||||
| #define E1000_ICR_RXQ1          0x00200000 /* Rx Queue 1 Interrupt */ | ||||
| #define E1000_ICR_TXQ0          0x00400000 /* Tx Queue 0 Interrupt */ | ||||
| #define E1000_ICR_TXQ1          0x00800000 /* Tx Queue 1 Interrupt */ | ||||
| #define E1000_ICR_OTHER         0x01000000 /* Other Interrupts */ | ||||
| 
 | ||||
| /* PBA ECC Register */ | ||||
| #define E1000_PBA_ECC_COUNTER_MASK  0xFFF00000 /* ECC counter mask */ | ||||
| #define E1000_PBA_ECC_COUNTER_SHIFT 20         /* ECC counter shift value */ | ||||
| #define E1000_PBA_ECC_CORR_EN       0x00000001 /* ECC correction enable */ | ||||
| #define E1000_PBA_ECC_STAT_CLR      0x00000002 /* Clear ECC error counter */ | ||||
| #define E1000_PBA_ECC_INT_EN        0x00000004 /* Enable ICR bit 5 for ECC */ | ||||
| 
 | ||||
| /* This defines the bits that are set in the Interrupt Mask
 | ||||
|  * Set/Read Register.  Each bit is documented below: | ||||
|  *   o RXT0   = Receiver Timer Interrupt (ring 0) | ||||
|  *   o TXDW   = Transmit Descriptor Written Back | ||||
|  *   o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) | ||||
|  *   o RXSEQ  = Receive Sequence Error | ||||
|  *   o LSC    = Link Status Change | ||||
|  */ | ||||
| #define IMS_ENABLE_MASK ( \ | ||||
| 	E1000_IMS_RXT0   |    \ | ||||
| 	E1000_IMS_TXDW   |    \ | ||||
| 	E1000_IMS_RXDMT0 |    \ | ||||
| 	E1000_IMS_RXSEQ  |    \ | ||||
| 	E1000_IMS_LSC) | ||||
| 
 | ||||
| /* Interrupt Mask Set */ | ||||
| #define E1000_IMS_TXDW      E1000_ICR_TXDW      /* Transmit desc written back */ | ||||
| #define E1000_IMS_LSC       E1000_ICR_LSC       /* Link Status Change */ | ||||
| #define E1000_IMS_RXSEQ     E1000_ICR_RXSEQ     /* Rx sequence error */ | ||||
| #define E1000_IMS_RXDMT0    E1000_ICR_RXDMT0    /* Rx desc min. threshold */ | ||||
| #define E1000_IMS_RXT0      E1000_ICR_RXT0      /* Rx timer intr */ | ||||
| #define E1000_IMS_ECCER     E1000_ICR_ECCER     /* Uncorrectable ECC Error */ | ||||
| #define E1000_IMS_RXQ0      E1000_ICR_RXQ0      /* Rx Queue 0 Interrupt */ | ||||
| #define E1000_IMS_RXQ1      E1000_ICR_RXQ1      /* Rx Queue 1 Interrupt */ | ||||
| #define E1000_IMS_TXQ0      E1000_ICR_TXQ0      /* Tx Queue 0 Interrupt */ | ||||
| #define E1000_IMS_TXQ1      E1000_ICR_TXQ1      /* Tx Queue 1 Interrupt */ | ||||
| #define E1000_IMS_OTHER     E1000_ICR_OTHER     /* Other Interrupts */ | ||||
| 
 | ||||
| /* Interrupt Cause Set */ | ||||
| #define E1000_ICS_LSC       E1000_ICR_LSC       /* Link Status Change */ | ||||
| #define E1000_ICS_RXSEQ     E1000_ICR_RXSEQ     /* Rx sequence error */ | ||||
| #define E1000_ICS_RXDMT0    E1000_ICR_RXDMT0    /* Rx desc min. threshold */ | ||||
| 
 | ||||
| /* Transmit Descriptor Control */ | ||||
| #define E1000_TXDCTL_PTHRESH 0x0000003F /* TXDCTL Prefetch Threshold */ | ||||
| #define E1000_TXDCTL_HTHRESH 0x00003F00 /* TXDCTL Host Threshold */ | ||||
| #define E1000_TXDCTL_WTHRESH 0x003F0000 /* TXDCTL Writeback Threshold */ | ||||
| #define E1000_TXDCTL_GRAN    0x01000000 /* TXDCTL Granularity */ | ||||
| #define E1000_TXDCTL_FULL_TX_DESC_WB 0x01010000 /* GRAN=1, WTHRESH=1 */ | ||||
| #define E1000_TXDCTL_MAX_TX_DESC_PREFETCH 0x0100001F /* GRAN=1, PTHRESH=31 */ | ||||
| /* Enable the counting of desc. still to be processed. */ | ||||
| #define E1000_TXDCTL_COUNT_DESC 0x00400000 | ||||
| 
 | ||||
| /* Flow Control Constants */ | ||||
| #define FLOW_CONTROL_ADDRESS_LOW  0x00C28001 | ||||
| #define FLOW_CONTROL_ADDRESS_HIGH 0x00000100 | ||||
| #define FLOW_CONTROL_TYPE         0x8808 | ||||
| 
 | ||||
| /* 802.1q VLAN Packet Size */ | ||||
| #define E1000_VLAN_FILTER_TBL_SIZE 128  /* VLAN Filter Table (4096 bits) */ | ||||
| 
 | ||||
| /* Receive Address
 | ||||
|  * Number of high/low register pairs in the RAR. The RAR (Receive Address | ||||
|  * Registers) holds the directed and multicast addresses that we monitor. | ||||
|  * Technically, we have 16 spots.  However, we reserve one of these spots | ||||
|  * (RAR[15]) for our directed address used by controllers with | ||||
|  * manageability enabled, allowing us room for 15 multicast addresses. | ||||
|  */ | ||||
| #define E1000_RAR_ENTRIES     15 | ||||
| #define E1000_RAH_AV  0x80000000        /* Receive descriptor valid */ | ||||
| #define E1000_RAL_MAC_ADDR_LEN 4 | ||||
| #define E1000_RAH_MAC_ADDR_LEN 2 | ||||
| 
 | ||||
| /* Error Codes */ | ||||
| #define E1000_ERR_NVM      1 | ||||
| #define E1000_ERR_PHY      2 | ||||
| #define E1000_ERR_CONFIG   3 | ||||
| #define E1000_ERR_PARAM    4 | ||||
| #define E1000_ERR_MAC_INIT 5 | ||||
| #define E1000_ERR_PHY_TYPE 6 | ||||
| #define E1000_ERR_RESET   9 | ||||
| #define E1000_ERR_MASTER_REQUESTS_PENDING 10 | ||||
| #define E1000_ERR_HOST_INTERFACE_COMMAND 11 | ||||
| #define E1000_BLK_PHY_RESET   12 | ||||
| #define E1000_ERR_SWFW_SYNC 13 | ||||
| #define E1000_NOT_IMPLEMENTED 14 | ||||
| #define E1000_ERR_INVALID_ARGUMENT  16 | ||||
| #define E1000_ERR_NO_SPACE          17 | ||||
| #define E1000_ERR_NVM_PBA_SECTION   18 | ||||
| 
 | ||||
| /* Loop limit on how long we wait for auto-negotiation to complete */ | ||||
| #define FIBER_LINK_UP_LIMIT               50 | ||||
| #define COPPER_LINK_UP_LIMIT              10 | ||||
| #define PHY_AUTO_NEG_LIMIT                45 | ||||
| #define PHY_FORCE_LIMIT                   20 | ||||
| /* Number of 100 microseconds we wait for PCI Express master disable */ | ||||
| #define MASTER_DISABLE_TIMEOUT      800 | ||||
| /* Number of milliseconds we wait for PHY configuration done after MAC reset */ | ||||
| #define PHY_CFG_TIMEOUT             100 | ||||
| /* Number of 2 milliseconds we wait for acquiring MDIO ownership. */ | ||||
| #define MDIO_OWNERSHIP_TIMEOUT      10 | ||||
| /* Number of milliseconds for NVM auto read done after MAC reset. */ | ||||
| #define AUTO_READ_DONE_TIMEOUT      10 | ||||
| 
 | ||||
| /* Flow Control */ | ||||
| #define E1000_FCRTH_RTH  0x0000FFF8     /* Mask Bits[15:3] for RTH */ | ||||
| #define E1000_FCRTL_RTL  0x0000FFF8     /* Mask Bits[15:3] for RTL */ | ||||
| #define E1000_FCRTL_XONE 0x80000000     /* Enable XON frame transmission */ | ||||
| 
 | ||||
| /* Transmit Configuration Word */ | ||||
| #define E1000_TXCW_FD         0x00000020        /* TXCW full duplex */ | ||||
| #define E1000_TXCW_PAUSE      0x00000080        /* TXCW sym pause request */ | ||||
| #define E1000_TXCW_ASM_DIR    0x00000100        /* TXCW astm pause direction */ | ||||
| #define E1000_TXCW_PAUSE_MASK 0x00000180        /* TXCW pause request mask */ | ||||
| #define E1000_TXCW_ANE        0x80000000        /* Auto-neg enable */ | ||||
| 
 | ||||
| /* Receive Configuration Word */ | ||||
| #define E1000_RXCW_CW         0x0000ffff        /* RxConfigWord mask */ | ||||
| #define E1000_RXCW_IV         0x08000000        /* Receive config invalid */ | ||||
| #define E1000_RXCW_C          0x20000000        /* Receive config */ | ||||
| #define E1000_RXCW_SYNCH      0x40000000        /* Receive config synch */ | ||||
| 
 | ||||
| #define E1000_TSYNCTXCTL_VALID		0x00000001 /* Tx timestamp valid */ | ||||
| #define E1000_TSYNCTXCTL_ENABLED	0x00000010 /* enable Tx timestamping */ | ||||
| 
 | ||||
| #define E1000_TSYNCRXCTL_VALID		0x00000001 /* Rx timestamp valid */ | ||||
| #define E1000_TSYNCRXCTL_TYPE_MASK	0x0000000E /* Rx type mask */ | ||||
| #define E1000_TSYNCRXCTL_TYPE_L2_V2	0x00 | ||||
| #define E1000_TSYNCRXCTL_TYPE_L4_V1	0x02 | ||||
| #define E1000_TSYNCRXCTL_TYPE_L2_L4_V2	0x04 | ||||
| #define E1000_TSYNCRXCTL_TYPE_ALL	0x08 | ||||
| #define E1000_TSYNCRXCTL_TYPE_EVENT_V2	0x0A | ||||
| #define E1000_TSYNCRXCTL_ENABLED	0x00000010 /* enable Rx timestamping */ | ||||
| #define E1000_TSYNCRXCTL_SYSCFI		0x00000020 /* Sys clock frequency */ | ||||
| 
 | ||||
| #define E1000_RXMTRL_PTP_V1_SYNC_MESSAGE	0x00000000 | ||||
| #define E1000_RXMTRL_PTP_V1_DELAY_REQ_MESSAGE	0x00010000 | ||||
| 
 | ||||
| #define E1000_RXMTRL_PTP_V2_SYNC_MESSAGE	0x00000000 | ||||
| #define E1000_RXMTRL_PTP_V2_DELAY_REQ_MESSAGE	0x01000000 | ||||
| 
 | ||||
| #define E1000_TIMINCA_INCPERIOD_SHIFT	24 | ||||
| #define E1000_TIMINCA_INCVALUE_MASK	0x00FFFFFF | ||||
| 
 | ||||
| /* PCI Express Control */ | ||||
| #define E1000_GCR_RXD_NO_SNOOP          0x00000001 | ||||
| #define E1000_GCR_RXDSCW_NO_SNOOP       0x00000002 | ||||
| #define E1000_GCR_RXDSCR_NO_SNOOP       0x00000004 | ||||
| #define E1000_GCR_TXD_NO_SNOOP          0x00000008 | ||||
| #define E1000_GCR_TXDSCW_NO_SNOOP       0x00000010 | ||||
| #define E1000_GCR_TXDSCR_NO_SNOOP       0x00000020 | ||||
| 
 | ||||
| #define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP         | \ | ||||
| 			   E1000_GCR_RXDSCW_NO_SNOOP      | \ | ||||
| 			   E1000_GCR_RXDSCR_NO_SNOOP      | \ | ||||
| 			   E1000_GCR_TXD_NO_SNOOP         | \ | ||||
| 			   E1000_GCR_TXDSCW_NO_SNOOP      | \ | ||||
| 			   E1000_GCR_TXDSCR_NO_SNOOP) | ||||
| 
 | ||||
| /* NVM Control */ | ||||
| #define E1000_EECD_SK        0x00000001 /* NVM Clock */ | ||||
| #define E1000_EECD_CS        0x00000002 /* NVM Chip Select */ | ||||
| #define E1000_EECD_DI        0x00000004 /* NVM Data In */ | ||||
| #define E1000_EECD_DO        0x00000008 /* NVM Data Out */ | ||||
| #define E1000_EECD_REQ       0x00000040 /* NVM Access Request */ | ||||
| #define E1000_EECD_GNT       0x00000080 /* NVM Access Grant */ | ||||
| #define E1000_EECD_PRES      0x00000100 /* NVM Present */ | ||||
| #define E1000_EECD_SIZE      0x00000200 /* NVM Size (0=64 word 1=256 word) */ | ||||
| /* NVM Addressing bits based on type (0-small, 1-large) */ | ||||
| #define E1000_EECD_ADDR_BITS 0x00000400 | ||||
| #define E1000_NVM_GRANT_ATTEMPTS   1000 /* NVM # attempts to gain grant */ | ||||
| #define E1000_EECD_AUTO_RD          0x00000200  /* NVM Auto Read done */ | ||||
| #define E1000_EECD_SIZE_EX_MASK     0x00007800  /* NVM Size */ | ||||
| #define E1000_EECD_SIZE_EX_SHIFT     11 | ||||
| #define E1000_EECD_FLUPD     0x00080000 /* Update FLASH */ | ||||
| #define E1000_EECD_AUPDEN    0x00100000 /* Enable Autonomous FLASH update */ | ||||
| #define E1000_EECD_SEC1VAL   0x00400000 /* Sector One Valid */ | ||||
| #define E1000_EECD_SEC1VAL_VALID_MASK (E1000_EECD_AUTO_RD | E1000_EECD_PRES) | ||||
| 
 | ||||
| #define E1000_NVM_RW_REG_DATA	16	/* Offset to data in NVM r/w regs */ | ||||
| #define E1000_NVM_RW_REG_DONE	2	/* Offset to READ/WRITE done bit */ | ||||
| #define E1000_NVM_RW_REG_START	1	/* Start operation */ | ||||
| #define E1000_NVM_RW_ADDR_SHIFT	2	/* Shift to the address bits */ | ||||
| #define E1000_NVM_POLL_WRITE	1	/* Flag for polling write complete */ | ||||
| #define E1000_NVM_POLL_READ	0	/* Flag for polling read complete */ | ||||
| #define E1000_FLASH_UPDATES	2000 | ||||
| 
 | ||||
| /* NVM Word Offsets */ | ||||
| #define NVM_COMPAT                 0x0003 | ||||
| #define NVM_ID_LED_SETTINGS        0x0004 | ||||
| #define NVM_FUTURE_INIT_WORD1      0x0019 | ||||
| #define NVM_COMPAT_VALID_CSUM      0x0001 | ||||
| #define NVM_FUTURE_INIT_WORD1_VALID_CSUM	0x0040 | ||||
| 
 | ||||
| #define NVM_INIT_CONTROL2_REG      0x000F | ||||
| #define NVM_INIT_CONTROL3_PORT_B   0x0014 | ||||
| #define NVM_INIT_3GIO_3            0x001A | ||||
| #define NVM_INIT_CONTROL3_PORT_A   0x0024 | ||||
| #define NVM_CFG                    0x0012 | ||||
| #define NVM_ALT_MAC_ADDR_PTR       0x0037 | ||||
| #define NVM_CHECKSUM_REG           0x003F | ||||
| 
 | ||||
| #define E1000_NVM_CFG_DONE_PORT_0  0x40000 /* MNG config cycle done */ | ||||
| #define E1000_NVM_CFG_DONE_PORT_1  0x80000 /* ...for second port */ | ||||
| 
 | ||||
| /* Mask bits for fields in Word 0x0f of the NVM */ | ||||
| #define NVM_WORD0F_PAUSE_MASK       0x3000 | ||||
| #define NVM_WORD0F_PAUSE            0x1000 | ||||
| #define NVM_WORD0F_ASM_DIR          0x2000 | ||||
| 
 | ||||
| /* Mask bits for fields in Word 0x1a of the NVM */ | ||||
| #define NVM_WORD1A_ASPM_MASK  0x000C | ||||
| 
 | ||||
| /* Mask bits for fields in Word 0x03 of the EEPROM */ | ||||
| #define NVM_COMPAT_LOM    0x0800 | ||||
| 
 | ||||
| /* length of string needed to store PBA number */ | ||||
| #define E1000_PBANUM_LENGTH             11 | ||||
| 
 | ||||
| /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ | ||||
| #define NVM_SUM                    0xBABA | ||||
| 
 | ||||
| /* PBA (printed board assembly) number words */ | ||||
| #define NVM_PBA_OFFSET_0           8 | ||||
| #define NVM_PBA_OFFSET_1           9 | ||||
| #define NVM_PBA_PTR_GUARD          0xFAFA | ||||
| #define NVM_WORD_SIZE_BASE_SHIFT   6 | ||||
| 
 | ||||
| /* NVM Commands - SPI */ | ||||
| #define NVM_MAX_RETRY_SPI          5000 /* Max wait of 5ms, for RDY signal */ | ||||
| #define NVM_READ_OPCODE_SPI        0x03 /* NVM read opcode */ | ||||
| #define NVM_WRITE_OPCODE_SPI       0x02 /* NVM write opcode */ | ||||
| #define NVM_A8_OPCODE_SPI          0x08 /* opcode bit-3 = address bit-8 */ | ||||
| #define NVM_WREN_OPCODE_SPI        0x06 /* NVM set Write Enable latch */ | ||||
| #define NVM_RDSR_OPCODE_SPI        0x05 /* NVM read Status register */ | ||||
| 
 | ||||
| /* SPI NVM Status Register */ | ||||
| #define NVM_STATUS_RDY_SPI         0x01 | ||||
| 
 | ||||
| /* Word definitions for ID LED Settings */ | ||||
| #define ID_LED_RESERVED_0000 0x0000 | ||||
| #define ID_LED_RESERVED_FFFF 0xFFFF | ||||
| #define ID_LED_DEFAULT       ((ID_LED_OFF1_ON2  << 12) | \ | ||||
| 			      (ID_LED_OFF1_OFF2 <<  8) | \ | ||||
| 			      (ID_LED_DEF1_DEF2 <<  4) | \ | ||||
| 			      (ID_LED_DEF1_DEF2)) | ||||
| #define ID_LED_DEF1_DEF2     0x1 | ||||
| #define ID_LED_DEF1_ON2      0x2 | ||||
| #define ID_LED_DEF1_OFF2     0x3 | ||||
| #define ID_LED_ON1_DEF2      0x4 | ||||
| #define ID_LED_ON1_ON2       0x5 | ||||
| #define ID_LED_ON1_OFF2      0x6 | ||||
| #define ID_LED_OFF1_DEF2     0x7 | ||||
| #define ID_LED_OFF1_ON2      0x8 | ||||
| #define ID_LED_OFF1_OFF2     0x9 | ||||
| 
 | ||||
| #define IGP_ACTIVITY_LED_MASK   0xFFFFF0FF | ||||
| #define IGP_ACTIVITY_LED_ENABLE 0x0300 | ||||
| #define IGP_LED3_MODE           0x07000000 | ||||
| 
 | ||||
| /* PCI/PCI-X/PCI-EX Config space */ | ||||
| #define PCI_HEADER_TYPE_REGISTER     0x0E | ||||
| #define PCIE_LINK_STATUS             0x12 | ||||
| 
 | ||||
| #define PCI_HEADER_TYPE_MULTIFUNC    0x80 | ||||
| #define PCIE_LINK_WIDTH_MASK         0x3F0 | ||||
| #define PCIE_LINK_WIDTH_SHIFT        4 | ||||
| 
 | ||||
| #define PHY_REVISION_MASK      0xFFFFFFF0 | ||||
| #define MAX_PHY_REG_ADDRESS    0x1F  /* 5 bit address bus (0-0x1F) */ | ||||
| #define MAX_PHY_MULTI_PAGE_REG 0xF | ||||
| 
 | ||||
| /* Bit definitions for valid PHY IDs.
 | ||||
|  * I = Integrated | ||||
|  * E = External | ||||
|  */ | ||||
| #define M88E1000_E_PHY_ID    0x01410C50 | ||||
| #define M88E1000_I_PHY_ID    0x01410C30 | ||||
| #define M88E1011_I_PHY_ID    0x01410C20 | ||||
| #define IGP01E1000_I_PHY_ID  0x02A80380 | ||||
| #define M88E1111_I_PHY_ID    0x01410CC0 | ||||
| #define GG82563_E_PHY_ID     0x01410CA0 | ||||
| #define IGP03E1000_E_PHY_ID  0x02A80390 | ||||
| #define IFE_E_PHY_ID         0x02A80330 | ||||
| #define IFE_PLUS_E_PHY_ID    0x02A80320 | ||||
| #define IFE_C_E_PHY_ID       0x02A80310 | ||||
| #define BME1000_E_PHY_ID     0x01410CB0 | ||||
| #define BME1000_E_PHY_ID_R2  0x01410CB1 | ||||
| #define I82577_E_PHY_ID      0x01540050 | ||||
| #define I82578_E_PHY_ID      0x004DD040 | ||||
| #define I82579_E_PHY_ID      0x01540090 | ||||
| #define I217_E_PHY_ID        0x015400A0 | ||||
| 
 | ||||
| /* M88E1000 Specific Registers */ | ||||
| #define M88E1000_PHY_SPEC_CTRL     0x10  /* PHY Specific Control Register */ | ||||
| #define M88E1000_PHY_SPEC_STATUS   0x11  /* PHY Specific Status Register */ | ||||
| #define M88E1000_EXT_PHY_SPEC_CTRL 0x14  /* Extended PHY Specific Control */ | ||||
| 
 | ||||
| #define M88E1000_PHY_PAGE_SELECT   0x1D  /* Reg 29 for page number setting */ | ||||
| #define M88E1000_PHY_GEN_CONTROL   0x1E  /* Its meaning depends on reg 29 */ | ||||
| 
 | ||||
| /* M88E1000 PHY Specific Control Register */ | ||||
| #define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reversal enabled */ | ||||
| #define M88E1000_PSCR_MDI_MANUAL_MODE  0x0000  /* MDI Crossover Mode bits 6:5 */ | ||||
| 					       /* Manual MDI configuration */ | ||||
| #define M88E1000_PSCR_MDIX_MANUAL_MODE 0x0020  /* Manual MDIX configuration */ | ||||
| /* 1000BASE-T: Auto crossover, 100BASE-TX/10BASE-T: MDI Mode */ | ||||
| #define M88E1000_PSCR_AUTO_X_1000T     0x0040 | ||||
| /* Auto crossover enabled all speeds */ | ||||
| #define M88E1000_PSCR_AUTO_X_MODE      0x0060 | ||||
| #define M88E1000_PSCR_ASSERT_CRS_ON_TX 0x0800 /* 1=Assert CRS on Transmit */ | ||||
| 
 | ||||
| /* M88E1000 PHY Specific Status Register */ | ||||
| #define M88E1000_PSSR_REV_POLARITY       0x0002 /* 1=Polarity reversed */ | ||||
| #define M88E1000_PSSR_DOWNSHIFT          0x0020 /* 1=Downshifted */ | ||||
| #define M88E1000_PSSR_MDIX               0x0040 /* 1=MDIX; 0=MDI */ | ||||
| /* 0=<50M; 1=50-80M; 2=80-110M; 3=110-140M; 4=>140M */ | ||||
| #define M88E1000_PSSR_CABLE_LENGTH       0x0380 | ||||
| #define M88E1000_PSSR_SPEED              0xC000 /* Speed, bits 14:15 */ | ||||
| #define M88E1000_PSSR_1000MBS            0x8000 /* 10=1000Mbs */ | ||||
| 
 | ||||
| #define M88E1000_PSSR_CABLE_LENGTH_SHIFT 7 | ||||
| 
 | ||||
| /* Number of times we will attempt to autonegotiate before downshifting if we
 | ||||
|  * are the master | ||||
|  */ | ||||
| #define M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK 0x0C00 | ||||
| #define M88E1000_EPSCR_MASTER_DOWNSHIFT_1X   0x0000 | ||||
| /* Number of times we will attempt to autonegotiate before downshifting if we
 | ||||
|  * are the slave | ||||
|  */ | ||||
| #define M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK  0x0300 | ||||
| #define M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X    0x0100 | ||||
| #define M88E1000_EPSCR_TX_CLK_25      0x0070 /* 25  MHz TX_CLK */ | ||||
| 
 | ||||
| /* M88EC018 Rev 2 specific DownShift settings */ | ||||
| #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK  0x0E00 | ||||
| #define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X    0x0800 | ||||
| 
 | ||||
| #define I82578_EPSCR_DOWNSHIFT_ENABLE          0x0020 | ||||
| #define I82578_EPSCR_DOWNSHIFT_COUNTER_MASK    0x001C | ||||
| 
 | ||||
| /* BME1000 PHY Specific Control Register */ | ||||
| #define BME1000_PSCR_ENABLE_DOWNSHIFT   0x0800 /* 1 = enable downshift */ | ||||
| 
 | ||||
| /* Bits...
 | ||||
|  * 15-5: page | ||||
|  * 4-0: register offset | ||||
|  */ | ||||
| #define GG82563_PAGE_SHIFT        5 | ||||
| #define GG82563_REG(page, reg)    \ | ||||
| 	(((page) << GG82563_PAGE_SHIFT) | ((reg) & MAX_PHY_REG_ADDRESS)) | ||||
| #define GG82563_MIN_ALT_REG       30 | ||||
| 
 | ||||
| /* GG82563 Specific Registers */ | ||||
| #define GG82563_PHY_SPEC_CTRL           \ | ||||
| 	GG82563_REG(0, 16) /* PHY Specific Control */ | ||||
| #define GG82563_PHY_PAGE_SELECT         \ | ||||
| 	GG82563_REG(0, 22) /* Page Select */ | ||||
| #define GG82563_PHY_SPEC_CTRL_2         \ | ||||
| 	GG82563_REG(0, 26) /* PHY Specific Control 2 */ | ||||
| #define GG82563_PHY_PAGE_SELECT_ALT     \ | ||||
| 	GG82563_REG(0, 29) /* Alternate Page Select */ | ||||
| 
 | ||||
| #define GG82563_PHY_MAC_SPEC_CTRL       \ | ||||
| 	GG82563_REG(2, 21) /* MAC Specific Control Register */ | ||||
| 
 | ||||
| #define GG82563_PHY_DSP_DISTANCE    \ | ||||
| 	GG82563_REG(5, 26) /* DSP Distance */ | ||||
| 
 | ||||
| /* Page 193 - Port Control Registers */ | ||||
| #define GG82563_PHY_KMRN_MODE_CTRL   \ | ||||
| 	GG82563_REG(193, 16) /* Kumeran Mode Control */ | ||||
| #define GG82563_PHY_PWR_MGMT_CTRL       \ | ||||
| 	GG82563_REG(193, 20) /* Power Management Control */ | ||||
| 
 | ||||
| /* Page 194 - KMRN Registers */ | ||||
| #define GG82563_PHY_INBAND_CTRL         \ | ||||
| 	GG82563_REG(194, 18) /* Inband Control */ | ||||
| 
 | ||||
| /* MDI Control */ | ||||
| #define E1000_MDIC_REG_MASK	0x001F0000 | ||||
| #define E1000_MDIC_REG_SHIFT 16 | ||||
| #define E1000_MDIC_PHY_SHIFT 21 | ||||
| #define E1000_MDIC_OP_WRITE  0x04000000 | ||||
| #define E1000_MDIC_OP_READ   0x08000000 | ||||
| #define E1000_MDIC_READY     0x10000000 | ||||
| #define E1000_MDIC_ERROR     0x40000000 | ||||
| 
 | ||||
| /* SerDes Control */ | ||||
| #define E1000_GEN_POLL_TIMEOUT          640 | ||||
| 
 | ||||
| #endif /* _E1000_DEFINES_H_ */ | ||||
							
								
								
									
										591
									
								
								drivers/net/ethernet/intel/e1000e/e1000.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										591
									
								
								drivers/net/ethernet/intel/e1000e/e1000.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,591 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| /* Linux PRO/1000 Ethernet Driver main header file */ | ||||
| 
 | ||||
| #ifndef _E1000_H_ | ||||
| #define _E1000_H_ | ||||
| 
 | ||||
| #include <linux/bitops.h> | ||||
| #include <linux/types.h> | ||||
| #include <linux/timer.h> | ||||
| #include <linux/workqueue.h> | ||||
| #include <linux/io.h> | ||||
| #include <linux/netdevice.h> | ||||
| #include <linux/pci.h> | ||||
| #include <linux/pci-aspm.h> | ||||
| #include <linux/crc32.h> | ||||
| #include <linux/if_vlan.h> | ||||
| #include <linux/clocksource.h> | ||||
| #include <linux/net_tstamp.h> | ||||
| #include <linux/ptp_clock_kernel.h> | ||||
| #include <linux/ptp_classify.h> | ||||
| #include <linux/mii.h> | ||||
| #include <linux/mdio.h> | ||||
| #include "hw.h" | ||||
| 
 | ||||
| struct e1000_info; | ||||
| 
 | ||||
| #define e_dbg(format, arg...) \ | ||||
| 	netdev_dbg(hw->adapter->netdev, format, ## arg) | ||||
| #define e_err(format, arg...) \ | ||||
| 	netdev_err(adapter->netdev, format, ## arg) | ||||
| #define e_info(format, arg...) \ | ||||
| 	netdev_info(adapter->netdev, format, ## arg) | ||||
| #define e_warn(format, arg...) \ | ||||
| 	netdev_warn(adapter->netdev, format, ## arg) | ||||
| #define e_notice(format, arg...) \ | ||||
| 	netdev_notice(adapter->netdev, format, ## arg) | ||||
| 
 | ||||
| /* Interrupt modes, as used by the IntMode parameter */ | ||||
| #define E1000E_INT_MODE_LEGACY		0 | ||||
| #define E1000E_INT_MODE_MSI		1 | ||||
| #define E1000E_INT_MODE_MSIX		2 | ||||
| 
 | ||||
| /* Tx/Rx descriptor defines */ | ||||
| #define E1000_DEFAULT_TXD		256 | ||||
| #define E1000_MAX_TXD			4096 | ||||
| #define E1000_MIN_TXD			64 | ||||
| 
 | ||||
| #define E1000_DEFAULT_RXD		256 | ||||
| #define E1000_MAX_RXD			4096 | ||||
| #define E1000_MIN_RXD			64 | ||||
| 
 | ||||
| #define E1000_MIN_ITR_USECS		10 /* 100000 irq/sec */ | ||||
| #define E1000_MAX_ITR_USECS		10000 /* 100    irq/sec */ | ||||
| 
 | ||||
| #define E1000_FC_PAUSE_TIME		0x0680 /* 858 usec */ | ||||
| 
 | ||||
| /* How many Tx Descriptors do we need to call netif_wake_queue ? */ | ||||
| /* How many Rx Buffers do we bundle into one write to the hardware ? */ | ||||
| #define E1000_RX_BUFFER_WRITE		16 /* Must be power of 2 */ | ||||
| 
 | ||||
| #define AUTO_ALL_MODES			0 | ||||
| #define E1000_EEPROM_APME		0x0400 | ||||
| 
 | ||||
| #define E1000_MNG_VLAN_NONE		(-1) | ||||
| 
 | ||||
| #define DEFAULT_JUMBO			9234 | ||||
| 
 | ||||
| /* Time to wait before putting the device into D3 if there's no link (in ms). */ | ||||
| #define LINK_TIMEOUT		100 | ||||
| 
 | ||||
| /* Count for polling __E1000_RESET condition every 10-20msec.
 | ||||
|  * Experimentation has shown the reset can take approximately 210msec. | ||||
|  */ | ||||
| #define E1000_CHECK_RESET_COUNT		25 | ||||
| 
 | ||||
| #define DEFAULT_RDTR			0 | ||||
| #define DEFAULT_RADV			8 | ||||
| #define BURST_RDTR			0x20 | ||||
| #define BURST_RADV			0x20 | ||||
| 
 | ||||
| /* in the case of WTHRESH, it appears at least the 82571/2 hardware
 | ||||
|  * writes back 4 descriptors when WTHRESH=5, and 3 descriptors when | ||||
|  * WTHRESH=4, so a setting of 5 gives the most efficient bus | ||||
|  * utilization but to avoid possible Tx stalls, set it to 1 | ||||
|  */ | ||||
| #define E1000_TXDCTL_DMA_BURST_ENABLE                          \ | ||||
| 	(E1000_TXDCTL_GRAN | /* set descriptor granularity */  \ | ||||
| 	 E1000_TXDCTL_COUNT_DESC |                             \ | ||||
| 	 (1 << 16) | /* wthresh must be +1 more than desired */\ | ||||
| 	 (1 << 8)  | /* hthresh */                             \ | ||||
| 	 0x1f)       /* pthresh */ | ||||
| 
 | ||||
| #define E1000_RXDCTL_DMA_BURST_ENABLE                          \ | ||||
| 	(0x01000000 | /* set descriptor granularity */         \ | ||||
| 	 (4 << 16)  | /* set writeback threshold    */         \ | ||||
| 	 (4 << 8)   | /* set prefetch threshold     */         \ | ||||
| 	 0x20)        /* set hthresh                */ | ||||
| 
 | ||||
| #define E1000_TIDV_FPD (1 << 31) | ||||
| #define E1000_RDTR_FPD (1 << 31) | ||||
| 
 | ||||
| enum e1000_boards { | ||||
| 	board_82571, | ||||
| 	board_82572, | ||||
| 	board_82573, | ||||
| 	board_82574, | ||||
| 	board_82583, | ||||
| 	board_80003es2lan, | ||||
| 	board_ich8lan, | ||||
| 	board_ich9lan, | ||||
| 	board_ich10lan, | ||||
| 	board_pchlan, | ||||
| 	board_pch2lan, | ||||
| 	board_pch_lpt, | ||||
| }; | ||||
| 
 | ||||
| struct e1000_ps_page { | ||||
| 	struct page *page; | ||||
| 	u64 dma; /* must be u64 - written to hw */ | ||||
| }; | ||||
| 
 | ||||
| /* wrappers around a pointer to a socket buffer,
 | ||||
|  * so a DMA handle can be stored along with the buffer | ||||
|  */ | ||||
| struct e1000_buffer { | ||||
| 	dma_addr_t dma; | ||||
| 	struct sk_buff *skb; | ||||
| 	union { | ||||
| 		/* Tx */ | ||||
| 		struct { | ||||
| 			unsigned long time_stamp; | ||||
| 			u16 length; | ||||
| 			u16 next_to_watch; | ||||
| 			unsigned int segs; | ||||
| 			unsigned int bytecount; | ||||
| 			u16 mapped_as_page; | ||||
| 		}; | ||||
| 		/* Rx */ | ||||
| 		struct { | ||||
| 			/* arrays of page information for packet split */ | ||||
| 			struct e1000_ps_page *ps_pages; | ||||
| 			struct page *page; | ||||
| 		}; | ||||
| 	}; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_ring { | ||||
| 	struct e1000_adapter *adapter;	/* back pointer to adapter */ | ||||
| 	void *desc;			/* pointer to ring memory  */ | ||||
| 	dma_addr_t dma;			/* phys address of ring    */ | ||||
| 	unsigned int size;		/* length of ring in bytes */ | ||||
| 	unsigned int count;		/* number of desc. in ring */ | ||||
| 
 | ||||
| 	u16 next_to_use; | ||||
| 	u16 next_to_clean; | ||||
| 
 | ||||
| 	void __iomem *head; | ||||
| 	void __iomem *tail; | ||||
| 
 | ||||
| 	/* array of buffer information structs */ | ||||
| 	struct e1000_buffer *buffer_info; | ||||
| 
 | ||||
| 	char name[IFNAMSIZ + 5]; | ||||
| 	u32 ims_val; | ||||
| 	u32 itr_val; | ||||
| 	void __iomem *itr_register; | ||||
| 	int set_itr; | ||||
| 
 | ||||
| 	struct sk_buff *rx_skb_top; | ||||
| }; | ||||
| 
 | ||||
| /* PHY register snapshot values */ | ||||
| struct e1000_phy_regs { | ||||
| 	u16 bmcr;		/* basic mode control register    */ | ||||
| 	u16 bmsr;		/* basic mode status register     */ | ||||
| 	u16 advertise;		/* auto-negotiation advertisement */ | ||||
| 	u16 lpa;		/* link partner ability register  */ | ||||
| 	u16 expansion;		/* auto-negotiation expansion reg */ | ||||
| 	u16 ctrl1000;		/* 1000BASE-T control register    */ | ||||
| 	u16 stat1000;		/* 1000BASE-T status register     */ | ||||
| 	u16 estatus;		/* extended status register       */ | ||||
| }; | ||||
| 
 | ||||
| /* board specific private data structure */ | ||||
| struct e1000_adapter { | ||||
| 	struct timer_list watchdog_timer; | ||||
| 	struct timer_list phy_info_timer; | ||||
| 	struct timer_list blink_timer; | ||||
| 
 | ||||
| 	struct work_struct reset_task; | ||||
| 	struct work_struct watchdog_task; | ||||
| 
 | ||||
| 	const struct e1000_info *ei; | ||||
| 
 | ||||
| 	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | ||||
| 	u32 bd_number; | ||||
| 	u32 rx_buffer_len; | ||||
| 	u16 mng_vlan_id; | ||||
| 	u16 link_speed; | ||||
| 	u16 link_duplex; | ||||
| 	u16 eeprom_vers; | ||||
| 
 | ||||
| 	/* track device up/down/testing state */ | ||||
| 	unsigned long state; | ||||
| 
 | ||||
| 	/* Interrupt Throttle Rate */ | ||||
| 	u32 itr; | ||||
| 	u32 itr_setting; | ||||
| 	u16 tx_itr; | ||||
| 	u16 rx_itr; | ||||
| 
 | ||||
| 	/* Tx - one ring per active queue */ | ||||
| 	struct e1000_ring *tx_ring ____cacheline_aligned_in_smp; | ||||
| 	u32 tx_fifo_limit; | ||||
| 
 | ||||
| 	struct napi_struct napi; | ||||
| 
 | ||||
| 	unsigned int uncorr_errors;	/* uncorrectable ECC errors */ | ||||
| 	unsigned int corr_errors;	/* correctable ECC errors */ | ||||
| 	unsigned int restart_queue; | ||||
| 	u32 txd_cmd; | ||||
| 
 | ||||
| 	bool detect_tx_hung; | ||||
| 	bool tx_hang_recheck; | ||||
| 	u8 tx_timeout_factor; | ||||
| 
 | ||||
| 	u32 tx_int_delay; | ||||
| 	u32 tx_abs_int_delay; | ||||
| 
 | ||||
| 	unsigned int total_tx_bytes; | ||||
| 	unsigned int total_tx_packets; | ||||
| 	unsigned int total_rx_bytes; | ||||
| 	unsigned int total_rx_packets; | ||||
| 
 | ||||
| 	/* Tx stats */ | ||||
| 	u64 tpt_old; | ||||
| 	u64 colc_old; | ||||
| 	u32 gotc; | ||||
| 	u64 gotc_old; | ||||
| 	u32 tx_timeout_count; | ||||
| 	u32 tx_fifo_head; | ||||
| 	u32 tx_head_addr; | ||||
| 	u32 tx_fifo_size; | ||||
| 	u32 tx_dma_failed; | ||||
| 	u32 tx_hwtstamp_timeouts; | ||||
| 
 | ||||
| 	/* Rx */ | ||||
| 	bool (*clean_rx)(struct e1000_ring *ring, int *work_done, | ||||
| 			 int work_to_do) ____cacheline_aligned_in_smp; | ||||
| 	void (*alloc_rx_buf)(struct e1000_ring *ring, int cleaned_count, | ||||
| 			     gfp_t gfp); | ||||
| 	struct e1000_ring *rx_ring; | ||||
| 
 | ||||
| 	u32 rx_int_delay; | ||||
| 	u32 rx_abs_int_delay; | ||||
| 
 | ||||
| 	/* Rx stats */ | ||||
| 	u64 hw_csum_err; | ||||
| 	u64 hw_csum_good; | ||||
| 	u64 rx_hdr_split; | ||||
| 	u32 gorc; | ||||
| 	u64 gorc_old; | ||||
| 	u32 alloc_rx_buff_failed; | ||||
| 	u32 rx_dma_failed; | ||||
| 	u32 rx_hwtstamp_cleared; | ||||
| 
 | ||||
| 	unsigned int rx_ps_pages; | ||||
| 	u16 rx_ps_bsize0; | ||||
| 	u32 max_frame_size; | ||||
| 	u32 min_frame_size; | ||||
| 
 | ||||
| 	/* OS defined structs */ | ||||
| 	struct net_device *netdev; | ||||
| 	struct pci_dev *pdev; | ||||
| 
 | ||||
| 	/* structs defined in e1000_hw.h */ | ||||
| 	struct e1000_hw hw; | ||||
| 
 | ||||
| 	spinlock_t stats64_lock;	/* protects statistics counters */ | ||||
| 	struct e1000_hw_stats stats; | ||||
| 	struct e1000_phy_info phy_info; | ||||
| 	struct e1000_phy_stats phy_stats; | ||||
| 
 | ||||
| 	/* Snapshot of PHY registers */ | ||||
| 	struct e1000_phy_regs phy_regs; | ||||
| 
 | ||||
| 	struct e1000_ring test_tx_ring; | ||||
| 	struct e1000_ring test_rx_ring; | ||||
| 	u32 test_icr; | ||||
| 
 | ||||
| 	u32 msg_enable; | ||||
| 	unsigned int num_vectors; | ||||
| 	struct msix_entry *msix_entries; | ||||
| 	int int_mode; | ||||
| 	u32 eiac_mask; | ||||
| 
 | ||||
| 	u32 eeprom_wol; | ||||
| 	u32 wol; | ||||
| 	u32 pba; | ||||
| 	u32 max_hw_frame_size; | ||||
| 
 | ||||
| 	bool fc_autoneg; | ||||
| 
 | ||||
| 	unsigned int flags; | ||||
| 	unsigned int flags2; | ||||
| 	struct work_struct downshift_task; | ||||
| 	struct work_struct update_phy_task; | ||||
| 	struct work_struct print_hang_task; | ||||
| 
 | ||||
| 	int phy_hang_count; | ||||
| 
 | ||||
| 	u16 tx_ring_count; | ||||
| 	u16 rx_ring_count; | ||||
| 
 | ||||
| 	struct hwtstamp_config hwtstamp_config; | ||||
| 	struct delayed_work systim_overflow_work; | ||||
| 	struct sk_buff *tx_hwtstamp_skb; | ||||
| 	unsigned long tx_hwtstamp_start; | ||||
| 	struct work_struct tx_hwtstamp_work; | ||||
| 	spinlock_t systim_lock;	/* protects SYSTIML/H regsters */ | ||||
| 	struct cyclecounter cc; | ||||
| 	struct timecounter tc; | ||||
| 	struct ptp_clock *ptp_clock; | ||||
| 	struct ptp_clock_info ptp_clock_info; | ||||
| 
 | ||||
| 	u16 eee_advert; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_info { | ||||
| 	enum e1000_mac_type	mac; | ||||
| 	unsigned int		flags; | ||||
| 	unsigned int		flags2; | ||||
| 	u32			pba; | ||||
| 	u32			max_hw_frame_size; | ||||
| 	s32			(*get_variants)(struct e1000_adapter *); | ||||
| 	const struct e1000_mac_operations *mac_ops; | ||||
| 	const struct e1000_phy_operations *phy_ops; | ||||
| 	const struct e1000_nvm_operations *nvm_ops; | ||||
| }; | ||||
| 
 | ||||
| s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca); | ||||
| 
 | ||||
| /* The system time is maintained by a 64-bit counter comprised of the 32-bit
 | ||||
|  * SYSTIMH and SYSTIML registers.  How the counter increments (and therefore | ||||
|  * its resolution) is based on the contents of the TIMINCA register - it | ||||
|  * increments every incperiod (bits 31:24) clock ticks by incvalue (bits 23:0). | ||||
|  * For the best accuracy, the incperiod should be as small as possible.  The | ||||
|  * incvalue is scaled by a factor as large as possible (while still fitting | ||||
|  * in bits 23:0) so that relatively small clock corrections can be made. | ||||
|  * | ||||
|  * As a result, a shift of INCVALUE_SHIFT_n is used to fit a value of | ||||
|  * INCVALUE_n into the TIMINCA register allowing 32+8+(24-INCVALUE_SHIFT_n) | ||||
|  * bits to count nanoseconds leaving the rest for fractional nonseconds. | ||||
|  */ | ||||
| #define INCVALUE_96MHz		125 | ||||
| #define INCVALUE_SHIFT_96MHz	17 | ||||
| #define INCPERIOD_SHIFT_96MHz	2 | ||||
| #define INCPERIOD_96MHz		(12 >> INCPERIOD_SHIFT_96MHz) | ||||
| 
 | ||||
| #define INCVALUE_25MHz		40 | ||||
| #define INCVALUE_SHIFT_25MHz	18 | ||||
| #define INCPERIOD_25MHz		1 | ||||
| 
 | ||||
| /* Another drawback of scaling the incvalue by a large factor is the
 | ||||
|  * 64-bit SYSTIM register overflows more quickly.  This is dealt with | ||||
|  * by simply reading the clock before it overflows. | ||||
|  * | ||||
|  * Clock	ns bits	Overflows after | ||||
|  * ~~~~~~	~~~~~~~	~~~~~~~~~~~~~~~ | ||||
|  * 96MHz	47-bit	2^(47-INCPERIOD_SHIFT_96MHz) / 10^9 / 3600 = 9.77 hrs | ||||
|  * 25MHz	46-bit	2^46 / 10^9 / 3600 = 19.55 hours | ||||
|  */ | ||||
| #define E1000_SYSTIM_OVERFLOW_PERIOD	(HZ * 60 * 60 * 4) | ||||
| #define E1000_MAX_82574_SYSTIM_REREADS	50 | ||||
| #define E1000_82574_SYSTIM_EPSILON	(1ULL << 35ULL) | ||||
| 
 | ||||
| /* hardware capability, feature, and workaround flags */ | ||||
| #define FLAG_HAS_AMT                      (1 << 0) | ||||
| #define FLAG_HAS_FLASH                    (1 << 1) | ||||
| #define FLAG_HAS_HW_VLAN_FILTER           (1 << 2) | ||||
| #define FLAG_HAS_WOL                      (1 << 3) | ||||
| /* reserved bit4 */ | ||||
| #define FLAG_HAS_CTRLEXT_ON_LOAD          (1 << 5) | ||||
| #define FLAG_HAS_SWSM_ON_LOAD             (1 << 6) | ||||
| #define FLAG_HAS_JUMBO_FRAMES             (1 << 7) | ||||
| #define FLAG_READ_ONLY_NVM                (1 << 8) | ||||
| #define FLAG_IS_ICH                       (1 << 9) | ||||
| #define FLAG_HAS_MSIX                     (1 << 10) | ||||
| #define FLAG_HAS_SMART_POWER_DOWN         (1 << 11) | ||||
| #define FLAG_IS_QUAD_PORT_A               (1 << 12) | ||||
| #define FLAG_IS_QUAD_PORT                 (1 << 13) | ||||
| #define FLAG_HAS_HW_TIMESTAMP             (1 << 14) | ||||
| #define FLAG_APME_IN_WUC                  (1 << 15) | ||||
| #define FLAG_APME_IN_CTRL3                (1 << 16) | ||||
| #define FLAG_APME_CHECK_PORT_B            (1 << 17) | ||||
| #define FLAG_DISABLE_FC_PAUSE_TIME        (1 << 18) | ||||
| #define FLAG_NO_WAKE_UCAST                (1 << 19) | ||||
| #define FLAG_MNG_PT_ENABLED               (1 << 20) | ||||
| #define FLAG_RESET_OVERWRITES_LAA         (1 << 21) | ||||
| #define FLAG_TARC_SPEED_MODE_BIT          (1 << 22) | ||||
| #define FLAG_TARC_SET_BIT_ZERO            (1 << 23) | ||||
| #define FLAG_RX_NEEDS_RESTART             (1 << 24) | ||||
| #define FLAG_LSC_GIG_SPEED_DROP           (1 << 25) | ||||
| #define FLAG_SMART_POWER_DOWN             (1 << 26) | ||||
| #define FLAG_MSI_ENABLED                  (1 << 27) | ||||
| /* reserved (1 << 28) */ | ||||
| #define FLAG_TSO_FORCE                    (1 << 29) | ||||
| #define FLAG_RESTART_NOW                  (1 << 30) | ||||
| #define FLAG_MSI_TEST_FAILED              (1 << 31) | ||||
| 
 | ||||
| #define FLAG2_CRC_STRIPPING               (1 << 0) | ||||
| #define FLAG2_HAS_PHY_WAKEUP              (1 << 1) | ||||
| #define FLAG2_IS_DISCARDING               (1 << 2) | ||||
| #define FLAG2_DISABLE_ASPM_L1             (1 << 3) | ||||
| #define FLAG2_HAS_PHY_STATS               (1 << 4) | ||||
| #define FLAG2_HAS_EEE                     (1 << 5) | ||||
| #define FLAG2_DMA_BURST                   (1 << 6) | ||||
| #define FLAG2_DISABLE_ASPM_L0S            (1 << 7) | ||||
| #define FLAG2_DISABLE_AIM                 (1 << 8) | ||||
| #define FLAG2_CHECK_PHY_HANG              (1 << 9) | ||||
| #define FLAG2_NO_DISABLE_RX               (1 << 10) | ||||
| #define FLAG2_PCIM2PCI_ARBITER_WA         (1 << 11) | ||||
| #define FLAG2_DFLT_CRC_STRIPPING          (1 << 12) | ||||
| #define FLAG2_CHECK_RX_HWTSTAMP           (1 << 13) | ||||
| 
 | ||||
| #define E1000_RX_DESC_PS(R, i)	    \ | ||||
| 	(&(((union e1000_rx_desc_packet_split *)((R).desc))[i])) | ||||
| #define E1000_RX_DESC_EXT(R, i)	    \ | ||||
| 	(&(((union e1000_rx_desc_extended *)((R).desc))[i])) | ||||
| #define E1000_GET_DESC(R, i, type)	(&(((struct type *)((R).desc))[i])) | ||||
| #define E1000_TX_DESC(R, i)		E1000_GET_DESC(R, i, e1000_tx_desc) | ||||
| #define E1000_CONTEXT_DESC(R, i)	E1000_GET_DESC(R, i, e1000_context_desc) | ||||
| 
 | ||||
| enum e1000_state_t { | ||||
| 	__E1000_TESTING, | ||||
| 	__E1000_RESETTING, | ||||
| 	__E1000_ACCESS_SHARED_RESOURCE, | ||||
| 	__E1000_DOWN | ||||
| }; | ||||
| 
 | ||||
| enum latency_range { | ||||
| 	lowest_latency = 0, | ||||
| 	low_latency = 1, | ||||
| 	bulk_latency = 2, | ||||
| 	latency_invalid = 255 | ||||
| }; | ||||
| 
 | ||||
| extern char e1000e_driver_name[]; | ||||
| extern const char e1000e_driver_version[]; | ||||
| 
 | ||||
| void e1000e_check_options(struct e1000_adapter *adapter); | ||||
| void e1000e_set_ethtool_ops(struct net_device *netdev); | ||||
| 
 | ||||
| int e1000e_up(struct e1000_adapter *adapter); | ||||
| void e1000e_down(struct e1000_adapter *adapter, bool reset); | ||||
| void e1000e_reinit_locked(struct e1000_adapter *adapter); | ||||
| void e1000e_reset(struct e1000_adapter *adapter); | ||||
| void e1000e_power_up_phy(struct e1000_adapter *adapter); | ||||
| int e1000e_setup_rx_resources(struct e1000_ring *ring); | ||||
| int e1000e_setup_tx_resources(struct e1000_ring *ring); | ||||
| void e1000e_free_rx_resources(struct e1000_ring *ring); | ||||
| void e1000e_free_tx_resources(struct e1000_ring *ring); | ||||
| struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev, | ||||
| 					     struct rtnl_link_stats64 *stats); | ||||
| void e1000e_set_interrupt_capability(struct e1000_adapter *adapter); | ||||
| void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter); | ||||
| void e1000e_get_hw_control(struct e1000_adapter *adapter); | ||||
| void e1000e_release_hw_control(struct e1000_adapter *adapter); | ||||
| void e1000e_write_itr(struct e1000_adapter *adapter, u32 itr); | ||||
| 
 | ||||
| extern unsigned int copybreak; | ||||
| 
 | ||||
| extern const struct e1000_info e1000_82571_info; | ||||
| extern const struct e1000_info e1000_82572_info; | ||||
| extern const struct e1000_info e1000_82573_info; | ||||
| extern const struct e1000_info e1000_82574_info; | ||||
| extern const struct e1000_info e1000_82583_info; | ||||
| extern const struct e1000_info e1000_ich8_info; | ||||
| extern const struct e1000_info e1000_ich9_info; | ||||
| extern const struct e1000_info e1000_ich10_info; | ||||
| extern const struct e1000_info e1000_pch_info; | ||||
| extern const struct e1000_info e1000_pch2_info; | ||||
| extern const struct e1000_info e1000_pch_lpt_info; | ||||
| extern const struct e1000_info e1000_es2_info; | ||||
| 
 | ||||
| void e1000e_ptp_init(struct e1000_adapter *adapter); | ||||
| void e1000e_ptp_remove(struct e1000_adapter *adapter); | ||||
| 
 | ||||
| static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw) | ||||
| { | ||||
| 	return hw->phy.ops.reset(hw); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1e_rphy(struct e1000_hw *hw, u32 offset, u16 *data) | ||||
| { | ||||
| 	return hw->phy.ops.read_reg(hw, offset, data); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1e_rphy_locked(struct e1000_hw *hw, u32 offset, u16 *data) | ||||
| { | ||||
| 	return hw->phy.ops.read_reg_locked(hw, offset, data); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1e_wphy(struct e1000_hw *hw, u32 offset, u16 data) | ||||
| { | ||||
| 	return hw->phy.ops.write_reg(hw, offset, data); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1e_wphy_locked(struct e1000_hw *hw, u32 offset, u16 data) | ||||
| { | ||||
| 	return hw->phy.ops.write_reg_locked(hw, offset, data); | ||||
| } | ||||
| 
 | ||||
| void e1000e_reload_nvm_generic(struct e1000_hw *hw); | ||||
| 
 | ||||
| static inline s32 e1000e_read_mac_addr(struct e1000_hw *hw) | ||||
| { | ||||
| 	if (hw->mac.ops.read_mac_addr) | ||||
| 		return hw->mac.ops.read_mac_addr(hw); | ||||
| 
 | ||||
| 	return e1000_read_mac_addr_generic(hw); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1000_validate_nvm_checksum(struct e1000_hw *hw) | ||||
| { | ||||
| 	return hw->nvm.ops.validate(hw); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1000e_update_nvm_checksum(struct e1000_hw *hw) | ||||
| { | ||||
| 	return hw->nvm.ops.update(hw); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, | ||||
| 				 u16 *data) | ||||
| { | ||||
| 	return hw->nvm.ops.read(hw, offset, words, data); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, | ||||
| 				  u16 *data) | ||||
| { | ||||
| 	return hw->nvm.ops.write(hw, offset, words, data); | ||||
| } | ||||
| 
 | ||||
| static inline s32 e1000_get_phy_info(struct e1000_hw *hw) | ||||
| { | ||||
| 	return hw->phy.ops.get_info(hw); | ||||
| } | ||||
| 
 | ||||
| static inline u32 __er32(struct e1000_hw *hw, unsigned long reg) | ||||
| { | ||||
| 	return readl(hw->hw_addr + reg); | ||||
| } | ||||
| 
 | ||||
| #define er32(reg)	__er32(hw, E1000_##reg) | ||||
| 
 | ||||
| s32 __ew32_prepare(struct e1000_hw *hw); | ||||
| void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val); | ||||
| 
 | ||||
| #define ew32(reg, val)	__ew32(hw, E1000_##reg, (val)) | ||||
| 
 | ||||
| #define e1e_flush()	er32(STATUS) | ||||
| 
 | ||||
| #define E1000_WRITE_REG_ARRAY(a, reg, offset, value) \ | ||||
| 	(__ew32((a), (reg + ((offset) << 2)), (value))) | ||||
| 
 | ||||
| #define E1000_READ_REG_ARRAY(a, reg, offset) \ | ||||
| 	(readl((a)->hw_addr + reg + ((offset) << 2))) | ||||
| 
 | ||||
| #endif /* _E1000_H_ */ | ||||
							
								
								
									
										2320
									
								
								drivers/net/ethernet/intel/e1000e/ethtool.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2320
									
								
								drivers/net/ethernet/intel/e1000e/ethtool.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										692
									
								
								drivers/net/ethernet/intel/e1000e/hw.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										692
									
								
								drivers/net/ethernet/intel/e1000e/hw.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,692 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000_HW_H_ | ||||
| #define _E1000_HW_H_ | ||||
| 
 | ||||
| #include "regs.h" | ||||
| #include "defines.h" | ||||
| 
 | ||||
| struct e1000_hw; | ||||
| 
 | ||||
| #define E1000_DEV_ID_82571EB_COPPER		0x105E | ||||
| #define E1000_DEV_ID_82571EB_FIBER		0x105F | ||||
| #define E1000_DEV_ID_82571EB_SERDES		0x1060 | ||||
| #define E1000_DEV_ID_82571EB_QUAD_COPPER	0x10A4 | ||||
| #define E1000_DEV_ID_82571PT_QUAD_COPPER	0x10D5 | ||||
| #define E1000_DEV_ID_82571EB_QUAD_FIBER		0x10A5 | ||||
| #define E1000_DEV_ID_82571EB_QUAD_COPPER_LP	0x10BC | ||||
| #define E1000_DEV_ID_82571EB_SERDES_DUAL	0x10D9 | ||||
| #define E1000_DEV_ID_82571EB_SERDES_QUAD	0x10DA | ||||
| #define E1000_DEV_ID_82572EI_COPPER		0x107D | ||||
| #define E1000_DEV_ID_82572EI_FIBER		0x107E | ||||
| #define E1000_DEV_ID_82572EI_SERDES		0x107F | ||||
| #define E1000_DEV_ID_82572EI			0x10B9 | ||||
| #define E1000_DEV_ID_82573E			0x108B | ||||
| #define E1000_DEV_ID_82573E_IAMT		0x108C | ||||
| #define E1000_DEV_ID_82573L			0x109A | ||||
| #define E1000_DEV_ID_82574L			0x10D3 | ||||
| #define E1000_DEV_ID_82574LA			0x10F6 | ||||
| #define E1000_DEV_ID_82583V			0x150C | ||||
| #define E1000_DEV_ID_80003ES2LAN_COPPER_DPT	0x1096 | ||||
| #define E1000_DEV_ID_80003ES2LAN_SERDES_DPT	0x1098 | ||||
| #define E1000_DEV_ID_80003ES2LAN_COPPER_SPT	0x10BA | ||||
| #define E1000_DEV_ID_80003ES2LAN_SERDES_SPT	0x10BB | ||||
| #define E1000_DEV_ID_ICH8_82567V_3		0x1501 | ||||
| #define E1000_DEV_ID_ICH8_IGP_M_AMT		0x1049 | ||||
| #define E1000_DEV_ID_ICH8_IGP_AMT		0x104A | ||||
| #define E1000_DEV_ID_ICH8_IGP_C			0x104B | ||||
| #define E1000_DEV_ID_ICH8_IFE			0x104C | ||||
| #define E1000_DEV_ID_ICH8_IFE_GT		0x10C4 | ||||
| #define E1000_DEV_ID_ICH8_IFE_G			0x10C5 | ||||
| #define E1000_DEV_ID_ICH8_IGP_M			0x104D | ||||
| #define E1000_DEV_ID_ICH9_IGP_AMT		0x10BD | ||||
| #define E1000_DEV_ID_ICH9_BM			0x10E5 | ||||
| #define E1000_DEV_ID_ICH9_IGP_M_AMT		0x10F5 | ||||
| #define E1000_DEV_ID_ICH9_IGP_M			0x10BF | ||||
| #define E1000_DEV_ID_ICH9_IGP_M_V		0x10CB | ||||
| #define E1000_DEV_ID_ICH9_IGP_C			0x294C | ||||
| #define E1000_DEV_ID_ICH9_IFE			0x10C0 | ||||
| #define E1000_DEV_ID_ICH9_IFE_GT		0x10C3 | ||||
| #define E1000_DEV_ID_ICH9_IFE_G			0x10C2 | ||||
| #define E1000_DEV_ID_ICH10_R_BM_LM		0x10CC | ||||
| #define E1000_DEV_ID_ICH10_R_BM_LF		0x10CD | ||||
| #define E1000_DEV_ID_ICH10_R_BM_V		0x10CE | ||||
| #define E1000_DEV_ID_ICH10_D_BM_LM		0x10DE | ||||
| #define E1000_DEV_ID_ICH10_D_BM_LF		0x10DF | ||||
| #define E1000_DEV_ID_ICH10_D_BM_V		0x1525 | ||||
| #define E1000_DEV_ID_PCH_M_HV_LM		0x10EA | ||||
| #define E1000_DEV_ID_PCH_M_HV_LC		0x10EB | ||||
| #define E1000_DEV_ID_PCH_D_HV_DM		0x10EF | ||||
| #define E1000_DEV_ID_PCH_D_HV_DC		0x10F0 | ||||
| #define E1000_DEV_ID_PCH2_LV_LM			0x1502 | ||||
| #define E1000_DEV_ID_PCH2_LV_V			0x1503 | ||||
| #define E1000_DEV_ID_PCH_LPT_I217_LM		0x153A | ||||
| #define E1000_DEV_ID_PCH_LPT_I217_V		0x153B | ||||
| #define E1000_DEV_ID_PCH_LPTLP_I218_LM		0x155A | ||||
| #define E1000_DEV_ID_PCH_LPTLP_I218_V		0x1559 | ||||
| #define E1000_DEV_ID_PCH_I218_LM2		0x15A0 | ||||
| #define E1000_DEV_ID_PCH_I218_V2		0x15A1 | ||||
| #define E1000_DEV_ID_PCH_I218_LM3		0x15A2	/* Wildcat Point PCH */ | ||||
| #define E1000_DEV_ID_PCH_I218_V3		0x15A3	/* Wildcat Point PCH */ | ||||
| 
 | ||||
| #define E1000_REVISION_4	4 | ||||
| 
 | ||||
| #define E1000_FUNC_1		1 | ||||
| 
 | ||||
| #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0	0 | ||||
| #define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1	3 | ||||
| 
 | ||||
| enum e1000_mac_type { | ||||
| 	e1000_82571, | ||||
| 	e1000_82572, | ||||
| 	e1000_82573, | ||||
| 	e1000_82574, | ||||
| 	e1000_82583, | ||||
| 	e1000_80003es2lan, | ||||
| 	e1000_ich8lan, | ||||
| 	e1000_ich9lan, | ||||
| 	e1000_ich10lan, | ||||
| 	e1000_pchlan, | ||||
| 	e1000_pch2lan, | ||||
| 	e1000_pch_lpt, | ||||
| }; | ||||
| 
 | ||||
| enum e1000_media_type { | ||||
| 	e1000_media_type_unknown = 0, | ||||
| 	e1000_media_type_copper = 1, | ||||
| 	e1000_media_type_fiber = 2, | ||||
| 	e1000_media_type_internal_serdes = 3, | ||||
| 	e1000_num_media_types | ||||
| }; | ||||
| 
 | ||||
| enum e1000_nvm_type { | ||||
| 	e1000_nvm_unknown = 0, | ||||
| 	e1000_nvm_none, | ||||
| 	e1000_nvm_eeprom_spi, | ||||
| 	e1000_nvm_flash_hw, | ||||
| 	e1000_nvm_flash_sw | ||||
| }; | ||||
| 
 | ||||
| enum e1000_nvm_override { | ||||
| 	e1000_nvm_override_none = 0, | ||||
| 	e1000_nvm_override_spi_small, | ||||
| 	e1000_nvm_override_spi_large | ||||
| }; | ||||
| 
 | ||||
| enum e1000_phy_type { | ||||
| 	e1000_phy_unknown = 0, | ||||
| 	e1000_phy_none, | ||||
| 	e1000_phy_m88, | ||||
| 	e1000_phy_igp, | ||||
| 	e1000_phy_igp_2, | ||||
| 	e1000_phy_gg82563, | ||||
| 	e1000_phy_igp_3, | ||||
| 	e1000_phy_ife, | ||||
| 	e1000_phy_bm, | ||||
| 	e1000_phy_82578, | ||||
| 	e1000_phy_82577, | ||||
| 	e1000_phy_82579, | ||||
| 	e1000_phy_i217, | ||||
| }; | ||||
| 
 | ||||
| enum e1000_bus_width { | ||||
| 	e1000_bus_width_unknown = 0, | ||||
| 	e1000_bus_width_pcie_x1, | ||||
| 	e1000_bus_width_pcie_x2, | ||||
| 	e1000_bus_width_pcie_x4 = 4, | ||||
| 	e1000_bus_width_32, | ||||
| 	e1000_bus_width_64, | ||||
| 	e1000_bus_width_reserved | ||||
| }; | ||||
| 
 | ||||
| enum e1000_1000t_rx_status { | ||||
| 	e1000_1000t_rx_status_not_ok = 0, | ||||
| 	e1000_1000t_rx_status_ok, | ||||
| 	e1000_1000t_rx_status_undefined = 0xFF | ||||
| }; | ||||
| 
 | ||||
| enum e1000_rev_polarity { | ||||
| 	e1000_rev_polarity_normal = 0, | ||||
| 	e1000_rev_polarity_reversed, | ||||
| 	e1000_rev_polarity_undefined = 0xFF | ||||
| }; | ||||
| 
 | ||||
| enum e1000_fc_mode { | ||||
| 	e1000_fc_none = 0, | ||||
| 	e1000_fc_rx_pause, | ||||
| 	e1000_fc_tx_pause, | ||||
| 	e1000_fc_full, | ||||
| 	e1000_fc_default = 0xFF | ||||
| }; | ||||
| 
 | ||||
| enum e1000_ms_type { | ||||
| 	e1000_ms_hw_default = 0, | ||||
| 	e1000_ms_force_master, | ||||
| 	e1000_ms_force_slave, | ||||
| 	e1000_ms_auto | ||||
| }; | ||||
| 
 | ||||
| enum e1000_smart_speed { | ||||
| 	e1000_smart_speed_default = 0, | ||||
| 	e1000_smart_speed_on, | ||||
| 	e1000_smart_speed_off | ||||
| }; | ||||
| 
 | ||||
| enum e1000_serdes_link_state { | ||||
| 	e1000_serdes_link_down = 0, | ||||
| 	e1000_serdes_link_autoneg_progress, | ||||
| 	e1000_serdes_link_autoneg_complete, | ||||
| 	e1000_serdes_link_forced_up | ||||
| }; | ||||
| 
 | ||||
| /* Receive Descriptor - Extended */ | ||||
| union e1000_rx_desc_extended { | ||||
| 	struct { | ||||
| 		__le64 buffer_addr; | ||||
| 		__le64 reserved; | ||||
| 	} read; | ||||
| 	struct { | ||||
| 		struct { | ||||
| 			__le32 mrq;	      /* Multiple Rx Queues */ | ||||
| 			union { | ||||
| 				__le32 rss;	    /* RSS Hash */ | ||||
| 				struct { | ||||
| 					__le16 ip_id;  /* IP id */ | ||||
| 					__le16 csum;   /* Packet Checksum */ | ||||
| 				} csum_ip; | ||||
| 			} hi_dword; | ||||
| 		} lower; | ||||
| 		struct { | ||||
| 			__le32 status_error;     /* ext status/error */ | ||||
| 			__le16 length; | ||||
| 			__le16 vlan;	     /* VLAN tag */ | ||||
| 		} upper; | ||||
| 	} wb;  /* writeback */ | ||||
| }; | ||||
| 
 | ||||
| #define MAX_PS_BUFFERS 4 | ||||
| 
 | ||||
| /* Number of packet split data buffers (not including the header buffer) */ | ||||
| #define PS_PAGE_BUFFERS	(MAX_PS_BUFFERS - 1) | ||||
| 
 | ||||
| /* Receive Descriptor - Packet Split */ | ||||
| union e1000_rx_desc_packet_split { | ||||
| 	struct { | ||||
| 		/* one buffer for protocol header(s), three data buffers */ | ||||
| 		__le64 buffer_addr[MAX_PS_BUFFERS]; | ||||
| 	} read; | ||||
| 	struct { | ||||
| 		struct { | ||||
| 			__le32 mrq;	      /* Multiple Rx Queues */ | ||||
| 			union { | ||||
| 				__le32 rss;	      /* RSS Hash */ | ||||
| 				struct { | ||||
| 					__le16 ip_id;    /* IP id */ | ||||
| 					__le16 csum;     /* Packet Checksum */ | ||||
| 				} csum_ip; | ||||
| 			} hi_dword; | ||||
| 		} lower; | ||||
| 		struct { | ||||
| 			__le32 status_error;     /* ext status/error */ | ||||
| 			__le16 length0;	  /* length of buffer 0 */ | ||||
| 			__le16 vlan;	     /* VLAN tag */ | ||||
| 		} middle; | ||||
| 		struct { | ||||
| 			__le16 header_status; | ||||
| 			/* length of buffers 1-3 */ | ||||
| 			__le16 length[PS_PAGE_BUFFERS]; | ||||
| 		} upper; | ||||
| 		__le64 reserved; | ||||
| 	} wb; /* writeback */ | ||||
| }; | ||||
| 
 | ||||
| /* Transmit Descriptor */ | ||||
| struct e1000_tx_desc { | ||||
| 	__le64 buffer_addr;      /* Address of the descriptor's data buffer */ | ||||
| 	union { | ||||
| 		__le32 data; | ||||
| 		struct { | ||||
| 			__le16 length;    /* Data buffer length */ | ||||
| 			u8 cso;	/* Checksum offset */ | ||||
| 			u8 cmd;	/* Descriptor control */ | ||||
| 		} flags; | ||||
| 	} lower; | ||||
| 	union { | ||||
| 		__le32 data; | ||||
| 		struct { | ||||
| 			u8 status;     /* Descriptor status */ | ||||
| 			u8 css;	/* Checksum start */ | ||||
| 			__le16 special; | ||||
| 		} fields; | ||||
| 	} upper; | ||||
| }; | ||||
| 
 | ||||
| /* Offload Context Descriptor */ | ||||
| struct e1000_context_desc { | ||||
| 	union { | ||||
| 		__le32 ip_config; | ||||
| 		struct { | ||||
| 			u8 ipcss;      /* IP checksum start */ | ||||
| 			u8 ipcso;      /* IP checksum offset */ | ||||
| 			__le16 ipcse;     /* IP checksum end */ | ||||
| 		} ip_fields; | ||||
| 	} lower_setup; | ||||
| 	union { | ||||
| 		__le32 tcp_config; | ||||
| 		struct { | ||||
| 			u8 tucss;      /* TCP checksum start */ | ||||
| 			u8 tucso;      /* TCP checksum offset */ | ||||
| 			__le16 tucse;     /* TCP checksum end */ | ||||
| 		} tcp_fields; | ||||
| 	} upper_setup; | ||||
| 	__le32 cmd_and_length; | ||||
| 	union { | ||||
| 		__le32 data; | ||||
| 		struct { | ||||
| 			u8 status;     /* Descriptor status */ | ||||
| 			u8 hdr_len;    /* Header length */ | ||||
| 			__le16 mss;       /* Maximum segment size */ | ||||
| 		} fields; | ||||
| 	} tcp_seg_setup; | ||||
| }; | ||||
| 
 | ||||
| /* Offload data descriptor */ | ||||
| struct e1000_data_desc { | ||||
| 	__le64 buffer_addr;   /* Address of the descriptor's buffer address */ | ||||
| 	union { | ||||
| 		__le32 data; | ||||
| 		struct { | ||||
| 			__le16 length;    /* Data buffer length */ | ||||
| 			u8 typ_len_ext; | ||||
| 			u8 cmd; | ||||
| 		} flags; | ||||
| 	} lower; | ||||
| 	union { | ||||
| 		__le32 data; | ||||
| 		struct { | ||||
| 			u8 status;     /* Descriptor status */ | ||||
| 			u8 popts;      /* Packet Options */ | ||||
| 			__le16 special; | ||||
| 		} fields; | ||||
| 	} upper; | ||||
| }; | ||||
| 
 | ||||
| /* Statistics counters collected by the MAC */ | ||||
| struct e1000_hw_stats { | ||||
| 	u64 crcerrs; | ||||
| 	u64 algnerrc; | ||||
| 	u64 symerrs; | ||||
| 	u64 rxerrc; | ||||
| 	u64 mpc; | ||||
| 	u64 scc; | ||||
| 	u64 ecol; | ||||
| 	u64 mcc; | ||||
| 	u64 latecol; | ||||
| 	u64 colc; | ||||
| 	u64 dc; | ||||
| 	u64 tncrs; | ||||
| 	u64 sec; | ||||
| 	u64 cexterr; | ||||
| 	u64 rlec; | ||||
| 	u64 xonrxc; | ||||
| 	u64 xontxc; | ||||
| 	u64 xoffrxc; | ||||
| 	u64 xofftxc; | ||||
| 	u64 fcruc; | ||||
| 	u64 prc64; | ||||
| 	u64 prc127; | ||||
| 	u64 prc255; | ||||
| 	u64 prc511; | ||||
| 	u64 prc1023; | ||||
| 	u64 prc1522; | ||||
| 	u64 gprc; | ||||
| 	u64 bprc; | ||||
| 	u64 mprc; | ||||
| 	u64 gptc; | ||||
| 	u64 gorc; | ||||
| 	u64 gotc; | ||||
| 	u64 rnbc; | ||||
| 	u64 ruc; | ||||
| 	u64 rfc; | ||||
| 	u64 roc; | ||||
| 	u64 rjc; | ||||
| 	u64 mgprc; | ||||
| 	u64 mgpdc; | ||||
| 	u64 mgptc; | ||||
| 	u64 tor; | ||||
| 	u64 tot; | ||||
| 	u64 tpr; | ||||
| 	u64 tpt; | ||||
| 	u64 ptc64; | ||||
| 	u64 ptc127; | ||||
| 	u64 ptc255; | ||||
| 	u64 ptc511; | ||||
| 	u64 ptc1023; | ||||
| 	u64 ptc1522; | ||||
| 	u64 mptc; | ||||
| 	u64 bptc; | ||||
| 	u64 tsctc; | ||||
| 	u64 tsctfc; | ||||
| 	u64 iac; | ||||
| 	u64 icrxptc; | ||||
| 	u64 icrxatc; | ||||
| 	u64 ictxptc; | ||||
| 	u64 ictxatc; | ||||
| 	u64 ictxqec; | ||||
| 	u64 ictxqmtc; | ||||
| 	u64 icrxdmtc; | ||||
| 	u64 icrxoc; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_phy_stats { | ||||
| 	u32 idle_errors; | ||||
| 	u32 receive_errors; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_host_mng_dhcp_cookie { | ||||
| 	u32 signature; | ||||
| 	u8 status; | ||||
| 	u8 reserved0; | ||||
| 	u16 vlan_id; | ||||
| 	u32 reserved1; | ||||
| 	u16 reserved2; | ||||
| 	u8 reserved3; | ||||
| 	u8 checksum; | ||||
| }; | ||||
| 
 | ||||
| /* Host Interface "Rev 1" */ | ||||
| struct e1000_host_command_header { | ||||
| 	u8 command_id; | ||||
| 	u8 command_length; | ||||
| 	u8 command_options; | ||||
| 	u8 checksum; | ||||
| }; | ||||
| 
 | ||||
| #define E1000_HI_MAX_DATA_LENGTH	252 | ||||
| struct e1000_host_command_info { | ||||
| 	struct e1000_host_command_header command_header; | ||||
| 	u8 command_data[E1000_HI_MAX_DATA_LENGTH]; | ||||
| }; | ||||
| 
 | ||||
| /* Host Interface "Rev 2" */ | ||||
| struct e1000_host_mng_command_header { | ||||
| 	u8 command_id; | ||||
| 	u8 checksum; | ||||
| 	u16 reserved1; | ||||
| 	u16 reserved2; | ||||
| 	u16 command_length; | ||||
| }; | ||||
| 
 | ||||
| #define E1000_HI_MAX_MNG_DATA_LENGTH	0x6F8 | ||||
| struct e1000_host_mng_command_info { | ||||
| 	struct e1000_host_mng_command_header command_header; | ||||
| 	u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH]; | ||||
| }; | ||||
| 
 | ||||
| #include "mac.h" | ||||
| #include "phy.h" | ||||
| #include "nvm.h" | ||||
| #include "manage.h" | ||||
| 
 | ||||
| /* Function pointers for the MAC. */ | ||||
| struct e1000_mac_operations { | ||||
| 	s32  (*id_led_init)(struct e1000_hw *); | ||||
| 	s32  (*blink_led)(struct e1000_hw *); | ||||
| 	bool (*check_mng_mode)(struct e1000_hw *); | ||||
| 	s32  (*check_for_link)(struct e1000_hw *); | ||||
| 	s32  (*cleanup_led)(struct e1000_hw *); | ||||
| 	void (*clear_hw_cntrs)(struct e1000_hw *); | ||||
| 	void (*clear_vfta)(struct e1000_hw *); | ||||
| 	s32  (*get_bus_info)(struct e1000_hw *); | ||||
| 	void (*set_lan_id)(struct e1000_hw *); | ||||
| 	s32  (*get_link_up_info)(struct e1000_hw *, u16 *, u16 *); | ||||
| 	s32  (*led_on)(struct e1000_hw *); | ||||
| 	s32  (*led_off)(struct e1000_hw *); | ||||
| 	void (*update_mc_addr_list)(struct e1000_hw *, u8 *, u32); | ||||
| 	s32  (*reset_hw)(struct e1000_hw *); | ||||
| 	s32  (*init_hw)(struct e1000_hw *); | ||||
| 	s32  (*setup_link)(struct e1000_hw *); | ||||
| 	s32  (*setup_physical_interface)(struct e1000_hw *); | ||||
| 	s32  (*setup_led)(struct e1000_hw *); | ||||
| 	void (*write_vfta)(struct e1000_hw *, u32, u32); | ||||
| 	void (*config_collision_dist)(struct e1000_hw *); | ||||
| 	int  (*rar_set)(struct e1000_hw *, u8 *, u32); | ||||
| 	s32  (*read_mac_addr)(struct e1000_hw *); | ||||
| 	u32  (*rar_get_count)(struct e1000_hw *); | ||||
| }; | ||||
| 
 | ||||
| /* When to use various PHY register access functions:
 | ||||
|  * | ||||
|  *                 Func   Caller | ||||
|  *   Function      Does   Does    When to use | ||||
|  *   ~~~~~~~~~~~~  ~~~~~  ~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||
|  *   X_reg         L,P,A  n/a     for simple PHY reg accesses | ||||
|  *   X_reg_locked  P,A    L       for multiple accesses of different regs | ||||
|  *                                on different pages | ||||
|  *   X_reg_page    A      L,P     for multiple accesses of different regs | ||||
|  *                                on the same page | ||||
|  * | ||||
|  * Where X=[read|write], L=locking, P=sets page, A=register access | ||||
|  * | ||||
|  */ | ||||
| struct e1000_phy_operations { | ||||
| 	s32  (*acquire)(struct e1000_hw *); | ||||
| 	s32  (*cfg_on_link_up)(struct e1000_hw *); | ||||
| 	s32  (*check_polarity)(struct e1000_hw *); | ||||
| 	s32  (*check_reset_block)(struct e1000_hw *); | ||||
| 	s32  (*commit)(struct e1000_hw *); | ||||
| 	s32  (*force_speed_duplex)(struct e1000_hw *); | ||||
| 	s32  (*get_cfg_done)(struct e1000_hw *hw); | ||||
| 	s32  (*get_cable_length)(struct e1000_hw *); | ||||
| 	s32  (*get_info)(struct e1000_hw *); | ||||
| 	s32  (*set_page)(struct e1000_hw *, u16); | ||||
| 	s32  (*read_reg)(struct e1000_hw *, u32, u16 *); | ||||
| 	s32  (*read_reg_locked)(struct e1000_hw *, u32, u16 *); | ||||
| 	s32  (*read_reg_page)(struct e1000_hw *, u32, u16 *); | ||||
| 	void (*release)(struct e1000_hw *); | ||||
| 	s32  (*reset)(struct e1000_hw *); | ||||
| 	s32  (*set_d0_lplu_state)(struct e1000_hw *, bool); | ||||
| 	s32  (*set_d3_lplu_state)(struct e1000_hw *, bool); | ||||
| 	s32  (*write_reg)(struct e1000_hw *, u32, u16); | ||||
| 	s32  (*write_reg_locked)(struct e1000_hw *, u32, u16); | ||||
| 	s32  (*write_reg_page)(struct e1000_hw *, u32, u16); | ||||
| 	void (*power_up)(struct e1000_hw *); | ||||
| 	void (*power_down)(struct e1000_hw *); | ||||
| }; | ||||
| 
 | ||||
| /* Function pointers for the NVM. */ | ||||
| struct e1000_nvm_operations { | ||||
| 	s32  (*acquire)(struct e1000_hw *); | ||||
| 	s32  (*read)(struct e1000_hw *, u16, u16, u16 *); | ||||
| 	void (*release)(struct e1000_hw *); | ||||
| 	void (*reload)(struct e1000_hw *); | ||||
| 	s32  (*update)(struct e1000_hw *); | ||||
| 	s32  (*valid_led_default)(struct e1000_hw *, u16 *); | ||||
| 	s32  (*validate)(struct e1000_hw *); | ||||
| 	s32  (*write)(struct e1000_hw *, u16, u16, u16 *); | ||||
| }; | ||||
| 
 | ||||
| struct e1000_mac_info { | ||||
| 	struct e1000_mac_operations ops; | ||||
| 	u8 addr[ETH_ALEN]; | ||||
| 	u8 perm_addr[ETH_ALEN]; | ||||
| 
 | ||||
| 	enum e1000_mac_type type; | ||||
| 
 | ||||
| 	u32 collision_delta; | ||||
| 	u32 ledctl_default; | ||||
| 	u32 ledctl_mode1; | ||||
| 	u32 ledctl_mode2; | ||||
| 	u32 mc_filter_type; | ||||
| 	u32 tx_packet_delta; | ||||
| 	u32 txcw; | ||||
| 
 | ||||
| 	u16 current_ifs_val; | ||||
| 	u16 ifs_max_val; | ||||
| 	u16 ifs_min_val; | ||||
| 	u16 ifs_ratio; | ||||
| 	u16 ifs_step_size; | ||||
| 	u16 mta_reg_count; | ||||
| 
 | ||||
| 	/* Maximum size of the MTA register table in all supported adapters */ | ||||
| #define MAX_MTA_REG 128 | ||||
| 	u32 mta_shadow[MAX_MTA_REG]; | ||||
| 	u16 rar_entry_count; | ||||
| 
 | ||||
| 	u8 forced_speed_duplex; | ||||
| 
 | ||||
| 	bool adaptive_ifs; | ||||
| 	bool has_fwsm; | ||||
| 	bool arc_subsystem_valid; | ||||
| 	bool autoneg; | ||||
| 	bool autoneg_failed; | ||||
| 	bool get_link_status; | ||||
| 	bool in_ifs_mode; | ||||
| 	bool serdes_has_link; | ||||
| 	bool tx_pkt_filtering; | ||||
| 	enum e1000_serdes_link_state serdes_link_state; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_phy_info { | ||||
| 	struct e1000_phy_operations ops; | ||||
| 
 | ||||
| 	enum e1000_phy_type type; | ||||
| 
 | ||||
| 	enum e1000_1000t_rx_status local_rx; | ||||
| 	enum e1000_1000t_rx_status remote_rx; | ||||
| 	enum e1000_ms_type ms_type; | ||||
| 	enum e1000_ms_type original_ms_type; | ||||
| 	enum e1000_rev_polarity cable_polarity; | ||||
| 	enum e1000_smart_speed smart_speed; | ||||
| 
 | ||||
| 	u32 addr; | ||||
| 	u32 id; | ||||
| 	u32 reset_delay_us;	/* in usec */ | ||||
| 	u32 revision; | ||||
| 
 | ||||
| 	enum e1000_media_type media_type; | ||||
| 
 | ||||
| 	u16 autoneg_advertised; | ||||
| 	u16 autoneg_mask; | ||||
| 	u16 cable_length; | ||||
| 	u16 max_cable_length; | ||||
| 	u16 min_cable_length; | ||||
| 
 | ||||
| 	u8 mdix; | ||||
| 
 | ||||
| 	bool disable_polarity_correction; | ||||
| 	bool is_mdix; | ||||
| 	bool polarity_correction; | ||||
| 	bool speed_downgraded; | ||||
| 	bool autoneg_wait_to_complete; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_nvm_info { | ||||
| 	struct e1000_nvm_operations ops; | ||||
| 
 | ||||
| 	enum e1000_nvm_type type; | ||||
| 	enum e1000_nvm_override override; | ||||
| 
 | ||||
| 	u32 flash_bank_size; | ||||
| 	u32 flash_base_addr; | ||||
| 
 | ||||
| 	u16 word_size; | ||||
| 	u16 delay_usec; | ||||
| 	u16 address_bits; | ||||
| 	u16 opcode_bits; | ||||
| 	u16 page_size; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_bus_info { | ||||
| 	enum e1000_bus_width width; | ||||
| 
 | ||||
| 	u16 func; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_fc_info { | ||||
| 	u32 high_water;          /* Flow control high-water mark */ | ||||
| 	u32 low_water;           /* Flow control low-water mark */ | ||||
| 	u16 pause_time;          /* Flow control pause timer */ | ||||
| 	u16 refresh_time;        /* Flow control refresh timer */ | ||||
| 	bool send_xon;           /* Flow control send XON */ | ||||
| 	bool strict_ieee;        /* Strict IEEE mode */ | ||||
| 	enum e1000_fc_mode current_mode; /* FC mode in effect */ | ||||
| 	enum e1000_fc_mode requested_mode; /* FC mode requested by caller */ | ||||
| }; | ||||
| 
 | ||||
| struct e1000_dev_spec_82571 { | ||||
| 	bool laa_is_present; | ||||
| 	u32 smb_counter; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_dev_spec_80003es2lan { | ||||
| 	bool mdic_wa_enable; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_shadow_ram { | ||||
| 	u16 value; | ||||
| 	bool modified; | ||||
| }; | ||||
| 
 | ||||
| #define E1000_ICH8_SHADOW_RAM_WORDS		2048 | ||||
| 
 | ||||
| /* I218 PHY Ultra Low Power (ULP) states */ | ||||
| enum e1000_ulp_state { | ||||
| 	e1000_ulp_state_unknown, | ||||
| 	e1000_ulp_state_off, | ||||
| 	e1000_ulp_state_on, | ||||
| }; | ||||
| 
 | ||||
| struct e1000_dev_spec_ich8lan { | ||||
| 	bool kmrn_lock_loss_workaround_enabled; | ||||
| 	struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS]; | ||||
| 	bool nvm_k1_enabled; | ||||
| 	bool eee_disable; | ||||
| 	u16 eee_lp_ability; | ||||
| 	enum e1000_ulp_state ulp_state; | ||||
| }; | ||||
| 
 | ||||
| struct e1000_hw { | ||||
| 	struct e1000_adapter *adapter; | ||||
| 
 | ||||
| 	void __iomem *hw_addr; | ||||
| 	void __iomem *flash_address; | ||||
| 
 | ||||
| 	struct e1000_mac_info mac; | ||||
| 	struct e1000_fc_info fc; | ||||
| 	struct e1000_phy_info phy; | ||||
| 	struct e1000_nvm_info nvm; | ||||
| 	struct e1000_bus_info bus; | ||||
| 	struct e1000_host_mng_dhcp_cookie mng_cookie; | ||||
| 
 | ||||
| 	union { | ||||
| 		struct e1000_dev_spec_82571 e82571; | ||||
| 		struct e1000_dev_spec_80003es2lan e80003es2lan; | ||||
| 		struct e1000_dev_spec_ich8lan ich8lan; | ||||
| 	} dev_spec; | ||||
| }; | ||||
| 
 | ||||
| #include "82571.h" | ||||
| #include "80003es2lan.h" | ||||
| #include "ich8lan.h" | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										5168
									
								
								drivers/net/ethernet/intel/e1000e/ich8lan.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5168
									
								
								drivers/net/ethernet/intel/e1000e/ich8lan.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										294
									
								
								drivers/net/ethernet/intel/e1000e/ich8lan.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										294
									
								
								drivers/net/ethernet/intel/e1000e/ich8lan.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,294 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_ICH8LAN_H_ | ||||
| #define _E1000E_ICH8LAN_H_ | ||||
| 
 | ||||
| #define ICH_FLASH_GFPREG		0x0000 | ||||
| #define ICH_FLASH_HSFSTS		0x0004 | ||||
| #define ICH_FLASH_HSFCTL		0x0006 | ||||
| #define ICH_FLASH_FADDR			0x0008 | ||||
| #define ICH_FLASH_FDATA0		0x0010 | ||||
| #define ICH_FLASH_PR0			0x0074 | ||||
| 
 | ||||
| /* Requires up to 10 seconds when MNG might be accessing part. */ | ||||
| #define ICH_FLASH_READ_COMMAND_TIMEOUT	10000000 | ||||
| #define ICH_FLASH_WRITE_COMMAND_TIMEOUT	10000000 | ||||
| #define ICH_FLASH_ERASE_COMMAND_TIMEOUT	10000000 | ||||
| #define ICH_FLASH_LINEAR_ADDR_MASK	0x00FFFFFF | ||||
| #define ICH_FLASH_CYCLE_REPEAT_COUNT	10 | ||||
| 
 | ||||
| #define ICH_CYCLE_READ			0 | ||||
| #define ICH_CYCLE_WRITE			2 | ||||
| #define ICH_CYCLE_ERASE			3 | ||||
| 
 | ||||
| #define FLASH_GFPREG_BASE_MASK		0x1FFF | ||||
| #define FLASH_SECTOR_ADDR_SHIFT		12 | ||||
| 
 | ||||
| #define ICH_FLASH_SEG_SIZE_256		256 | ||||
| #define ICH_FLASH_SEG_SIZE_4K		4096 | ||||
| #define ICH_FLASH_SEG_SIZE_8K		8192 | ||||
| #define ICH_FLASH_SEG_SIZE_64K		65536 | ||||
| 
 | ||||
| #define E1000_ICH_FWSM_RSPCIPHY	0x00000040	/* Reset PHY on PCI Reset */ | ||||
| /* FW established a valid mode */ | ||||
| #define E1000_ICH_FWSM_FW_VALID	0x00008000 | ||||
| #define E1000_ICH_FWSM_PCIM2PCI	0x01000000	/* ME PCIm-to-PCI active */ | ||||
| #define E1000_ICH_FWSM_PCIM2PCI_COUNT	2000 | ||||
| 
 | ||||
| #define E1000_ICH_MNG_IAMT_MODE		0x2 | ||||
| 
 | ||||
| #define E1000_FWSM_WLOCK_MAC_MASK	0x0380 | ||||
| #define E1000_FWSM_WLOCK_MAC_SHIFT	7 | ||||
| #define E1000_FWSM_ULP_CFG_DONE		0x00000400	/* Low power cfg done */ | ||||
| 
 | ||||
| /* Shared Receive Address Registers */ | ||||
| #define E1000_SHRAL_PCH_LPT(_i)		(0x05408 + ((_i) * 8)) | ||||
| #define E1000_SHRAH_PCH_LPT(_i)		(0x0540C + ((_i) * 8)) | ||||
| 
 | ||||
| #define E1000_H2ME		0x05B50	/* Host to ME */ | ||||
| #define E1000_H2ME_ULP		0x00000800	/* ULP Indication Bit */ | ||||
| #define E1000_H2ME_ENFORCE_SETTINGS	0x00001000	/* Enforce Settings */ | ||||
| 
 | ||||
| #define ID_LED_DEFAULT_ICH8LAN	((ID_LED_DEF1_DEF2 << 12) | \ | ||||
| 				 (ID_LED_OFF1_OFF2 <<  8) | \ | ||||
| 				 (ID_LED_OFF1_ON2  <<  4) | \ | ||||
| 				 (ID_LED_DEF1_DEF2)) | ||||
| 
 | ||||
| #define E1000_ICH_NVM_SIG_WORD		0x13 | ||||
| #define E1000_ICH_NVM_SIG_MASK		0xC000 | ||||
| #define E1000_ICH_NVM_VALID_SIG_MASK	0xC0 | ||||
| #define E1000_ICH_NVM_SIG_VALUE		0x80 | ||||
| 
 | ||||
| #define E1000_ICH8_LAN_INIT_TIMEOUT	1500 | ||||
| 
 | ||||
| /* FEXT register bit definition */ | ||||
| #define E1000_FEXT_PHY_CABLE_DISCONNECTED	0x00000004 | ||||
| 
 | ||||
| #define E1000_FEXTNVM_SW_CONFIG		1 | ||||
| #define E1000_FEXTNVM_SW_CONFIG_ICH8M	(1 << 27)	/* different on ICH8M */ | ||||
| 
 | ||||
| #define E1000_FEXTNVM3_PHY_CFG_COUNTER_MASK	0x0C000000 | ||||
| #define E1000_FEXTNVM3_PHY_CFG_COUNTER_50MSEC	0x08000000 | ||||
| 
 | ||||
| #define E1000_FEXTNVM4_BEACON_DURATION_MASK	0x7 | ||||
| #define E1000_FEXTNVM4_BEACON_DURATION_8USEC	0x7 | ||||
| #define E1000_FEXTNVM4_BEACON_DURATION_16USEC	0x3 | ||||
| 
 | ||||
| #define E1000_FEXTNVM6_REQ_PLL_CLK	0x00000100 | ||||
| #define E1000_FEXTNVM6_ENABLE_K1_ENTRY_CONDITION	0x00000200 | ||||
| 
 | ||||
| #define E1000_FEXTNVM7_DISABLE_SMB_PERST	0x00000020 | ||||
| 
 | ||||
| #define PCIE_ICH8_SNOOP_ALL	PCIE_NO_SNOOP_ALL | ||||
| 
 | ||||
| #define E1000_ICH_RAR_ENTRIES	7 | ||||
| #define E1000_PCH2_RAR_ENTRIES	5	/* RAR[0], SHRA[0-3] */ | ||||
| #define E1000_PCH_LPT_RAR_ENTRIES	12	/* RAR[0], SHRA[0-10] */ | ||||
| 
 | ||||
| #define PHY_PAGE_SHIFT		5 | ||||
| #define PHY_REG(page, reg)	(((page) << PHY_PAGE_SHIFT) | \ | ||||
| 				 ((reg) & MAX_PHY_REG_ADDRESS)) | ||||
| #define IGP3_KMRN_DIAG	PHY_REG(770, 19)	/* KMRN Diagnostic */ | ||||
| #define IGP3_VR_CTRL	PHY_REG(776, 18)	/* Voltage Regulator Control */ | ||||
| 
 | ||||
| #define IGP3_KMRN_DIAG_PCS_LOCK_LOSS		0x0002 | ||||
| #define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK	0x0300 | ||||
| #define IGP3_VR_CTRL_MODE_SHUTDOWN		0x0200 | ||||
| 
 | ||||
| /* PHY Wakeup Registers and defines */ | ||||
| #define BM_PORT_GEN_CFG		PHY_REG(BM_PORT_CTRL_PAGE, 17) | ||||
| #define BM_RCTL			PHY_REG(BM_WUC_PAGE, 0) | ||||
| #define BM_WUC			PHY_REG(BM_WUC_PAGE, 1) | ||||
| #define BM_WUFC			PHY_REG(BM_WUC_PAGE, 2) | ||||
| #define BM_WUS			PHY_REG(BM_WUC_PAGE, 3) | ||||
| #define BM_RAR_L(_i)		(BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2))) | ||||
| #define BM_RAR_M(_i)		(BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2))) | ||||
| #define BM_RAR_H(_i)		(BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2))) | ||||
| #define BM_RAR_CTRL(_i)		(BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2))) | ||||
| #define BM_MTA(_i)		(BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1))) | ||||
| 
 | ||||
| #define BM_RCTL_UPE		0x0001	/* Unicast Promiscuous Mode */ | ||||
| #define BM_RCTL_MPE		0x0002	/* Multicast Promiscuous Mode */ | ||||
| #define BM_RCTL_MO_SHIFT	3	/* Multicast Offset Shift */ | ||||
| #define BM_RCTL_MO_MASK		(3 << 3)	/* Multicast Offset Mask */ | ||||
| #define BM_RCTL_BAM		0x0020	/* Broadcast Accept Mode */ | ||||
| #define BM_RCTL_PMCF		0x0040	/* Pass MAC Control Frames */ | ||||
| #define BM_RCTL_RFCE		0x0080	/* Rx Flow Control Enable */ | ||||
| 
 | ||||
| #define HV_LED_CONFIG		PHY_REG(768, 30)	/* LED Configuration */ | ||||
| #define HV_MUX_DATA_CTRL	PHY_REG(776, 16) | ||||
| #define HV_MUX_DATA_CTRL_GEN_TO_MAC	0x0400 | ||||
| #define HV_MUX_DATA_CTRL_FORCE_SPEED	0x0004 | ||||
| #define HV_STATS_PAGE	778 | ||||
| /* Half-duplex collision counts */ | ||||
| #define HV_SCC_UPPER	PHY_REG(HV_STATS_PAGE, 16)	/* Single Collision */ | ||||
| #define HV_SCC_LOWER	PHY_REG(HV_STATS_PAGE, 17) | ||||
| #define HV_ECOL_UPPER	PHY_REG(HV_STATS_PAGE, 18)	/* Excessive Coll. */ | ||||
| #define HV_ECOL_LOWER	PHY_REG(HV_STATS_PAGE, 19) | ||||
| #define HV_MCC_UPPER	PHY_REG(HV_STATS_PAGE, 20)	/* Multiple Collision */ | ||||
| #define HV_MCC_LOWER	PHY_REG(HV_STATS_PAGE, 21) | ||||
| #define HV_LATECOL_UPPER PHY_REG(HV_STATS_PAGE, 23)	/* Late Collision */ | ||||
| #define HV_LATECOL_LOWER PHY_REG(HV_STATS_PAGE, 24) | ||||
| #define HV_COLC_UPPER	PHY_REG(HV_STATS_PAGE, 25)	/* Collision */ | ||||
| #define HV_COLC_LOWER	PHY_REG(HV_STATS_PAGE, 26) | ||||
| #define HV_DC_UPPER	PHY_REG(HV_STATS_PAGE, 27)	/* Defer Count */ | ||||
| #define HV_DC_LOWER	PHY_REG(HV_STATS_PAGE, 28) | ||||
| #define HV_TNCRS_UPPER	PHY_REG(HV_STATS_PAGE, 29)	/* Tx with no CRS */ | ||||
| #define HV_TNCRS_LOWER	PHY_REG(HV_STATS_PAGE, 30) | ||||
| 
 | ||||
| #define E1000_FCRTV_PCH	0x05F40	/* PCH Flow Control Refresh Timer Value */ | ||||
| 
 | ||||
| #define E1000_NVM_K1_CONFIG	0x1B	/* NVM K1 Config Word */ | ||||
| #define E1000_NVM_K1_ENABLE	0x1	/* NVM Enable K1 bit */ | ||||
| 
 | ||||
| /* SMBus Control Phy Register */ | ||||
| #define CV_SMB_CTRL		PHY_REG(769, 23) | ||||
| #define CV_SMB_CTRL_FORCE_SMBUS	0x0001 | ||||
| 
 | ||||
| /* I218 Ultra Low Power Configuration 1 Register */ | ||||
| #define I218_ULP_CONFIG1		PHY_REG(779, 16) | ||||
| #define I218_ULP_CONFIG1_START		0x0001	/* Start auto ULP config */ | ||||
| #define I218_ULP_CONFIG1_IND		0x0004	/* Pwr up from ULP indication */ | ||||
| #define I218_ULP_CONFIG1_STICKY_ULP	0x0010	/* Set sticky ULP mode */ | ||||
| #define I218_ULP_CONFIG1_INBAND_EXIT	0x0020	/* Inband on ULP exit */ | ||||
| #define I218_ULP_CONFIG1_WOL_HOST	0x0040	/* WoL Host on ULP exit */ | ||||
| #define I218_ULP_CONFIG1_RESET_TO_SMBUS	0x0100	/* Reset to SMBus mode */ | ||||
| #define I218_ULP_CONFIG1_DISABLE_SMB_PERST	0x1000	/* Disable on PERST# */ | ||||
| 
 | ||||
| /* SMBus Address Phy Register */ | ||||
| #define HV_SMB_ADDR		PHY_REG(768, 26) | ||||
| #define HV_SMB_ADDR_MASK	0x007F | ||||
| #define HV_SMB_ADDR_PEC_EN	0x0200 | ||||
| #define HV_SMB_ADDR_VALID	0x0080 | ||||
| #define HV_SMB_ADDR_FREQ_MASK		0x1100 | ||||
| #define HV_SMB_ADDR_FREQ_LOW_SHIFT	8 | ||||
| #define HV_SMB_ADDR_FREQ_HIGH_SHIFT	12 | ||||
| 
 | ||||
| /* Strapping Option Register - RO */ | ||||
| #define E1000_STRAP			0x0000C | ||||
| #define E1000_STRAP_SMBUS_ADDRESS_MASK	0x00FE0000 | ||||
| #define E1000_STRAP_SMBUS_ADDRESS_SHIFT	17 | ||||
| #define E1000_STRAP_SMT_FREQ_MASK	0x00003000 | ||||
| #define E1000_STRAP_SMT_FREQ_SHIFT	12 | ||||
| 
 | ||||
| /* OEM Bits Phy Register */ | ||||
| #define HV_OEM_BITS		PHY_REG(768, 25) | ||||
| #define HV_OEM_BITS_LPLU	0x0004	/* Low Power Link Up */ | ||||
| #define HV_OEM_BITS_GBE_DIS	0x0040	/* Gigabit Disable */ | ||||
| #define HV_OEM_BITS_RESTART_AN	0x0400	/* Restart Auto-negotiation */ | ||||
| 
 | ||||
| /* KMRN Mode Control */ | ||||
| #define HV_KMRN_MODE_CTRL	PHY_REG(769, 16) | ||||
| #define HV_KMRN_MDIO_SLOW	0x0400 | ||||
| 
 | ||||
| /* KMRN FIFO Control and Status */ | ||||
| #define HV_KMRN_FIFO_CTRLSTA			PHY_REG(770, 16) | ||||
| #define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_MASK	0x7000 | ||||
| #define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT	12 | ||||
| 
 | ||||
| /* PHY Power Management Control */ | ||||
| #define HV_PM_CTRL		PHY_REG(770, 17) | ||||
| #define HV_PM_CTRL_PLL_STOP_IN_K1_GIGA	0x100 | ||||
| #define HV_PM_CTRL_K1_ENABLE		0x4000 | ||||
| 
 | ||||
| #define SW_FLAG_TIMEOUT		1000	/* SW Semaphore flag timeout in ms */ | ||||
| 
 | ||||
| /* Inband Control */ | ||||
| #define I217_INBAND_CTRL				PHY_REG(770, 18) | ||||
| #define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK	0x3F00 | ||||
| #define I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT	8 | ||||
| 
 | ||||
| /* Low Power Idle GPIO Control */ | ||||
| #define I217_LPI_GPIO_CTRL			PHY_REG(772, 18) | ||||
| #define I217_LPI_GPIO_CTRL_AUTO_EN_LPI		0x0800 | ||||
| 
 | ||||
| /* PHY Low Power Idle Control */ | ||||
| #define I82579_LPI_CTRL				PHY_REG(772, 20) | ||||
| #define I82579_LPI_CTRL_100_ENABLE		0x2000 | ||||
| #define I82579_LPI_CTRL_1000_ENABLE		0x4000 | ||||
| #define I82579_LPI_CTRL_ENABLE_MASK		0x6000 | ||||
| #define I82579_LPI_CTRL_FORCE_PLL_LOCK_COUNT	0x80 | ||||
| 
 | ||||
| /* Extended Management Interface (EMI) Registers */ | ||||
| #define I82579_EMI_ADDR		0x10 | ||||
| #define I82579_EMI_DATA		0x11 | ||||
| #define I82579_LPI_UPDATE_TIMER	0x4805	/* in 40ns units + 40 ns base value */ | ||||
| #define I82579_MSE_THRESHOLD	0x084F	/* 82579 Mean Square Error Threshold */ | ||||
| #define I82577_MSE_THRESHOLD	0x0887	/* 82577 Mean Square Error Threshold */ | ||||
| #define I82579_MSE_LINK_DOWN	0x2411	/* MSE count before dropping link */ | ||||
| #define I82579_RX_CONFIG		0x3412	/* Receive configuration */ | ||||
| #define I82579_LPI_PLL_SHUT		0x4412	/* LPI PLL Shut Enable */ | ||||
| #define I82579_EEE_PCS_STATUS		0x182E	/* IEEE MMD Register 3.1 >> 8 */ | ||||
| #define I82579_EEE_CAPABILITY		0x0410	/* IEEE MMD Register 3.20 */ | ||||
| #define I82579_EEE_ADVERTISEMENT	0x040E	/* IEEE MMD Register 7.60 */ | ||||
| #define I82579_EEE_LP_ABILITY		0x040F	/* IEEE MMD Register 7.61 */ | ||||
| #define I82579_EEE_100_SUPPORTED	(1 << 1)	/* 100BaseTx EEE */ | ||||
| #define I82579_EEE_1000_SUPPORTED	(1 << 2)	/* 1000BaseTx EEE */ | ||||
| #define I82579_LPI_100_PLL_SHUT	(1 << 2)	/* 100M LPI PLL Shut Enabled */ | ||||
| #define I217_EEE_PCS_STATUS	0x9401	/* IEEE MMD Register 3.1 */ | ||||
| #define I217_EEE_CAPABILITY	0x8000	/* IEEE MMD Register 3.20 */ | ||||
| #define I217_EEE_ADVERTISEMENT	0x8001	/* IEEE MMD Register 7.60 */ | ||||
| #define I217_EEE_LP_ABILITY	0x8002	/* IEEE MMD Register 7.61 */ | ||||
| #define I217_RX_CONFIG		0xB20C	/* Receive configuration */ | ||||
| 
 | ||||
| #define E1000_EEE_RX_LPI_RCVD	0x0400	/* Tx LP idle received */ | ||||
| #define E1000_EEE_TX_LPI_RCVD	0x0800	/* Rx LP idle received */ | ||||
| 
 | ||||
| /* Intel Rapid Start Technology Support */ | ||||
| #define I217_PROXY_CTRL		BM_PHY_REG(BM_WUC_PAGE, 70) | ||||
| #define I217_PROXY_CTRL_AUTO_DISABLE	0x0080 | ||||
| #define I217_SxCTRL			PHY_REG(BM_PORT_CTRL_PAGE, 28) | ||||
| #define I217_SxCTRL_ENABLE_LPI_RESET	0x1000 | ||||
| #define I217_CGFREG			PHY_REG(772, 29) | ||||
| #define I217_CGFREG_ENABLE_MTA_RESET	0x0002 | ||||
| #define I217_MEMPWR			PHY_REG(772, 26) | ||||
| #define I217_MEMPWR_DISABLE_SMB_RELEASE	0x0010 | ||||
| 
 | ||||
| /* Receive Address Initial CRC Calculation */ | ||||
| #define E1000_PCH_RAICC(_n)	(0x05F50 + ((_n) * 4)) | ||||
| 
 | ||||
| /* Latency Tolerance Reporting */ | ||||
| #define E1000_LTRV			0x000F8 | ||||
| #define E1000_LTRV_SCALE_MAX		5 | ||||
| #define E1000_LTRV_SCALE_FACTOR		5 | ||||
| #define E1000_LTRV_REQ_SHIFT		15 | ||||
| #define E1000_LTRV_NOSNOOP_SHIFT	16 | ||||
| #define E1000_LTRV_SEND			(1 << 30) | ||||
| 
 | ||||
| /* Proprietary Latency Tolerance Reporting PCI Capability */ | ||||
| #define E1000_PCI_LTR_CAP_LPT		0xA8 | ||||
| 
 | ||||
| void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw); | ||||
| void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, | ||||
| 						  bool state); | ||||
| void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); | ||||
| void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); | ||||
| void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw); | ||||
| void e1000_resume_workarounds_pchlan(struct e1000_hw *hw); | ||||
| s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable); | ||||
| void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw); | ||||
| s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable); | ||||
| s32 e1000_read_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 *data); | ||||
| s32 e1000_write_emi_reg_locked(struct e1000_hw *hw, u16 addr, u16 data); | ||||
| s32 e1000_set_eee_pchlan(struct e1000_hw *hw); | ||||
| s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx); | ||||
| #endif /* _E1000E_ICH8LAN_H_ */ | ||||
							
								
								
									
										1800
									
								
								drivers/net/ethernet/intel/e1000e/mac.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1800
									
								
								drivers/net/ethernet/intel/e1000e/mac.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										68
									
								
								drivers/net/ethernet/intel/e1000e/mac.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								drivers/net/ethernet/intel/e1000e/mac.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,68 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_MAC_H_ | ||||
| #define _E1000E_MAC_H_ | ||||
| 
 | ||||
| s32 e1000e_blink_led_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_check_for_copper_link(struct e1000_hw *hw); | ||||
| s32 e1000e_check_for_fiber_link(struct e1000_hw *hw); | ||||
| s32 e1000e_check_for_serdes_link(struct e1000_hw *hw); | ||||
| s32 e1000e_cleanup_led_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw); | ||||
| s32 e1000e_disable_pcie_master(struct e1000_hw *hw); | ||||
| s32 e1000e_force_mac_fc(struct e1000_hw *hw); | ||||
| s32 e1000e_get_auto_rd_done(struct e1000_hw *hw); | ||||
| s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw); | ||||
| void e1000_set_lan_id_single_port(struct e1000_hw *hw); | ||||
| s32 e1000e_get_hw_semaphore(struct e1000_hw *hw); | ||||
| s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, | ||||
| 				       u16 *duplex); | ||||
| s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, | ||||
| 					     u16 *speed, u16 *duplex); | ||||
| s32 e1000e_id_led_init_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_led_on_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_led_off_generic(struct e1000_hw *hw); | ||||
| void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw, | ||||
| 					u8 *mc_addr_list, u32 mc_addr_count); | ||||
| s32 e1000e_set_fc_watermarks(struct e1000_hw *hw); | ||||
| s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw); | ||||
| s32 e1000e_setup_led_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_setup_link_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_validate_mdi_setting_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_validate_mdi_setting_crossover_generic(struct e1000_hw *hw); | ||||
| 
 | ||||
| void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw); | ||||
| void e1000_clear_vfta_generic(struct e1000_hw *hw); | ||||
| void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count); | ||||
| void e1000e_put_hw_semaphore(struct e1000_hw *hw); | ||||
| s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw); | ||||
| void e1000e_reset_adaptive(struct e1000_hw *hw); | ||||
| void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop); | ||||
| void e1000e_update_adaptive(struct e1000_hw *hw); | ||||
| void e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value); | ||||
| 
 | ||||
| void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); | ||||
| u32 e1000e_rar_get_count_generic(struct e1000_hw *hw); | ||||
| int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index); | ||||
| void e1000e_config_collision_dist_generic(struct e1000_hw *hw); | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										347
									
								
								drivers/net/ethernet/intel/e1000e/manage.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										347
									
								
								drivers/net/ethernet/intel/e1000e/manage.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,347 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #include "e1000.h" | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_calculate_checksum - Calculate checksum for buffer | ||||
|  *  @buffer: pointer to EEPROM | ||||
|  *  @length: size of EEPROM to calculate a checksum for | ||||
|  * | ||||
|  *  Calculates the checksum for some buffer on a specified length.  The | ||||
|  *  checksum calculated is returned. | ||||
|  **/ | ||||
| static u8 e1000_calculate_checksum(u8 *buffer, u32 length) | ||||
| { | ||||
| 	u32 i; | ||||
| 	u8 sum = 0; | ||||
| 
 | ||||
| 	if (!buffer) | ||||
| 		return 0; | ||||
| 
 | ||||
| 	for (i = 0; i < length; i++) | ||||
| 		sum += buffer[i]; | ||||
| 
 | ||||
| 	return (u8)(0 - sum); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_mng_enable_host_if - Checks host interface is enabled | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Returns 0 upon success, else -E1000_ERR_HOST_INTERFACE_COMMAND | ||||
|  * | ||||
|  *  This function checks whether the HOST IF is enabled for command operation | ||||
|  *  and also checks whether the previous command is completed.  It busy waits | ||||
|  *  in case of previous command is not completed. | ||||
|  **/ | ||||
| static s32 e1000_mng_enable_host_if(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 hicr; | ||||
| 	u8 i; | ||||
| 
 | ||||
| 	if (!hw->mac.arc_subsystem_valid) { | ||||
| 		e_dbg("ARC subsystem not valid.\n"); | ||||
| 		return -E1000_ERR_HOST_INTERFACE_COMMAND; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Check that the host interface is enabled. */ | ||||
| 	hicr = er32(HICR); | ||||
| 	if (!(hicr & E1000_HICR_EN)) { | ||||
| 		e_dbg("E1000_HOST_EN bit disabled.\n"); | ||||
| 		return -E1000_ERR_HOST_INTERFACE_COMMAND; | ||||
| 	} | ||||
| 	/* check the previous command is completed */ | ||||
| 	for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) { | ||||
| 		hicr = er32(HICR); | ||||
| 		if (!(hicr & E1000_HICR_C)) | ||||
| 			break; | ||||
| 		mdelay(1); | ||||
| 	} | ||||
| 
 | ||||
| 	if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) { | ||||
| 		e_dbg("Previous command timeout failed.\n"); | ||||
| 		return -E1000_ERR_HOST_INTERFACE_COMMAND; | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_check_mng_mode_generic - Generic check management mode | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Reads the firmware semaphore register and returns true (>0) if | ||||
|  *  manageability is enabled, else false (0). | ||||
|  **/ | ||||
| bool e1000e_check_mng_mode_generic(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 fwsm = er32(FWSM); | ||||
| 
 | ||||
| 	return (fwsm & E1000_FWSM_MODE_MASK) == | ||||
| 	    (E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_enable_tx_pkt_filtering - Enable packet filtering on Tx | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Enables packet filtering on transmit packets if manageability is enabled | ||||
|  *  and host interface is enabled. | ||||
|  **/ | ||||
| bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw) | ||||
| { | ||||
| 	struct e1000_host_mng_dhcp_cookie *hdr = &hw->mng_cookie; | ||||
| 	u32 *buffer = (u32 *)&hw->mng_cookie; | ||||
| 	u32 offset; | ||||
| 	s32 ret_val, hdr_csum, csum; | ||||
| 	u8 i, len; | ||||
| 
 | ||||
| 	hw->mac.tx_pkt_filtering = true; | ||||
| 
 | ||||
| 	/* No manageability, no filtering */ | ||||
| 	if (!hw->mac.ops.check_mng_mode(hw)) { | ||||
| 		hw->mac.tx_pkt_filtering = false; | ||||
| 		return hw->mac.tx_pkt_filtering; | ||||
| 	} | ||||
| 
 | ||||
| 	/* If we can't read from the host interface for whatever
 | ||||
| 	 * reason, disable filtering. | ||||
| 	 */ | ||||
| 	ret_val = e1000_mng_enable_host_if(hw); | ||||
| 	if (ret_val) { | ||||
| 		hw->mac.tx_pkt_filtering = false; | ||||
| 		return hw->mac.tx_pkt_filtering; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Read in the header.  Length and offset are in dwords. */ | ||||
| 	len = E1000_MNG_DHCP_COOKIE_LENGTH >> 2; | ||||
| 	offset = E1000_MNG_DHCP_COOKIE_OFFSET >> 2; | ||||
| 	for (i = 0; i < len; i++) | ||||
| 		*(buffer + i) = E1000_READ_REG_ARRAY(hw, E1000_HOST_IF, | ||||
| 						     offset + i); | ||||
| 	hdr_csum = hdr->checksum; | ||||
| 	hdr->checksum = 0; | ||||
| 	csum = e1000_calculate_checksum((u8 *)hdr, | ||||
| 					E1000_MNG_DHCP_COOKIE_LENGTH); | ||||
| 	/* If either the checksums or signature don't match, then
 | ||||
| 	 * the cookie area isn't considered valid, in which case we | ||||
| 	 * take the safe route of assuming Tx filtering is enabled. | ||||
| 	 */ | ||||
| 	if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) { | ||||
| 		hw->mac.tx_pkt_filtering = true; | ||||
| 		return hw->mac.tx_pkt_filtering; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Cookie area is valid, make the final check for filtering. */ | ||||
| 	if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) | ||||
| 		hw->mac.tx_pkt_filtering = false; | ||||
| 
 | ||||
| 	return hw->mac.tx_pkt_filtering; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_mng_write_cmd_header - Writes manageability command header | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @hdr: pointer to the host interface command header | ||||
|  * | ||||
|  *  Writes the command header after does the checksum calculation. | ||||
|  **/ | ||||
| static s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, | ||||
| 				      struct e1000_host_mng_command_header *hdr) | ||||
| { | ||||
| 	u16 i, length = sizeof(struct e1000_host_mng_command_header); | ||||
| 
 | ||||
| 	/* Write the whole command header structure with new checksum. */ | ||||
| 
 | ||||
| 	hdr->checksum = e1000_calculate_checksum((u8 *)hdr, length); | ||||
| 
 | ||||
| 	length >>= 2; | ||||
| 	/* Write the relevant command block into the ram area. */ | ||||
| 	for (i = 0; i < length; i++) { | ||||
| 		E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, i, *((u32 *)hdr + i)); | ||||
| 		e1e_flush(); | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_mng_host_if_write - Write to the manageability host interface | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @buffer: pointer to the host interface buffer | ||||
|  *  @length: size of the buffer | ||||
|  *  @offset: location in the buffer to write to | ||||
|  *  @sum: sum of the data (not checksum) | ||||
|  * | ||||
|  *  This function writes the buffer content at the offset given on the host if. | ||||
|  *  It also does alignment considerations to do the writes in most efficient | ||||
|  *  way.  Also fills up the sum of the buffer in *buffer parameter. | ||||
|  **/ | ||||
| static s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, | ||||
| 				   u16 length, u16 offset, u8 *sum) | ||||
| { | ||||
| 	u8 *tmp; | ||||
| 	u8 *bufptr = buffer; | ||||
| 	u32 data = 0; | ||||
| 	u16 remaining, i, j, prev_bytes; | ||||
| 
 | ||||
| 	/* sum = only sum of the data and it is not checksum */ | ||||
| 
 | ||||
| 	if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) | ||||
| 		return -E1000_ERR_PARAM; | ||||
| 
 | ||||
| 	tmp = (u8 *)&data; | ||||
| 	prev_bytes = offset & 0x3; | ||||
| 	offset >>= 2; | ||||
| 
 | ||||
| 	if (prev_bytes) { | ||||
| 		data = E1000_READ_REG_ARRAY(hw, E1000_HOST_IF, offset); | ||||
| 		for (j = prev_bytes; j < sizeof(u32); j++) { | ||||
| 			*(tmp + j) = *bufptr++; | ||||
| 			*sum += *(tmp + j); | ||||
| 		} | ||||
| 		E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, offset, data); | ||||
| 		length -= j - prev_bytes; | ||||
| 		offset++; | ||||
| 	} | ||||
| 
 | ||||
| 	remaining = length & 0x3; | ||||
| 	length -= remaining; | ||||
| 
 | ||||
| 	/* Calculate length in DWORDs */ | ||||
| 	length >>= 2; | ||||
| 
 | ||||
| 	/* The device driver writes the relevant command block into the
 | ||||
| 	 * ram area. | ||||
| 	 */ | ||||
| 	for (i = 0; i < length; i++) { | ||||
| 		for (j = 0; j < sizeof(u32); j++) { | ||||
| 			*(tmp + j) = *bufptr++; | ||||
| 			*sum += *(tmp + j); | ||||
| 		} | ||||
| 
 | ||||
| 		E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, offset + i, data); | ||||
| 	} | ||||
| 	if (remaining) { | ||||
| 		for (j = 0; j < sizeof(u32); j++) { | ||||
| 			if (j < remaining) | ||||
| 				*(tmp + j) = *bufptr++; | ||||
| 			else | ||||
| 				*(tmp + j) = 0; | ||||
| 
 | ||||
| 			*sum += *(tmp + j); | ||||
| 		} | ||||
| 		E1000_WRITE_REG_ARRAY(hw, E1000_HOST_IF, offset + i, data); | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_mng_write_dhcp_info - Writes DHCP info to host interface | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @buffer: pointer to the host interface | ||||
|  *  @length: size of the buffer | ||||
|  * | ||||
|  *  Writes the DHCP information to the host interface. | ||||
|  **/ | ||||
| s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length) | ||||
| { | ||||
| 	struct e1000_host_mng_command_header hdr; | ||||
| 	s32 ret_val; | ||||
| 	u32 hicr; | ||||
| 
 | ||||
| 	hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD; | ||||
| 	hdr.command_length = length; | ||||
| 	hdr.reserved1 = 0; | ||||
| 	hdr.reserved2 = 0; | ||||
| 	hdr.checksum = 0; | ||||
| 
 | ||||
| 	/* Enable the host interface */ | ||||
| 	ret_val = e1000_mng_enable_host_if(hw); | ||||
| 	if (ret_val) | ||||
| 		return ret_val; | ||||
| 
 | ||||
| 	/* Populate the host interface with the contents of "buffer". */ | ||||
| 	ret_val = e1000_mng_host_if_write(hw, buffer, length, | ||||
| 					  sizeof(hdr), &(hdr.checksum)); | ||||
| 	if (ret_val) | ||||
| 		return ret_val; | ||||
| 
 | ||||
| 	/* Write the manageability command header */ | ||||
| 	ret_val = e1000_mng_write_cmd_header(hw, &hdr); | ||||
| 	if (ret_val) | ||||
| 		return ret_val; | ||||
| 
 | ||||
| 	/* Tell the ARC a new command is pending. */ | ||||
| 	hicr = er32(HICR); | ||||
| 	ew32(HICR, hicr | E1000_HICR_C); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_enable_mng_pass_thru - Check if management passthrough is needed | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Verifies the hardware needs to leave interface enabled so that frames can | ||||
|  *  be directed to and from the management interface. | ||||
|  **/ | ||||
| bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 manc; | ||||
| 	u32 fwsm, factps; | ||||
| 
 | ||||
| 	manc = er32(MANC); | ||||
| 
 | ||||
| 	if (!(manc & E1000_MANC_RCV_TCO_EN)) | ||||
| 		return false; | ||||
| 
 | ||||
| 	if (hw->mac.has_fwsm) { | ||||
| 		fwsm = er32(FWSM); | ||||
| 		factps = er32(FACTPS); | ||||
| 
 | ||||
| 		if (!(factps & E1000_FACTPS_MNGCG) && | ||||
| 		    ((fwsm & E1000_FWSM_MODE_MASK) == | ||||
| 		     (e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) | ||||
| 			return true; | ||||
| 	} else if ((hw->mac.type == e1000_82574) || | ||||
| 		   (hw->mac.type == e1000_82583)) { | ||||
| 		u16 data; | ||||
| 		s32 ret_val; | ||||
| 
 | ||||
| 		factps = er32(FACTPS); | ||||
| 		ret_val = e1000_read_nvm(hw, NVM_INIT_CONTROL2_REG, 1, &data); | ||||
| 		if (ret_val) | ||||
| 			return false; | ||||
| 
 | ||||
| 		if (!(factps & E1000_FACTPS_MNGCG) && | ||||
| 		    ((data & E1000_NVM_INIT_CTRL2_MNGM) == | ||||
| 		     (e1000_mng_mode_pt << 13))) | ||||
| 			return true; | ||||
| 	} else if ((manc & E1000_MANC_SMBUS_EN) && | ||||
| 		   !(manc & E1000_MANC_ASF_EN)) { | ||||
| 		return true; | ||||
| 	} | ||||
| 
 | ||||
| 	return false; | ||||
| } | ||||
							
								
								
									
										65
									
								
								drivers/net/ethernet/intel/e1000e/manage.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								drivers/net/ethernet/intel/e1000e/manage.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,65 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_MANAGE_H_ | ||||
| #define _E1000E_MANAGE_H_ | ||||
| 
 | ||||
| bool e1000e_check_mng_mode_generic(struct e1000_hw *hw); | ||||
| bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw); | ||||
| s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length); | ||||
| bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw); | ||||
| 
 | ||||
| enum e1000_mng_mode { | ||||
| 	e1000_mng_mode_none = 0, | ||||
| 	e1000_mng_mode_asf, | ||||
| 	e1000_mng_mode_pt, | ||||
| 	e1000_mng_mode_ipmi, | ||||
| 	e1000_mng_mode_host_if_only | ||||
| }; | ||||
| 
 | ||||
| #define E1000_FACTPS_MNGCG			0x20000000 | ||||
| 
 | ||||
| #define E1000_FWSM_MODE_MASK			0xE | ||||
| #define E1000_FWSM_MODE_SHIFT			1 | ||||
| 
 | ||||
| #define E1000_MNG_IAMT_MODE			0x3 | ||||
| #define E1000_MNG_DHCP_COOKIE_LENGTH		0x10 | ||||
| #define E1000_MNG_DHCP_COOKIE_OFFSET		0x6F0 | ||||
| #define E1000_MNG_DHCP_COMMAND_TIMEOUT		10 | ||||
| #define E1000_MNG_DHCP_TX_PAYLOAD_CMD		64 | ||||
| #define E1000_MNG_DHCP_COOKIE_STATUS_PARSING	0x1 | ||||
| #define E1000_MNG_DHCP_COOKIE_STATUS_VLAN	0x2 | ||||
| 
 | ||||
| #define E1000_VFTA_ENTRY_SHIFT			5 | ||||
| #define E1000_VFTA_ENTRY_MASK			0x7F | ||||
| #define E1000_VFTA_ENTRY_BIT_SHIFT_MASK		0x1F | ||||
| 
 | ||||
| #define E1000_HICR_EN			0x01	/* Enable bit - RO */ | ||||
| /* Driver sets this bit when done to put command in RAM */ | ||||
| #define E1000_HICR_C			0x02 | ||||
| #define E1000_HICR_SV			0x04	/* Status Validity */ | ||||
| #define E1000_HICR_FW_RESET_ENABLE	0x40 | ||||
| #define E1000_HICR_FW_RESET		0x80 | ||||
| 
 | ||||
| /* Intel(R) Active Management Technology signature */ | ||||
| #define E1000_IAMT_SIGNATURE		0x544D4149 | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										7285
									
								
								drivers/net/ethernet/intel/e1000e/netdev.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7285
									
								
								drivers/net/ethernet/intel/e1000e/netdev.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										633
									
								
								drivers/net/ethernet/intel/e1000e/nvm.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										633
									
								
								drivers/net/ethernet/intel/e1000e/nvm.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,633 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #include "e1000.h" | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_raise_eec_clk - Raise EEPROM clock | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @eecd: pointer to the EEPROM | ||||
|  * | ||||
|  *  Enable/Raise the EEPROM clock bit. | ||||
|  **/ | ||||
| static void e1000_raise_eec_clk(struct e1000_hw *hw, u32 *eecd) | ||||
| { | ||||
| 	*eecd = *eecd | E1000_EECD_SK; | ||||
| 	ew32(EECD, *eecd); | ||||
| 	e1e_flush(); | ||||
| 	udelay(hw->nvm.delay_usec); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_lower_eec_clk - Lower EEPROM clock | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @eecd: pointer to the EEPROM | ||||
|  * | ||||
|  *  Clear/Lower the EEPROM clock bit. | ||||
|  **/ | ||||
| static void e1000_lower_eec_clk(struct e1000_hw *hw, u32 *eecd) | ||||
| { | ||||
| 	*eecd = *eecd & ~E1000_EECD_SK; | ||||
| 	ew32(EECD, *eecd); | ||||
| 	e1e_flush(); | ||||
| 	udelay(hw->nvm.delay_usec); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_shift_out_eec_bits - Shift data bits our to the EEPROM | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @data: data to send to the EEPROM | ||||
|  *  @count: number of bits to shift out | ||||
|  * | ||||
|  *  We need to shift 'count' bits out to the EEPROM.  So, the value in the | ||||
|  *  "data" parameter will be shifted out to the EEPROM one bit at a time. | ||||
|  *  In order to do this, "data" must be broken down into bits. | ||||
|  **/ | ||||
| static void e1000_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count) | ||||
| { | ||||
| 	struct e1000_nvm_info *nvm = &hw->nvm; | ||||
| 	u32 eecd = er32(EECD); | ||||
| 	u32 mask; | ||||
| 
 | ||||
| 	mask = 0x01 << (count - 1); | ||||
| 	if (nvm->type == e1000_nvm_eeprom_spi) | ||||
| 		eecd |= E1000_EECD_DO; | ||||
| 
 | ||||
| 	do { | ||||
| 		eecd &= ~E1000_EECD_DI; | ||||
| 
 | ||||
| 		if (data & mask) | ||||
| 			eecd |= E1000_EECD_DI; | ||||
| 
 | ||||
| 		ew32(EECD, eecd); | ||||
| 		e1e_flush(); | ||||
| 
 | ||||
| 		udelay(nvm->delay_usec); | ||||
| 
 | ||||
| 		e1000_raise_eec_clk(hw, &eecd); | ||||
| 		e1000_lower_eec_clk(hw, &eecd); | ||||
| 
 | ||||
| 		mask >>= 1; | ||||
| 	} while (mask); | ||||
| 
 | ||||
| 	eecd &= ~E1000_EECD_DI; | ||||
| 	ew32(EECD, eecd); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_shift_in_eec_bits - Shift data bits in from the EEPROM | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @count: number of bits to shift in | ||||
|  * | ||||
|  *  In order to read a register from the EEPROM, we need to shift 'count' bits | ||||
|  *  in from the EEPROM.  Bits are "shifted in" by raising the clock input to | ||||
|  *  the EEPROM (setting the SK bit), and then reading the value of the data out | ||||
|  *  "DO" bit.  During this "shifting in" process the data in "DI" bit should | ||||
|  *  always be clear. | ||||
|  **/ | ||||
| static u16 e1000_shift_in_eec_bits(struct e1000_hw *hw, u16 count) | ||||
| { | ||||
| 	u32 eecd; | ||||
| 	u32 i; | ||||
| 	u16 data; | ||||
| 
 | ||||
| 	eecd = er32(EECD); | ||||
| 	eecd &= ~(E1000_EECD_DO | E1000_EECD_DI); | ||||
| 	data = 0; | ||||
| 
 | ||||
| 	for (i = 0; i < count; i++) { | ||||
| 		data <<= 1; | ||||
| 		e1000_raise_eec_clk(hw, &eecd); | ||||
| 
 | ||||
| 		eecd = er32(EECD); | ||||
| 
 | ||||
| 		eecd &= ~E1000_EECD_DI; | ||||
| 		if (eecd & E1000_EECD_DO) | ||||
| 			data |= 1; | ||||
| 
 | ||||
| 		e1000_lower_eec_clk(hw, &eecd); | ||||
| 	} | ||||
| 
 | ||||
| 	return data; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_poll_eerd_eewr_done - Poll for EEPROM read/write completion | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @ee_reg: EEPROM flag for polling | ||||
|  * | ||||
|  *  Polls the EEPROM status bit for either read or write completion based | ||||
|  *  upon the value of 'ee_reg'. | ||||
|  **/ | ||||
| s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg) | ||||
| { | ||||
| 	u32 attempts = 100000; | ||||
| 	u32 i, reg = 0; | ||||
| 
 | ||||
| 	for (i = 0; i < attempts; i++) { | ||||
| 		if (ee_reg == E1000_NVM_POLL_READ) | ||||
| 			reg = er32(EERD); | ||||
| 		else | ||||
| 			reg = er32(EEWR); | ||||
| 
 | ||||
| 		if (reg & E1000_NVM_RW_REG_DONE) | ||||
| 			return 0; | ||||
| 
 | ||||
| 		udelay(5); | ||||
| 	} | ||||
| 
 | ||||
| 	return -E1000_ERR_NVM; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_acquire_nvm - Generic request for access to EEPROM | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Set the EEPROM access request bit and wait for EEPROM access grant bit. | ||||
|  *  Return successful if access grant bit set, else clear the request for | ||||
|  *  EEPROM access and return -E1000_ERR_NVM (-1). | ||||
|  **/ | ||||
| s32 e1000e_acquire_nvm(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 eecd = er32(EECD); | ||||
| 	s32 timeout = E1000_NVM_GRANT_ATTEMPTS; | ||||
| 
 | ||||
| 	ew32(EECD, eecd | E1000_EECD_REQ); | ||||
| 	eecd = er32(EECD); | ||||
| 
 | ||||
| 	while (timeout) { | ||||
| 		if (eecd & E1000_EECD_GNT) | ||||
| 			break; | ||||
| 		udelay(5); | ||||
| 		eecd = er32(EECD); | ||||
| 		timeout--; | ||||
| 	} | ||||
| 
 | ||||
| 	if (!timeout) { | ||||
| 		eecd &= ~E1000_EECD_REQ; | ||||
| 		ew32(EECD, eecd); | ||||
| 		e_dbg("Could not acquire NVM grant\n"); | ||||
| 		return -E1000_ERR_NVM; | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_standby_nvm - Return EEPROM to standby state | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Return the EEPROM to a standby state. | ||||
|  **/ | ||||
| static void e1000_standby_nvm(struct e1000_hw *hw) | ||||
| { | ||||
| 	struct e1000_nvm_info *nvm = &hw->nvm; | ||||
| 	u32 eecd = er32(EECD); | ||||
| 
 | ||||
| 	if (nvm->type == e1000_nvm_eeprom_spi) { | ||||
| 		/* Toggle CS to flush commands */ | ||||
| 		eecd |= E1000_EECD_CS; | ||||
| 		ew32(EECD, eecd); | ||||
| 		e1e_flush(); | ||||
| 		udelay(nvm->delay_usec); | ||||
| 		eecd &= ~E1000_EECD_CS; | ||||
| 		ew32(EECD, eecd); | ||||
| 		e1e_flush(); | ||||
| 		udelay(nvm->delay_usec); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_stop_nvm - Terminate EEPROM command | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Terminates the current command by inverting the EEPROM's chip select pin. | ||||
|  **/ | ||||
| static void e1000_stop_nvm(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 eecd; | ||||
| 
 | ||||
| 	eecd = er32(EECD); | ||||
| 	if (hw->nvm.type == e1000_nvm_eeprom_spi) { | ||||
| 		/* Pull CS high */ | ||||
| 		eecd |= E1000_EECD_CS; | ||||
| 		e1000_lower_eec_clk(hw, &eecd); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_release_nvm - Release exclusive access to EEPROM | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Stop any current commands to the EEPROM and clear the EEPROM request bit. | ||||
|  **/ | ||||
| void e1000e_release_nvm(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 eecd; | ||||
| 
 | ||||
| 	e1000_stop_nvm(hw); | ||||
| 
 | ||||
| 	eecd = er32(EECD); | ||||
| 	eecd &= ~E1000_EECD_REQ; | ||||
| 	ew32(EECD, eecd); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_ready_nvm_eeprom - Prepares EEPROM for read/write | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Setups the EEPROM for reading and writing. | ||||
|  **/ | ||||
| static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw) | ||||
| { | ||||
| 	struct e1000_nvm_info *nvm = &hw->nvm; | ||||
| 	u32 eecd = er32(EECD); | ||||
| 	u8 spi_stat_reg; | ||||
| 
 | ||||
| 	if (nvm->type == e1000_nvm_eeprom_spi) { | ||||
| 		u16 timeout = NVM_MAX_RETRY_SPI; | ||||
| 
 | ||||
| 		/* Clear SK and CS */ | ||||
| 		eecd &= ~(E1000_EECD_CS | E1000_EECD_SK); | ||||
| 		ew32(EECD, eecd); | ||||
| 		e1e_flush(); | ||||
| 		udelay(1); | ||||
| 
 | ||||
| 		/* Read "Status Register" repeatedly until the LSB is cleared.
 | ||||
| 		 * The EEPROM will signal that the command has been completed | ||||
| 		 * by clearing bit 0 of the internal status register.  If it's | ||||
| 		 * not cleared within 'timeout', then error out. | ||||
| 		 */ | ||||
| 		while (timeout) { | ||||
| 			e1000_shift_out_eec_bits(hw, NVM_RDSR_OPCODE_SPI, | ||||
| 						 hw->nvm.opcode_bits); | ||||
| 			spi_stat_reg = (u8)e1000_shift_in_eec_bits(hw, 8); | ||||
| 			if (!(spi_stat_reg & NVM_STATUS_RDY_SPI)) | ||||
| 				break; | ||||
| 
 | ||||
| 			udelay(5); | ||||
| 			e1000_standby_nvm(hw); | ||||
| 			timeout--; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!timeout) { | ||||
| 			e_dbg("SPI NVM Status error\n"); | ||||
| 			return -E1000_ERR_NVM; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_read_nvm_eerd - Reads EEPROM using EERD register | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @offset: offset of word in the EEPROM to read | ||||
|  *  @words: number of words to read | ||||
|  *  @data: word read from the EEPROM | ||||
|  * | ||||
|  *  Reads a 16 bit word from the EEPROM using the EERD register. | ||||
|  **/ | ||||
| s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | ||||
| { | ||||
| 	struct e1000_nvm_info *nvm = &hw->nvm; | ||||
| 	u32 i, eerd = 0; | ||||
| 	s32 ret_val = 0; | ||||
| 
 | ||||
| 	/* A check for invalid values:  offset too large, too many words,
 | ||||
| 	 * too many words for the offset, and not enough words. | ||||
| 	 */ | ||||
| 	if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || | ||||
| 	    (words == 0)) { | ||||
| 		e_dbg("nvm parameter(s) out of bounds\n"); | ||||
| 		return -E1000_ERR_NVM; | ||||
| 	} | ||||
| 
 | ||||
| 	for (i = 0; i < words; i++) { | ||||
| 		eerd = ((offset + i) << E1000_NVM_RW_ADDR_SHIFT) + | ||||
| 		    E1000_NVM_RW_REG_START; | ||||
| 
 | ||||
| 		ew32(EERD, eerd); | ||||
| 		ret_val = e1000e_poll_eerd_eewr_done(hw, E1000_NVM_POLL_READ); | ||||
| 		if (ret_val) { | ||||
| 			e_dbg("NVM read error: %d\n", ret_val); | ||||
| 			break; | ||||
| 		} | ||||
| 
 | ||||
| 		data[i] = (er32(EERD) >> E1000_NVM_RW_REG_DATA); | ||||
| 	} | ||||
| 
 | ||||
| 	return ret_val; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_write_nvm_spi - Write to EEPROM using SPI | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @offset: offset within the EEPROM to be written to | ||||
|  *  @words: number of words to write | ||||
|  *  @data: 16 bit word(s) to be written to the EEPROM | ||||
|  * | ||||
|  *  Writes data to EEPROM at offset using SPI interface. | ||||
|  * | ||||
|  *  If e1000e_update_nvm_checksum is not called after this function , the | ||||
|  *  EEPROM will most likely contain an invalid checksum. | ||||
|  **/ | ||||
| s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) | ||||
| { | ||||
| 	struct e1000_nvm_info *nvm = &hw->nvm; | ||||
| 	s32 ret_val = -E1000_ERR_NVM; | ||||
| 	u16 widx = 0; | ||||
| 
 | ||||
| 	/* A check for invalid values:  offset too large, too many words,
 | ||||
| 	 * and not enough words. | ||||
| 	 */ | ||||
| 	if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) || | ||||
| 	    (words == 0)) { | ||||
| 		e_dbg("nvm parameter(s) out of bounds\n"); | ||||
| 		return -E1000_ERR_NVM; | ||||
| 	} | ||||
| 
 | ||||
| 	while (widx < words) { | ||||
| 		u8 write_opcode = NVM_WRITE_OPCODE_SPI; | ||||
| 
 | ||||
| 		ret_val = nvm->ops.acquire(hw); | ||||
| 		if (ret_val) | ||||
| 			return ret_val; | ||||
| 
 | ||||
| 		ret_val = e1000_ready_nvm_eeprom(hw); | ||||
| 		if (ret_val) { | ||||
| 			nvm->ops.release(hw); | ||||
| 			return ret_val; | ||||
| 		} | ||||
| 
 | ||||
| 		e1000_standby_nvm(hw); | ||||
| 
 | ||||
| 		/* Send the WRITE ENABLE command (8 bit opcode) */ | ||||
| 		e1000_shift_out_eec_bits(hw, NVM_WREN_OPCODE_SPI, | ||||
| 					 nvm->opcode_bits); | ||||
| 
 | ||||
| 		e1000_standby_nvm(hw); | ||||
| 
 | ||||
| 		/* Some SPI eeproms use the 8th address bit embedded in the
 | ||||
| 		 * opcode | ||||
| 		 */ | ||||
| 		if ((nvm->address_bits == 8) && (offset >= 128)) | ||||
| 			write_opcode |= NVM_A8_OPCODE_SPI; | ||||
| 
 | ||||
| 		/* Send the Write command (8-bit opcode + addr) */ | ||||
| 		e1000_shift_out_eec_bits(hw, write_opcode, nvm->opcode_bits); | ||||
| 		e1000_shift_out_eec_bits(hw, (u16)((offset + widx) * 2), | ||||
| 					 nvm->address_bits); | ||||
| 
 | ||||
| 		/* Loop to allow for up to whole page write of eeprom */ | ||||
| 		while (widx < words) { | ||||
| 			u16 word_out = data[widx]; | ||||
| 
 | ||||
| 			word_out = (word_out >> 8) | (word_out << 8); | ||||
| 			e1000_shift_out_eec_bits(hw, word_out, 16); | ||||
| 			widx++; | ||||
| 
 | ||||
| 			if ((((offset + widx) * 2) % nvm->page_size) == 0) { | ||||
| 				e1000_standby_nvm(hw); | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		usleep_range(10000, 20000); | ||||
| 		nvm->ops.release(hw); | ||||
| 	} | ||||
| 
 | ||||
| 	return ret_val; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_read_pba_string_generic - Read device part number | ||||
|  *  @hw: pointer to the HW structure | ||||
|  *  @pba_num: pointer to device part number | ||||
|  *  @pba_num_size: size of part number buffer | ||||
|  * | ||||
|  *  Reads the product board assembly (PBA) number from the EEPROM and stores | ||||
|  *  the value in pba_num. | ||||
|  **/ | ||||
| s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, | ||||
| 				  u32 pba_num_size) | ||||
| { | ||||
| 	s32 ret_val; | ||||
| 	u16 nvm_data; | ||||
| 	u16 pba_ptr; | ||||
| 	u16 offset; | ||||
| 	u16 length; | ||||
| 
 | ||||
| 	if (pba_num == NULL) { | ||||
| 		e_dbg("PBA string buffer was null\n"); | ||||
| 		return -E1000_ERR_INVALID_ARGUMENT; | ||||
| 	} | ||||
| 
 | ||||
| 	ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_0, 1, &nvm_data); | ||||
| 	if (ret_val) { | ||||
| 		e_dbg("NVM Read Error\n"); | ||||
| 		return ret_val; | ||||
| 	} | ||||
| 
 | ||||
| 	ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_1, 1, &pba_ptr); | ||||
| 	if (ret_val) { | ||||
| 		e_dbg("NVM Read Error\n"); | ||||
| 		return ret_val; | ||||
| 	} | ||||
| 
 | ||||
| 	/* if nvm_data is not ptr guard the PBA must be in legacy format which
 | ||||
| 	 * means pba_ptr is actually our second data word for the PBA number | ||||
| 	 * and we can decode it into an ascii string | ||||
| 	 */ | ||||
| 	if (nvm_data != NVM_PBA_PTR_GUARD) { | ||||
| 		e_dbg("NVM PBA number is not stored as string\n"); | ||||
| 
 | ||||
| 		/* make sure callers buffer is big enough to store the PBA */ | ||||
| 		if (pba_num_size < E1000_PBANUM_LENGTH) { | ||||
| 			e_dbg("PBA string buffer too small\n"); | ||||
| 			return E1000_ERR_NO_SPACE; | ||||
| 		} | ||||
| 
 | ||||
| 		/* extract hex string from data and pba_ptr */ | ||||
| 		pba_num[0] = (nvm_data >> 12) & 0xF; | ||||
| 		pba_num[1] = (nvm_data >> 8) & 0xF; | ||||
| 		pba_num[2] = (nvm_data >> 4) & 0xF; | ||||
| 		pba_num[3] = nvm_data & 0xF; | ||||
| 		pba_num[4] = (pba_ptr >> 12) & 0xF; | ||||
| 		pba_num[5] = (pba_ptr >> 8) & 0xF; | ||||
| 		pba_num[6] = '-'; | ||||
| 		pba_num[7] = 0; | ||||
| 		pba_num[8] = (pba_ptr >> 4) & 0xF; | ||||
| 		pba_num[9] = pba_ptr & 0xF; | ||||
| 
 | ||||
| 		/* put a null character on the end of our string */ | ||||
| 		pba_num[10] = '\0'; | ||||
| 
 | ||||
| 		/* switch all the data but the '-' to hex char */ | ||||
| 		for (offset = 0; offset < 10; offset++) { | ||||
| 			if (pba_num[offset] < 0xA) | ||||
| 				pba_num[offset] += '0'; | ||||
| 			else if (pba_num[offset] < 0x10) | ||||
| 				pba_num[offset] += 'A' - 0xA; | ||||
| 		} | ||||
| 
 | ||||
| 		return 0; | ||||
| 	} | ||||
| 
 | ||||
| 	ret_val = e1000_read_nvm(hw, pba_ptr, 1, &length); | ||||
| 	if (ret_val) { | ||||
| 		e_dbg("NVM Read Error\n"); | ||||
| 		return ret_val; | ||||
| 	} | ||||
| 
 | ||||
| 	if (length == 0xFFFF || length == 0) { | ||||
| 		e_dbg("NVM PBA number section invalid length\n"); | ||||
| 		return -E1000_ERR_NVM_PBA_SECTION; | ||||
| 	} | ||||
| 	/* check if pba_num buffer is big enough */ | ||||
| 	if (pba_num_size < (((u32)length * 2) - 1)) { | ||||
| 		e_dbg("PBA string buffer too small\n"); | ||||
| 		return -E1000_ERR_NO_SPACE; | ||||
| 	} | ||||
| 
 | ||||
| 	/* trim pba length from start of string */ | ||||
| 	pba_ptr++; | ||||
| 	length--; | ||||
| 
 | ||||
| 	for (offset = 0; offset < length; offset++) { | ||||
| 		ret_val = e1000_read_nvm(hw, pba_ptr + offset, 1, &nvm_data); | ||||
| 		if (ret_val) { | ||||
| 			e_dbg("NVM Read Error\n"); | ||||
| 			return ret_val; | ||||
| 		} | ||||
| 		pba_num[offset * 2] = (u8)(nvm_data >> 8); | ||||
| 		pba_num[(offset * 2) + 1] = (u8)(nvm_data & 0xFF); | ||||
| 	} | ||||
| 	pba_num[offset * 2] = '\0'; | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000_read_mac_addr_generic - Read device MAC address | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Reads the device MAC address from the EEPROM and stores the value. | ||||
|  *  Since devices with two ports use the same EEPROM, we increment the | ||||
|  *  last bit in the MAC address for the second port. | ||||
|  **/ | ||||
| s32 e1000_read_mac_addr_generic(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 rar_high; | ||||
| 	u32 rar_low; | ||||
| 	u16 i; | ||||
| 
 | ||||
| 	rar_high = er32(RAH(0)); | ||||
| 	rar_low = er32(RAL(0)); | ||||
| 
 | ||||
| 	for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++) | ||||
| 		hw->mac.perm_addr[i] = (u8)(rar_low >> (i * 8)); | ||||
| 
 | ||||
| 	for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++) | ||||
| 		hw->mac.perm_addr[i + 4] = (u8)(rar_high >> (i * 8)); | ||||
| 
 | ||||
| 	for (i = 0; i < ETH_ALEN; i++) | ||||
| 		hw->mac.addr[i] = hw->mac.perm_addr[i]; | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_validate_nvm_checksum_generic - Validate EEPROM checksum | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Calculates the EEPROM checksum by reading/adding each word of the EEPROM | ||||
|  *  and then verifies that the sum of the EEPROM is equal to 0xBABA. | ||||
|  **/ | ||||
| s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw) | ||||
| { | ||||
| 	s32 ret_val; | ||||
| 	u16 checksum = 0; | ||||
| 	u16 i, nvm_data; | ||||
| 
 | ||||
| 	for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) { | ||||
| 		ret_val = e1000_read_nvm(hw, i, 1, &nvm_data); | ||||
| 		if (ret_val) { | ||||
| 			e_dbg("NVM Read Error\n"); | ||||
| 			return ret_val; | ||||
| 		} | ||||
| 		checksum += nvm_data; | ||||
| 	} | ||||
| 
 | ||||
| 	if (checksum != (u16)NVM_SUM) { | ||||
| 		e_dbg("NVM Checksum Invalid\n"); | ||||
| 		return -E1000_ERR_NVM; | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_update_nvm_checksum_generic - Update EEPROM checksum | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Updates the EEPROM checksum by reading/adding each word of the EEPROM | ||||
|  *  up to the checksum.  Then calculates the EEPROM checksum and writes the | ||||
|  *  value to the EEPROM. | ||||
|  **/ | ||||
| s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw) | ||||
| { | ||||
| 	s32 ret_val; | ||||
| 	u16 checksum = 0; | ||||
| 	u16 i, nvm_data; | ||||
| 
 | ||||
| 	for (i = 0; i < NVM_CHECKSUM_REG; i++) { | ||||
| 		ret_val = e1000_read_nvm(hw, i, 1, &nvm_data); | ||||
| 		if (ret_val) { | ||||
| 			e_dbg("NVM Read Error while updating checksum.\n"); | ||||
| 			return ret_val; | ||||
| 		} | ||||
| 		checksum += nvm_data; | ||||
| 	} | ||||
| 	checksum = (u16)NVM_SUM - checksum; | ||||
| 	ret_val = e1000_write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum); | ||||
| 	if (ret_val) | ||||
| 		e_dbg("NVM Write Error while updating checksum.\n"); | ||||
| 
 | ||||
| 	return ret_val; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  *  e1000e_reload_nvm_generic - Reloads EEPROM | ||||
|  *  @hw: pointer to the HW structure | ||||
|  * | ||||
|  *  Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the | ||||
|  *  extended control register. | ||||
|  **/ | ||||
| void e1000e_reload_nvm_generic(struct e1000_hw *hw) | ||||
| { | ||||
| 	u32 ctrl_ext; | ||||
| 
 | ||||
| 	usleep_range(10, 20); | ||||
| 	ctrl_ext = er32(CTRL_EXT); | ||||
| 	ctrl_ext |= E1000_CTRL_EXT_EE_RST; | ||||
| 	ew32(CTRL_EXT, ctrl_ext); | ||||
| 	e1e_flush(); | ||||
| } | ||||
							
								
								
									
										40
									
								
								drivers/net/ethernet/intel/e1000e/nvm.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								drivers/net/ethernet/intel/e1000e/nvm.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_NVM_H_ | ||||
| #define _E1000E_NVM_H_ | ||||
| 
 | ||||
| s32 e1000e_acquire_nvm(struct e1000_hw *hw); | ||||
| 
 | ||||
| s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); | ||||
| s32 e1000_read_mac_addr_generic(struct e1000_hw *hw); | ||||
| s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num, | ||||
| 				  u32 pba_num_size); | ||||
| s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); | ||||
| s32 e1000e_valid_led_default(struct e1000_hw *hw, u16 *data); | ||||
| s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); | ||||
| s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw); | ||||
| void e1000e_release_nvm(struct e1000_hw *hw); | ||||
| 
 | ||||
| #define E1000_STM_OPCODE	0xDB00 | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										533
									
								
								drivers/net/ethernet/intel/e1000e/param.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										533
									
								
								drivers/net/ethernet/intel/e1000e/param.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,533 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #include <linux/netdevice.h> | ||||
| #include <linux/module.h> | ||||
| #include <linux/pci.h> | ||||
| 
 | ||||
| #include "e1000.h" | ||||
| 
 | ||||
| /* This is the only thing that needs to be changed to adjust the
 | ||||
|  * maximum number of ports that the driver can manage. | ||||
|  */ | ||||
| #define E1000_MAX_NIC 32 | ||||
| 
 | ||||
| #define OPTION_UNSET   -1 | ||||
| #define OPTION_DISABLED 0 | ||||
| #define OPTION_ENABLED  1 | ||||
| 
 | ||||
| #define COPYBREAK_DEFAULT 256 | ||||
| unsigned int copybreak = COPYBREAK_DEFAULT; | ||||
| module_param(copybreak, uint, 0644); | ||||
| MODULE_PARM_DESC(copybreak, | ||||
| 		 "Maximum size of packet that is copied to a new buffer on receive"); | ||||
| 
 | ||||
| /* All parameters are treated the same, as an integer array of values.
 | ||||
|  * This macro just reduces the need to repeat the same declaration code | ||||
|  * over and over (plus this helps to avoid typo bugs). | ||||
|  */ | ||||
| #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET } | ||||
| #define E1000_PARAM(X, desc)					\ | ||||
| 	static int X[E1000_MAX_NIC+1] = E1000_PARAM_INIT;	\ | ||||
| 	static unsigned int num_##X;				\ | ||||
| 	module_param_array_named(X, X, int, &num_##X, 0);	\ | ||||
| 	MODULE_PARM_DESC(X, desc); | ||||
| 
 | ||||
| /* Transmit Interrupt Delay in units of 1.024 microseconds
 | ||||
|  * Tx interrupt delay needs to typically be set to something non-zero | ||||
|  * | ||||
|  * Valid Range: 0-65535 | ||||
|  */ | ||||
| E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay"); | ||||
| #define DEFAULT_TIDV 8 | ||||
| #define MAX_TXDELAY 0xFFFF | ||||
| #define MIN_TXDELAY 0 | ||||
| 
 | ||||
| /* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
 | ||||
|  * | ||||
|  * Valid Range: 0-65535 | ||||
|  */ | ||||
| E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay"); | ||||
| #define DEFAULT_TADV 32 | ||||
| #define MAX_TXABSDELAY 0xFFFF | ||||
| #define MIN_TXABSDELAY 0 | ||||
| 
 | ||||
| /* Receive Interrupt Delay in units of 1.024 microseconds
 | ||||
|  * hardware will likely hang if you set this to anything but zero. | ||||
|  * | ||||
|  * Valid Range: 0-65535 | ||||
|  */ | ||||
| E1000_PARAM(RxIntDelay, "Receive Interrupt Delay"); | ||||
| #define MAX_RXDELAY 0xFFFF | ||||
| #define MIN_RXDELAY 0 | ||||
| 
 | ||||
| /* Receive Absolute Interrupt Delay in units of 1.024 microseconds
 | ||||
|  * | ||||
|  * Valid Range: 0-65535 | ||||
|  */ | ||||
| E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); | ||||
| #define MAX_RXABSDELAY 0xFFFF | ||||
| #define MIN_RXABSDELAY 0 | ||||
| 
 | ||||
| /* Interrupt Throttle Rate (interrupts/sec)
 | ||||
|  * | ||||
|  * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative | ||||
|  */ | ||||
| E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | ||||
| #define DEFAULT_ITR 3 | ||||
| #define MAX_ITR 100000 | ||||
| #define MIN_ITR 100 | ||||
| 
 | ||||
| /* IntMode (Interrupt Mode)
 | ||||
|  * | ||||
|  * Valid Range: varies depending on kernel configuration & hardware support | ||||
|  * | ||||
|  * legacy=0, MSI=1, MSI-X=2 | ||||
|  * | ||||
|  * When MSI/MSI-X support is enabled in kernel- | ||||
|  *   Default Value: 2 (MSI-X) when supported by hardware, 1 (MSI) otherwise | ||||
|  * When MSI/MSI-X support is not enabled in kernel- | ||||
|  *   Default Value: 0 (legacy) | ||||
|  * | ||||
|  * When a mode is specified that is not allowed/supported, it will be | ||||
|  * demoted to the most advanced interrupt mode available. | ||||
|  */ | ||||
| E1000_PARAM(IntMode, "Interrupt Mode"); | ||||
| #define MAX_INTMODE	2 | ||||
| #define MIN_INTMODE	0 | ||||
| 
 | ||||
| /* Enable Smart Power Down of the PHY
 | ||||
|  * | ||||
|  * Valid Range: 0, 1 | ||||
|  * | ||||
|  * Default Value: 0 (disabled) | ||||
|  */ | ||||
| E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down"); | ||||
| 
 | ||||
| /* Enable Kumeran Lock Loss workaround
 | ||||
|  * | ||||
|  * Valid Range: 0, 1 | ||||
|  * | ||||
|  * Default Value: 1 (enabled) | ||||
|  */ | ||||
| E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); | ||||
| 
 | ||||
| /* Write Protect NVM
 | ||||
|  * | ||||
|  * Valid Range: 0, 1 | ||||
|  * | ||||
|  * Default Value: 1 (enabled) | ||||
|  */ | ||||
| E1000_PARAM(WriteProtectNVM, | ||||
| 	    "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]"); | ||||
| 
 | ||||
| /* Enable CRC Stripping
 | ||||
|  * | ||||
|  * Valid Range: 0, 1 | ||||
|  * | ||||
|  * Default Value: 1 (enabled) | ||||
|  */ | ||||
| E1000_PARAM(CrcStripping, | ||||
| 	    "Enable CRC Stripping, disable if your BMC needs the CRC"); | ||||
| 
 | ||||
| struct e1000_option { | ||||
| 	enum { enable_option, range_option, list_option } type; | ||||
| 	const char *name; | ||||
| 	const char *err; | ||||
| 	int def; | ||||
| 	union { | ||||
| 		/* range_option info */ | ||||
| 		struct { | ||||
| 			int min; | ||||
| 			int max; | ||||
| 		} r; | ||||
| 		/* list_option info */ | ||||
| 		struct { | ||||
| 			int nr; | ||||
| 			struct e1000_opt_list { | ||||
| 				int i; | ||||
| 				char *str; | ||||
| 			} *p; | ||||
| 		} l; | ||||
| 	} arg; | ||||
| }; | ||||
| 
 | ||||
| static int e1000_validate_option(unsigned int *value, | ||||
| 				 const struct e1000_option *opt, | ||||
| 				 struct e1000_adapter *adapter) | ||||
| { | ||||
| 	if (*value == OPTION_UNSET) { | ||||
| 		*value = opt->def; | ||||
| 		return 0; | ||||
| 	} | ||||
| 
 | ||||
| 	switch (opt->type) { | ||||
| 	case enable_option: | ||||
| 		switch (*value) { | ||||
| 		case OPTION_ENABLED: | ||||
| 			dev_info(&adapter->pdev->dev, "%s Enabled\n", | ||||
| 				 opt->name); | ||||
| 			return 0; | ||||
| 		case OPTION_DISABLED: | ||||
| 			dev_info(&adapter->pdev->dev, "%s Disabled\n", | ||||
| 				 opt->name); | ||||
| 			return 0; | ||||
| 		} | ||||
| 		break; | ||||
| 	case range_option: | ||||
| 		if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) { | ||||
| 			dev_info(&adapter->pdev->dev, "%s set to %i\n", | ||||
| 				 opt->name, *value); | ||||
| 			return 0; | ||||
| 		} | ||||
| 		break; | ||||
| 	case list_option: { | ||||
| 		int i; | ||||
| 		struct e1000_opt_list *ent; | ||||
| 
 | ||||
| 		for (i = 0; i < opt->arg.l.nr; i++) { | ||||
| 			ent = &opt->arg.l.p[i]; | ||||
| 			if (*value == ent->i) { | ||||
| 				if (ent->str[0] != '\0') | ||||
| 					dev_info(&adapter->pdev->dev, "%s\n", | ||||
| 						 ent->str); | ||||
| 				return 0; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 		break; | ||||
| 	default: | ||||
| 		BUG(); | ||||
| 	} | ||||
| 
 | ||||
| 	dev_info(&adapter->pdev->dev, "Invalid %s value specified (%i) %s\n", | ||||
| 		 opt->name, *value, opt->err); | ||||
| 	*value = opt->def; | ||||
| 	return -1; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_check_options - Range Checking for Command Line Parameters | ||||
|  * @adapter: board private structure | ||||
|  * | ||||
|  * This routine checks all command line parameters for valid user | ||||
|  * input.  If an invalid value is given, or if no user specified | ||||
|  * value exists, a default value is used.  The final value is stored | ||||
|  * in a variable in the adapter structure. | ||||
|  **/ | ||||
| void e1000e_check_options(struct e1000_adapter *adapter) | ||||
| { | ||||
| 	struct e1000_hw *hw = &adapter->hw; | ||||
| 	int bd = adapter->bd_number; | ||||
| 
 | ||||
| 	if (bd >= E1000_MAX_NIC) { | ||||
| 		dev_notice(&adapter->pdev->dev, | ||||
| 			   "Warning: no configuration for board #%i\n", bd); | ||||
| 		dev_notice(&adapter->pdev->dev, | ||||
| 			   "Using defaults for all values\n"); | ||||
| 	} | ||||
| 
 | ||||
| 	/* Transmit Interrupt Delay */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = range_option, | ||||
| 			.name = "Transmit Interrupt Delay", | ||||
| 			.err  = "using default of " | ||||
| 				__MODULE_STRING(DEFAULT_TIDV), | ||||
| 			.def  = DEFAULT_TIDV, | ||||
| 			.arg  = { .r = { .min = MIN_TXDELAY, | ||||
| 					 .max = MAX_TXDELAY } } | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_TxIntDelay > bd) { | ||||
| 			adapter->tx_int_delay = TxIntDelay[bd]; | ||||
| 			e1000_validate_option(&adapter->tx_int_delay, &opt, | ||||
| 					      adapter); | ||||
| 		} else { | ||||
| 			adapter->tx_int_delay = opt.def; | ||||
| 		} | ||||
| 	} | ||||
| 	/* Transmit Absolute Interrupt Delay */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = range_option, | ||||
| 			.name = "Transmit Absolute Interrupt Delay", | ||||
| 			.err  = "using default of " | ||||
| 				__MODULE_STRING(DEFAULT_TADV), | ||||
| 			.def  = DEFAULT_TADV, | ||||
| 			.arg  = { .r = { .min = MIN_TXABSDELAY, | ||||
| 					 .max = MAX_TXABSDELAY } } | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_TxAbsIntDelay > bd) { | ||||
| 			adapter->tx_abs_int_delay = TxAbsIntDelay[bd]; | ||||
| 			e1000_validate_option(&adapter->tx_abs_int_delay, &opt, | ||||
| 					      adapter); | ||||
| 		} else { | ||||
| 			adapter->tx_abs_int_delay = opt.def; | ||||
| 		} | ||||
| 	} | ||||
| 	/* Receive Interrupt Delay */ | ||||
| 	{ | ||||
| 		static struct e1000_option opt = { | ||||
| 			.type = range_option, | ||||
| 			.name = "Receive Interrupt Delay", | ||||
| 			.err  = "using default of " | ||||
| 				__MODULE_STRING(DEFAULT_RDTR), | ||||
| 			.def  = DEFAULT_RDTR, | ||||
| 			.arg  = { .r = { .min = MIN_RXDELAY, | ||||
| 					 .max = MAX_RXDELAY } } | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_RxIntDelay > bd) { | ||||
| 			adapter->rx_int_delay = RxIntDelay[bd]; | ||||
| 			e1000_validate_option(&adapter->rx_int_delay, &opt, | ||||
| 					      adapter); | ||||
| 		} else { | ||||
| 			adapter->rx_int_delay = opt.def; | ||||
| 		} | ||||
| 	} | ||||
| 	/* Receive Absolute Interrupt Delay */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = range_option, | ||||
| 			.name = "Receive Absolute Interrupt Delay", | ||||
| 			.err  = "using default of " | ||||
| 				__MODULE_STRING(DEFAULT_RADV), | ||||
| 			.def  = DEFAULT_RADV, | ||||
| 			.arg  = { .r = { .min = MIN_RXABSDELAY, | ||||
| 					 .max = MAX_RXABSDELAY } } | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_RxAbsIntDelay > bd) { | ||||
| 			adapter->rx_abs_int_delay = RxAbsIntDelay[bd]; | ||||
| 			e1000_validate_option(&adapter->rx_abs_int_delay, &opt, | ||||
| 					      adapter); | ||||
| 		} else { | ||||
| 			adapter->rx_abs_int_delay = opt.def; | ||||
| 		} | ||||
| 	} | ||||
| 	/* Interrupt Throttling Rate */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = range_option, | ||||
| 			.name = "Interrupt Throttling Rate (ints/sec)", | ||||
| 			.err  = "using default of " | ||||
| 				__MODULE_STRING(DEFAULT_ITR), | ||||
| 			.def  = DEFAULT_ITR, | ||||
| 			.arg  = { .r = { .min = MIN_ITR, | ||||
| 					 .max = MAX_ITR } } | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_InterruptThrottleRate > bd) { | ||||
| 			adapter->itr = InterruptThrottleRate[bd]; | ||||
| 
 | ||||
| 			/* Make sure a message is printed for non-special
 | ||||
| 			 * values. And in case of an invalid option, display | ||||
| 			 * warning, use default and go through itr/itr_setting | ||||
| 			 * adjustment logic below | ||||
| 			 */ | ||||
| 			if ((adapter->itr > 4) && | ||||
| 			    e1000_validate_option(&adapter->itr, &opt, adapter)) | ||||
| 				adapter->itr = opt.def; | ||||
| 		} else { | ||||
| 			/* If no option specified, use default value and go
 | ||||
| 			 * through the logic below to adjust itr/itr_setting | ||||
| 			 */ | ||||
| 			adapter->itr = opt.def; | ||||
| 
 | ||||
| 			/* Make sure a message is printed for non-special
 | ||||
| 			 * default values | ||||
| 			 */ | ||||
| 			if (adapter->itr > 4) | ||||
| 				dev_info(&adapter->pdev->dev, | ||||
| 					 "%s set to default %d\n", opt.name, | ||||
| 					 adapter->itr); | ||||
| 		} | ||||
| 
 | ||||
| 		adapter->itr_setting = adapter->itr; | ||||
| 		switch (adapter->itr) { | ||||
| 		case 0: | ||||
| 			dev_info(&adapter->pdev->dev, "%s turned off\n", | ||||
| 				 opt.name); | ||||
| 			break; | ||||
| 		case 1: | ||||
| 			dev_info(&adapter->pdev->dev, | ||||
| 				 "%s set to dynamic mode\n", opt.name); | ||||
| 			adapter->itr = 20000; | ||||
| 			break; | ||||
| 		case 2: | ||||
| 			dev_info(&adapter->pdev->dev, | ||||
| 				 "%s Invalid mode - setting default\n", | ||||
| 				 opt.name); | ||||
| 			adapter->itr_setting = opt.def; | ||||
| 			/* fall-through */ | ||||
| 		case 3: | ||||
| 			dev_info(&adapter->pdev->dev, | ||||
| 				 "%s set to dynamic conservative mode\n", | ||||
| 				 opt.name); | ||||
| 			adapter->itr = 20000; | ||||
| 			break; | ||||
| 		case 4: | ||||
| 			dev_info(&adapter->pdev->dev, | ||||
| 				 "%s set to simplified (2000-8000 ints) mode\n", | ||||
| 				 opt.name); | ||||
| 			break; | ||||
| 		default: | ||||
| 			/* Save the setting, because the dynamic bits
 | ||||
| 			 * change itr. | ||||
| 			 * | ||||
| 			 * Clear the lower two bits because | ||||
| 			 * they are used as control. | ||||
| 			 */ | ||||
| 			adapter->itr_setting &= ~3; | ||||
| 			break; | ||||
| 		} | ||||
| 	} | ||||
| 	/* Interrupt Mode */ | ||||
| 	{ | ||||
| 		static struct e1000_option opt = { | ||||
| 			.type = range_option, | ||||
| 			.name = "Interrupt Mode", | ||||
| #ifndef CONFIG_PCI_MSI | ||||
| 			.err  = "defaulting to 0 (legacy)", | ||||
| 			.def  = E1000E_INT_MODE_LEGACY, | ||||
| 			.arg  = { .r = { .min = 0, | ||||
| 					 .max = 0 } } | ||||
| #endif | ||||
| 		}; | ||||
| 
 | ||||
| #ifdef CONFIG_PCI_MSI | ||||
| 		if (adapter->flags & FLAG_HAS_MSIX) { | ||||
| 			opt.err = kstrdup("defaulting to 2 (MSI-X)", | ||||
| 					  GFP_KERNEL); | ||||
| 			opt.def = E1000E_INT_MODE_MSIX; | ||||
| 			opt.arg.r.max = E1000E_INT_MODE_MSIX; | ||||
| 		} else { | ||||
| 			opt.err = kstrdup("defaulting to 1 (MSI)", GFP_KERNEL); | ||||
| 			opt.def = E1000E_INT_MODE_MSI; | ||||
| 			opt.arg.r.max = E1000E_INT_MODE_MSI; | ||||
| 		} | ||||
| 
 | ||||
| 		if (!opt.err) { | ||||
| 			dev_err(&adapter->pdev->dev, | ||||
| 				"Failed to allocate memory\n"); | ||||
| 			return; | ||||
| 		} | ||||
| #endif | ||||
| 
 | ||||
| 		if (num_IntMode > bd) { | ||||
| 			unsigned int int_mode = IntMode[bd]; | ||||
| 
 | ||||
| 			e1000_validate_option(&int_mode, &opt, adapter); | ||||
| 			adapter->int_mode = int_mode; | ||||
| 		} else { | ||||
| 			adapter->int_mode = opt.def; | ||||
| 		} | ||||
| 
 | ||||
| #ifdef CONFIG_PCI_MSI | ||||
| 		kfree(opt.err); | ||||
| #endif | ||||
| 	} | ||||
| 	/* Smart Power Down */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = enable_option, | ||||
| 			.name = "PHY Smart Power Down", | ||||
| 			.err  = "defaulting to Disabled", | ||||
| 			.def  = OPTION_DISABLED | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_SmartPowerDownEnable > bd) { | ||||
| 			unsigned int spd = SmartPowerDownEnable[bd]; | ||||
| 
 | ||||
| 			e1000_validate_option(&spd, &opt, adapter); | ||||
| 			if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) && spd) | ||||
| 				adapter->flags |= FLAG_SMART_POWER_DOWN; | ||||
| 		} | ||||
| 	} | ||||
| 	/* CRC Stripping */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = enable_option, | ||||
| 			.name = "CRC Stripping", | ||||
| 			.err  = "defaulting to Enabled", | ||||
| 			.def  = OPTION_ENABLED | ||||
| 		}; | ||||
| 
 | ||||
| 		if (num_CrcStripping > bd) { | ||||
| 			unsigned int crc_stripping = CrcStripping[bd]; | ||||
| 
 | ||||
| 			e1000_validate_option(&crc_stripping, &opt, adapter); | ||||
| 			if (crc_stripping == OPTION_ENABLED) { | ||||
| 				adapter->flags2 |= FLAG2_CRC_STRIPPING; | ||||
| 				adapter->flags2 |= FLAG2_DFLT_CRC_STRIPPING; | ||||
| 			} | ||||
| 		} else { | ||||
| 			adapter->flags2 |= FLAG2_CRC_STRIPPING; | ||||
| 			adapter->flags2 |= FLAG2_DFLT_CRC_STRIPPING; | ||||
| 		} | ||||
| 	} | ||||
| 	/* Kumeran Lock Loss Workaround */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = enable_option, | ||||
| 			.name = "Kumeran Lock Loss Workaround", | ||||
| 			.err  = "defaulting to Enabled", | ||||
| 			.def  = OPTION_ENABLED | ||||
| 		}; | ||||
| 		bool enabled = opt.def; | ||||
| 
 | ||||
| 		if (num_KumeranLockLoss > bd) { | ||||
| 			unsigned int kmrn_lock_loss = KumeranLockLoss[bd]; | ||||
| 
 | ||||
| 			e1000_validate_option(&kmrn_lock_loss, &opt, adapter); | ||||
| 			enabled = kmrn_lock_loss; | ||||
| 		} | ||||
| 
 | ||||
| 		if (hw->mac.type == e1000_ich8lan) | ||||
| 			e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, | ||||
| 								     enabled); | ||||
| 	} | ||||
| 	/* Write-protect NVM */ | ||||
| 	{ | ||||
| 		static const struct e1000_option opt = { | ||||
| 			.type = enable_option, | ||||
| 			.name = "Write-protect NVM", | ||||
| 			.err  = "defaulting to Enabled", | ||||
| 			.def  = OPTION_ENABLED | ||||
| 		}; | ||||
| 
 | ||||
| 		if (adapter->flags & FLAG_IS_ICH) { | ||||
| 			if (num_WriteProtectNVM > bd) { | ||||
| 				unsigned int write_protect_nvm = | ||||
| 				    WriteProtectNVM[bd]; | ||||
| 				e1000_validate_option(&write_protect_nvm, &opt, | ||||
| 						      adapter); | ||||
| 				if (write_protect_nvm) | ||||
| 					adapter->flags |= FLAG_READ_ONLY_NVM; | ||||
| 			} else { | ||||
| 				if (opt.def) | ||||
| 					adapter->flags |= FLAG_READ_ONLY_NVM; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										3237
									
								
								drivers/net/ethernet/intel/e1000e/phy.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3237
									
								
								drivers/net/ethernet/intel/e1000e/phy.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										236
									
								
								drivers/net/ethernet/intel/e1000e/phy.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										236
									
								
								drivers/net/ethernet/intel/e1000e/phy.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,236 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_PHY_H_ | ||||
| #define _E1000E_PHY_H_ | ||||
| 
 | ||||
| s32 e1000e_check_downshift(struct e1000_hw *hw); | ||||
| s32 e1000_check_polarity_m88(struct e1000_hw *hw); | ||||
| s32 e1000_check_polarity_igp(struct e1000_hw *hw); | ||||
| s32 e1000_check_polarity_ife(struct e1000_hw *hw); | ||||
| s32 e1000e_check_reset_block_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw); | ||||
| s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw); | ||||
| s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw); | ||||
| s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw); | ||||
| s32 e1000_phy_force_speed_duplex_ife(struct e1000_hw *hw); | ||||
| s32 e1000e_get_cable_length_m88(struct e1000_hw *hw); | ||||
| s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw); | ||||
| s32 e1000e_get_cfg_done_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_get_phy_id(struct e1000_hw *hw); | ||||
| s32 e1000e_get_phy_info_igp(struct e1000_hw *hw); | ||||
| s32 e1000e_get_phy_info_m88(struct e1000_hw *hw); | ||||
| s32 e1000_get_phy_info_ife(struct e1000_hw *hw); | ||||
| s32 e1000e_phy_sw_reset(struct e1000_hw *hw); | ||||
| void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl); | ||||
| s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw); | ||||
| s32 e1000e_phy_reset_dsp(struct e1000_hw *hw); | ||||
| s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page); | ||||
| s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000e_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active); | ||||
| s32 e1000e_setup_copper_link(struct e1000_hw *hw); | ||||
| s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, | ||||
| 				u32 usec_interval, bool *success); | ||||
| s32 e1000e_phy_init_script_igp3(struct e1000_hw *hw); | ||||
| enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id); | ||||
| s32 e1000e_determine_phy_address(struct e1000_hw *hw); | ||||
| s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg); | ||||
| s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg); | ||||
| s32 e1000e_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000e_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| void e1000_power_up_phy_copper(struct e1000_hw *hw); | ||||
| void e1000_power_down_phy_copper(struct e1000_hw *hw); | ||||
| s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data); | ||||
| s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data); | ||||
| s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw); | ||||
| s32 e1000_copper_link_setup_82577(struct e1000_hw *hw); | ||||
| s32 e1000_check_polarity_82577(struct e1000_hw *hw); | ||||
| s32 e1000_get_phy_info_82577(struct e1000_hw *hw); | ||||
| s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw); | ||||
| s32 e1000_get_cable_length_82577(struct e1000_hw *hw); | ||||
| 
 | ||||
| #define E1000_MAX_PHY_ADDR		8 | ||||
| 
 | ||||
| /* IGP01E1000 Specific Registers */ | ||||
| #define IGP01E1000_PHY_PORT_CONFIG	0x10	/* Port Config */ | ||||
| #define IGP01E1000_PHY_PORT_STATUS	0x11	/* Status */ | ||||
| #define IGP01E1000_PHY_PORT_CTRL	0x12	/* Control */ | ||||
| #define IGP01E1000_PHY_LINK_HEALTH	0x13	/* PHY Link Health */ | ||||
| #define IGP02E1000_PHY_POWER_MGMT	0x19	/* Power Management */ | ||||
| #define IGP01E1000_PHY_PAGE_SELECT	0x1F	/* Page Select */ | ||||
| #define BM_PHY_PAGE_SELECT		22	/* Page Select for BM */ | ||||
| #define IGP_PAGE_SHIFT			5 | ||||
| #define PHY_REG_MASK			0x1F | ||||
| 
 | ||||
| /* BM/HV Specific Registers */ | ||||
| #define BM_PORT_CTRL_PAGE		769 | ||||
| #define BM_WUC_PAGE			800 | ||||
| #define BM_WUC_ADDRESS_OPCODE		0x11 | ||||
| #define BM_WUC_DATA_OPCODE		0x12 | ||||
| #define BM_WUC_ENABLE_PAGE		BM_PORT_CTRL_PAGE | ||||
| #define BM_WUC_ENABLE_REG		17 | ||||
| #define BM_WUC_ENABLE_BIT		(1 << 2) | ||||
| #define BM_WUC_HOST_WU_BIT		(1 << 4) | ||||
| #define BM_WUC_ME_WU_BIT		(1 << 5) | ||||
| 
 | ||||
| #define PHY_UPPER_SHIFT			21 | ||||
| #define BM_PHY_REG(page, reg) \ | ||||
| 	(((reg) & MAX_PHY_REG_ADDRESS) |\ | ||||
| 	 (((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\ | ||||
| 	 (((reg) & ~MAX_PHY_REG_ADDRESS) << (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT))) | ||||
| #define BM_PHY_REG_PAGE(offset) \ | ||||
| 	((u16)(((offset) >> PHY_PAGE_SHIFT) & 0xFFFF)) | ||||
| #define BM_PHY_REG_NUM(offset) \ | ||||
| 	((u16)(((offset) & MAX_PHY_REG_ADDRESS) |\ | ||||
| 	 (((offset) >> (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)) &\ | ||||
| 		~MAX_PHY_REG_ADDRESS))) | ||||
| 
 | ||||
| #define HV_INTC_FC_PAGE_START		768 | ||||
| #define I82578_ADDR_REG			29 | ||||
| #define I82577_ADDR_REG			16 | ||||
| #define I82577_CFG_REG			22 | ||||
| #define I82577_CFG_ASSERT_CRS_ON_TX	(1 << 15) | ||||
| #define I82577_CFG_ENABLE_DOWNSHIFT	(3 << 10)	/* auto downshift */ | ||||
| #define I82577_CTRL_REG			23 | ||||
| 
 | ||||
| /* 82577 specific PHY registers */ | ||||
| #define I82577_PHY_CTRL_2		18 | ||||
| #define I82577_PHY_LBK_CTRL		19 | ||||
| #define I82577_PHY_STATUS_2		26 | ||||
| #define I82577_PHY_DIAG_STATUS		31 | ||||
| 
 | ||||
| /* I82577 PHY Status 2 */ | ||||
| #define I82577_PHY_STATUS2_REV_POLARITY		0x0400 | ||||
| #define I82577_PHY_STATUS2_MDIX			0x0800 | ||||
| #define I82577_PHY_STATUS2_SPEED_MASK		0x0300 | ||||
| #define I82577_PHY_STATUS2_SPEED_1000MBPS	0x0200 | ||||
| 
 | ||||
| /* I82577 PHY Control 2 */ | ||||
| #define I82577_PHY_CTRL2_MANUAL_MDIX		0x0200 | ||||
| #define I82577_PHY_CTRL2_AUTO_MDI_MDIX		0x0400 | ||||
| #define I82577_PHY_CTRL2_MDIX_CFG_MASK		0x0600 | ||||
| 
 | ||||
| /* I82577 PHY Diagnostics Status */ | ||||
| #define I82577_DSTATUS_CABLE_LENGTH		0x03FC | ||||
| #define I82577_DSTATUS_CABLE_LENGTH_SHIFT	2 | ||||
| 
 | ||||
| /* BM PHY Copper Specific Control 1 */ | ||||
| #define BM_CS_CTRL1			16 | ||||
| 
 | ||||
| /* BM PHY Copper Specific Status */ | ||||
| #define BM_CS_STATUS			17 | ||||
| #define BM_CS_STATUS_LINK_UP		0x0400 | ||||
| #define BM_CS_STATUS_RESOLVED		0x0800 | ||||
| #define BM_CS_STATUS_SPEED_MASK		0xC000 | ||||
| #define BM_CS_STATUS_SPEED_1000		0x8000 | ||||
| 
 | ||||
| /* 82577 Mobile Phy Status Register */ | ||||
| #define HV_M_STATUS			26 | ||||
| #define HV_M_STATUS_AUTONEG_COMPLETE	0x1000 | ||||
| #define HV_M_STATUS_SPEED_MASK		0x0300 | ||||
| #define HV_M_STATUS_SPEED_1000		0x0200 | ||||
| #define HV_M_STATUS_SPEED_100		0x0100 | ||||
| #define HV_M_STATUS_LINK_UP		0x0040 | ||||
| 
 | ||||
| #define IGP01E1000_PHY_PCS_INIT_REG	0x00B4 | ||||
| #define IGP01E1000_PHY_POLARITY_MASK	0x0078 | ||||
| 
 | ||||
| #define IGP01E1000_PSCR_AUTO_MDIX	0x1000 | ||||
| #define IGP01E1000_PSCR_FORCE_MDI_MDIX	0x2000	/* 0=MDI, 1=MDIX */ | ||||
| 
 | ||||
| #define IGP01E1000_PSCFR_SMART_SPEED	0x0080 | ||||
| 
 | ||||
| #define IGP02E1000_PM_SPD		0x0001	/* Smart Power Down */ | ||||
| #define IGP02E1000_PM_D0_LPLU		0x0002	/* For D0a states */ | ||||
| #define IGP02E1000_PM_D3_LPLU		0x0004	/* For all other states */ | ||||
| 
 | ||||
| #define IGP01E1000_PLHR_SS_DOWNGRADE	0x8000 | ||||
| 
 | ||||
| #define IGP01E1000_PSSR_POLARITY_REVERSED	0x0002 | ||||
| #define IGP01E1000_PSSR_MDIX		0x0800 | ||||
| #define IGP01E1000_PSSR_SPEED_MASK	0xC000 | ||||
| #define IGP01E1000_PSSR_SPEED_1000MBPS	0xC000 | ||||
| 
 | ||||
| #define IGP02E1000_PHY_CHANNEL_NUM	4 | ||||
| #define IGP02E1000_PHY_AGC_A		0x11B1 | ||||
| #define IGP02E1000_PHY_AGC_B		0x12B1 | ||||
| #define IGP02E1000_PHY_AGC_C		0x14B1 | ||||
| #define IGP02E1000_PHY_AGC_D		0x18B1 | ||||
| 
 | ||||
| #define IGP02E1000_AGC_LENGTH_SHIFT	9	/* Course=15:13, Fine=12:9 */ | ||||
| #define IGP02E1000_AGC_LENGTH_MASK	0x7F | ||||
| #define IGP02E1000_AGC_RANGE		15 | ||||
| 
 | ||||
| #define E1000_CABLE_LENGTH_UNDEFINED	0xFF | ||||
| 
 | ||||
| #define E1000_KMRNCTRLSTA_OFFSET	0x001F0000 | ||||
| #define E1000_KMRNCTRLSTA_OFFSET_SHIFT	16 | ||||
| #define E1000_KMRNCTRLSTA_REN		0x00200000 | ||||
| #define E1000_KMRNCTRLSTA_CTRL_OFFSET	0x1	/* Kumeran Control */ | ||||
| #define E1000_KMRNCTRLSTA_DIAG_OFFSET	0x3	/* Kumeran Diagnostic */ | ||||
| #define E1000_KMRNCTRLSTA_TIMEOUTS	0x4	/* Kumeran Timeouts */ | ||||
| #define E1000_KMRNCTRLSTA_INBAND_PARAM	0x9	/* Kumeran InBand Parameters */ | ||||
| #define E1000_KMRNCTRLSTA_IBIST_DISABLE	0x0200	/* Kumeran IBIST Disable */ | ||||
| #define E1000_KMRNCTRLSTA_DIAG_NELPBK	0x1000	/* Nearend Loopback mode */ | ||||
| #define E1000_KMRNCTRLSTA_K1_CONFIG	0x7 | ||||
| #define E1000_KMRNCTRLSTA_K1_ENABLE	0x0002	/* enable K1 */ | ||||
| #define E1000_KMRNCTRLSTA_HD_CTRL	0x10	/* Kumeran HD Control */ | ||||
| 
 | ||||
| #define IFE_PHY_EXTENDED_STATUS_CONTROL	0x10 | ||||
| #define IFE_PHY_SPECIAL_CONTROL		0x11	/* 100BaseTx PHY Special Ctrl */ | ||||
| #define IFE_PHY_SPECIAL_CONTROL_LED	0x1B	/* PHY Special and LED Ctrl */ | ||||
| #define IFE_PHY_MDIX_CONTROL		0x1C	/* MDI/MDI-X Control */ | ||||
| 
 | ||||
| /* IFE PHY Extended Status Control */ | ||||
| #define IFE_PESC_POLARITY_REVERSED	0x0100 | ||||
| 
 | ||||
| /* IFE PHY Special Control */ | ||||
| #define IFE_PSC_AUTO_POLARITY_DISABLE	0x0010 | ||||
| #define IFE_PSC_FORCE_POLARITY		0x0020 | ||||
| 
 | ||||
| /* IFE PHY Special Control and LED Control */ | ||||
| #define IFE_PSCL_PROBE_MODE		0x0020 | ||||
| #define IFE_PSCL_PROBE_LEDS_OFF		0x0006	/* Force LEDs 0 and 2 off */ | ||||
| #define IFE_PSCL_PROBE_LEDS_ON		0x0007	/* Force LEDs 0 and 2 on */ | ||||
| 
 | ||||
| /* IFE PHY MDIX Control */ | ||||
| #define IFE_PMC_MDIX_STATUS		0x0020	/* 1=MDI-X, 0=MDI */ | ||||
| #define IFE_PMC_FORCE_MDIX		0x0040	/* 1=force MDI-X, 0=force MDI */ | ||||
| #define IFE_PMC_AUTO_MDIX		0x0080	/* 1=enable auto, 0=disable */ | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										275
									
								
								drivers/net/ethernet/intel/e1000e/ptp.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										275
									
								
								drivers/net/ethernet/intel/e1000e/ptp.c
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,275 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| /* PTP 1588 Hardware Clock (PHC)
 | ||||
|  * Derived from PTP Hardware Clock driver for Intel 82576 and 82580 (igb) | ||||
|  * Copyright (C) 2011 Richard Cochran <richardcochran@gmail.com> | ||||
|  */ | ||||
| 
 | ||||
| #include "e1000.h" | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_phc_adjfreq - adjust the frequency of the hardware clock | ||||
|  * @ptp: ptp clock structure | ||||
|  * @delta: Desired frequency change in parts per billion | ||||
|  * | ||||
|  * Adjust the frequency of the PHC cycle counter by the indicated delta from | ||||
|  * the base frequency. | ||||
|  **/ | ||||
| static int e1000e_phc_adjfreq(struct ptp_clock_info *ptp, s32 delta) | ||||
| { | ||||
| 	struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, | ||||
| 						     ptp_clock_info); | ||||
| 	struct e1000_hw *hw = &adapter->hw; | ||||
| 	bool neg_adj = false; | ||||
| 	unsigned long flags; | ||||
| 	u64 adjustment; | ||||
| 	u32 timinca, incvalue; | ||||
| 	s32 ret_val; | ||||
| 
 | ||||
| 	if ((delta > ptp->max_adj) || (delta <= -1000000000)) | ||||
| 		return -EINVAL; | ||||
| 
 | ||||
| 	if (delta < 0) { | ||||
| 		neg_adj = true; | ||||
| 		delta = -delta; | ||||
| 	} | ||||
| 
 | ||||
| 	/* Get the System Time Register SYSTIM base frequency */ | ||||
| 	ret_val = e1000e_get_base_timinca(adapter, &timinca); | ||||
| 	if (ret_val) | ||||
| 		return ret_val; | ||||
| 
 | ||||
| 	spin_lock_irqsave(&adapter->systim_lock, flags); | ||||
| 
 | ||||
| 	incvalue = timinca & E1000_TIMINCA_INCVALUE_MASK; | ||||
| 
 | ||||
| 	adjustment = incvalue; | ||||
| 	adjustment *= delta; | ||||
| 	adjustment = div_u64(adjustment, 1000000000); | ||||
| 
 | ||||
| 	incvalue = neg_adj ? (incvalue - adjustment) : (incvalue + adjustment); | ||||
| 
 | ||||
| 	timinca &= ~E1000_TIMINCA_INCVALUE_MASK; | ||||
| 	timinca |= incvalue; | ||||
| 
 | ||||
| 	ew32(TIMINCA, timinca); | ||||
| 
 | ||||
| 	spin_unlock_irqrestore(&adapter->systim_lock, flags); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_phc_adjtime - Shift the time of the hardware clock | ||||
|  * @ptp: ptp clock structure | ||||
|  * @delta: Desired change in nanoseconds | ||||
|  * | ||||
|  * Adjust the timer by resetting the timecounter structure. | ||||
|  **/ | ||||
| static int e1000e_phc_adjtime(struct ptp_clock_info *ptp, s64 delta) | ||||
| { | ||||
| 	struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, | ||||
| 						     ptp_clock_info); | ||||
| 	unsigned long flags; | ||||
| 	s64 now; | ||||
| 
 | ||||
| 	spin_lock_irqsave(&adapter->systim_lock, flags); | ||||
| 	now = timecounter_read(&adapter->tc); | ||||
| 	now += delta; | ||||
| 	timecounter_init(&adapter->tc, &adapter->cc, now); | ||||
| 	spin_unlock_irqrestore(&adapter->systim_lock, flags); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_phc_gettime - Reads the current time from the hardware clock | ||||
|  * @ptp: ptp clock structure | ||||
|  * @ts: timespec structure to hold the current time value | ||||
|  * | ||||
|  * Read the timecounter and return the correct value in ns after converting | ||||
|  * it into a struct timespec. | ||||
|  **/ | ||||
| static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec *ts) | ||||
| { | ||||
| 	struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, | ||||
| 						     ptp_clock_info); | ||||
| 	unsigned long flags; | ||||
| 	u32 remainder; | ||||
| 	u64 ns; | ||||
| 
 | ||||
| 	spin_lock_irqsave(&adapter->systim_lock, flags); | ||||
| 	ns = timecounter_read(&adapter->tc); | ||||
| 	spin_unlock_irqrestore(&adapter->systim_lock, flags); | ||||
| 
 | ||||
| 	ts->tv_sec = div_u64_rem(ns, NSEC_PER_SEC, &remainder); | ||||
| 	ts->tv_nsec = remainder; | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_phc_settime - Set the current time on the hardware clock | ||||
|  * @ptp: ptp clock structure | ||||
|  * @ts: timespec containing the new time for the cycle counter | ||||
|  * | ||||
|  * Reset the timecounter to use a new base value instead of the kernel | ||||
|  * wall timer value. | ||||
|  **/ | ||||
| static int e1000e_phc_settime(struct ptp_clock_info *ptp, | ||||
| 			      const struct timespec *ts) | ||||
| { | ||||
| 	struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, | ||||
| 						     ptp_clock_info); | ||||
| 	unsigned long flags; | ||||
| 	u64 ns; | ||||
| 
 | ||||
| 	ns = timespec_to_ns(ts); | ||||
| 
 | ||||
| 	/* reset the timecounter */ | ||||
| 	spin_lock_irqsave(&adapter->systim_lock, flags); | ||||
| 	timecounter_init(&adapter->tc, &adapter->cc, ns); | ||||
| 	spin_unlock_irqrestore(&adapter->systim_lock, flags); | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_phc_enable - enable or disable an ancillary feature | ||||
|  * @ptp: ptp clock structure | ||||
|  * @request: Desired resource to enable or disable | ||||
|  * @on: Caller passes one to enable or zero to disable | ||||
|  * | ||||
|  * Enable (or disable) ancillary features of the PHC subsystem. | ||||
|  * Currently, no ancillary features are supported. | ||||
|  **/ | ||||
| static int e1000e_phc_enable(struct ptp_clock_info __always_unused *ptp, | ||||
| 			     struct ptp_clock_request __always_unused *request, | ||||
| 			     int __always_unused on) | ||||
| { | ||||
| 	return -EOPNOTSUPP; | ||||
| } | ||||
| 
 | ||||
| static void e1000e_systim_overflow_work(struct work_struct *work) | ||||
| { | ||||
| 	struct e1000_adapter *adapter = container_of(work, struct e1000_adapter, | ||||
| 						     systim_overflow_work.work); | ||||
| 	struct e1000_hw *hw = &adapter->hw; | ||||
| 	struct timespec ts; | ||||
| 
 | ||||
| 	adapter->ptp_clock_info.gettime(&adapter->ptp_clock_info, &ts); | ||||
| 
 | ||||
| 	e_dbg("SYSTIM overflow check at %ld.%09lu\n", ts.tv_sec, ts.tv_nsec); | ||||
| 
 | ||||
| 	schedule_delayed_work(&adapter->systim_overflow_work, | ||||
| 			      E1000_SYSTIM_OVERFLOW_PERIOD); | ||||
| } | ||||
| 
 | ||||
| static const struct ptp_clock_info e1000e_ptp_clock_info = { | ||||
| 	.owner		= THIS_MODULE, | ||||
| 	.n_alarm	= 0, | ||||
| 	.n_ext_ts	= 0, | ||||
| 	.n_per_out	= 0, | ||||
| 	.n_pins		= 0, | ||||
| 	.pps		= 0, | ||||
| 	.adjfreq	= e1000e_phc_adjfreq, | ||||
| 	.adjtime	= e1000e_phc_adjtime, | ||||
| 	.gettime	= e1000e_phc_gettime, | ||||
| 	.settime	= e1000e_phc_settime, | ||||
| 	.enable		= e1000e_phc_enable, | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_ptp_init - initialize PTP for devices which support it | ||||
|  * @adapter: board private structure | ||||
|  * | ||||
|  * This function performs the required steps for enabling PTP support. | ||||
|  * If PTP support has already been loaded it simply calls the cyclecounter | ||||
|  * init routine and exits. | ||||
|  **/ | ||||
| void e1000e_ptp_init(struct e1000_adapter *adapter) | ||||
| { | ||||
| 	struct e1000_hw *hw = &adapter->hw; | ||||
| 
 | ||||
| 	adapter->ptp_clock = NULL; | ||||
| 
 | ||||
| 	if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP)) | ||||
| 		return; | ||||
| 
 | ||||
| 	adapter->ptp_clock_info = e1000e_ptp_clock_info; | ||||
| 
 | ||||
| 	snprintf(adapter->ptp_clock_info.name, | ||||
| 		 sizeof(adapter->ptp_clock_info.name), "%pm", | ||||
| 		 adapter->netdev->perm_addr); | ||||
| 
 | ||||
| 	switch (hw->mac.type) { | ||||
| 	case e1000_pch2lan: | ||||
| 	case e1000_pch_lpt: | ||||
| 		if ((hw->mac.type != e1000_pch_lpt) || | ||||
| 		    (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) { | ||||
| 			adapter->ptp_clock_info.max_adj = 24000000 - 1; | ||||
| 			break; | ||||
| 		} | ||||
| 		/* fall-through */ | ||||
| 	case e1000_82574: | ||||
| 	case e1000_82583: | ||||
| 		adapter->ptp_clock_info.max_adj = 600000000 - 1; | ||||
| 		break; | ||||
| 	default: | ||||
| 		break; | ||||
| 	} | ||||
| 
 | ||||
| 	INIT_DELAYED_WORK(&adapter->systim_overflow_work, | ||||
| 			  e1000e_systim_overflow_work); | ||||
| 
 | ||||
| 	schedule_delayed_work(&adapter->systim_overflow_work, | ||||
| 			      E1000_SYSTIM_OVERFLOW_PERIOD); | ||||
| 
 | ||||
| 	adapter->ptp_clock = ptp_clock_register(&adapter->ptp_clock_info, | ||||
| 						&adapter->pdev->dev); | ||||
| 	if (IS_ERR(adapter->ptp_clock)) { | ||||
| 		adapter->ptp_clock = NULL; | ||||
| 		e_err("ptp_clock_register failed\n"); | ||||
| 	} else { | ||||
| 		e_info("registered PHC clock\n"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * e1000e_ptp_remove - disable PTP device and stop the overflow check | ||||
|  * @adapter: board private structure | ||||
|  * | ||||
|  * Stop the PTP support, and cancel the delayed work. | ||||
|  **/ | ||||
| void e1000e_ptp_remove(struct e1000_adapter *adapter) | ||||
| { | ||||
| 	if (!(adapter->flags & FLAG_HAS_HW_TIMESTAMP)) | ||||
| 		return; | ||||
| 
 | ||||
| 	cancel_delayed_work_sync(&adapter->systim_overflow_work); | ||||
| 
 | ||||
| 	if (adapter->ptp_clock) { | ||||
| 		ptp_clock_unregister(adapter->ptp_clock); | ||||
| 		adapter->ptp_clock = NULL; | ||||
| 		e_info("removed PHC\n"); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										247
									
								
								drivers/net/ethernet/intel/e1000e/regs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										247
									
								
								drivers/net/ethernet/intel/e1000e/regs.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,247 @@ | |||
| /* Intel PRO/1000 Linux driver
 | ||||
|  * Copyright(c) 1999 - 2014 Intel Corporation. | ||||
|  * | ||||
|  * This program is free software; you can redistribute it and/or modify it | ||||
|  * under the terms and conditions of the GNU General Public License, | ||||
|  * version 2, as published by the Free Software Foundation. | ||||
|  * | ||||
|  * This program is distributed in the hope it will be useful, but WITHOUT | ||||
|  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
|  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for | ||||
|  * more details. | ||||
|  * | ||||
|  * The full GNU General Public License is included in this distribution in | ||||
|  * the file called "COPYING". | ||||
|  * | ||||
|  * Contact Information: | ||||
|  * Linux NICS <linux.nics@intel.com> | ||||
|  * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> | ||||
|  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef _E1000E_REGS_H_ | ||||
| #define _E1000E_REGS_H_ | ||||
| 
 | ||||
| #define E1000_CTRL	0x00000	/* Device Control - RW */ | ||||
| #define E1000_STATUS	0x00008	/* Device Status - RO */ | ||||
| #define E1000_EECD	0x00010	/* EEPROM/Flash Control - RW */ | ||||
| #define E1000_EERD	0x00014	/* EEPROM Read - RW */ | ||||
| #define E1000_CTRL_EXT	0x00018	/* Extended Device Control - RW */ | ||||
| #define E1000_FLA	0x0001C	/* Flash Access - RW */ | ||||
| #define E1000_MDIC	0x00020	/* MDI Control - RW */ | ||||
| #define E1000_SCTL	0x00024	/* SerDes Control - RW */ | ||||
| #define E1000_FCAL	0x00028	/* Flow Control Address Low - RW */ | ||||
| #define E1000_FCAH	0x0002C	/* Flow Control Address High -RW */ | ||||
| #define E1000_FEXT	0x0002C	/* Future Extended - RW */ | ||||
| #define E1000_FEXTNVM	0x00028	/* Future Extended NVM - RW */ | ||||
| #define E1000_FEXTNVM3	0x0003C	/* Future Extended NVM 3 - RW */ | ||||
| #define E1000_FEXTNVM4	0x00024	/* Future Extended NVM 4 - RW */ | ||||
| #define E1000_FEXTNVM6	0x00010	/* Future Extended NVM 6 - RW */ | ||||
| #define E1000_FEXTNVM7	0x000E4	/* Future Extended NVM 7 - RW */ | ||||
| #define E1000_FCT	0x00030	/* Flow Control Type - RW */ | ||||
| #define E1000_VET	0x00038	/* VLAN Ether Type - RW */ | ||||
| #define E1000_ICR	0x000C0	/* Interrupt Cause Read - R/clr */ | ||||
| #define E1000_ITR	0x000C4	/* Interrupt Throttling Rate - RW */ | ||||
| #define E1000_ICS	0x000C8	/* Interrupt Cause Set - WO */ | ||||
| #define E1000_IMS	0x000D0	/* Interrupt Mask Set - RW */ | ||||
| #define E1000_IMC	0x000D8	/* Interrupt Mask Clear - WO */ | ||||
| #define E1000_IAM	0x000E0	/* Interrupt Acknowledge Auto Mask */ | ||||
| #define E1000_IVAR	0x000E4	/* Interrupt Vector Allocation Register - RW */ | ||||
| #define E1000_SVCR	0x000F0 | ||||
| #define E1000_SVT	0x000F4 | ||||
| #define E1000_LPIC	0x000FC	/* Low Power IDLE control */ | ||||
| #define E1000_RCTL	0x00100	/* Rx Control - RW */ | ||||
| #define E1000_FCTTV	0x00170	/* Flow Control Transmit Timer Value - RW */ | ||||
| #define E1000_TXCW	0x00178	/* Tx Configuration Word - RW */ | ||||
| #define E1000_RXCW	0x00180	/* Rx Configuration Word - RO */ | ||||
| #define E1000_PBA_ECC	0x01100	/* PBA ECC Register */ | ||||
| #define E1000_TCTL	0x00400	/* Tx Control - RW */ | ||||
| #define E1000_TCTL_EXT	0x00404	/* Extended Tx Control - RW */ | ||||
| #define E1000_TIPG	0x00410	/* Tx Inter-packet gap -RW */ | ||||
| #define E1000_AIT	0x00458	/* Adaptive Interframe Spacing Throttle - RW */ | ||||
| #define E1000_LEDCTL	0x00E00	/* LED Control - RW */ | ||||
| #define E1000_EXTCNF_CTRL	0x00F00	/* Extended Configuration Control */ | ||||
| #define E1000_EXTCNF_SIZE	0x00F08	/* Extended Configuration Size */ | ||||
| #define E1000_PHY_CTRL	0x00F10	/* PHY Control Register in CSR */ | ||||
| #define E1000_POEMB	E1000_PHY_CTRL	/* PHY OEM Bits */ | ||||
| #define E1000_PBA	0x01000	/* Packet Buffer Allocation - RW */ | ||||
| #define E1000_PBS	0x01008	/* Packet Buffer Size */ | ||||
| #define E1000_PBECCSTS	0x0100C	/* Packet Buffer ECC Status - RW */ | ||||
| #define E1000_EEMNGCTL	0x01010	/* MNG EEprom Control */ | ||||
| #define E1000_EEWR	0x0102C	/* EEPROM Write Register - RW */ | ||||
| #define E1000_FLOP	0x0103C	/* FLASH Opcode Register */ | ||||
| #define E1000_ERT	0x02008	/* Early Rx Threshold - RW */ | ||||
| #define E1000_FCRTL	0x02160	/* Flow Control Receive Threshold Low - RW */ | ||||
| #define E1000_FCRTH	0x02168	/* Flow Control Receive Threshold High - RW */ | ||||
| #define E1000_PSRCTL	0x02170	/* Packet Split Receive Control - RW */ | ||||
| #define E1000_RDFH	0x02410	/* Rx Data FIFO Head - RW */ | ||||
| #define E1000_RDFT	0x02418	/* Rx Data FIFO Tail - RW */ | ||||
| #define E1000_RDFHS	0x02420	/* Rx Data FIFO Head Saved - RW */ | ||||
| #define E1000_RDFTS	0x02428	/* Rx Data FIFO Tail Saved - RW */ | ||||
| #define E1000_RDFPC	0x02430	/* Rx Data FIFO Packet Count - RW */ | ||||
| /* Split and Replication Rx Control - RW */ | ||||
| #define E1000_RDTR	0x02820	/* Rx Delay Timer - RW */ | ||||
| #define E1000_RADV	0x0282C	/* Rx Interrupt Absolute Delay Timer - RW */ | ||||
| /* Convenience macros
 | ||||
|  * | ||||
|  * Note: "_n" is the queue number of the register to be written to. | ||||
|  * | ||||
|  * Example usage: | ||||
|  * E1000_RDBAL_REG(current_rx_queue) | ||||
|  */ | ||||
| #define E1000_RDBAL(_n)	((_n) < 4 ? (0x02800 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0C000 + ((_n) * 0x40))) | ||||
| #define E1000_RDBAH(_n)	((_n) < 4 ? (0x02804 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0C004 + ((_n) * 0x40))) | ||||
| #define E1000_RDLEN(_n)	((_n) < 4 ? (0x02808 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0C008 + ((_n) * 0x40))) | ||||
| #define E1000_RDH(_n)	((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0C010 + ((_n) * 0x40))) | ||||
| #define E1000_RDT(_n)	((_n) < 4 ? (0x02818 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0C018 + ((_n) * 0x40))) | ||||
| #define E1000_RXDCTL(_n)	((_n) < 4 ? (0x02828 + ((_n) * 0x100)) : \ | ||||
| 				 (0x0C028 + ((_n) * 0x40))) | ||||
| #define E1000_TDBAL(_n)	((_n) < 4 ? (0x03800 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0E000 + ((_n) * 0x40))) | ||||
| #define E1000_TDBAH(_n)	((_n) < 4 ? (0x03804 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0E004 + ((_n) * 0x40))) | ||||
| #define E1000_TDLEN(_n)	((_n) < 4 ? (0x03808 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0E008 + ((_n) * 0x40))) | ||||
| #define E1000_TDH(_n)	((_n) < 4 ? (0x03810 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0E010 + ((_n) * 0x40))) | ||||
| #define E1000_TDT(_n)	((_n) < 4 ? (0x03818 + ((_n) * 0x100)) : \ | ||||
| 			 (0x0E018 + ((_n) * 0x40))) | ||||
| #define E1000_TXDCTL(_n)	((_n) < 4 ? (0x03828 + ((_n) * 0x100)) : \ | ||||
| 				 (0x0E028 + ((_n) * 0x40))) | ||||
| #define E1000_TARC(_n)		(0x03840 + ((_n) * 0x100)) | ||||
| #define E1000_KABGTXD		0x03004	/* AFE Band Gap Transmit Ref Data */ | ||||
| #define E1000_RAL(_i)		(((_i) <= 15) ? (0x05400 + ((_i) * 8)) : \ | ||||
| 				 (0x054E0 + ((_i - 16) * 8))) | ||||
| #define E1000_RAH(_i)		(((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \ | ||||
| 				 (0x054E4 + ((_i - 16) * 8))) | ||||
| #define E1000_SHRAL(_i)		(0x05438 + ((_i) * 8)) | ||||
| #define E1000_SHRAH(_i)		(0x0543C + ((_i) * 8)) | ||||
| #define E1000_TDFH		0x03410	/* Tx Data FIFO Head - RW */ | ||||
| #define E1000_TDFT		0x03418	/* Tx Data FIFO Tail - RW */ | ||||
| #define E1000_TDFHS		0x03420	/* Tx Data FIFO Head Saved - RW */ | ||||
| #define E1000_TDFTS		0x03428	/* Tx Data FIFO Tail Saved - RW */ | ||||
| #define E1000_TDFPC		0x03430	/* Tx Data FIFO Packet Count - RW */ | ||||
| #define E1000_TIDV	0x03820	/* Tx Interrupt Delay Value - RW */ | ||||
| #define E1000_TADV	0x0382C	/* Tx Interrupt Absolute Delay Val - RW */ | ||||
| #define E1000_CRCERRS	0x04000	/* CRC Error Count - R/clr */ | ||||
| #define E1000_ALGNERRC	0x04004	/* Alignment Error Count - R/clr */ | ||||
| #define E1000_SYMERRS	0x04008	/* Symbol Error Count - R/clr */ | ||||
| #define E1000_RXERRC	0x0400C	/* Receive Error Count - R/clr */ | ||||
| #define E1000_MPC	0x04010	/* Missed Packet Count - R/clr */ | ||||
| #define E1000_SCC	0x04014	/* Single Collision Count - R/clr */ | ||||
| #define E1000_ECOL	0x04018	/* Excessive Collision Count - R/clr */ | ||||
| #define E1000_MCC	0x0401C	/* Multiple Collision Count - R/clr */ | ||||
| #define E1000_LATECOL	0x04020	/* Late Collision Count - R/clr */ | ||||
| #define E1000_COLC	0x04028	/* Collision Count - R/clr */ | ||||
| #define E1000_DC	0x04030	/* Defer Count - R/clr */ | ||||
| #define E1000_TNCRS	0x04034	/* Tx-No CRS - R/clr */ | ||||
| #define E1000_SEC	0x04038	/* Sequence Error Count - R/clr */ | ||||
| #define E1000_CEXTERR	0x0403C	/* Carrier Extension Error Count - R/clr */ | ||||
| #define E1000_RLEC	0x04040	/* Receive Length Error Count - R/clr */ | ||||
| #define E1000_XONRXC	0x04048	/* XON Rx Count - R/clr */ | ||||
| #define E1000_XONTXC	0x0404C	/* XON Tx Count - R/clr */ | ||||
| #define E1000_XOFFRXC	0x04050	/* XOFF Rx Count - R/clr */ | ||||
| #define E1000_XOFFTXC	0x04054	/* XOFF Tx Count - R/clr */ | ||||
| #define E1000_FCRUC	0x04058	/* Flow Control Rx Unsupported Count- R/clr */ | ||||
| #define E1000_PRC64	0x0405C	/* Packets Rx (64 bytes) - R/clr */ | ||||
| #define E1000_PRC127	0x04060	/* Packets Rx (65-127 bytes) - R/clr */ | ||||
| #define E1000_PRC255	0x04064	/* Packets Rx (128-255 bytes) - R/clr */ | ||||
| #define E1000_PRC511	0x04068	/* Packets Rx (255-511 bytes) - R/clr */ | ||||
| #define E1000_PRC1023	0x0406C	/* Packets Rx (512-1023 bytes) - R/clr */ | ||||
| #define E1000_PRC1522	0x04070	/* Packets Rx (1024-1522 bytes) - R/clr */ | ||||
| #define E1000_GPRC	0x04074	/* Good Packets Rx Count - R/clr */ | ||||
| #define E1000_BPRC	0x04078	/* Broadcast Packets Rx Count - R/clr */ | ||||
| #define E1000_MPRC	0x0407C	/* Multicast Packets Rx Count - R/clr */ | ||||
| #define E1000_GPTC	0x04080	/* Good Packets Tx Count - R/clr */ | ||||
| #define E1000_GORCL	0x04088	/* Good Octets Rx Count Low - R/clr */ | ||||
| #define E1000_GORCH	0x0408C	/* Good Octets Rx Count High - R/clr */ | ||||
| #define E1000_GOTCL	0x04090	/* Good Octets Tx Count Low - R/clr */ | ||||
| #define E1000_GOTCH	0x04094	/* Good Octets Tx Count High - R/clr */ | ||||
| #define E1000_RNBC	0x040A0	/* Rx No Buffers Count - R/clr */ | ||||
| #define E1000_RUC	0x040A4	/* Rx Undersize Count - R/clr */ | ||||
| #define E1000_RFC	0x040A8	/* Rx Fragment Count - R/clr */ | ||||
| #define E1000_ROC	0x040AC	/* Rx Oversize Count - R/clr */ | ||||
| #define E1000_RJC	0x040B0	/* Rx Jabber Count - R/clr */ | ||||
| #define E1000_MGTPRC	0x040B4	/* Management Packets Rx Count - R/clr */ | ||||
| #define E1000_MGTPDC	0x040B8	/* Management Packets Dropped Count - R/clr */ | ||||
| #define E1000_MGTPTC	0x040BC	/* Management Packets Tx Count - R/clr */ | ||||
| #define E1000_TORL	0x040C0	/* Total Octets Rx Low - R/clr */ | ||||
| #define E1000_TORH	0x040C4	/* Total Octets Rx High - R/clr */ | ||||
| #define E1000_TOTL	0x040C8	/* Total Octets Tx Low - R/clr */ | ||||
| #define E1000_TOTH	0x040CC	/* Total Octets Tx High - R/clr */ | ||||
| #define E1000_TPR	0x040D0	/* Total Packets Rx - R/clr */ | ||||
| #define E1000_TPT	0x040D4	/* Total Packets Tx - R/clr */ | ||||
| #define E1000_PTC64	0x040D8	/* Packets Tx (64 bytes) - R/clr */ | ||||
| #define E1000_PTC127	0x040DC	/* Packets Tx (65-127 bytes) - R/clr */ | ||||
| #define E1000_PTC255	0x040E0	/* Packets Tx (128-255 bytes) - R/clr */ | ||||
| #define E1000_PTC511	0x040E4	/* Packets Tx (256-511 bytes) - R/clr */ | ||||
| #define E1000_PTC1023	0x040E8	/* Packets Tx (512-1023 bytes) - R/clr */ | ||||
| #define E1000_PTC1522	0x040EC	/* Packets Tx (1024-1522 Bytes) - R/clr */ | ||||
| #define E1000_MPTC	0x040F0	/* Multicast Packets Tx Count - R/clr */ | ||||
| #define E1000_BPTC	0x040F4	/* Broadcast Packets Tx Count - R/clr */ | ||||
| #define E1000_TSCTC	0x040F8	/* TCP Segmentation Context Tx - R/clr */ | ||||
| #define E1000_TSCTFC	0x040FC	/* TCP Segmentation Context Tx Fail - R/clr */ | ||||
| #define E1000_IAC	0x04100	/* Interrupt Assertion Count */ | ||||
| #define E1000_ICRXPTC	0x04104	/* Interrupt Cause Rx Pkt Timer Expire Count */ | ||||
| #define E1000_ICRXATC	0x04108	/* Interrupt Cause Rx Abs Timer Expire Count */ | ||||
| #define E1000_ICTXPTC	0x0410C	/* Interrupt Cause Tx Pkt Timer Expire Count */ | ||||
| #define E1000_ICTXATC	0x04110	/* Interrupt Cause Tx Abs Timer Expire Count */ | ||||
| #define E1000_ICTXQEC	0x04118	/* Interrupt Cause Tx Queue Empty Count */ | ||||
| #define E1000_ICTXQMTC	0x0411C	/* Interrupt Cause Tx Queue Min Thresh Count */ | ||||
| #define E1000_ICRXDMTC	0x04120	/* Interrupt Cause Rx Desc Min Thresh Count */ | ||||
| #define E1000_ICRXOC	0x04124	/* Interrupt Cause Receiver Overrun Count */ | ||||
| #define E1000_CRC_OFFSET	0x05F50	/* CRC Offset register */ | ||||
| 
 | ||||
| #define E1000_PCS_LCTL	0x04208	/* PCS Link Control - RW */ | ||||
| #define E1000_PCS_LSTAT	0x0420C	/* PCS Link Status - RO */ | ||||
| #define E1000_PCS_ANADV	0x04218	/* AN advertisement - RW */ | ||||
| #define E1000_PCS_LPAB	0x0421C	/* Link Partner Ability - RW */ | ||||
| #define E1000_RXCSUM	0x05000	/* Rx Checksum Control - RW */ | ||||
| #define E1000_RFCTL	0x05008	/* Receive Filter Control */ | ||||
| #define E1000_MTA	0x05200	/* Multicast Table Array - RW Array */ | ||||
| #define E1000_RA	0x05400	/* Receive Address - RW Array */ | ||||
| #define E1000_VFTA	0x05600	/* VLAN Filter Table Array - RW Array */ | ||||
| #define E1000_WUC	0x05800	/* Wakeup Control - RW */ | ||||
| #define E1000_WUFC	0x05808	/* Wakeup Filter Control - RW */ | ||||
| #define E1000_WUS	0x05810	/* Wakeup Status - RO */ | ||||
| #define E1000_MANC	0x05820	/* Management Control - RW */ | ||||
| #define E1000_FFLT	0x05F00	/* Flexible Filter Length Table - RW Array */ | ||||
| #define E1000_HOST_IF	0x08800	/* Host Interface */ | ||||
| 
 | ||||
| #define E1000_KMRNCTRLSTA	0x00034	/* MAC-PHY interface - RW */ | ||||
| #define E1000_MANC2H		0x05860	/* Management Control To Host - RW */ | ||||
| /* Management Decision Filters */ | ||||
| #define E1000_MDEF(_n)		(0x05890 + (4 * (_n))) | ||||
| #define E1000_SW_FW_SYNC	0x05B5C	/* SW-FW Synchronization - RW */ | ||||
| #define E1000_GCR	0x05B00	/* PCI-Ex Control */ | ||||
| #define E1000_GCR2	0x05B64	/* PCI-Ex Control #2 */ | ||||
| #define E1000_FACTPS	0x05B30	/* Function Active and Power State to MNG */ | ||||
| #define E1000_SWSM	0x05B50	/* SW Semaphore */ | ||||
| #define E1000_FWSM	0x05B54	/* FW Semaphore */ | ||||
| /* Driver-only SW semaphore (not used by BOOT agents) */ | ||||
| #define E1000_SWSM2	0x05B58 | ||||
| #define E1000_FFLT_DBG	0x05F04	/* Debug Register */ | ||||
| #define E1000_HICR	0x08F00	/* Host Interface Control */ | ||||
| 
 | ||||
| /* RSS registers */ | ||||
| #define E1000_MRQC	0x05818	/* Multiple Receive Control - RW */ | ||||
| #define E1000_RETA(_i)	(0x05C00 + ((_i) * 4))	/* Redirection Table - RW */ | ||||
| #define E1000_RSSRK(_i)	(0x05C80 + ((_i) * 4))	/* RSS Random Key - RW */ | ||||
| #define E1000_TSYNCRXCTL	0x0B620	/* Rx Time Sync Control register - RW */ | ||||
| #define E1000_TSYNCTXCTL	0x0B614	/* Tx Time Sync Control register - RW */ | ||||
| #define E1000_RXSTMPL	0x0B624	/* Rx timestamp Low - RO */ | ||||
| #define E1000_RXSTMPH	0x0B628	/* Rx timestamp High - RO */ | ||||
| #define E1000_TXSTMPL	0x0B618	/* Tx timestamp value Low - RO */ | ||||
| #define E1000_TXSTMPH	0x0B61C	/* Tx timestamp value High - RO */ | ||||
| #define E1000_SYSTIML	0x0B600	/* System time register Low - RO */ | ||||
| #define E1000_SYSTIMH	0x0B604	/* System time register High - RO */ | ||||
| #define E1000_TIMINCA	0x0B608	/* Increment attributes register - RW */ | ||||
| #define E1000_RXMTRL	0x0B634	/* Time sync Rx EtherType and Msg Type - RW */ | ||||
| #define E1000_RXUDP	0x0B638	/* Time Sync Rx UDP Port - RW */ | ||||
| 
 | ||||
| #endif | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 awab228
						awab228