ESXi-5.5-U3
This commit is contained in:
parent
d6b9b2ac58
commit
5fc7f20805
104 changed files with 38532 additions and 16411 deletions
|
@ -0,0 +1,9 @@
|
|||
|
||||
/*
|
||||
* DO NOT EDIT THIS FILE - IT IS GENERATED BY THE DRIVER BUILD.
|
||||
*
|
||||
* If you need to change the driver's name spaces, look in the scons
|
||||
* files for the driver's defineVmkDriver() rule.
|
||||
*/
|
||||
|
||||
VMK_NAMESPACE_REQUIRED("com.vmware.usb", "9.2.2.0");
|
|
@ -170,6 +170,9 @@ typedef vmk_uint32 vmk_LinkSpeed;
|
|||
/** Uplink link speed 10000Mbps */
|
||||
#define VMK_LINK_SPEED_10000_MBPS 10000
|
||||
|
||||
/** Uplink link speed 20000Mbps */
|
||||
#define VMK_LINK_SPEED_20000_MBPS 20000
|
||||
|
||||
/** Uplink link speed 40000Mbps */
|
||||
#define VMK_LINK_SPEED_40000_MBPS 40000
|
||||
|
||||
|
|
|
@ -1354,6 +1354,31 @@ vmk_NmpSatpAPActivatePathsHelper (
|
|||
vmk_uint32 starStopUnitTimeoutMs,
|
||||
vmk_Bool *pathsActivated);
|
||||
|
||||
/*
|
||||
************************************************************************
|
||||
* vmk_NmpSatpSetProbeFailuresOptionFlag -- */ /**
|
||||
*
|
||||
* \ingroup NMP_SATP_API
|
||||
* \brief Sets the option to handle retry failures for probe commands.
|
||||
*
|
||||
* Sets the SATP's preference on handling continuous RETRY failures
|
||||
* for probe sync commands. If set then the path will be marked dead
|
||||
* after a timeout else the path state will not be updated. If a SATP
|
||||
* uses NMP's default probing mechanism via
|
||||
* vmk_NmpSatpAPUpdatePathStatesHelper or
|
||||
* vmk_NmpSatpAAUpdatePathStatesHelper then this API must be called
|
||||
* from the SATP when the config option 'enable_action_OnRetryErrors'
|
||||
* or 'disable_action_OnRetryErrors' is set.
|
||||
*
|
||||
* \param[in] nmpDevice NMP device
|
||||
* \param[in] flag VMK_TRUE indicates option is ON
|
||||
* VMK_FALSE indicates option is OFF
|
||||
*
|
||||
************************************************************************
|
||||
*/
|
||||
void
|
||||
vmk_NmpSatpSetProbeFailuresOptionFlag(vmk_NmpDevice *nmpDevice, vmk_Bool flag);
|
||||
|
||||
#endif /* _VMK_NMP_SATP_H_ */
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
@ -170,6 +170,9 @@ typedef vmk_uint32 vmk_LinkSpeed;
|
|||
/** Uplink link speed 10000Mbps */
|
||||
#define VMK_LINK_SPEED_10000_MBPS 10000
|
||||
|
||||
/** Uplink link speed 20000Mbps */
|
||||
#define VMK_LINK_SPEED_20000_MBPS 20000
|
||||
|
||||
/** Uplink link speed 40000Mbps */
|
||||
#define VMK_LINK_SPEED_40000_MBPS 40000
|
||||
|
||||
|
|
|
@ -1354,6 +1354,31 @@ vmk_NmpSatpAPActivatePathsHelper (
|
|||
vmk_uint32 starStopUnitTimeoutMs,
|
||||
vmk_Bool *pathsActivated);
|
||||
|
||||
/*
|
||||
************************************************************************
|
||||
* vmk_NmpSatpSetProbeFailuresOptionFlag -- */ /**
|
||||
*
|
||||
* \ingroup NMP_SATP_API
|
||||
* \brief Sets the option to handle retry failures for probe commands.
|
||||
*
|
||||
* Sets the SATP's preference on handling continuous RETRY failures
|
||||
* for probe sync commands. If set then the path will be marked dead
|
||||
* after a timeout else the path state will not be updated. If a SATP
|
||||
* uses NMP's default probing mechanism via
|
||||
* vmk_NmpSatpAPUpdatePathStatesHelper or
|
||||
* vmk_NmpSatpAAUpdatePathStatesHelper then this API must be called
|
||||
* from the SATP when the config option 'enable_action_OnRetryErrors'
|
||||
* or 'disable_action_OnRetryErrors' is set.
|
||||
*
|
||||
* \param[in] nmpDevice NMP device
|
||||
* \param[in] flag VMK_TRUE indicates option is ON
|
||||
* VMK_FALSE indicates option is OFF
|
||||
*
|
||||
************************************************************************
|
||||
*/
|
||||
void
|
||||
vmk_NmpSatpSetProbeFailuresOptionFlag(vmk_NmpDevice *nmpDevice, vmk_Bool flag);
|
||||
|
||||
#endif /* _VMK_NMP_SATP_H_ */
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define BUILD_NUMBER "build-00000"
|
||||
#define BUILD_NUMBER_NUMERIC 00000
|
||||
#define BUILD_NUMBER_NUMERIC_STRING "00000"
|
||||
#define PRODUCT_BUILD_NUMBER "product-build-00000"
|
||||
#define PRODUCT_BUILD_NUMBER_NUMERIC 00000
|
||||
#define PRODUCT_BUILD_NUMBER_NUMERIC_STRING "00000"
|
||||
#define BUILD_NUMBER "build-2899292"
|
||||
#define BUILD_NUMBER_NUMERIC 2899292
|
||||
#define BUILD_NUMBER_NUMERIC_STRING "2899292"
|
||||
#define PRODUCT_BUILD_NUMBER "product-build-30998"
|
||||
#define PRODUCT_BUILD_NUMBER_NUMERIC 30998
|
||||
#define PRODUCT_BUILD_NUMBER_NUMERIC_STRING "30998"
|
||||
|
|
|
@ -3,16 +3,16 @@ This server should have SSH access enabled: Customize System/View Logs ->
|
|||
Troubleshooting Options -> Enable SSH
|
||||
|
||||
To install the package create a working directory on a datastore on the
|
||||
ESXi server, e.g., "/vmfs/volumes/Storage1/install" and copy the binary
|
||||
ESXi server, e.g., "/vmfs/volumes/datastore1/" and copy the binary
|
||||
disclosure created by the build:
|
||||
|
||||
scp centos-5.3-x64.tar root@esx.example.org:/vmfs/volumes/Storage1/install/centos-5.3-x64.tar
|
||||
scp centos-5.3-x64.tar root@esx.example.org:/vmfs/volumes/datastore1/centos-5.3-x64.tar
|
||||
|
||||
On the ESXi host, verify the shipped version:
|
||||
|
||||
Replace the shipped version with the custom build:
|
||||
|
||||
cd /vmfs/volumes/Storage1/install
|
||||
cd /vmfs/volumes/datastore1/
|
||||
tar xf centos-5.3-x64.tar
|
||||
./update-drivers.sh
|
||||
|
||||
|
|
1181
build-vmkdrivers.sh
Executable file → Normal file
1181
build-vmkdrivers.sh
Executable file → Normal file
File diff suppressed because one or more lines are too long
|
@ -54,7 +54,7 @@
|
|||
#endif
|
||||
|
||||
#define DRV_NAME "ahci"
|
||||
#define DRV_VERSION "3.0-20vmw"
|
||||
#define DRV_VERSION "3.0-22vmw"
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
static int ahci_skip_host_reset = 0;
|
||||
|
@ -651,7 +651,16 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
|||
{ PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa102), board_ahci }, /* Sunrise Point-H AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa106), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
|
||||
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
|
||||
|
@ -762,6 +771,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
|||
{ PCI_VDEVICE(SEAMICRO, 0x2923), board_ahci }, /* 2923 */
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
|
||||
/* Samsung */
|
||||
{ PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci }, /* Samsung PCIe SSD */
|
||||
|
||||
/* Generic, PCI class code for AHCI */
|
||||
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
|
||||
|
|
File diff suppressed because it is too large
Load diff
89
vmkdrivers/src_9/drivers/net/e1000e/80003es2lan.h
Normal file
89
vmkdrivers/src_9/drivers/net/e1000e/80003es2lan.h
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* 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
|
File diff suppressed because it is too large
Load diff
54
vmkdrivers/src_9/drivers/net/e1000e/82571.h
Normal file
54
vmkdrivers/src_9/drivers/net/e1000e/82571.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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
|
805
vmkdrivers/src_9/drivers/net/e1000e/defines.h
Normal file
805
vmkdrivers/src_9/drivers/net/e1000e/defines.h
Normal file
|
@ -0,0 +1,805 @@
|
|||
/*
|
||||
* 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_DEFINES_H_
|
||||
#define _E1000E_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 /* SW Definable Pin 3 data */
|
||||
#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 Clk 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 /* Drv 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 promisc enable */
|
||||
#define E1000_RCTL_MPE 0x00000010 /* multicast promisc enable */
|
||||
#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 thresh size */
|
||||
#define E1000_RCTL_RDMTS_HEX 0x00010000
|
||||
#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 0x01
|
||||
#define E1000_SWFW_PHY0_SM 0x02
|
||||
#define E1000_SWFW_PHY1_SM 0x04
|
||||
#define E1000_SWFW_CSR_SM 0x08
|
||||
|
||||
/* Device Control */
|
||||
#define E1000_CTRL_FD 0x00000001 /* Full duplex.0=half; 1=full */
|
||||
#define E1000_CTRL_GIO_MASTER_DISABLE 0x00000004 /*Blocks new Master reqs */
|
||||
#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 /* 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 Compltn by NVM */
|
||||
#define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */
|
||||
#define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Master request 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 /* Desc 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 /* Enable ECC error correction */
|
||||
#define E1000_PBA_ECC_STAT_CLR 0x00000002 /* Clear ECC error counter */
|
||||
#define E1000_PBA_ECC_INT_EN 0x00000004 /* Enable ICR bit 5 on ECC error */
|
||||
|
||||
/* 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 /* Tx 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 descriptors 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 */
|
||||
|
||||
/* HH Time Sync */
|
||||
#define E1000_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000 /* max delay */
|
||||
#define E1000_TSYNCTXCTL_SYNC_COMP_ERR 0x20000000 /* sync err */
|
||||
#define E1000_TSYNCTXCTL_SYNC_COMP 0x40000000 /* sync complete */
|
||||
#define E1000_TSYNCTXCTL_START_SYNC 0x80000000 /* initiate sync */
|
||||
|
||||
#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 /* Ena Auto 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 read/write 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 for write complete */
|
||||
#define E1000_NVM_POLL_READ 0 /* Flag for polling for 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 0x040000 /* MNG config cycle done */
|
||||
#define E1000_NVM_CFG_DONE_PORT_1 0x080000 /* ...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 Reg */
|
||||
#define M88E1000_PHY_SPEC_STATUS 0x11 /* PHY Specific Status Reg */
|
||||
#define M88E1000_EXT_PHY_SPEC_CTRL 0x14 /* Extended PHY Specific Cntrl */
|
||||
|
||||
#define M88E1000_PHY_PAGE_SELECT 0x1D /* Reg 29 for pg number setting */
|
||||
#define M88E1000_PHY_GEN_CONTROL 0x1E /* meaning depends on reg 29 */
|
||||
|
||||
/* M88E1000 PHY Specific Control Register */
|
||||
#define M88E1000_PSCR_POLARITY_REVERSAL 0x0002 /* 1=Polarity Reverse enabled */
|
||||
/* MDI Crossover Mode bits 6:5 Manual MDI configuration */
|
||||
#define M88E1000_PSCR_MDI_MANUAL_MODE 0x0000
|
||||
#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 Tx */
|
||||
|
||||
/* 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 Spec Cntrl */
|
||||
#define GG82563_PHY_PAGE_SELECT GG82563_REG(0, 22) /* Page Select */
|
||||
#define GG82563_PHY_SPEC_CTRL_2 GG82563_REG(0, 26) /* PHY Spec Cntrl2 */
|
||||
#define GG82563_PHY_PAGE_SELECT_ALT GG82563_REG(0, 29) /* Alt Page Select */
|
||||
|
||||
/* MAC Specific Control Register */
|
||||
#define GG82563_PHY_MAC_SPEC_CTRL GG82563_REG(2, 21)
|
||||
|
||||
#define GG82563_PHY_DSP_DISTANCE GG82563_REG(5, 26) /* DSP Distance */
|
||||
|
||||
/* Page 193 - Port Control Registers */
|
||||
/* Kumeran Mode Control */
|
||||
#define GG82563_PHY_KMRN_MODE_CTRL GG82563_REG(193, 16)
|
||||
#define GG82563_PHY_PWR_MGMT_CTRL GG82563_REG(193, 20) /* Pwr Mgt Ctrl */
|
||||
|
||||
/* Page 194 - KMRN Registers */
|
||||
#define GG82563_PHY_INBAND_CTRL GG82563_REG(194, 18) /* Inband Ctrl */
|
||||
|
||||
/* 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 /* _E1000E_DEFINES_H_ */
|
|
@ -1,76 +1,68 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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
|
||||
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* 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 <asm/io.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include <linux/if_vlan.h>
|
||||
#include "kcompat.h"
|
||||
#ifdef HAVE_HW_TIME_STAMP
|
||||
#include <linux/clocksource.h>
|
||||
#include <linux/net_tstamp.h>
|
||||
#endif
|
||||
#ifdef HAVE_PTP_1588_CLOCK
|
||||
#include <linux/ptp_clock_kernel.h>
|
||||
#include <linux/ptp_classify.h>
|
||||
#endif
|
||||
#include <linux/mii.h>
|
||||
#ifdef ETHTOOL_GEEE
|
||||
#include <linux/mdio.h>
|
||||
#endif
|
||||
#include "hw.h"
|
||||
|
||||
struct e1000_info;
|
||||
|
||||
#define e_printk(level, adapter, format, arg...) \
|
||||
printk(level "%s: %s: " format, pci_name(adapter->pdev), \
|
||||
(strchr(adapter->netdev->name, '%') ? "" : \
|
||||
adapter->netdev->name), ## arg)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define e_dbg(format, arg...) \
|
||||
e_printk(KERN_DEBUG, hw->adapter, format, ## arg)
|
||||
#else
|
||||
#define e_dbg(format, arg...) do { (void)(hw); } while (0)
|
||||
#endif
|
||||
|
||||
netdev_dbg(hw->adapter->netdev, format, ## arg)
|
||||
#define e_err(format, arg...) \
|
||||
e_printk(KERN_ERR, adapter, format, ## arg)
|
||||
netdev_err(adapter->netdev, format, ## arg)
|
||||
#define e_info(format, arg...) \
|
||||
e_printk(KERN_INFO, adapter, format, ## arg)
|
||||
netdev_info(adapter->netdev, format, ## arg)
|
||||
#define e_warn(format, arg...) \
|
||||
e_printk(KERN_WARNING, adapter, format, ## arg)
|
||||
netdev_warn(adapter->netdev, format, ## arg)
|
||||
#define e_notice(format, arg...) \
|
||||
e_printk(KERN_NOTICE, adapter, format, ## arg)
|
||||
netdev_notice(adapter->netdev, format, ## arg)
|
||||
|
||||
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
/* Interrupt modes, as used by the IntMode paramter */
|
||||
/* 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
|
||||
|
||||
#endif /* CONFIG_E1000E_MSIX */
|
||||
#ifndef CONFIG_E1000E_NAPI
|
||||
#define E1000_MAX_INTR 10
|
||||
|
||||
|
@ -87,9 +79,6 @@ struct e1000_info;
|
|||
#define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
|
||||
#define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
|
||||
|
||||
/* Early Receive defines */
|
||||
#define E1000_ERT_2048 0x100
|
||||
|
||||
#define E1000_FC_PAUSE_TIME 0x0680 /* 858 usec */
|
||||
|
||||
/* How many Tx Descriptors do we need to call netif_wake_queue ? */
|
||||
|
@ -101,27 +90,56 @@ struct e1000_info;
|
|||
|
||||
#define E1000_MNG_VLAN_NONE (-1)
|
||||
|
||||
/* Number of packet split data buffers (not including the header buffer) */
|
||||
#define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 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_82583,
|
||||
};
|
||||
|
||||
struct e1000_queue_stats {
|
||||
u64 packets;
|
||||
u64 bytes;
|
||||
board_pch2lan,
|
||||
board_pch_lpt,
|
||||
board_pch_spt
|
||||
};
|
||||
|
||||
struct e1000_ps_page {
|
||||
|
@ -129,8 +147,7 @@ struct e1000_ps_page {
|
|||
u64 dma; /* must be u64 - written to hw */
|
||||
};
|
||||
|
||||
/*
|
||||
* wrappers around a pointer to a socket buffer,
|
||||
/* wrappers around a pointer to a socket buffer,
|
||||
* so a DMA handle can be stored along with the buffer
|
||||
*/
|
||||
struct e1000_buffer {
|
||||
|
@ -142,15 +159,21 @@ struct e1000_buffer {
|
|||
unsigned long time_stamp;
|
||||
u16 length;
|
||||
u16 next_to_watch;
|
||||
unsigned int segs;
|
||||
unsigned int bytecount;
|
||||
u16 mapped_as_page;
|
||||
};
|
||||
/* Rx */
|
||||
/* arrays of page information for packet split */
|
||||
struct e1000_ps_page *ps_pages;
|
||||
struct {
|
||||
/* arrays of page information for packet split */
|
||||
struct e1000_ps_page *ps_pages;
|
||||
struct page *page;
|
||||
};
|
||||
};
|
||||
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 */
|
||||
|
@ -159,23 +182,19 @@ struct e1000_ring {
|
|||
u16 next_to_use;
|
||||
u16 next_to_clean;
|
||||
|
||||
u16 head;
|
||||
u16 tail;
|
||||
void __iomem *head;
|
||||
void __iomem *tail;
|
||||
|
||||
/* array of buffer information structs */
|
||||
struct e1000_buffer *buffer_info;
|
||||
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
char name[IFNAMSIZ + 5];
|
||||
u32 ims_val;
|
||||
u32 itr_val;
|
||||
u16 itr_register;
|
||||
void __iomem *itr_register;
|
||||
int set_itr;
|
||||
|
||||
#endif /* CONFIG_E1000E_MSIX */
|
||||
struct sk_buff *rx_skb_top;
|
||||
|
||||
struct e1000_queue_stats stats;
|
||||
};
|
||||
|
||||
#ifdef SIOCGMIIPHY
|
||||
|
@ -203,7 +222,11 @@ struct e1000_adapter {
|
|||
|
||||
const struct e1000_info *ei;
|
||||
|
||||
#ifdef HAVE_VLAN_RX_REGISTER
|
||||
struct vlan_group *vlgrp;
|
||||
#else
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
#endif
|
||||
u32 bd_number;
|
||||
u32 rx_buffer_len;
|
||||
u16 mng_vlan_id;
|
||||
|
@ -220,21 +243,21 @@ struct e1000_adapter {
|
|||
u16 tx_itr;
|
||||
u16 rx_itr;
|
||||
|
||||
/*
|
||||
* Tx
|
||||
*/
|
||||
struct e1000_ring *tx_ring /* One per active queue */
|
||||
____cacheline_aligned_in_smp;
|
||||
/* Tx - one ring per active queue */
|
||||
struct e1000_ring *tx_ring ____cacheline_aligned_in_smp;
|
||||
u32 tx_fifo_limit;
|
||||
|
||||
#ifdef CONFIG_E1000E_NAPI
|
||||
struct napi_struct napi;
|
||||
#endif
|
||||
|
||||
unsigned long tx_queue_len;
|
||||
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;
|
||||
|
@ -255,20 +278,17 @@ struct e1000_adapter {
|
|||
u32 tx_head_addr;
|
||||
u32 tx_fifo_size;
|
||||
u32 tx_dma_failed;
|
||||
u32 tx_hwtstamp_timeouts;
|
||||
|
||||
/*
|
||||
* Rx
|
||||
*/
|
||||
/* Rx */
|
||||
#ifdef CONFIG_E1000E_NAPI
|
||||
bool (*clean_rx) (struct e1000_adapter *adapter,
|
||||
int *work_done, int work_to_do)
|
||||
____cacheline_aligned_in_smp;
|
||||
bool (*clean_rx)(struct e1000_ring *ring, int *work_done,
|
||||
int work_to_do) ____cacheline_aligned_in_smp;
|
||||
#else
|
||||
bool (*clean_rx) (struct e1000_adapter *adapter)
|
||||
____cacheline_aligned_in_smp;
|
||||
bool (*clean_rx)(struct e1000_ring *ring) ____cacheline_aligned_in_smp;
|
||||
#endif
|
||||
void (*alloc_rx_buf) (struct e1000_adapter *adapter,
|
||||
int cleaned_count);
|
||||
void (*alloc_rx_buf)(struct e1000_ring *ring, int cleaned_count,
|
||||
gfp_t gfp);
|
||||
struct e1000_ring *rx_ring;
|
||||
|
||||
u32 rx_int_delay;
|
||||
|
@ -282,6 +302,15 @@ struct e1000_adapter {
|
|||
u64 gorc_old;
|
||||
u32 alloc_rx_buff_failed;
|
||||
u32 rx_dma_failed;
|
||||
#ifdef HAVE_HW_TIME_STAMP
|
||||
u32 rx_hwtstamp_cleared;
|
||||
#endif
|
||||
#ifdef DYNAMIC_LTR_SUPPORT
|
||||
u64 c10_mpc_count; /* frequently updated MPC count */
|
||||
u64 c10_rx_bytes; /* frequently updated RX bytes count */
|
||||
u32 c10_pba_bytes; /* current PBA RXA converted to bytes*/
|
||||
bool c10_demote_ltr; /* is/should LTR be demoted */
|
||||
#endif /* DYNAMIC_LTR_SUPPORT */
|
||||
|
||||
unsigned int rx_ps_pages;
|
||||
u16 rx_ps_bsize0;
|
||||
|
@ -294,11 +323,16 @@ struct e1000_adapter {
|
|||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
#ifndef HAVE_NETDEV_STATS_IN_NETDEV
|
||||
struct net_device_stats net_stats;
|
||||
#endif
|
||||
|
||||
/* structs defined in e1000_hw.h */
|
||||
struct e1000_hw hw;
|
||||
|
||||
#ifdef HAVE_NDO_GET_STATS64
|
||||
spinlock_t stats64_lock; /* protects statistics counters */
|
||||
#endif
|
||||
struct e1000_hw_stats stats;
|
||||
struct e1000_phy_info phy_info;
|
||||
struct e1000_phy_stats phy_stats;
|
||||
|
@ -313,11 +347,10 @@ struct e1000_adapter {
|
|||
u32 test_icr;
|
||||
|
||||
u32 msg_enable;
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
unsigned int num_vectors;
|
||||
struct msix_entry *msix_entries;
|
||||
int int_mode;
|
||||
u32 eiac_mask;
|
||||
#endif /* CONFIG_E1000E_MSIX */
|
||||
|
||||
u32 eeprom_wol;
|
||||
u32 wol;
|
||||
|
@ -326,20 +359,52 @@ struct e1000_adapter {
|
|||
|
||||
bool fc_autoneg;
|
||||
|
||||
#ifndef HAVE_ETHTOOL_SET_PHYS_ID
|
||||
unsigned long led_status;
|
||||
|
||||
#endif
|
||||
unsigned int flags;
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
unsigned int flags1;
|
||||
enum {
|
||||
hw_hang_on_unknown = 0,
|
||||
hw_hang_on_tso
|
||||
} hw_hang_reason;
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
|
||||
unsigned int flags2;
|
||||
struct work_struct downshift_task;
|
||||
struct work_struct update_phy_task;
|
||||
#ifndef HAVE_ETHTOOL_SET_PHYS_ID
|
||||
struct work_struct led_blink_task;
|
||||
#endif
|
||||
struct work_struct print_hang_task;
|
||||
u32 *config_space;
|
||||
|
||||
bool discarding;
|
||||
int node; /* store the node to allocate memory on */
|
||||
int phy_hang_count;
|
||||
|
||||
u16 tx_ring_count;
|
||||
u16 rx_ring_count;
|
||||
u8 revision_id;
|
||||
|
||||
#ifdef HAVE_HW_TIME_STAMP
|
||||
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;
|
||||
#endif
|
||||
#ifdef HAVE_PTP_1588_CLOCK
|
||||
struct ptp_clock *ptp_clock;
|
||||
struct ptp_clock_info ptp_clock_info;
|
||||
#endif
|
||||
|
||||
u16 eee_advert;
|
||||
};
|
||||
|
||||
struct e1000_info {
|
||||
|
@ -349,26 +414,67 @@ struct e1000_info {
|
|||
u32 pba;
|
||||
u32 max_hw_frame_size;
|
||||
s32 (*get_variants)(struct e1000_adapter *);
|
||||
void (*init_ops)(struct e1000_hw *);
|
||||
const struct e1000_mac_operations *mac_ops;
|
||||
const struct e1000_phy_operations *phy_ops;
|
||||
const struct e1000_nvm_operations *nvm_ops;
|
||||
};
|
||||
|
||||
#ifdef HAVE_HW_TIME_STAMP
|
||||
#ifdef HAVE_PTP_1588_CLOCK
|
||||
s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca);
|
||||
#endif
|
||||
|
||||
/* 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)
|
||||
#endif /* HAVE_HW_TIME_STAMP */
|
||||
|
||||
/* 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)
|
||||
#define FLAG_HAS_ERT (1 << 4)
|
||||
/* 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)
|
||||
/* reserved bit8 */
|
||||
#define FLAG_IS_ICH (1 << 9)
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
#define FLAG_HAS_MSIX (1 << 10)
|
||||
#endif
|
||||
#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_TIPG_MEDIUM_FOR_80003ESLAN (1 << 14)
|
||||
#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)
|
||||
|
@ -382,29 +488,55 @@ struct e1000_info {
|
|||
#define FLAG_LSC_GIG_SPEED_DROP (1 << 25)
|
||||
#define FLAG_SMART_POWER_DOWN (1 << 26)
|
||||
#define FLAG_MSI_ENABLED (1 << 27)
|
||||
#ifndef HAVE_NDO_SET_FEATURES
|
||||
#define FLAG_RX_CSUM_ENABLED (1 << 28)
|
||||
#else
|
||||
/* reserved (1 << 28) */
|
||||
#endif
|
||||
#define FLAG_TSO_FORCE (1 << 29)
|
||||
#define FLAG_RX_RESTART_NOW (1 << 30)
|
||||
#define FLAG_RESTART_NOW (1 << 30)
|
||||
#define FLAG_MSI_TEST_FAILED (1 << 31)
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
#define FLAG_READ_ONLY_NVM (1 << 0)
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
|
||||
/* CRC Stripping defines */
|
||||
#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)
|
||||
#ifdef __VMKLNX__
|
||||
/* DMA burst in VMKlinux always introduce performance issue, even if
|
||||
* it's threshold is reduced to 1 a slight performance regression is
|
||||
* still observed. Disable it totally in VMKLinux.
|
||||
*/
|
||||
#define FLAG2_DMA_BURST 0
|
||||
#else
|
||||
#define FLAG2_DMA_BURST (1 << 6)
|
||||
#endif /* __VMKLNX__ */
|
||||
#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_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
|
||||
#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_OBFF_DISABLED,
|
||||
__E1000_TESTING,
|
||||
__E1000_RESETTING,
|
||||
__E1000_ACCESS_SHARED_RESOURCE,
|
||||
__E1000_DOWN
|
||||
};
|
||||
|
||||
|
@ -420,184 +552,95 @@ extern const char e1000e_driver_version[];
|
|||
|
||||
extern void e1000e_check_options(struct e1000_adapter *adapter);
|
||||
extern void e1000e_set_ethtool_ops(struct net_device *netdev);
|
||||
#ifndef HAVE_ETHTOOL_SET_PHYS_ID
|
||||
extern void e1000e_led_blink_task(struct work_struct *work);
|
||||
#endif
|
||||
#ifdef ETHTOOL_OPS_COMPAT
|
||||
extern int ethtool_ioctl(struct ifreq *ifr);
|
||||
#endif
|
||||
|
||||
extern int e1000e_up(struct e1000_adapter *adapter);
|
||||
extern void e1000e_down(struct e1000_adapter *adapter);
|
||||
extern void e1000e_down(struct e1000_adapter *adapter, bool reset);
|
||||
extern void e1000e_reinit_locked(struct e1000_adapter *adapter);
|
||||
extern void e1000e_reset(struct e1000_adapter *adapter);
|
||||
extern void e1000e_power_up_phy(struct e1000_adapter *adapter);
|
||||
extern int e1000e_setup_rx_resources(struct e1000_adapter *adapter);
|
||||
extern int e1000e_setup_tx_resources(struct e1000_adapter *adapter);
|
||||
extern void e1000e_free_rx_resources(struct e1000_adapter *adapter);
|
||||
extern void e1000e_free_tx_resources(struct e1000_adapter *adapter);
|
||||
extern int e1000e_setup_rx_resources(struct e1000_ring *ring);
|
||||
extern int e1000e_setup_tx_resources(struct e1000_ring *ring);
|
||||
extern void e1000e_free_rx_resources(struct e1000_ring *ring);
|
||||
extern void e1000e_free_tx_resources(struct e1000_ring *ring);
|
||||
#ifdef HAVE_NDO_GET_STATS64
|
||||
extern struct rtnl_link_stats64 *e1000e_get_stats64(struct net_device *netdev,
|
||||
struct rtnl_link_stats64
|
||||
*stats);
|
||||
#else /* HAVE_NDO_GET_STATS64 */
|
||||
extern void e1000e_update_stats(struct e1000_adapter *adapter);
|
||||
extern bool e1000_has_link(struct e1000_adapter *adapter);
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
#endif /* HAVE_NDO_GET_STATS64 */
|
||||
extern void e1000e_set_interrupt_capability(struct e1000_adapter *adapter);
|
||||
extern void e1000e_reset_interrupt_capability(struct e1000_adapter *adapter);
|
||||
#endif
|
||||
extern void e1000e_get_hw_control(struct e1000_adapter *adapter);
|
||||
extern void e1000e_release_hw_control(struct e1000_adapter *adapter);
|
||||
extern void e1000e_write_itr(struct e1000_adapter *adapter, u32 itr);
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
#ifdef __VMKLNX__
|
||||
extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw);
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
#endif /* __VMKLNX__ */
|
||||
extern unsigned int copybreak;
|
||||
|
||||
extern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
|
||||
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_pch_spt_info;
|
||||
extern const struct e1000_info e1000_es2_info;
|
||||
|
||||
extern s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num);
|
||||
|
||||
static inline s32 e1000e_commit_phy(struct e1000_hw *hw)
|
||||
{
|
||||
if (hw->phy.ops.commit)
|
||||
return hw->phy.ops.commit(hw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
|
||||
|
||||
extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
|
||||
extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
|
||||
|
||||
extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
|
||||
bool state);
|
||||
extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
|
||||
extern void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
|
||||
extern void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw);
|
||||
|
||||
extern s32 e1000e_check_for_copper_link(struct e1000_hw *hw);
|
||||
extern s32 e1000e_check_for_fiber_link(struct e1000_hw *hw);
|
||||
extern s32 e1000e_check_for_serdes_link(struct e1000_hw *hw);
|
||||
extern s32 e1000e_cleanup_led_generic(struct e1000_hw *hw);
|
||||
extern s32 e1000e_led_on_generic(struct e1000_hw *hw);
|
||||
extern s32 e1000e_led_off_generic(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_speed_and_duplex_copper(struct e1000_hw *hw, u16 *speed, u16 *duplex);
|
||||
extern s32 e1000e_get_speed_and_duplex_fiber_serdes(struct e1000_hw *hw, u16 *speed, u16 *duplex);
|
||||
extern s32 e1000e_disable_pcie_master(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_auto_rd_done(struct e1000_hw *hw);
|
||||
extern s32 e1000e_id_led_init(struct e1000_hw *hw);
|
||||
extern void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw);
|
||||
extern s32 e1000e_setup_fiber_serdes_link(struct e1000_hw *hw);
|
||||
extern s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw);
|
||||
extern s32 e1000e_copper_link_setup_igp(struct e1000_hw *hw);
|
||||
extern s32 e1000e_setup_link(struct e1000_hw *hw);
|
||||
static inline void e1000e_clear_vfta(struct e1000_hw *hw)
|
||||
{
|
||||
hw->mac.ops.clear_vfta(hw);
|
||||
}
|
||||
extern void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
|
||||
extern void e1000e_update_mc_addr_list_generic(struct e1000_hw *hw,
|
||||
u8 *mc_addr_list,
|
||||
u32 mc_addr_count);
|
||||
extern void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
|
||||
extern s32 e1000e_set_fc_watermarks(struct e1000_hw *hw);
|
||||
extern void e1000e_set_pcie_no_snoop(struct e1000_hw *hw, u32 no_snoop);
|
||||
extern s32 e1000e_get_hw_semaphore(struct e1000_hw *hw);
|
||||
extern s32 e1000e_valid_led_default(struct e1000_hw *hw, u16 *data);
|
||||
extern void e1000e_config_collision_dist(struct e1000_hw *hw);
|
||||
extern s32 e1000e_config_fc_after_link_up(struct e1000_hw *hw);
|
||||
extern s32 e1000e_force_mac_fc(struct e1000_hw *hw);
|
||||
extern s32 e1000e_blink_led(struct e1000_hw *hw);
|
||||
extern void e1000e_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
|
||||
static inline void e1000e_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
|
||||
{
|
||||
if (hw->mac.ops.write_vfta)
|
||||
hw->mac.ops.write_vfta(hw, offset, value);
|
||||
}
|
||||
extern void e1000e_reset_adaptive(struct e1000_hw *hw);
|
||||
extern void e1000e_update_adaptive(struct e1000_hw *hw);
|
||||
|
||||
extern s32 e1000e_setup_copper_link(struct e1000_hw *hw);
|
||||
extern void e1000e_put_hw_semaphore(struct e1000_hw *hw);
|
||||
extern s32 e1000e_check_reset_block_generic(struct e1000_hw *hw);
|
||||
extern s32 e1000e_phy_force_speed_duplex_igp(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_cable_length_igp_2(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_phy_info_igp(struct e1000_hw *hw);
|
||||
extern s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
extern s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw);
|
||||
extern s32 e1000e_set_d3_lplu_state(struct e1000_hw *hw, bool active);
|
||||
extern s32 e1000e_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
extern s32 e1000e_phy_sw_reset(struct e1000_hw *hw);
|
||||
extern s32 e1000e_phy_force_speed_duplex_m88(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_cfg_done(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_cable_length_m88(struct e1000_hw *hw);
|
||||
extern s32 e1000e_get_phy_info_m88(struct e1000_hw *hw);
|
||||
extern s32 e1000e_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
extern s32 e1000e_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
extern enum e1000_phy_type e1000e_get_phy_type_from_id(u32 phy_id);
|
||||
extern s32 e1000e_determine_phy_address(struct e1000_hw *hw);
|
||||
extern s32 e1000e_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
extern s32 e1000e_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
extern void e1000e_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl);
|
||||
extern s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
extern s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
extern s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
|
||||
u32 usec_interval, bool *success);
|
||||
extern s32 e1000e_phy_reset_dsp(struct e1000_hw *hw);
|
||||
extern s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
extern s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
extern s32 e1000e_check_downshift(struct e1000_hw *hw);
|
||||
#ifdef HAVE_PTP_1588_CLOCK
|
||||
extern void e1000e_ptp_init(struct e1000_adapter *adapter);
|
||||
extern void e1000e_ptp_remove(struct e1000_adapter *adapter);
|
||||
#else
|
||||
#define e1000e_ptp_init(adapter) do {} while (0)
|
||||
#define e1000e_ptp_remove(adapter) do {} while (0)
|
||||
#endif
|
||||
|
||||
static inline s32 e1000_phy_hw_reset(struct e1000_hw *hw)
|
||||
{
|
||||
if (hw->phy.ops.reset)
|
||||
return hw->phy.ops.reset(hw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline s32 e1000_check_reset_block(struct e1000_hw *hw)
|
||||
{
|
||||
if (hw->phy.ops.check_reset_block)
|
||||
return hw->phy.ops.check_reset_block(hw);
|
||||
|
||||
return 0;
|
||||
return hw->phy.ops.reset(hw);
|
||||
}
|
||||
|
||||
static inline s32 e1e_rphy(struct e1000_hw *hw, u32 offset, u16 *data)
|
||||
{
|
||||
if (hw->phy.ops.read_reg)
|
||||
return hw->phy.ops.read_reg(hw, offset, data);
|
||||
return hw->phy.ops.read_reg(hw, offset, data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
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)
|
||||
{
|
||||
if (hw->phy.ops.write_reg)
|
||||
return hw->phy.ops.write_reg(hw, offset, data);
|
||||
|
||||
return 0;
|
||||
return hw->phy.ops.write_reg(hw, offset, data);
|
||||
}
|
||||
|
||||
static inline s32 e1000_get_cable_length(struct e1000_hw *hw)
|
||||
static inline s32 e1e_wphy_locked(struct e1000_hw *hw, u32 offset, u16 data)
|
||||
{
|
||||
if (hw->phy.ops.get_cable_length)
|
||||
return hw->phy.ops.get_cable_length(hw);
|
||||
|
||||
return 0;
|
||||
return hw->phy.ops.write_reg_locked(hw, offset, data);
|
||||
}
|
||||
|
||||
extern s32 e1000e_acquire_nvm(struct e1000_hw *hw);
|
||||
extern s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
|
||||
extern s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw);
|
||||
extern s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
|
||||
extern s32 e1000e_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
|
||||
extern s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw);
|
||||
extern void e1000e_release_nvm(struct e1000_hw *hw);
|
||||
extern 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);
|
||||
if (hw->mac.ops.read_mac_addr)
|
||||
return hw->mac.ops.read_mac_addr(hw);
|
||||
|
||||
return e1000e_read_mac_addr_generic(hw);
|
||||
return e1000_read_mac_addr_generic(hw);
|
||||
}
|
||||
|
||||
static inline s32 e1000_validate_nvm_checksum(struct e1000_hw *hw)
|
||||
|
@ -610,78 +653,68 @@ 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)
|
||||
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)
|
||||
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)
|
||||
{
|
||||
if (hw->phy.ops.get_info)
|
||||
return hw->phy.ops.get_info(hw);
|
||||
|
||||
return 0;
|
||||
return hw->phy.ops.get_info(hw);
|
||||
}
|
||||
|
||||
extern bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw);
|
||||
extern s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
|
||||
|
||||
static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
|
||||
{
|
||||
return readl(hw->hw_addr + reg);
|
||||
}
|
||||
|
||||
#define er32(reg) __er32(hw, E1000_##reg)
|
||||
|
||||
/**
|
||||
* __ew32_prepare - prepare to write to MAC CSR register on certain parts
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* When updating the MAC CSR registers, the Manageability Engine (ME) could
|
||||
* be accessing the registers at the same time. Normally, this is handled in
|
||||
* h/w by an arbiter but on some parts there is a bug that acknowledges Host
|
||||
* accesses later than it should which could result in the register to have
|
||||
* an incorrect value. Workaround this by checking the FWSM register which
|
||||
* has bit 24 set while ME is accessing MAC CSR registers, wait if it is set
|
||||
* and try again a number of times.
|
||||
**/
|
||||
static inline s32 __ew32_prepare(struct e1000_hw *hw)
|
||||
{
|
||||
s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT;
|
||||
|
||||
while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i)
|
||||
udelay(50);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
|
||||
{
|
||||
if (hw->adapter->flags2 & FLAG2_PCIM2PCI_ARBITER_WA)
|
||||
__ew32_prepare(hw);
|
||||
|
||||
writel(val, hw->hw_addr + reg);
|
||||
}
|
||||
|
||||
#define er32(reg) __er32(hw, E1000_##reg)
|
||||
#define ew32(reg, val) __ew32(hw, E1000_##reg, (val))
|
||||
|
||||
#define e1e_flush() er32(STATUS)
|
||||
|
||||
#define E1000_WRITE_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->hw_addr + reg)))
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) \
|
||||
(__ew32((a), (reg + ((offset) << 2)), (value)))
|
||||
|
||||
#define E1000_READ_REG(a, reg) (readl((a)->hw_addr + reg))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
|
||||
writel((value), ((a)->hw_addr + reg + ((offset) << 2))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
|
||||
readl((a)->hw_addr + reg + ((offset) << 2)))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
|
||||
#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
|
||||
|
||||
static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
|
||||
{
|
||||
return readw(hw->flash_address + reg);
|
||||
}
|
||||
|
||||
static inline u32 __er32flash(struct e1000_hw *hw, unsigned long reg)
|
||||
{
|
||||
return readl(hw->flash_address + reg);
|
||||
}
|
||||
|
||||
static inline void __ew16flash(struct e1000_hw *hw, unsigned long reg, u16 val)
|
||||
{
|
||||
writew(val, hw->flash_address + reg);
|
||||
}
|
||||
|
||||
static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val)
|
||||
{
|
||||
writel(val, hw->flash_address + reg);
|
||||
}
|
||||
|
||||
#define er16flash(reg) __er16flash(hw, (reg))
|
||||
#define er32flash(reg) __er32flash(hw, (reg))
|
||||
#define ew16flash(reg, val) __ew16flash(hw, (reg), (val))
|
||||
#define ew32flash(reg, val) __ew32flash(hw, (reg), (val))
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) \
|
||||
(readl((a)->hw_addr + reg + ((offset) << 2)))
|
||||
|
||||
#endif /* _E1000_H_ */
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_80003ES2LAN_H_
|
||||
#define _E1000_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 /* Gigabit 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 Disabled */
|
||||
#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-Negotiation */
|
||||
|
||||
/* 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_2_5 0x0006
|
||||
#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) */
|
||||
#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001
|
||||
/* 1=Enable SERDES Electrical Idle */
|
||||
|
||||
/* In-Band Control Register (Page 194, Register 18) */
|
||||
#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */
|
||||
|
||||
#endif
|
|
@ -1,53 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_82571_H_
|
||||
#define _E1000_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
|
||||
|
||||
/* 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_NVM_INIT_CTRL2_MNGM 0x6000 /* Manageability Operation Mode mask */
|
||||
|
||||
#define E1000_RXCFGL 0x0B634 /* TimeSync Rx EtherType & Msg Type Reg - RW */
|
||||
|
||||
bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
|
||||
void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,197 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_ICH8LAN_H_
|
||||
#define _E1000_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
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
#define ICH_FLASH_PR0 0x0074
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
|
||||
/* 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 ICH_FLASH_SECTOR_SIZE 4096
|
||||
|
||||
#define ICH_FLASH_REG_MAPSIZE 0x00A0
|
||||
|
||||
#define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */
|
||||
#define E1000_ICH_FWSM_DISSW 0x10000000 /* FW Disables SW Writes */
|
||||
/* FW established a valid mode */
|
||||
#define E1000_ICH_FWSM_FW_VALID 0x00008000
|
||||
|
||||
#define E1000_ICH_MNG_IAMT_MODE 0x2
|
||||
|
||||
#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
|
||||
|
||||
#define E1000_FEXTNVM_SW_CONFIG 1
|
||||
#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M */
|
||||
|
||||
#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
|
||||
|
||||
#define E1000_ICH_RAR_ENTRIES 7
|
||||
|
||||
#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_CAPABILITY PHY_REG(776, 19) /* Capability */
|
||||
#define IGP3_PM_CTRL PHY_REG(769, 20) /* Power Management 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
|
||||
#define IGP3_PM_CTRL_FORCE_PWR_DOWN 0x0020
|
||||
|
||||
/* PHY Wakeup Registers and defines */
|
||||
#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_SCC_UPPER PHY_REG(778, 16) /* Single Collision Count */
|
||||
#define HV_SCC_LOWER PHY_REG(778, 17)
|
||||
#define HV_ECOL_UPPER PHY_REG(778, 18) /* Excessive Collision Count */
|
||||
#define HV_ECOL_LOWER PHY_REG(778, 19)
|
||||
#define HV_MCC_UPPER PHY_REG(778, 20) /* Multiple Collision Count */
|
||||
#define HV_MCC_LOWER PHY_REG(778, 21)
|
||||
#define HV_LATECOL_UPPER PHY_REG(778, 23) /* Late Collision Count */
|
||||
#define HV_LATECOL_LOWER PHY_REG(778, 24)
|
||||
#define HV_COLC_UPPER PHY_REG(778, 25) /* Collision Count */
|
||||
#define HV_COLC_LOWER PHY_REG(778, 26)
|
||||
#define HV_DC_UPPER PHY_REG(778, 27) /* Defer Count */
|
||||
#define HV_DC_LOWER PHY_REG(778, 28)
|
||||
#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */
|
||||
#define HV_TNCRS_LOWER PHY_REG(778, 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 Address Phy Register */
|
||||
#define HV_SMB_ADDR PHY_REG(768, 26)
|
||||
#define HV_SMB_ADDR_PEC_EN 0x0200
|
||||
#define HV_SMB_ADDR_VALID 0x0080
|
||||
|
||||
/* Strapping Option Register - RO */
|
||||
#define E1000_STRAP 0x0000C
|
||||
#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
|
||||
#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
|
||||
|
||||
/* 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 */
|
||||
|
||||
#define LCD_CFG_PHY_ADDR_BIT 0x0020 /* Phy address bit from LCD Config word */
|
||||
|
||||
#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */
|
||||
|
||||
/*
|
||||
* Additional interrupts need to be handled for ICH family:
|
||||
* DSW = The FW changed the status of the DISSW bit in FWSM
|
||||
* PHYINT = The LAN connected device generates an interrupt
|
||||
* EPRST = Manageability reset event
|
||||
*/
|
||||
#define IMS_ICH_ENABLE_MASK (\
|
||||
E1000_IMS_DSW | \
|
||||
E1000_IMS_PHYINT | \
|
||||
E1000_IMS_EPRST)
|
||||
|
||||
/* Additional interrupt register bit definitions */
|
||||
#define E1000_ICR_LSECPNC 0x00004000 /* PN threshold - client */
|
||||
#define E1000_IMS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */
|
||||
#define E1000_ICS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */
|
||||
|
||||
/* Security Processing bit Indication */
|
||||
#define E1000_RXDEXT_LINKSEC_STATUS_LSECH 0x01000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_BIT_MASK 0x60000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_NO_SA_MATCH 0x20000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_REPLAY_ERROR 0x40000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_BAD_SIG 0x60000000
|
||||
|
||||
|
||||
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 e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw);
|
||||
s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
|
||||
s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_config);
|
||||
#endif
|
|
@ -1,77 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_MAC_H_
|
||||
#define _E1000_MAC_H_
|
||||
|
||||
/*
|
||||
* Functions that should not be called directly from drivers but can be used
|
||||
* by other files in this 'shared code'
|
||||
*/
|
||||
void e1000_init_mac_ops_generic(struct e1000_hw *hw);
|
||||
s32 e1000e_blink_led(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(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 e1000_setup_led_generic(struct e1000_hw *hw);
|
||||
s32 e1000e_setup_link(struct e1000_hw *hw);
|
||||
|
||||
void e1000e_clear_hw_cntrs_base(struct e1000_hw *hw);
|
||||
void e1000e_clear_vfta_generic(struct e1000_hw *hw);
|
||||
void e1000e_config_collision_dist(struct e1000_hw *hw);
|
||||
void e1000e_init_rx_addrs(struct e1000_hw *hw, u16 rar_count);
|
||||
void e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value);
|
||||
void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw);
|
||||
void e1000e_put_hw_semaphore(struct e1000_hw *hw);
|
||||
void e1000e_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
|
||||
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 e1000e_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value);
|
||||
|
||||
#endif
|
|
@ -1,82 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_MANAGE_H_
|
||||
#define _E1000_MANAGE_H_
|
||||
|
||||
bool e1000_check_mng_mode_generic(struct e1000_hw *hw);
|
||||
bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw);
|
||||
s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw);
|
||||
s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length, u16 offset, u8 *sum);
|
||||
s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header *hdr);
|
||||
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_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */
|
||||
#define E1000_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */
|
||||
#define E1000_HI_COMMAND_TIMEOUT 500 /* Process HI command limit */
|
||||
|
||||
#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
|
|
@ -1,51 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_NVM_H_
|
||||
#define _E1000_NVM_H_
|
||||
|
||||
void e1000_init_nvm_ops_generic(struct e1000_hw *hw);
|
||||
s32 e1000e_acquire_nvm(struct e1000_hw *hw);
|
||||
|
||||
s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
|
||||
s32 e1000e_read_mac_addr_generic(struct e1000_hw *hw);
|
||||
s32 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num);
|
||||
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 e1000_write_nvm_eewr(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
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
|
|
@ -1,116 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2008 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
/* glue for the OS-dependent part of e1000
|
||||
* includes register access macros
|
||||
*/
|
||||
|
||||
#ifndef _E1000_OSDEP_H_
|
||||
#define _E1000_OSDEP_H_
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
#include "kcompat.h"
|
||||
|
||||
#define usec_delay(x) udelay(x)
|
||||
#ifndef msec_delay
|
||||
#define msec_delay(x) do { if(in_interrupt()) { \
|
||||
/* Don't sleep in interrupt context! */ \
|
||||
BUG(); \
|
||||
} else { \
|
||||
msleep(x); \
|
||||
} } while (0)
|
||||
|
||||
/* Some workarounds require millisecond delays and are run during interrupt
|
||||
* context. Most notably, when establishing link, the phy may need tweaking
|
||||
* but cannot process phy register reads/writes faster than millisecond
|
||||
* intervals...and we establish link due to a "link status change" interrupt.
|
||||
*/
|
||||
#define msec_delay_irq(x) mdelay(x)
|
||||
#endif
|
||||
|
||||
#define PCI_COMMAND_REGISTER PCI_COMMAND
|
||||
#define CMD_MEM_WRT_INVALIDATE PCI_COMMAND_INVALIDATE
|
||||
#define ETH_ADDR_LEN ETH_ALEN
|
||||
|
||||
|
||||
#define DEBUGOUT(S)
|
||||
#define DEBUGOUT1(S, A...)
|
||||
|
||||
#define DEBUGFUNC(F) DEBUGOUT(F "\n")
|
||||
#define DEBUGOUT2 DEBUGOUT1
|
||||
#define DEBUGOUT3 DEBUGOUT2
|
||||
#define DEBUGOUT7 DEBUGOUT3
|
||||
|
||||
#define E1000_WRITE_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->hw_addr + reg)))
|
||||
|
||||
#define E1000_READ_REG(a, reg) (readl((a)->hw_addr + reg))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
|
||||
writel((value), ((a)->hw_addr + reg + ((offset) << 2))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
|
||||
readl((a)->hw_addr + reg + ((offset) << 2)))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
|
||||
#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
|
||||
writew((value), ((a)->hw_addr + reg + ((offset) << 1))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
|
||||
readw((a)->hw_addr + reg + ((offset) << 1)))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
|
||||
writeb((value), ((a)->hw_addr + reg + (offset))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
|
||||
readb((a)->hw_addr + reg + (offset)))
|
||||
|
||||
#define E1000_WRITE_REG_IO(a, reg, offset) do { \
|
||||
outl(reg, ((a)->io_base)); \
|
||||
outl(offset, ((a)->io_base + 4)); } while(0)
|
||||
|
||||
#define E1000_WRITE_FLUSH(a) E1000_READ_REG(a, E1000_STATUS)
|
||||
|
||||
#define E1000_WRITE_FLASH_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_WRITE_FLASH_REG16(a, reg, value) ( \
|
||||
writew((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_FLASH_REG(a, reg) (readl((a)->flash_address + reg))
|
||||
|
||||
#define E1000_READ_FLASH_REG16(a, reg) (readw((a)->flash_address + reg))
|
||||
|
||||
#endif /* _E1000_OSDEP_H_ */
|
|
@ -1,249 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_PHY_H_
|
||||
#define _E1000_PHY_H_
|
||||
|
||||
void e1000_init_phy_ops_generic(struct e1000_hw *hw);
|
||||
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(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 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 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 e1000_wait_autoneg(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 e1000_phy_reset_dsp(struct e1000_hw *hw);
|
||||
s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
|
||||
u32 usec_interval, bool *success);
|
||||
s32 e1000_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 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_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_set_mdio_slow_mode_hv(struct e1000_hw *hw, bool slow);
|
||||
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 4
|
||||
|
||||
/* 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 IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO */
|
||||
#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality */
|
||||
#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_PCIE_PAGE 770
|
||||
#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 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 100/10 */
|
||||
#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
|
||||
#define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100
|
||||
|
||||
/* I82577 PHY Control 2 */
|
||||
#define I82577_PHY_CTRL2_AUTO_MDIX 0x0400
|
||||
#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
|
||||
|
||||
/* 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
|
||||
#define BM_CS_CTRL1_ENERGY_DETECT 0x0300 /* Enable Energy Detect */
|
||||
|
||||
/* BM PHY Copper Specific Status */
|
||||
#define BM_CS_STATUS 17
|
||||
#define BM_CS_STATUS_ENERGY_DETECT 0x0010 /* Energy Detect Status */
|
||||
#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_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
|
||||
|
||||
/* Enable flexible speed on link-up */
|
||||
#define IGP01E1000_GMII_FLEX_SPD 0x0010
|
||||
#define IGP01E1000_GMII_SPD 0x0020 /* Enable SPD */
|
||||
|
||||
#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 IGP03E1000_PHY_MISC_CTRL 0x1B
|
||||
#define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Manually Set Duplex */
|
||||
|
||||
#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_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */
|
||||
#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */
|
||||
#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */
|
||||
#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */
|
||||
#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7
|
||||
#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002
|
||||
|
||||
#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10
|
||||
#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */
|
||||
#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY Special and LED Control */
|
||||
#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
|
||||
#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100
|
||||
|
||||
/* 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 MDI/MDI-X, 0=disable */
|
||||
|
||||
#endif
|
|
@ -1,338 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_REGS_H_
|
||||
#define _E1000_REGS_H_
|
||||
|
||||
#define E1000_CTRL 0x00000 /* Device Control - RW */
|
||||
#define E1000_CTRL_DUP 0x00004 /* Device Control Duplicate (Shadow) - 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_FCT 0x00030 /* Flow Control Type - RW */
|
||||
#define E1000_CONNSW 0x00034 /* Copper/Fiber switch control - 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_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_TBT 0x00448 /* Tx Burst Timer - 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_PBA 0x01000 /* Packet Buffer Allocation - RW */
|
||||
#define E1000_PBS 0x01008 /* Packet Buffer Size */
|
||||
#define E1000_EEMNGCTL 0x01010 /* MNG EEprom Control */
|
||||
#define E1000_EEARBC 0x01024 /* EEPROM Auto Read Bus Control */
|
||||
#define E1000_FLASHT 0x01028 /* FLASH Timer Register */
|
||||
#define E1000_EEWR 0x0102C /* EEPROM Write Register - RW */
|
||||
#define E1000_FLSWCTL 0x01030 /* FLASH control register */
|
||||
#define E1000_FLSWDATA 0x01034 /* FLASH data register */
|
||||
#define E1000_FLSWCNT 0x01038 /* FLASH Access Counter */
|
||||
#define E1000_FLOP 0x0103C /* FLASH Opcode Register */
|
||||
#define E1000_I2CCMD 0x01028 /* SFPI2C Command Register - RW */
|
||||
#define E1000_I2CPARAMS 0x0102C /* SFPI2C Parameters Register - RW */
|
||||
#define E1000_WDSTP 0x01040 /* Watchdog Setup - RW */
|
||||
#define E1000_SWDSTS 0x01044 /* SW Device Status - RW */
|
||||
#define E1000_FRTIMER 0x01048 /* Free Running Timer - RW */
|
||||
#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_RDFPCQ(_n) (0x02430 + (0x4 * (_n)))
|
||||
#define E1000_PBRTH 0x02458 /* PB Rx Arbitration Threshold - RW */
|
||||
#define E1000_FCRTV 0x02460 /* Flow Control Refresh Timer Value - RW */
|
||||
/* Split and Replication Rx Control - RW */
|
||||
#define E1000_RDPUMB 0x025CC /* DMA Rx Descriptor uC Mailbox - RW */
|
||||
#define E1000_RDPUAD 0x025D0 /* DMA Rx Descriptor uC Addr Command - RW */
|
||||
#define E1000_RDPUWD 0x025D4 /* DMA Rx Descriptor uC Data Write - RW */
|
||||
#define E1000_RDPURD 0x025D8 /* DMA Rx Descriptor uC Data Read - RW */
|
||||
#define E1000_RDPUCTL 0x025DC /* DMA Rx Descriptor uC 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_SRRCTL(_n) ((_n) < 4 ? (0x0280C + ((_n) * 0x100)) : \
|
||||
(0x0C00C + ((_n) * 0x40)))
|
||||
#define E1000_RDH(_n) ((_n) < 4 ? (0x02810 + ((_n) * 0x100)) : \
|
||||
(0x0C010 + ((_n) * 0x40)))
|
||||
#define E1000_RXCTL(_n) ((_n) < 4 ? (0x02814 + ((_n) * 0x100)) : \
|
||||
(0x0C014 + ((_n) * 0x40)))
|
||||
#define E1000_DCA_RXCTRL(_n) E1000_RXCTL(_n)
|
||||
#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_RQDPC(_n) ((_n) < 4 ? (0x02830 + ((_n) * 0x100)) : \
|
||||
(0x0C030 + ((_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_TXCTL(_n) ((_n) < 4 ? (0x03814 + ((_n) * 0x100)) : \
|
||||
(0x0E014 + ((_n) * 0x40)))
|
||||
#define E1000_DCA_TXCTRL(_n) E1000_TXCTL(_n)
|
||||
#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_TDWBAL(_n) ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) : \
|
||||
(0x0E038 + ((_n) * 0x40)))
|
||||
#define E1000_TDWBAH(_n) ((_n) < 4 ? (0x0383C + ((_n) * 0x100)) : \
|
||||
(0x0E03C + ((_n) * 0x40)))
|
||||
#define E1000_TARC(_n) (0x03840 + ((_n) * 0x100))
|
||||
#define E1000_RSRPD 0x02C00 /* Rx Small Packet Detect - RW */
|
||||
#define E1000_RAID 0x02C08 /* Receive Ack Interrupt Delay - RW */
|
||||
#define E1000_TXDMAC 0x03000 /* Tx DMA Control - RW */
|
||||
#define E1000_KABGTXD 0x03004 /* AFE Band Gap Transmit Ref Data */
|
||||
#define E1000_PSRTYPE(_i) (0x05480 + ((_i) * 4))
|
||||
#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_IP4AT_REG(_i) (0x05840 + ((_i) * 8))
|
||||
#define E1000_IP6AT_REG(_i) (0x05880 + ((_i) * 4))
|
||||
#define E1000_WUPM_REG(_i) (0x05A00 + ((_i) * 4))
|
||||
#define E1000_FFMT_REG(_i) (0x09000 + ((_i) * 8))
|
||||
#define E1000_FFVT_REG(_i) (0x09800 + ((_i) * 8))
|
||||
#define E1000_FFLT_REG(_i) (0x05F00 + ((_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_TDPUMB 0x0357C /* DMA Tx Descriptor uC Mail Box - RW */
|
||||
#define E1000_TDPUAD 0x03580 /* DMA Tx Descriptor uC Addr Command - RW */
|
||||
#define E1000_TDPUWD 0x03584 /* DMA Tx Descriptor uC Data Write - RW */
|
||||
#define E1000_TDPURD 0x03588 /* DMA Tx Descriptor uC Data Read - RW */
|
||||
#define E1000_TDPUCTL 0x0358C /* DMA Tx Descriptor uC Control - RW */
|
||||
#define E1000_DTXCTL 0x03590 /* DMA Tx Control - RW */
|
||||
#define E1000_TIDV 0x03820 /* Tx Interrupt Delay Value - RW */
|
||||
#define E1000_TADV 0x0382C /* Tx Interrupt Absolute Delay Val - RW */
|
||||
#define E1000_TSPMT 0x03830 /* TCP Segmentation PAD & Min Threshold - 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_CFG0 0x04200 /* PCS Configuration 0 - RW */
|
||||
#define E1000_PCS_LCTL 0x04208 /* PCS Link Control - RW */
|
||||
#define E1000_PCS_LSTAT 0x0420C /* PCS Link Status - RO */
|
||||
#define E1000_CBTMPC 0x0402C /* Circuit Breaker Tx Packet Count */
|
||||
#define E1000_HTDPMC 0x0403C /* Host Transmit Discarded Packets */
|
||||
#define E1000_CBRDPC 0x04044 /* Circuit Breaker Rx Dropped Count */
|
||||
#define E1000_CBRMPC 0x040FC /* Circuit Breaker Rx Packet Count */
|
||||
#define E1000_RPTHC 0x04104 /* Rx Packets To Host */
|
||||
#define E1000_HGPTC 0x04118 /* Host Good Packets Tx Count */
|
||||
#define E1000_HTCBDPC 0x04124 /* Host Tx Circuit Breaker Dropped Count */
|
||||
#define E1000_HGORCL 0x04128 /* Host Good Octets Received Count Low */
|
||||
#define E1000_HGORCH 0x0412C /* Host Good Octets Received Count High */
|
||||
#define E1000_HGOTCL 0x04130 /* Host Good Octets Transmit Count Low */
|
||||
#define E1000_HGOTCH 0x04134 /* Host Good Octets Transmit Count High */
|
||||
#define E1000_LENERRS 0x04138 /* Length Errors Count */
|
||||
#define E1000_SCVPC 0x04228 /* SerDes/SGMII Code Violation Pkt Count */
|
||||
#define E1000_HRMPC 0x0A018 /* Header Redirection Missed Packet Count */
|
||||
#define E1000_PCS_ANADV 0x04218 /* AN advertisement - RW */
|
||||
#define E1000_PCS_LPAB 0x0421C /* Link Partner Ability - RW */
|
||||
#define E1000_PCS_NPTX 0x04220 /* AN Next Page Transmit - RW */
|
||||
#define E1000_PCS_LPABNP 0x04224 /* Link Partner Ability Next Page - RW */
|
||||
#define E1000_1GSTAT_RCV 0x04228 /* 1GSTAT Code Violation Packet Count - RW */
|
||||
#define E1000_RXCSUM 0x05000 /* Rx Checksum Control - RW */
|
||||
#define E1000_RLPML 0x05004 /* Rx Long Packet Max Length */
|
||||
#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_VT_CTL 0x0581C /* VMDq Control - RW */
|
||||
#define E1000_VFQA0 0x0B000 /* VLAN Filter Queue Array 0 - RW Array */
|
||||
#define E1000_VFQA1 0x0B200 /* VLAN Filter Queue Array 1 - 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_IPAV 0x05838 /* IP Address Valid - RW */
|
||||
#define E1000_IP4AT 0x05840 /* IPv4 Address Table - RW Array */
|
||||
#define E1000_IP6AT 0x05880 /* IPv6 Address Table - RW Array */
|
||||
#define E1000_WUPL 0x05900 /* Wakeup Packet Length - RW */
|
||||
#define E1000_WUPM 0x05A00 /* Wakeup Packet Memory - RO A */
|
||||
#define E1000_PBACL 0x05B68 /* MSIx PBA Clear - Read/Write 1's to clear */
|
||||
#define E1000_FFLT 0x05F00 /* Flexible Filter Length Table - RW Array */
|
||||
#define E1000_HOST_IF 0x08800 /* Host Interface */
|
||||
#define E1000_FFMT 0x09000 /* Flexible Filter Mask Table - RW Array */
|
||||
#define E1000_FFVT 0x09800 /* Flexible Filter Value Table - RW Array */
|
||||
|
||||
#define E1000_KMRNCTRLSTA 0x00034 /* MAC-PHY interface - RW */
|
||||
#define E1000_MDPHYA 0x0003C /* PHY address - RW */
|
||||
#define E1000_MANC2H 0x05860 /* Management Control To Host - RW */
|
||||
#define E1000_SW_FW_SYNC 0x05B5C /* Software-Firmware Synchronization - RW */
|
||||
#define E1000_CCMCTL 0x05B48 /* CCM Control Register */
|
||||
#define E1000_GIOCTL 0x05B44 /* GIO Analog Control Register */
|
||||
#define E1000_SCCTL 0x05B4C /* PCIc PLL Configuration Register */
|
||||
#define E1000_GCR 0x05B00 /* PCI-Ex Control */
|
||||
#define E1000_GCR2 0x05B64 /* PCI-Ex Control #2 */
|
||||
#define E1000_GSCL_1 0x05B10 /* PCI-Ex Statistic Control #1 */
|
||||
#define E1000_GSCL_2 0x05B14 /* PCI-Ex Statistic Control #2 */
|
||||
#define E1000_GSCL_3 0x05B18 /* PCI-Ex Statistic Control #3 */
|
||||
#define E1000_GSCL_4 0x05B1C /* PCI-Ex Statistic Control #4 */
|
||||
#define E1000_FACTPS 0x05B30 /* Function Active and Power State to MNG */
|
||||
#define E1000_SWSM 0x05B50 /* SW Semaphore */
|
||||
#define E1000_FWSM 0x05B54 /* FW Semaphore */
|
||||
#define E1000_SWSM2 0x05B58 /* Driver-only SW semaphore (not used by BOOT agents) */
|
||||
#define E1000_DCA_ID 0x05B70 /* DCA Requester ID Information - RO */
|
||||
#define E1000_DCA_CTRL 0x05B74 /* DCA Control - RW */
|
||||
#define E1000_FFLT_DBG 0x05F04 /* Debug Register */
|
||||
#define E1000_HICR 0x08F00 /* Host Interface Control */
|
||||
|
||||
/* RSS registers */
|
||||
#define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */
|
||||
#define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */
|
||||
#define E1000_IMIR(_i) (0x05A80 + ((_i) * 4)) /* Immediate Interrupt */
|
||||
#define E1000_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* Immediate Interrupt Ext*/
|
||||
#define E1000_IMIRVP 0x05AC0 /* Immediate Interrupt Rx VLAN Priority - RW */
|
||||
#define E1000_MSIXBM(_i) (0x01600 + ((_i) * 4)) /* MSI-X Allocation Register
|
||||
* (_i) - RW */
|
||||
#define E1000_MSIXTADD(_i) (0x0C000 + ((_i) * 0x10)) /* MSI-X Table entry addr
|
||||
* low reg - RW */
|
||||
#define E1000_MSIXTUADD(_i) (0x0C004 + ((_i) * 0x10)) /* MSI-X Table entry addr
|
||||
* upper reg - RW */
|
||||
#define E1000_MSIXTMSG(_i) (0x0C008 + ((_i) * 0x10)) /* MSI-X Table entry
|
||||
* message reg - RW */
|
||||
#define E1000_MSIXVCTRL(_i) (0x0C00C + ((_i) * 0x10)) /* MSI-X Table entry
|
||||
* vector ctrl reg - RW */
|
||||
#define E1000_MSIXPBA 0x0E000 /* MSI-X Pending bit array */
|
||||
#define E1000_RETA(_i) (0x05C00 + ((_i) * 4)) /* Redirection Table - RW */
|
||||
#define E1000_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* RSS Random Key - RW */
|
||||
#define E1000_RSSIM 0x05864 /* RSS Interrupt Mask */
|
||||
#define E1000_RSSIR 0x05868 /* RSS Interrupt Request */
|
||||
#define E1000_RXMTRL 0x0B634 /* Time sync Rx EtherType and Msg Type - RW */
|
||||
#define E1000_RXUDP 0x0B638 /* Time Sync Rx UDP Port - RW */
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -1,105 +1,106 @@
|
|||
/*******************************************************************************
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 Intel Corporation.
|
||||
#ifndef _E1000E_HW_H_
|
||||
#define _E1000E_HW_H_
|
||||
|
||||
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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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_
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
#include "e1000_osdep.h"
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
#include "e1000_regs.h"
|
||||
#include "e1000_defines.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_SERDES_DUAL 0x10D9
|
||||
#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA
|
||||
#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_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_M 0x10BF
|
||||
#define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5
|
||||
#define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB
|
||||
#define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD
|
||||
#define E1000_DEV_ID_ICH9_BM 0x10E5
|
||||
#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_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_REVISION_0 0
|
||||
#define E1000_REVISION_1 1
|
||||
#define E1000_REVISION_2 2
|
||||
#define E1000_REVISION_3 3
|
||||
#define E1000_REVISION_4 4
|
||||
#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_DEV_ID_PCH_SPT_I219_LM 0x156F /* Sunrise Point PCH */
|
||||
#define E1000_DEV_ID_PCH_SPT_I219_V 0x1570 /* Sunrise Point PCH */
|
||||
#define E1000_DEV_ID_PCH_SPT_I219_LM2 0x15B8 /* Sunrise Point-H PCH */
|
||||
#define E1000_DEV_ID_PCH_SPT_I219_V2 0x15B7 /* Sunrise Point-H PCH */
|
||||
|
||||
#define E1000_FUNC_0 0
|
||||
#define E1000_FUNC_1 1
|
||||
#define E1000_REVISION_4 4
|
||||
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
|
||||
#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_undefined = 0,
|
||||
e1000_82571,
|
||||
e1000_82572,
|
||||
e1000_82573,
|
||||
|
@ -110,7 +111,9 @@ enum e1000_mac_type {
|
|||
e1000_ich9lan,
|
||||
e1000_ich10lan,
|
||||
e1000_pchlan,
|
||||
e1000_num_macs /* List is 1-based, so subtract 1 for true count. */
|
||||
e1000_pch2lan,
|
||||
e1000_pch_lpt,
|
||||
e1000_pch_spt,
|
||||
};
|
||||
|
||||
enum e1000_media_type {
|
||||
|
@ -132,7 +135,7 @@ enum e1000_nvm_type {
|
|||
enum e1000_nvm_override {
|
||||
e1000_nvm_override_none = 0,
|
||||
e1000_nvm_override_spi_small,
|
||||
e1000_nvm_override_spi_large,
|
||||
e1000_nvm_override_spi_large
|
||||
};
|
||||
|
||||
enum e1000_phy_type {
|
||||
|
@ -147,26 +150,8 @@ enum e1000_phy_type {
|
|||
e1000_phy_bm,
|
||||
e1000_phy_82578,
|
||||
e1000_phy_82577,
|
||||
};
|
||||
|
||||
enum e1000_bus_type {
|
||||
e1000_bus_type_unknown = 0,
|
||||
e1000_bus_type_pci,
|
||||
e1000_bus_type_pcix,
|
||||
e1000_bus_type_pci_express,
|
||||
e1000_bus_type_reserved
|
||||
};
|
||||
|
||||
enum e1000_bus_speed {
|
||||
e1000_bus_speed_unknown = 0,
|
||||
e1000_bus_speed_33,
|
||||
e1000_bus_speed_66,
|
||||
e1000_bus_speed_100,
|
||||
e1000_bus_speed_120,
|
||||
e1000_bus_speed_133,
|
||||
e1000_bus_speed_2500,
|
||||
e1000_bus_speed_5000,
|
||||
e1000_bus_speed_reserved
|
||||
e1000_phy_82579,
|
||||
e1000_phy_i217,
|
||||
};
|
||||
|
||||
enum e1000_bus_width {
|
||||
|
@ -220,16 +205,15 @@ enum e1000_serdes_link_state {
|
|||
e1000_serdes_link_forced_up
|
||||
};
|
||||
|
||||
/* Receive Descriptor */
|
||||
struct e1000_rx_desc {
|
||||
__le64 buffer_addr; /* Address of the descriptor's data buffer */
|
||||
__le16 length; /* Length of data DMAed into data buffer */
|
||||
__le16 csum; /* Packet checksum */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 errors; /* Descriptor Errors */
|
||||
__le16 special;
|
||||
};
|
||||
|
||||
#ifndef __le16
|
||||
#define __le16 u16
|
||||
#endif
|
||||
#ifndef __le32
|
||||
#define __le32 u32
|
||||
#endif
|
||||
#ifndef __le64
|
||||
#define __le64 u64
|
||||
#endif
|
||||
/* Receive Descriptor - Extended */
|
||||
union e1000_rx_desc_extended {
|
||||
struct {
|
||||
|
@ -238,24 +222,28 @@ union e1000_rx_desc_extended {
|
|||
} read;
|
||||
struct {
|
||||
struct {
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
union {
|
||||
__le32 rss; /* RSS Hash */
|
||||
__le32 rss; /* RSS Hash */
|
||||
struct {
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
} csum_ip;
|
||||
} hi_dword;
|
||||
} lower;
|
||||
struct {
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le16 length;
|
||||
__le16 vlan; /* VLAN tag */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
} upper;
|
||||
} wb; /* writeback */
|
||||
} 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 {
|
||||
|
@ -264,44 +252,45 @@ union e1000_rx_desc_packet_split {
|
|||
} read;
|
||||
struct {
|
||||
struct {
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
union {
|
||||
__le32 rss; /* RSS Hash */
|
||||
__le32 rss; /* RSS Hash */
|
||||
struct {
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
__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 */
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le16 length0; /* length of buffer 0 */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
} middle;
|
||||
struct {
|
||||
__le16 header_status;
|
||||
__le16 length[3]; /* length of buffers 1-3 */
|
||||
/* length of buffers 1-3 */
|
||||
__le16 length[PS_PAGE_BUFFERS];
|
||||
} upper;
|
||||
__le64 reserved;
|
||||
} wb; /* writeback */
|
||||
} wb; /* writeback */
|
||||
};
|
||||
|
||||
/* Transmit Descriptor */
|
||||
struct e1000_tx_desc {
|
||||
__le64 buffer_addr; /* Address of the descriptor's data buffer */
|
||||
__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 */
|
||||
__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 */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 css; /* Checksum start */
|
||||
__le16 special;
|
||||
} fields;
|
||||
} upper;
|
||||
|
@ -312,37 +301,37 @@ struct e1000_context_desc {
|
|||
union {
|
||||
__le32 ip_config;
|
||||
struct {
|
||||
u8 ipcss; /* IP checksum start */
|
||||
u8 ipcso; /* IP checksum offset */
|
||||
__le16 ipcse; /* IP checksum end */
|
||||
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 */
|
||||
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 */
|
||||
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 */
|
||||
__le64 buffer_addr; /* Address of the descriptor's buffer address */
|
||||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
__le16 length; /* Data buffer length */
|
||||
__le16 length; /* Data buffer length */
|
||||
u8 typ_len_ext;
|
||||
u8 cmd;
|
||||
} flags;
|
||||
|
@ -350,8 +339,8 @@ struct e1000_data_desc {
|
|||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
u8 status; /* Descriptor status */
|
||||
u8 popts; /* Packet Options */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 popts; /* Packet Options */
|
||||
__le16 special;
|
||||
} fields;
|
||||
} upper;
|
||||
|
@ -422,10 +411,8 @@ struct e1000_hw_stats {
|
|||
u64 ictxqmtc;
|
||||
u64 icrxdmtc;
|
||||
u64 icrxoc;
|
||||
u64 doosync;
|
||||
};
|
||||
|
||||
|
||||
struct e1000_phy_stats {
|
||||
u32 idle_errors;
|
||||
u32 receive_errors;
|
||||
|
@ -433,13 +420,13 @@ struct e1000_phy_stats {
|
|||
|
||||
struct e1000_host_mng_dhcp_cookie {
|
||||
u32 signature;
|
||||
u8 status;
|
||||
u8 reserved0;
|
||||
u8 status;
|
||||
u8 reserved0;
|
||||
u16 vlan_id;
|
||||
u32 reserved1;
|
||||
u16 reserved2;
|
||||
u8 reserved3;
|
||||
u8 checksum;
|
||||
u8 reserved3;
|
||||
u8 checksum;
|
||||
};
|
||||
|
||||
/* Host Interface "Rev 1" */
|
||||
|
@ -450,7 +437,7 @@ struct e1000_host_command_header {
|
|||
u8 checksum;
|
||||
};
|
||||
|
||||
#define E1000_HI_MAX_DATA_LENGTH 252
|
||||
#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];
|
||||
|
@ -458,97 +445,107 @@ struct e1000_host_command_info {
|
|||
|
||||
/* Host Interface "Rev 2" */
|
||||
struct e1000_host_mng_command_header {
|
||||
u8 command_id;
|
||||
u8 checksum;
|
||||
u8 command_id;
|
||||
u8 checksum;
|
||||
u16 reserved1;
|
||||
u16 reserved2;
|
||||
u16 command_length;
|
||||
};
|
||||
|
||||
#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
|
||||
#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 "e1000_mac.h"
|
||||
#include "e1000_phy.h"
|
||||
#include "e1000_nvm.h"
|
||||
#include "e1000_manage.h"
|
||||
#include "mac.h"
|
||||
#include "phy.h"
|
||||
#include "nvm.h"
|
||||
#include "manage.h"
|
||||
|
||||
/* Function pointers for the MAC. */
|
||||
struct e1000_mac_operations {
|
||||
/* Function pointers for the MAC. */
|
||||
s32 (*init_params)(struct e1000_hw *);
|
||||
s32 (*id_led_init)(struct e1000_hw *);
|
||||
s32 (*blink_led)(struct e1000_hw *);
|
||||
s32 (*check_for_link)(struct e1000_hw *);
|
||||
bool (*check_mng_mode)(struct e1000_hw *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 (*mta_set)(struct e1000_hw *, u32);
|
||||
void (*config_collision_dist)(struct e1000_hw *);
|
||||
void (*rar_set)(struct e1000_hw *, u8*, u32);
|
||||
s32 (*read_mac_addr)(struct e1000_hw *);
|
||||
s32 (*validate_mdi_setting)(struct e1000_hw *);
|
||||
s32 (*mng_host_if_write)(struct e1000_hw *, u8*, u16, u16, u8*);
|
||||
s32 (*mng_write_cmd_header)(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header*);
|
||||
s32 (*mng_enable_host_if)(struct e1000_hw *);
|
||||
s32 (*wait_autoneg)(struct e1000_hw *);
|
||||
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);
|
||||
u32 (*rar_get_count) (struct e1000_hw *);
|
||||
s32 (*read_mac_addr) (struct e1000_hw *);
|
||||
s32 (*validate_mdi_setting) (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 (*init_params)(struct e1000_hw *);
|
||||
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 (*read_reg)(struct e1000_hw *, u32, u16 *);
|
||||
s32 (*read_reg_locked)(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);
|
||||
void (*power_up)(struct e1000_hw *);
|
||||
void (*power_down)(struct e1000_hw *);
|
||||
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 (*init_params)(struct e1000_hw *);
|
||||
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 *);
|
||||
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[6];
|
||||
u8 perm_addr[6];
|
||||
u8 addr[ETH_ALEN];
|
||||
u8 perm_addr[ETH_ALEN];
|
||||
|
||||
enum e1000_mac_type type;
|
||||
|
||||
|
@ -568,26 +565,27 @@ struct e1000_mac_info {
|
|||
u16 mta_reg_count;
|
||||
|
||||
/* Maximum size of the MTA register table in all supported adapters */
|
||||
#define MAX_MTA_REG 128
|
||||
#define MAX_MTA_REG 128
|
||||
u32 mta_shadow[MAX_MTA_REG];
|
||||
u16 rar_entry_count;
|
||||
|
||||
u8 forced_speed_duplex;
|
||||
u8 forced_speed_duplex;
|
||||
|
||||
bool adaptive_ifs;
|
||||
bool has_fwsm;
|
||||
bool arc_subsystem_valid;
|
||||
bool asf_firmware_present;
|
||||
bool autoneg;
|
||||
bool autoneg_failed;
|
||||
bool get_link_status;
|
||||
bool in_ifs_mode;
|
||||
enum e1000_serdes_link_state serdes_link_state;
|
||||
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;
|
||||
|
@ -599,7 +597,7 @@ struct e1000_phy_info {
|
|||
|
||||
u32 addr;
|
||||
u32 id;
|
||||
u32 reset_delay_us; /* in usec */
|
||||
u32 reset_delay_us; /* in usec */
|
||||
u32 revision;
|
||||
|
||||
enum e1000_media_type media_type;
|
||||
|
@ -615,13 +613,13 @@ struct e1000_phy_info {
|
|||
bool disable_polarity_correction;
|
||||
bool is_mdix;
|
||||
bool polarity_correction;
|
||||
bool reset_disable;
|
||||
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;
|
||||
|
||||
|
@ -636,22 +634,20 @@ struct e1000_nvm_info {
|
|||
};
|
||||
|
||||
struct e1000_bus_info {
|
||||
enum e1000_bus_type type;
|
||||
enum e1000_bus_speed speed;
|
||||
enum e1000_bus_width width;
|
||||
|
||||
u16 func;
|
||||
u16 pci_cmd_word;
|
||||
};
|
||||
|
||||
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 */
|
||||
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 */
|
||||
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 {
|
||||
|
@ -660,54 +656,58 @@ struct e1000_dev_spec_82571 {
|
|||
};
|
||||
|
||||
struct e1000_dev_spec_80003es2lan {
|
||||
bool mdic_wa_enable;
|
||||
bool mdic_wa_enable;
|
||||
};
|
||||
|
||||
struct e1000_shadow_ram {
|
||||
u16 value;
|
||||
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;
|
||||
#ifdef DYNAMIC_LTR_SUPPORT
|
||||
u16 lat_enc;
|
||||
u16 max_ltr_enc;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct e1000_hw {
|
||||
struct e1000_adapter *adapter;
|
||||
|
||||
u8 __iomem *hw_addr;
|
||||
u8 __iomem *flash_address;
|
||||
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_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 _82571;
|
||||
struct e1000_dev_spec_80003es2lan _80003es2lan;
|
||||
struct e1000_dev_spec_ich8lan ich8lan;
|
||||
struct e1000_dev_spec_82571 e82571;
|
||||
struct e1000_dev_spec_80003es2lan e80003es2lan;
|
||||
struct e1000_dev_spec_ich8lan ich8lan;
|
||||
} dev_spec;
|
||||
|
||||
u16 device_id;
|
||||
u16 subsystem_vendor_id;
|
||||
u16 subsystem_device_id;
|
||||
u16 vendor_id;
|
||||
|
||||
u8 revision_id;
|
||||
};
|
||||
|
||||
#include "e1000_82571.h"
|
||||
#include "e1000_80003es2lan.h"
|
||||
#include "e1000_ich8lan.h"
|
||||
|
||||
/* These functions must be implemented by drivers */
|
||||
s32 e1000_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value);
|
||||
#include "82571.h"
|
||||
#include "80003es2lan.h"
|
||||
#include "ich8lan.h"
|
||||
|
||||
#endif
|
||||
|
|
5855
vmkdrivers/src_9/drivers/net/e1000e/ich8lan.c
Normal file
5855
vmkdrivers/src_9/drivers/net/e1000e/ich8lan.c
Normal file
File diff suppressed because it is too large
Load diff
308
vmkdrivers/src_9/drivers/net/e1000e/ich8lan.h
Normal file
308
vmkdrivers/src_9/drivers/net/e1000e/ich8lan.h
Normal file
|
@ -0,0 +1,308 @@
|
|||
/*
|
||||
* 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
|
||||
|
||||
#ifdef __VMKLNX__
|
||||
#define ICH_FLASH_PR0 0x0074
|
||||
#endif /* __VMKLNX__ */
|
||||
|
||||
/* 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 NVM_SIZE_MULTIPLIER 4096 /*multiplier for NVMS field */
|
||||
#define E1000_FLASH_BASE_ADDR 0xE000 /*offset of NVM access regs */
|
||||
#define E1000_CTRL_EXT_NVMVS 0x3 /*NVM valid sector */
|
||||
|
||||
#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
|
||||
|
||||
/* 82579 DFT Control */
|
||||
#define I82579_DFT_CTRL PHY_REG(769, 20)
|
||||
#define I82579_DFT_CTRL_GATE_PHY_RESET 0x0040 /* Gate PHY Reset on MAC Reset */
|
||||
|
||||
/* 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
|
||||
|
||||
#define E1000_PCI_REVISION_ID_REG 0x08
|
||||
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_ */
|
||||
#ifdef DYNAMIC_LTR_SUPPORT
|
||||
void e1000_demote_ltr(struct e1000_hw *hw, bool demote, bool link);
|
||||
#endif /* DYNAMIC_LTR_SUPPORT */
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,30 +1,24 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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
|
||||
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*
|
||||
* net/core/ethtool.c - Ethtool ioctl handler
|
||||
|
@ -62,49 +56,48 @@
|
|||
#undef ADVERTISED_10000baseT_Full
|
||||
#define ADVERTISED_10000baseT_Full (1 << 12)
|
||||
#undef SPEED_10000
|
||||
#define SPEED_10000 10000
|
||||
|
||||
#undef ethtool_ops
|
||||
#define ethtool_ops _kc_ethtool_ops
|
||||
|
||||
struct _kc_ethtool_ops {
|
||||
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
|
||||
int (*set_settings)(struct net_device *, struct ethtool_cmd *);
|
||||
void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
|
||||
int (*get_regs_len)(struct net_device *);
|
||||
void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
|
||||
void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
|
||||
int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
|
||||
u32 (*get_msglevel)(struct net_device *);
|
||||
void (*set_msglevel)(struct net_device *, u32);
|
||||
int (*nway_reset)(struct net_device *);
|
||||
u32 (*get_link)(struct net_device *);
|
||||
int (*get_eeprom_len)(struct net_device *);
|
||||
int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
|
||||
int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
|
||||
int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
|
||||
int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
|
||||
void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
|
||||
int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
|
||||
void (*get_pauseparam)(struct net_device *,
|
||||
struct ethtool_pauseparam*);
|
||||
int (*set_pauseparam)(struct net_device *,
|
||||
struct ethtool_pauseparam*);
|
||||
u32 (*get_rx_csum)(struct net_device *);
|
||||
int (*set_rx_csum)(struct net_device *, u32);
|
||||
u32 (*get_tx_csum)(struct net_device *);
|
||||
int (*set_tx_csum)(struct net_device *, u32);
|
||||
u32 (*get_sg)(struct net_device *);
|
||||
int (*set_sg)(struct net_device *, u32);
|
||||
u32 (*get_tso)(struct net_device *);
|
||||
int (*set_tso)(struct net_device *, u32);
|
||||
int (*self_test_count)(struct net_device *);
|
||||
void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
|
||||
void (*get_strings)(struct net_device *, u32 stringset, u8 *);
|
||||
int (*phys_id)(struct net_device *, u32);
|
||||
int (*get_stats_count)(struct net_device *);
|
||||
void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *,
|
||||
u64 *);
|
||||
int (*get_settings) (struct net_device *, struct ethtool_cmd *);
|
||||
int (*set_settings) (struct net_device *, struct ethtool_cmd *);
|
||||
void (*get_drvinfo) (struct net_device *, struct ethtool_drvinfo *);
|
||||
int (*get_regs_len) (struct net_device *);
|
||||
void (*get_regs) (struct net_device *, struct ethtool_regs *, void *);
|
||||
void (*get_wol) (struct net_device *, struct ethtool_wolinfo *);
|
||||
int (*set_wol) (struct net_device *, struct ethtool_wolinfo *);
|
||||
u32 (*get_msglevel) (struct net_device *);
|
||||
void (*set_msglevel) (struct net_device *, u32);
|
||||
int (*nway_reset) (struct net_device *);
|
||||
u32 (*get_link) (struct net_device *);
|
||||
int (*get_eeprom_len) (struct net_device *);
|
||||
int (*get_eeprom) (struct net_device *, struct ethtool_eeprom *, u8 *);
|
||||
int (*set_eeprom) (struct net_device *, struct ethtool_eeprom *, u8 *);
|
||||
int (*get_coalesce) (struct net_device *, struct ethtool_coalesce *);
|
||||
int (*set_coalesce) (struct net_device *, struct ethtool_coalesce *);
|
||||
void (*get_ringparam) (struct net_device *, struct ethtool_ringparam *);
|
||||
int (*set_ringparam) (struct net_device *, struct ethtool_ringparam *);
|
||||
void (*get_pauseparam) (struct net_device *,
|
||||
struct ethtool_pauseparam *);
|
||||
int (*set_pauseparam) (struct net_device *,
|
||||
struct ethtool_pauseparam *);
|
||||
u32 (*get_rx_csum) (struct net_device *);
|
||||
int (*set_rx_csum) (struct net_device *, u32);
|
||||
u32 (*get_tx_csum) (struct net_device *);
|
||||
int (*set_tx_csum) (struct net_device *, u32);
|
||||
u32 (*get_sg) (struct net_device *);
|
||||
int (*set_sg) (struct net_device *, u32);
|
||||
u32 (*get_tso) (struct net_device *);
|
||||
int (*set_tso) (struct net_device *, u32);
|
||||
int (*self_test_count) (struct net_device *);
|
||||
void (*self_test) (struct net_device *, struct ethtool_test *, u64 *);
|
||||
void (*get_strings) (struct net_device *, u32 stringset, u8 *);
|
||||
int (*phys_id) (struct net_device *, u32);
|
||||
int (*get_stats_count) (struct net_device *);
|
||||
void (*get_ethtool_stats) (struct net_device *, struct ethtool_stats *,
|
||||
u64 *);
|
||||
} *ethtool_ops = NULL;
|
||||
|
||||
#undef SET_ETHTOOL_OPS
|
||||
|
@ -783,7 +776,7 @@ out:
|
|||
int ethtool_ioctl(struct ifreq *ifr)
|
||||
{
|
||||
struct net_device *dev = __dev_get_by_name(ifr->ifr_name);
|
||||
void *useraddr = (void *) ifr->ifr_data;
|
||||
void *useraddr = (void *)ifr->ifr_data;
|
||||
u32 ethcmd;
|
||||
|
||||
/*
|
||||
|
@ -796,7 +789,7 @@ int ethtool_ioctl(struct ifreq *ifr)
|
|||
if (!dev || !netif_device_present(dev))
|
||||
return -ENODEV;
|
||||
|
||||
if (copy_from_user(ðcmd, useraddr, sizeof (ethcmd)))
|
||||
if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd)))
|
||||
return -EFAULT;
|
||||
|
||||
switch (ethcmd) {
|
||||
|
@ -874,12 +867,13 @@ struct _kc_mii_if_info {
|
|||
int phy_id_mask;
|
||||
int reg_num_mask;
|
||||
|
||||
unsigned int full_duplex : 1; /* is full duplex? */
|
||||
unsigned int force_media : 1; /* is autoneg. disabled? */
|
||||
unsigned int full_duplex:1; /* is full duplex? */
|
||||
unsigned int force_media:1; /* is autoneg. disabled? */
|
||||
|
||||
struct net_device *dev;
|
||||
int (*mdio_read) (struct net_device *dev, int phy_id, int location);
|
||||
void (*mdio_write) (struct net_device *dev, int phy_id, int location, int val);
|
||||
int (*mdio_read) (struct net_device * dev, int phy_id, int location);
|
||||
void (*mdio_write) (struct net_device * dev, int phy_id, int location,
|
||||
int val);
|
||||
};
|
||||
|
||||
struct ethtool_cmd;
|
||||
|
@ -895,19 +889,20 @@ struct mii_ioctl_data;
|
|||
#define mii_ethtool_sset _kc_mii_ethtool_sset
|
||||
#undef mii_check_link
|
||||
#define mii_check_link _kc_mii_check_link
|
||||
extern int _kc_mii_link_ok(struct mii_if_info *mii);
|
||||
extern int _kc_mii_nway_restart(struct mii_if_info *mii);
|
||||
extern int _kc_mii_ethtool_gset(struct mii_if_info *mii,
|
||||
struct ethtool_cmd *ecmd);
|
||||
extern int _kc_mii_ethtool_sset(struct mii_if_info *mii,
|
||||
struct ethtool_cmd *ecmd);
|
||||
extern void _kc_mii_check_link(struct mii_if_info *mii);
|
||||
#if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,4,6) )
|
||||
#undef generic_mii_ioctl
|
||||
#define generic_mii_ioctl _kc_generic_mii_ioctl
|
||||
extern int _kc_mii_link_ok (struct mii_if_info *mii);
|
||||
extern int _kc_mii_nway_restart (struct mii_if_info *mii);
|
||||
extern int _kc_mii_ethtool_gset(struct mii_if_info *mii,
|
||||
struct ethtool_cmd *ecmd);
|
||||
extern int _kc_mii_ethtool_sset(struct mii_if_info *mii,
|
||||
struct ethtool_cmd *ecmd);
|
||||
extern void _kc_mii_check_link (struct mii_if_info *mii);
|
||||
extern int _kc_generic_mii_ioctl(struct mii_if_info *mii_if,
|
||||
struct mii_ioctl_data *mii_data, int cmd,
|
||||
unsigned int *duplex_changed);
|
||||
|
||||
struct mii_ioctl_data *mii_data, int cmd,
|
||||
unsigned int *duplex_changed);
|
||||
#endif /* > 2.4.6 */
|
||||
|
||||
struct _kc_pci_dev_ext {
|
||||
struct pci_dev *dev;
|
||||
|
@ -920,7 +915,6 @@ struct _kc_net_dev_ext {
|
|||
unsigned int carrier;
|
||||
};
|
||||
|
||||
|
||||
/**************************************/
|
||||
/* mii support */
|
||||
|
||||
|
@ -976,7 +970,8 @@ int _kc_mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
|
|||
ecmd->autoneg = AUTONEG_DISABLE;
|
||||
|
||||
ecmd->speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
|
||||
ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
|
||||
ecmd->duplex =
|
||||
(bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
|
||||
}
|
||||
|
||||
/* ignore maxtxpkt, maxrxpkt for now */
|
||||
|
@ -1055,7 +1050,7 @@ int _kc_mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _kc_mii_link_ok (struct mii_if_info *mii)
|
||||
int _kc_mii_link_ok(struct mii_if_info *mii)
|
||||
{
|
||||
/* first, a dummy read, needed to latch some MII phys */
|
||||
mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR);
|
||||
|
@ -1064,7 +1059,7 @@ int _kc_mii_link_ok (struct mii_if_info *mii)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int _kc_mii_nway_restart (struct mii_if_info *mii)
|
||||
int _kc_mii_nway_restart(struct mii_if_info *mii)
|
||||
{
|
||||
int bmcr;
|
||||
int r = -EINVAL;
|
||||
|
@ -1081,7 +1076,7 @@ int _kc_mii_nway_restart (struct mii_if_info *mii)
|
|||
return r;
|
||||
}
|
||||
|
||||
void _kc_mii_check_link (struct mii_if_info *mii)
|
||||
void _kc_mii_check_link(struct mii_if_info *mii)
|
||||
{
|
||||
int cur_link = mii_link_ok(mii);
|
||||
int prev_link = netif_carrier_ok(mii->dev);
|
||||
|
@ -1092,9 +1087,10 @@ void _kc_mii_check_link (struct mii_if_info *mii)
|
|||
netif_carrier_off(mii->dev);
|
||||
}
|
||||
|
||||
#if ( LINUX_VERSION_CODE > KERNEL_VERSION(2,4,6) )
|
||||
int _kc_generic_mii_ioctl(struct mii_if_info *mii_if,
|
||||
struct mii_ioctl_data *mii_data, int cmd,
|
||||
unsigned int *duplex_chg_out)
|
||||
struct mii_ioctl_data *mii_data, int cmd,
|
||||
unsigned int *duplex_chg_out)
|
||||
{
|
||||
int rc = 0;
|
||||
unsigned int duplex_changed = 0;
|
||||
|
@ -1105,56 +1101,60 @@ int _kc_generic_mii_ioctl(struct mii_if_info *mii_if,
|
|||
mii_data->phy_id &= mii_if->phy_id_mask;
|
||||
mii_data->reg_num &= mii_if->reg_num_mask;
|
||||
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case SIOCDEVPRIVATE: /* binary compat, remove in 2.5 */
|
||||
case SIOCGMIIPHY:
|
||||
mii_data->phy_id = mii_if->phy_id;
|
||||
/* fall through */
|
||||
|
||||
case SIOCDEVPRIVATE + 1:/* binary compat, remove in 2.5 */
|
||||
case SIOCDEVPRIVATE + 1: /* binary compat, remove in 2.5 */
|
||||
case SIOCGMIIREG:
|
||||
mii_data->val_out =
|
||||
mii_if->mdio_read(mii_if->dev, mii_data->phy_id,
|
||||
mii_data->reg_num);
|
||||
mii_if->mdio_read(mii_if->dev, mii_data->phy_id,
|
||||
mii_data->reg_num);
|
||||
break;
|
||||
|
||||
case SIOCDEVPRIVATE + 2:/* binary compat, remove in 2.5 */
|
||||
case SIOCSMIIREG: {
|
||||
u16 val = mii_data->val_in;
|
||||
case SIOCDEVPRIVATE + 2: /* binary compat, remove in 2.5 */
|
||||
case SIOCSMIIREG:{
|
||||
u16 val = mii_data->val_in;
|
||||
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (mii_data->phy_id == mii_if->phy_id) {
|
||||
switch(mii_data->reg_num) {
|
||||
case MII_BMCR: {
|
||||
unsigned int new_duplex = 0;
|
||||
if (val & (BMCR_RESET|BMCR_ANENABLE))
|
||||
mii_if->force_media = 0;
|
||||
else
|
||||
mii_if->force_media = 1;
|
||||
if (mii_if->force_media &&
|
||||
(val & BMCR_FULLDPLX))
|
||||
new_duplex = 1;
|
||||
if (mii_if->full_duplex != new_duplex) {
|
||||
duplex_changed = 1;
|
||||
mii_if->full_duplex = new_duplex;
|
||||
if (mii_data->phy_id == mii_if->phy_id) {
|
||||
switch (mii_data->reg_num) {
|
||||
case MII_BMCR:{
|
||||
unsigned int new_duplex = 0;
|
||||
if (val &
|
||||
(BMCR_RESET |
|
||||
BMCR_ANENABLE))
|
||||
mii_if->force_media = 0;
|
||||
else
|
||||
mii_if->force_media = 1;
|
||||
if (mii_if->force_media &&
|
||||
(val & BMCR_FULLDPLX))
|
||||
new_duplex = 1;
|
||||
if (mii_if->full_duplex !=
|
||||
new_duplex) {
|
||||
duplex_changed = 1;
|
||||
mii_if->full_duplex =
|
||||
new_duplex;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MII_ADVERTISE:
|
||||
mii_if->advertising = val;
|
||||
break;
|
||||
default:
|
||||
/* do nothing */
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MII_ADVERTISE:
|
||||
mii_if->advertising = val;
|
||||
break;
|
||||
default:
|
||||
/* do nothing */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mii_if->mdio_write(mii_if->dev, mii_data->phy_id,
|
||||
mii_data->reg_num, val);
|
||||
break;
|
||||
}
|
||||
mii_if->mdio_write(mii_if->dev, mii_data->phy_id,
|
||||
mii_data->reg_num, val);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
rc = -EOPNOTSUPP;
|
||||
|
@ -1166,4 +1166,4 @@ int _kc_generic_mii_ioctl(struct mii_if_info *mii_if,
|
|||
|
||||
return rc;
|
||||
}
|
||||
|
||||
#endif /* > 2.4.6 */
|
||||
|
|
File diff suppressed because it is too large
Load diff
69
vmkdrivers/src_9/drivers/net/e1000e/mac.h
Normal file
69
vmkdrivers/src_9/drivers/net/e1000e/mac.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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);
|
||||
int e1000e_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
|
||||
u32 e1000e_rar_get_count_generic(struct e1000_hw *hw);
|
||||
void e1000e_config_collision_dist_generic(struct e1000_hw *hw);
|
||||
|
||||
#endif
|
|
@ -1,35 +1,27 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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
|
||||
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* 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"
|
||||
|
||||
static u8 e1000_calculate_checksum(u8 *buffer, u32 length);
|
||||
|
||||
/**
|
||||
* e1000_calculate_checksum - Calculate checksum for buffer
|
||||
* @buffer: pointer to EEPROM
|
||||
|
@ -41,18 +33,18 @@ static u8 e1000_calculate_checksum(u8 *buffer, u32 length);
|
|||
static u8 e1000_calculate_checksum(u8 *buffer, u32 length)
|
||||
{
|
||||
u32 i;
|
||||
u8 sum = 0;
|
||||
u8 sum = 0;
|
||||
|
||||
if (!buffer)
|
||||
return 0;
|
||||
for (i = 0; i < length; i++)
|
||||
sum += buffer[i];
|
||||
|
||||
return (u8) (0 - sum);
|
||||
return (u8)(0 - sum);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_mng_enable_host_if_generic - Checks host interface is enabled
|
||||
* e1000_mng_enable_host_if - Checks host interface is enabled
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
|
||||
|
@ -61,18 +53,21 @@ static u8 e1000_calculate_checksum(u8 *buffer, u32 length)
|
|||
* and also checks whether the previous command is completed. It busy waits
|
||||
* in case of previous command is not completed.
|
||||
**/
|
||||
s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw)
|
||||
static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
|
||||
{
|
||||
u32 hicr;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u8 i;
|
||||
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) == 0) {
|
||||
if (!(hicr & E1000_HICR_EN)) {
|
||||
e_dbg("E1000_HOST_EN bit disabled.\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
/* check the previous command is completed */
|
||||
for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) {
|
||||
|
@ -84,31 +79,29 @@ s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw)
|
|||
|
||||
if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
|
||||
e_dbg("Previous command timeout failed .\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_check_mng_mode_generic - Generic check management mode
|
||||
* 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 e1000_check_mng_mode_generic(struct e1000_hw *hw)
|
||||
bool e1000e_check_mng_mode_generic(struct e1000_hw *hw)
|
||||
{
|
||||
u32 fwsm;
|
||||
u32 fwsm = er32(FWSM);
|
||||
|
||||
fwsm = er32(FWSM);
|
||||
return (fwsm & E1000_FWSM_MODE_MASK) ==
|
||||
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
|
||||
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_enable_tx_pkt_filtering - Enable packet filtering on TX
|
||||
* 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
|
||||
|
@ -121,53 +114,146 @@ bool e1000e_enable_tx_pkt_filtering(struct e1000_hw *hw)
|
|||
u32 offset;
|
||||
s32 ret_val, hdr_csum, csum;
|
||||
u8 i, len;
|
||||
bool tx_filter = true;
|
||||
|
||||
hw->mac.tx_pkt_filtering = true;
|
||||
|
||||
/* No manageability, no filtering */
|
||||
if (!hw->mac.ops.check_mng_mode(hw)) {
|
||||
tx_filter = false;
|
||||
goto out;
|
||||
hw->mac.tx_pkt_filtering = false;
|
||||
return hw->mac.tx_pkt_filtering;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we can't read from the host interface for whatever
|
||||
/* If we can't read from the host interface for whatever
|
||||
* reason, disable filtering.
|
||||
*/
|
||||
ret_val = hw->mac.ops.mng_enable_host_if(hw);
|
||||
if (ret_val != E1000_SUCCESS) {
|
||||
tx_filter = false;
|
||||
goto out;
|
||||
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;
|
||||
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_DWORD(hw,
|
||||
E1000_HOST_IF,
|
||||
offset + i);
|
||||
}
|
||||
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
|
||||
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)
|
||||
goto out;
|
||||
if (hdr->signature != E1000_IAMT_SIGNATURE)
|
||||
goto out;
|
||||
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))
|
||||
tx_filter = false;
|
||||
hw->mac.tx_pkt_filtering = false;
|
||||
|
||||
out:
|
||||
hw->mac.tx_pkt_filtering = tx_filter;
|
||||
return tx_filter;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,8 +264,7 @@ out:
|
|||
*
|
||||
* Writes the DHCP information to the host interface.
|
||||
**/
|
||||
s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length)
|
||||
s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
|
||||
{
|
||||
struct e1000_host_mng_command_header hdr;
|
||||
s32 ret_val;
|
||||
|
@ -192,174 +277,71 @@ s32 e1000e_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer,
|
|||
hdr.checksum = 0;
|
||||
|
||||
/* Enable the host interface */
|
||||
ret_val = hw->mac.ops.mng_enable_host_if(hw);
|
||||
ret_val = e1000_mng_enable_host_if(hw);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
return ret_val;
|
||||
|
||||
/* Populate the host interface with the contents of "buffer". */
|
||||
ret_val = hw->mac.ops.mng_host_if_write(hw, buffer, length,
|
||||
sizeof(hdr), &(hdr.checksum));
|
||||
ret_val = e1000_mng_host_if_write(hw, buffer, length,
|
||||
sizeof(hdr), &(hdr.checksum));
|
||||
if (ret_val)
|
||||
goto out;
|
||||
return ret_val;
|
||||
|
||||
/* Write the manageability command header */
|
||||
ret_val = hw->mac.ops.mng_write_cmd_header(hw, &hdr);
|
||||
ret_val = e1000_mng_write_cmd_header(hw, &hdr);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
return ret_val;
|
||||
|
||||
/* Tell the ARC a new command is pending. */
|
||||
hicr = er32(HICR);
|
||||
ew32(HICR, hicr | E1000_HICR_C);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_mng_write_cmd_header_generic - 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.
|
||||
**/
|
||||
s32 e1000_mng_write_cmd_header_generic(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_DWORD(hw, E1000_HOST_IF, i,
|
||||
*((u32 *) hdr + i));
|
||||
e1e_flush();
|
||||
}
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_mng_host_if_write_generic - 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.
|
||||
**/
|
||||
s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length, u16 offset, u8 *sum)
|
||||
{
|
||||
u8 *tmp;
|
||||
u8 *bufptr = buffer;
|
||||
u32 data = 0;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
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) {
|
||||
ret_val = -E1000_ERR_PARAM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
tmp = (u8 *)&data;
|
||||
prev_bytes = offset & 0x3;
|
||||
offset >>= 2;
|
||||
|
||||
if (prev_bytes) {
|
||||
data = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset);
|
||||
for (j = prev_bytes; j < sizeof(u32); j++) {
|
||||
*(tmp + j) = *bufptr++;
|
||||
*sum += *(tmp + j);
|
||||
}
|
||||
E1000_WRITE_REG_ARRAY_DWORD(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_DWORD(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_DWORD(hw, E1000_HOST_IF, offset + i, data);
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_enable_mng_pass_thru - Enable processing of ARP's
|
||||
* e1000e_enable_mng_pass_thru - Check if management passthrough is needed
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Verifies the hardware needs to allow ARPs to be processed by the host.
|
||||
* 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;
|
||||
bool ret_val = false;
|
||||
|
||||
if (!hw->mac.asf_firmware_present)
|
||||
goto out;
|
||||
|
||||
manc = er32(MANC);
|
||||
|
||||
if (!(manc & E1000_MANC_RCV_TCO_EN) ||
|
||||
!(manc & E1000_MANC_EN_MAC_ADDR_FILTER))
|
||||
goto out;
|
||||
if (!(manc & E1000_MANC_RCV_TCO_EN))
|
||||
return false;
|
||||
|
||||
if (hw->mac.arc_subsystem_valid) {
|
||||
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))) {
|
||||
ret_val = true;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
if ((manc & E1000_MANC_SMBUS_EN) &&
|
||||
!(manc & E1000_MANC_ASF_EN)) {
|
||||
ret_val = true;
|
||||
goto out;
|
||||
}
|
||||
(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;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return false;
|
||||
}
|
||||
|
66
vmkdrivers/src_9/drivers/net/e1000e/manage.h
Normal file
66
vmkdrivers/src_9/drivers/net/e1000e/manage.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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
|
File diff suppressed because it is too large
Load diff
|
@ -1,49 +1,27 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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
|
||||
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* 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"
|
||||
|
||||
static void e1000_stop_nvm(struct e1000_hw *hw);
|
||||
static void e1000e_reload_nvm(struct e1000_hw *hw);
|
||||
|
||||
/**
|
||||
* e1000_init_nvm_ops_generic - Initialize NVM function pointers
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Setups up the function pointers to no-op functions
|
||||
**/
|
||||
void e1000_init_nvm_ops_generic(struct e1000_hw *hw)
|
||||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
/* Initialize function pointers */
|
||||
nvm->ops.reload = e1000e_reload_nvm;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_raise_eec_clk - Raise EEPROM clock
|
||||
* @hw: pointer to the HW structure
|
||||
|
@ -164,7 +142,6 @@ s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
|
|||
{
|
||||
u32 attempts = 100000;
|
||||
u32 i, reg = 0;
|
||||
s32 ret_val = -E1000_ERR_NVM;
|
||||
|
||||
for (i = 0; i < attempts; i++) {
|
||||
if (ee_reg == E1000_NVM_POLL_READ)
|
||||
|
@ -172,15 +149,13 @@ s32 e1000e_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg)
|
|||
else
|
||||
reg = er32(EEWR);
|
||||
|
||||
if (reg & E1000_NVM_RW_REG_DONE) {
|
||||
ret_val = E1000_SUCCESS;
|
||||
break;
|
||||
}
|
||||
if (reg & E1000_NVM_RW_REG_DONE)
|
||||
return 0;
|
||||
|
||||
udelay(5);
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
return -E1000_ERR_NVM;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -195,7 +170,6 @@ s32 e1000e_acquire_nvm(struct e1000_hw *hw)
|
|||
{
|
||||
u32 eecd = er32(EECD);
|
||||
s32 timeout = E1000_NVM_GRANT_ATTEMPTS;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
ew32(EECD, eecd | E1000_EECD_REQ);
|
||||
eecd = er32(EECD);
|
||||
|
@ -211,10 +185,10 @@ s32 e1000e_acquire_nvm(struct e1000_hw *hw)
|
|||
eecd &= ~E1000_EECD_REQ;
|
||||
ew32(EECD, eecd);
|
||||
e_dbg("Could not acquire NVM grant\n");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
return -E1000_ERR_NVM;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,26 +260,25 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
|
|||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
u32 eecd = er32(EECD);
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u16 timeout = 0;
|
||||
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);
|
||||
timeout = NVM_MAX_RETRY_SPI;
|
||||
|
||||
/*
|
||||
* Read "Status Register" repeatedly until the LSB is cleared.
|
||||
/* 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);
|
||||
hw->nvm.opcode_bits);
|
||||
spi_stat_reg = (u8)e1000_shift_in_eec_bits(hw, 8);
|
||||
if (!(spi_stat_reg & NVM_STATUS_RDY_SPI))
|
||||
break;
|
||||
|
@ -317,13 +290,11 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
|
|||
|
||||
if (!timeout) {
|
||||
e_dbg("SPI NVM Status error\n");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
goto out;
|
||||
return -E1000_ERR_NVM;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,33 +310,32 @@ 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 = E1000_SUCCESS;
|
||||
s32 ret_val = 0;
|
||||
|
||||
/*
|
||||
* A check for invalid values: offset too large, too many words,
|
||||
/* 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");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
goto out;
|
||||
return -E1000_ERR_NVM;
|
||||
}
|
||||
|
||||
for (i = 0; i < words; i++) {
|
||||
eerd = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) +
|
||||
E1000_NVM_RW_REG_START;
|
||||
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)
|
||||
break;
|
||||
|
||||
data[i] = (er32(EERD) >>
|
||||
E1000_NVM_RW_REG_DATA);
|
||||
data[i] = (er32(EERD) >> E1000_NVM_RW_REG_DATA);
|
||||
}
|
||||
|
||||
out:
|
||||
if (ret_val)
|
||||
e_dbg("NVM read error: %d\n", ret_val);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
@ -378,47 +348,46 @@ out:
|
|||
*
|
||||
* Writes data to EEPROM at offset using SPI interface.
|
||||
*
|
||||
* If e1000_update_nvm_checksum is not called after this function , the
|
||||
* 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;
|
||||
s32 ret_val = -E1000_ERR_NVM;
|
||||
u16 widx = 0;
|
||||
|
||||
/*
|
||||
* A check for invalid values: offset too large, too many words,
|
||||
/* 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");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
goto out;
|
||||
return -E1000_ERR_NVM;
|
||||
}
|
||||
|
||||
ret_val = nvm->ops.acquire(hw);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
while (widx < words) {
|
||||
u8 write_opcode = NVM_WRITE_OPCODE_SPI;
|
||||
|
||||
ret_val = e1000_ready_nvm_eeprom(hw);
|
||||
ret_val = nvm->ops.acquire(hw);
|
||||
if (ret_val)
|
||||
goto release;
|
||||
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);
|
||||
nvm->opcode_bits);
|
||||
|
||||
e1000_standby_nvm(hw);
|
||||
|
||||
/*
|
||||
* Some SPI eeproms use the 8th address bit embedded in the
|
||||
/* Some SPI eeproms use the 8th address bit embedded in the
|
||||
* opcode
|
||||
*/
|
||||
if ((nvm->address_bits == 8) && (offset >= 128))
|
||||
|
@ -427,7 +396,7 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
|
|||
/* 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);
|
||||
nvm->address_bits);
|
||||
|
||||
/* Loop to allow for up to whole page write of eeprom */
|
||||
while (widx < words) {
|
||||
|
@ -441,56 +410,130 @@ s32 e1000e_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
|
|||
break;
|
||||
}
|
||||
}
|
||||
usleep_range(10000, 20000);
|
||||
nvm->ops.release(hw);
|
||||
}
|
||||
|
||||
msleep(10);
|
||||
release:
|
||||
nvm->ops.release(hw);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_read_pba_num - Read device part number
|
||||
* 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 e1000e_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
|
||||
s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
|
||||
u32 pba_num_size)
|
||||
{
|
||||
s32 ret_val;
|
||||
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");
|
||||
goto out;
|
||||
return ret_val;
|
||||
}
|
||||
*pba_num = (u32)(nvm_data << 16);
|
||||
|
||||
ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
|
||||
ret_val = e1000_read_nvm(hw, NVM_PBA_OFFSET_1, 1, &pba_ptr);
|
||||
if (ret_val) {
|
||||
e_dbg("NVM Read Error\n");
|
||||
goto out;
|
||||
return ret_val;
|
||||
}
|
||||
*pba_num |= nvm_data;
|
||||
|
||||
out:
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_read_mac_addr_generic - Read device MAC address
|
||||
* 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 e1000e_read_mac_addr_generic(struct e1000_hw *hw)
|
||||
s32 e1000_read_mac_addr_generic(struct e1000_hw *hw)
|
||||
{
|
||||
u32 rar_high;
|
||||
u32 rar_low;
|
||||
|
@ -500,15 +543,15 @@ s32 e1000e_read_mac_addr_generic(struct e1000_hw *hw)
|
|||
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));
|
||||
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));
|
||||
hw->mac.perm_addr[i + 4] = (u8)(rar_high >> (i * 8));
|
||||
|
||||
for (i = 0; i < ETH_ADDR_LEN; i++)
|
||||
for (i = 0; i < ETH_ALEN; i++)
|
||||
hw->mac.addr[i] = hw->mac.perm_addr[i];
|
||||
|
||||
return E1000_SUCCESS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -520,7 +563,7 @@ s32 e1000e_read_mac_addr_generic(struct e1000_hw *hw)
|
|||
**/
|
||||
s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
s32 ret_val;
|
||||
u16 checksum = 0;
|
||||
u16 i, nvm_data;
|
||||
|
||||
|
@ -528,19 +571,17 @@ s32 e1000e_validate_nvm_checksum_generic(struct e1000_hw *hw)
|
|||
ret_val = e1000_read_nvm(hw, i, 1, &nvm_data);
|
||||
if (ret_val) {
|
||||
e_dbg("NVM Read Error\n");
|
||||
goto out;
|
||||
return ret_val;
|
||||
}
|
||||
checksum += nvm_data;
|
||||
}
|
||||
|
||||
if (checksum != (u16) NVM_SUM) {
|
||||
if (checksum != (u16)NVM_SUM) {
|
||||
e_dbg("NVM Checksum Invalid\n");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
goto out;
|
||||
return -E1000_ERR_NVM;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -553,7 +594,7 @@ out:
|
|||
**/
|
||||
s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val;
|
||||
s32 ret_val;
|
||||
u16 checksum = 0;
|
||||
u16 i, nvm_data;
|
||||
|
||||
|
@ -561,34 +602,32 @@ s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw)
|
|||
ret_val = e1000_read_nvm(hw, i, 1, &nvm_data);
|
||||
if (ret_val) {
|
||||
e_dbg("NVM Read Error while updating checksum.\n");
|
||||
goto out;
|
||||
return ret_val;
|
||||
}
|
||||
checksum += nvm_data;
|
||||
}
|
||||
checksum = (u16) NVM_SUM - checksum;
|
||||
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");
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000e_reload_nvm - Reloads EEPROM
|
||||
* 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.
|
||||
**/
|
||||
static void e1000e_reload_nvm(struct e1000_hw *hw)
|
||||
void e1000e_reload_nvm_generic(struct e1000_hw *hw)
|
||||
{
|
||||
u32 ctrl_ext;
|
||||
|
||||
udelay(10);
|
||||
usleep_range(10, 20);
|
||||
ctrl_ext = er32(CTRL_EXT);
|
||||
ctrl_ext |= E1000_CTRL_EXT_EE_RST;
|
||||
ew32(CTRL_EXT, ctrl_ext);
|
||||
e1e_flush();
|
||||
}
|
||||
|
41
vmkdrivers/src_9/drivers/net/e1000e/nvm.h
Normal file
41
vmkdrivers/src_9/drivers/net/e1000e/nvm.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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
|
|
@ -1,40 +1,34 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Intel PRO/1000 Linux driver
|
||||
Copyright(c) 1999 - 2009 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, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
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
|
||||
|
||||
*******************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
/* 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
|
||||
|
@ -45,14 +39,12 @@
|
|||
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");
|
||||
"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.
|
||||
/* 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 }
|
||||
#ifndef module_param_array
|
||||
/* Module Parameters are always initialized to -1, so that the driver
|
||||
|
@ -65,23 +57,27 @@ MODULE_PARM_DESC(copybreak,
|
|||
* "Extensions to the C Language Family" of the GCC documentation.
|
||||
*/
|
||||
#define E1000_PARAM(X, desc) \
|
||||
static const int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
|
||||
static const int X[E1000_MAX_NIC+1] __devinitconst = E1000_PARAM_INIT; \
|
||||
static unsigned int num_##X; \
|
||||
MODULE_PARM(X, "1-" __MODULE_STRING(E1000_MAX_NIC) "i"); \
|
||||
MODULE_PARM_DESC(X, desc);
|
||||
#elif defined(HAVE_CONFIG_HOTPLUG)
|
||||
#define E1000_PARAM(X, desc) \
|
||||
static int X[E1000_MAX_NIC+1] __devinitdata \
|
||||
= E1000_PARAM_INIT; \
|
||||
static unsigned int num_##X; \
|
||||
module_param_array_named(X, X, int, &num_##X, 0); \
|
||||
MODULE_PARM_DESC(X, desc);
|
||||
#else
|
||||
#define E1000_PARAM(X, desc) \
|
||||
static int __devinitdata X[E1000_MAX_NIC+1] \
|
||||
= E1000_PARAM_INIT; \
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Transmit Interrupt Delay in units of 1.024 microseconds
|
||||
* Tx interrupt delay needs to typically be set to something non zero
|
||||
/* 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
|
||||
*/
|
||||
|
@ -90,8 +86,7 @@ E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
|
|||
#define MAX_TXDELAY 0xFFFF
|
||||
#define MIN_TXDELAY 0
|
||||
|
||||
/*
|
||||
* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
|
||||
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
|
||||
*
|
||||
* Valid Range: 0-65535
|
||||
*/
|
||||
|
@ -100,51 +95,51 @@ E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
|
|||
#define MAX_TXABSDELAY 0xFFFF
|
||||
#define MIN_TXABSDELAY 0
|
||||
|
||||
/*
|
||||
* Receive Interrupt Delay in units of 1.024 microseconds
|
||||
/* 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 DEFAULT_RDTR 0
|
||||
#define MAX_RXDELAY 0xFFFF
|
||||
#define MIN_RXDELAY 0
|
||||
|
||||
/*
|
||||
* Receive Absolute Interrupt Delay in units of 1.024 microseconds
|
||||
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds
|
||||
*
|
||||
* Valid Range: 0-65535
|
||||
*/
|
||||
E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
|
||||
#define DEFAULT_RADV 8
|
||||
#define MAX_RXABSDELAY 0xFFFF
|
||||
#define MIN_RXABSDELAY 0
|
||||
|
||||
/*
|
||||
* Interrupt Throttle Rate (interrupts/sec)
|
||||
/* Interrupt Throttle Rate (interrupts/sec)
|
||||
*
|
||||
* Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
|
||||
* 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
|
||||
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
/* IntMode (Interrupt Mode)
|
||||
*
|
||||
* Valid Range: 0 - 2
|
||||
* Valid Range: varies depending on kernel configuration & hardware support
|
||||
*
|
||||
* Default Value: 2 (MSI-X)
|
||||
* 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
|
||||
|
||||
#endif /* CONFIG_E1000E_MSIX */
|
||||
/*
|
||||
* Enable Smart Power Down of the PHY
|
||||
/* Enable Smart Power Down of the PHY
|
||||
*
|
||||
* Valid Range: 0, 1
|
||||
*
|
||||
|
@ -152,8 +147,7 @@ E1000_PARAM(IntMode, "Interrupt Mode");
|
|||
*/
|
||||
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
|
||||
|
||||
/*
|
||||
* Enable Kumeran Lock Loss workaround
|
||||
/* Enable Kumeran Lock Loss workaround
|
||||
*
|
||||
* Valid Range: 0, 1
|
||||
*
|
||||
|
@ -161,17 +155,16 @@ E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
|
|||
*/
|
||||
E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
|
||||
|
||||
/*
|
||||
* Enable CRC Stripping
|
||||
/* Enable CRC Stripping
|
||||
*
|
||||
* Valid Range: 0, 1
|
||||
*
|
||||
* Default Value: 1 (enabled)
|
||||
*/
|
||||
E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \
|
||||
"the CRC");
|
||||
E1000_PARAM(CrcStripping,
|
||||
"Enable CRC Stripping, disable if your BMC needs the CRC");
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
#ifdef __VMKLNX__
|
||||
/*
|
||||
* Write Protect NVM
|
||||
*
|
||||
|
@ -180,7 +173,26 @@ E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \
|
|||
* Default Value: 1 (enabled)
|
||||
*/
|
||||
E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
#endif /* __VMKLNX__ */
|
||||
|
||||
/* Enable/disable EEE (a.k.a. IEEE802.3az)
|
||||
*
|
||||
* Valid Range: 0, 1
|
||||
*
|
||||
* Default Value: 1
|
||||
*/
|
||||
E1000_PARAM(EEE, "Enable/disable on parts that support the feature");
|
||||
|
||||
/* Enable node specific allocation of all data structures, typically
|
||||
* specific to routing setups, not generally useful.
|
||||
*
|
||||
* Depends on: NUMA configuration
|
||||
*
|
||||
* Valid Range: -1, 0-32768
|
||||
*
|
||||
* Default Value: -1 (disabled, default to kernel choice of node)
|
||||
*/
|
||||
E1000_PARAM(Node, "[ROUTING] Node to allocate memory on, default -1");
|
||||
|
||||
struct e1000_option {
|
||||
enum { enable_option, range_option, list_option } type;
|
||||
|
@ -188,20 +200,31 @@ struct e1000_option {
|
|||
const char *err;
|
||||
int def;
|
||||
union {
|
||||
struct { /* range_option info */
|
||||
/* range_option info */
|
||||
struct {
|
||||
int min;
|
||||
int max;
|
||||
} r;
|
||||
struct { /* list_option info */
|
||||
/* list_option info */
|
||||
struct {
|
||||
int nr;
|
||||
struct e1000_opt_list { int i; char *str; } *p;
|
||||
struct e1000_opt_list {
|
||||
int i;
|
||||
char *str;
|
||||
} *p;
|
||||
} l;
|
||||
} arg;
|
||||
};
|
||||
|
||||
#ifdef HAVE_CONFIG_HOTPLUG
|
||||
static int __devinit e1000_validate_option(unsigned int *value,
|
||||
const struct e1000_option *opt,
|
||||
struct e1000_adapter *adapter)
|
||||
#else
|
||||
static int e1000_validate_option(unsigned int *value,
|
||||
const struct e1000_option *opt,
|
||||
struct e1000_adapter *adapter)
|
||||
#endif
|
||||
{
|
||||
if (*value == OPTION_UNSET) {
|
||||
*value = opt->def;
|
||||
|
@ -212,16 +235,19 @@ static int __devinit e1000_validate_option(unsigned int *value,
|
|||
case enable_option:
|
||||
switch (*value) {
|
||||
case OPTION_ENABLED:
|
||||
e_info("%s Enabled\n", opt->name);
|
||||
dev_info(pci_dev_to_dev(adapter->pdev), "%s Enabled\n",
|
||||
opt->name);
|
||||
return 0;
|
||||
case OPTION_DISABLED:
|
||||
e_info("%s Disabled\n", opt->name);
|
||||
dev_info(pci_dev_to_dev(adapter->pdev), "%s Disabled\n",
|
||||
opt->name);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case range_option:
|
||||
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
|
||||
e_info("%s set to %i\n", opt->name, *value);
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"%s set to %i\n", opt->name, *value);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
@ -233,7 +259,8 @@ static int __devinit e1000_validate_option(unsigned int *value,
|
|||
ent = &opt->arg.l.p[i];
|
||||
if (*value == ent->i) {
|
||||
if (ent->str[0] != '\0')
|
||||
e_info("%s\n", ent->str);
|
||||
dev_info(pci_dev_to_dev(adapter->pdev), "%s\n",
|
||||
ent->str);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -243,8 +270,9 @@ static int __devinit e1000_validate_option(unsigned int *value,
|
|||
BUG();
|
||||
}
|
||||
|
||||
e_info("Invalid %s value specified (%i) %s\n", opt->name, *value,
|
||||
opt->err);
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"Invalid %s value specified (%i) %s\n", opt->name, *value,
|
||||
opt->err);
|
||||
*value = opt->def;
|
||||
return -1;
|
||||
}
|
||||
|
@ -258,18 +286,25 @@ static int __devinit e1000_validate_option(unsigned int *value,
|
|||
* value exists, a default value is used. The final value is stored
|
||||
* in a variable in the adapter structure.
|
||||
**/
|
||||
#ifdef HAVE_CONFIG_HOTPLUG
|
||||
void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
||||
#else
|
||||
void e1000e_check_options(struct e1000_adapter *adapter)
|
||||
#endif
|
||||
{
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
int bd = adapter->bd_number;
|
||||
|
||||
if (bd >= E1000_MAX_NIC) {
|
||||
e_notice("Warning: no configuration for board #%i\n", bd);
|
||||
e_notice("Using defaults for all values\n");
|
||||
dev_notice(pci_dev_to_dev(adapter->pdev),
|
||||
"Warning: no configuration for board #%i\n", bd);
|
||||
dev_notice(pci_dev_to_dev(adapter->pdev),
|
||||
"Using defaults for all values\n");
|
||||
}
|
||||
|
||||
{ /* Transmit Interrupt Delay */
|
||||
const struct e1000_option opt = {
|
||||
/* Transmit Interrupt Delay */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Transmit Interrupt Delay",
|
||||
.err = "using default of "
|
||||
|
@ -287,8 +322,9 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
adapter->tx_int_delay = opt.def;
|
||||
}
|
||||
}
|
||||
{ /* Transmit Absolute Interrupt Delay */
|
||||
const struct e1000_option opt = {
|
||||
/* Transmit Absolute Interrupt Delay */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Transmit Absolute Interrupt Delay",
|
||||
.err = "using default of "
|
||||
|
@ -306,8 +342,9 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
adapter->tx_abs_int_delay = opt.def;
|
||||
}
|
||||
}
|
||||
{ /* Receive Interrupt Delay */
|
||||
struct e1000_option opt = {
|
||||
/* Receive Interrupt Delay */
|
||||
{
|
||||
static struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Receive Interrupt Delay",
|
||||
.err = "using default of "
|
||||
|
@ -325,8 +362,9 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
adapter->rx_int_delay = opt.def;
|
||||
}
|
||||
}
|
||||
{ /* Receive Absolute Interrupt Delay */
|
||||
const struct e1000_option opt = {
|
||||
/* Receive Absolute Interrupt Delay */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Receive Absolute Interrupt Delay",
|
||||
.err = "using default of "
|
||||
|
@ -344,8 +382,9 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
adapter->rx_abs_int_delay = opt.def;
|
||||
}
|
||||
}
|
||||
{ /* Interrupt Throttling Rate */
|
||||
const struct e1000_option opt = {
|
||||
/* Interrupt Throttling Rate */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Interrupt Throttling Rate (ints/sec)",
|
||||
.err = "using default of "
|
||||
|
@ -357,61 +396,101 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
|
||||
if (num_InterruptThrottleRate > bd) {
|
||||
adapter->itr = InterruptThrottleRate[bd];
|
||||
switch (adapter->itr) {
|
||||
case 0:
|
||||
e_info("%s turned off\n", opt.name);
|
||||
break;
|
||||
case 1:
|
||||
e_info("%s set to dynamic mode\n", opt.name);
|
||||
adapter->itr_setting = adapter->itr;
|
||||
adapter->itr = 20000;
|
||||
break;
|
||||
case 3:
|
||||
e_info("%s set to dynamic conservative mode\n",
|
||||
opt.name);
|
||||
adapter->itr_setting = adapter->itr;
|
||||
adapter->itr = 20000;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Save the setting, because the dynamic bits
|
||||
* change itr.
|
||||
*/
|
||||
if (e1000_validate_option(&adapter->itr, &opt,
|
||||
adapter) &&
|
||||
(adapter->itr == 3)) {
|
||||
/*
|
||||
* In case of invalid user value,
|
||||
* default to conservative mode.
|
||||
*/
|
||||
adapter->itr_setting = adapter->itr;
|
||||
adapter->itr = 20000;
|
||||
} else {
|
||||
/*
|
||||
* Clear the lower two bits because
|
||||
* they are used as control.
|
||||
*/
|
||||
adapter->itr_setting =
|
||||
adapter->itr & ~3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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 {
|
||||
adapter->itr_setting = opt.def;
|
||||
/* 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(pci_dev_to_dev(adapter->pdev),
|
||||
"%s set to default %d\n", opt.name,
|
||||
adapter->itr);
|
||||
}
|
||||
|
||||
adapter->itr_setting = adapter->itr;
|
||||
switch (adapter->itr) {
|
||||
case 0:
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"%s turned off\n", opt.name);
|
||||
break;
|
||||
case 1:
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"%s set to dynamic mode\n", opt.name);
|
||||
adapter->itr = 20000;
|
||||
break;
|
||||
case 2:
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"%s Invalid mode - setting default\n",
|
||||
opt.name);
|
||||
adapter->itr_setting = opt.def;
|
||||
/* fall-through */
|
||||
case 3:
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"%s set to dynamic conservative mode\n",
|
||||
opt.name);
|
||||
adapter->itr = 20000;
|
||||
break;
|
||||
case 4:
|
||||
dev_info(pci_dev_to_dev(adapter->pdev),
|
||||
"%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;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_E1000E_MSIX
|
||||
{ /* Interrupt Mode */
|
||||
struct e1000_option opt = {
|
||||
/* Interrupt Mode */
|
||||
{
|
||||
static struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Interrupt Mode",
|
||||
.err = "defaulting to 2 (MSI-X)",
|
||||
.def = E1000E_INT_MODE_MSIX,
|
||||
.arg = { .r = { .min = MIN_INTMODE,
|
||||
.max = MAX_INTMODE } }
|
||||
#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(pci_dev_to_dev(adapter->pdev),
|
||||
"Failed to allocate memory\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (num_IntMode > bd) {
|
||||
unsigned int int_mode = IntMode[bd];
|
||||
e1000_validate_option(&int_mode, &opt, adapter);
|
||||
|
@ -419,10 +498,14 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
} else {
|
||||
adapter->int_mode = opt.def;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI_MSI
|
||||
kfree(opt.err);
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_E1000E_MSIX */
|
||||
{ /* Smart Power Down */
|
||||
const struct e1000_option opt = {
|
||||
/* Smart Power Down */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = enable_option,
|
||||
.name = "PHY Smart Power Down",
|
||||
.err = "defaulting to Disabled",
|
||||
|
@ -432,13 +515,13 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
if (num_SmartPowerDownEnable > bd) {
|
||||
unsigned int spd = SmartPowerDownEnable[bd];
|
||||
e1000_validate_option(&spd, &opt, adapter);
|
||||
if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN)
|
||||
&& spd)
|
||||
if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) && spd)
|
||||
adapter->flags |= FLAG_SMART_POWER_DOWN;
|
||||
}
|
||||
}
|
||||
{ /* CRC Stripping */
|
||||
const struct e1000_option opt = {
|
||||
/* CRC Stripping */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = enable_option,
|
||||
.name = "CRC Stripping",
|
||||
.err = "defaulting to Enabled",
|
||||
|
@ -448,33 +531,99 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
if (num_CrcStripping > bd) {
|
||||
unsigned int crc_stripping = CrcStripping[bd];
|
||||
e1000_validate_option(&crc_stripping, &opt, adapter);
|
||||
if (crc_stripping == OPTION_ENABLED)
|
||||
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 */
|
||||
const struct e1000_option opt = {
|
||||
/* 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);
|
||||
if (hw->mac.type == e1000_ich8lan)
|
||||
e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
|
||||
kmrn_lock_loss);
|
||||
} else {
|
||||
if (hw->mac.type == e1000_ich8lan)
|
||||
e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
|
||||
opt.def);
|
||||
enabled = kmrn_lock_loss;
|
||||
}
|
||||
|
||||
if (hw->mac.type == e1000_ich8lan)
|
||||
e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw,
|
||||
enabled);
|
||||
}
|
||||
/* EEE for parts supporting the feature */
|
||||
{
|
||||
static const struct e1000_option opt = {
|
||||
.type = enable_option,
|
||||
.name = "EEE Support",
|
||||
.err = "defaulting to Enabled (100T/1000T full)",
|
||||
.def = OPTION_ENABLED
|
||||
};
|
||||
|
||||
if (adapter->flags2 & FLAG2_HAS_EEE) {
|
||||
/* Currently only supported on 82579 and newer */
|
||||
if (num_EEE > bd) {
|
||||
unsigned int eee = EEE[bd];
|
||||
e1000_validate_option(&eee, &opt, adapter);
|
||||
hw->dev_spec.ich8lan.eee_disable = !eee;
|
||||
} else {
|
||||
hw->dev_spec.ich8lan.eee_disable = !opt.def;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(__VMKLNX__)
|
||||
/* configure node specific allocation */
|
||||
{
|
||||
static struct e1000_option opt = {
|
||||
.type = range_option,
|
||||
.name = "Node used to allocate memory",
|
||||
.err = "defaulting to -1 (disabled)",
|
||||
#ifdef HAVE_EARLY_VMALLOC_NODE
|
||||
.def = 0,
|
||||
#else
|
||||
.def = -1,
|
||||
#endif
|
||||
.arg = { .r = { .min = 0,
|
||||
.max = MAX_NUMNODES - 1 } }
|
||||
};
|
||||
int node = opt.def;
|
||||
|
||||
/* if the default was zero then we need to set the
|
||||
* default value to an online node, which is not
|
||||
* necessarily zero, and the constant initializer
|
||||
* above can't take first_online_node
|
||||
*/
|
||||
if (node == 0) {
|
||||
/* must set opt.def for validate */
|
||||
node = first_online_node;
|
||||
opt.def = node;
|
||||
}
|
||||
|
||||
if (num_Node > bd) {
|
||||
node = Node[bd];
|
||||
e1000_validate_option((unsigned int *)&node, &opt,
|
||||
adapter);
|
||||
if (node != OPTION_UNSET)
|
||||
e_info("node used for allocation: %d\n", node);
|
||||
}
|
||||
|
||||
/* check sanity of the value */
|
||||
if ((node != -1) && !node_online(node)) {
|
||||
e_info("ignoring node set to invalid value %d\n", node);
|
||||
node = opt.def;
|
||||
}
|
||||
|
||||
adapter->node = node;
|
||||
}
|
||||
#ifdef __VMKLNX__
|
||||
{ /* Write-protect NVM */
|
||||
const struct e1000_option opt = {
|
||||
.type = enable_option,
|
||||
|
@ -496,5 +645,5 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
#endif /* __VMKLNX__ */
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
237
vmkdrivers/src_9/drivers/net/e1000e/phy.h
Normal file
237
vmkdrivers/src_9/drivers/net/e1000e/phy.h
Normal file
|
@ -0,0 +1,237 @@
|
|||
/*
|
||||
* 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
|
277
vmkdrivers/src_9/drivers/net/e1000e/ptp.c
Normal file
277
vmkdrivers/src_9/drivers/net/e1000e/ptp.c
Normal file
|
@ -0,0 +1,277 @@
|
|||
/*
|
||||
* 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,
|
||||
.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:
|
||||
case e1000_pch_spt:
|
||||
if (((hw->mac.type != e1000_pch_lpt) &&
|
||||
(hw->mac.type != e1000_pch_spt)) ||
|
||||
(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,
|
||||
pci_dev_to_dev(adapter->pdev));
|
||||
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");
|
||||
}
|
||||
}
|
254
vmkdrivers/src_9/drivers/net/e1000e/regs.h
Normal file
254
vmkdrivers/src_9/drivers/net/e1000e/regs.h
Normal file
|
@ -0,0 +1,254 @@
|
|||
/*
|
||||
* 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_IOSFPC 0x00F28 /* TX corrupted data */
|
||||
#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_TARC0_CB_MULTIQ_3_REQ (1 << 28 | 1 << 29)
|
||||
#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_SYSSTMPL 0x0B648 /* HH Timesync system stamp low register */
|
||||
#define E1000_SYSSTMPH 0x0B64C /* HH Timesync system stamp hi register */
|
||||
#define E1000_PLTSTMPL 0x0B640 /* HH Timesync platform stamp low register */
|
||||
#define E1000_PLTSTMPH 0x0B644 /* HH Timesync platform stamp hi register */
|
||||
#define E1000_RXMTRL 0x0B634 /* Time sync Rx EtherType and Msg Type - RW */
|
||||
#define E1000_RXUDP 0x0B638 /* Time Sync Rx UDP Port - RW */
|
||||
|
||||
#endif
|
|
@ -475,7 +475,7 @@ static void igb_set_msglevel(struct net_device *netdev, u32 data)
|
|||
|
||||
static int igb_get_regs_len(struct net_device *netdev)
|
||||
{
|
||||
#define IGB_REGS_LEN 555
|
||||
#define IGB_REGS_LEN 587
|
||||
return IGB_REGS_LEN * sizeof(u32);
|
||||
}
|
||||
|
||||
|
@ -698,6 +698,8 @@ static void igb_get_regs(struct net_device *netdev,
|
|||
regs_buff[553] = adapter->stats.o2bspc;
|
||||
regs_buff[554] = adapter->stats.b2ogprc;
|
||||
}
|
||||
for (i = 0; i < 32; i++)
|
||||
regs_buff[555 + i] = E1000_READ_REG(hw, E1000_RETA(i));
|
||||
}
|
||||
|
||||
static int igb_get_eeprom_len(struct net_device *netdev)
|
||||
|
|
|
@ -3290,7 +3290,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)
|
|||
{
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 mrqc, rxcsum;
|
||||
u32 j, num_rx_queues, shift = 0, shift2 = 0;
|
||||
u32 j, num_rx_queues;
|
||||
volatile u32 shift = 0, shift2 = 0;
|
||||
static const u32 rsskey[10] = { 0xDA565A6D, 0xC20E5B25, 0x3D256741,
|
||||
0xB08FA343, 0xCB2BCAD0, 0xB4307BAE,
|
||||
0xA32DCB77, 0x0CF23080, 0x3BB7426A,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
/*
|
||||
* Source file for NIC routines to access the Phantom hardware
|
||||
*
|
||||
* $Id: //depot/vmkdrivers/vsphere55u2/src_9/drivers/net/nx_nic/unm_nic_hw.c#1 $
|
||||
* $Id: //depot/vmkdrivers/vsphere55u3/src_9/drivers/net/nx_nic/unm_nic_hw.c#1 $
|
||||
*
|
||||
*/
|
||||
#include <linux/delay.h>
|
||||
|
|
|
@ -900,28 +900,41 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
|
|||
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
|
||||
u32 buf_size;
|
||||
buf_offset = frag->page_offset;
|
||||
len = frag->size;
|
||||
|
||||
tbi = tq->buf_info + tq->tx_ring.next2fill;
|
||||
tbi->map_type = VMXNET3_MAP_PAGE;
|
||||
tbi->dma_addr = pci_map_page(adapter->pdev,
|
||||
frag->page, frag->page_offset,
|
||||
frag->size, PCI_DMA_TODEVICE);
|
||||
while (len) {
|
||||
tbi = tq->buf_info + tq->tx_ring.next2fill;
|
||||
if (len < VMXNET3_MAX_TX_BUF_SIZE) {
|
||||
buf_size = len;
|
||||
dw2 |= len;
|
||||
} else {
|
||||
buf_size = VMXNET3_MAX_TX_BUF_SIZE;
|
||||
/* spec says that for TxDesc.len, 0 == 2^14 */
|
||||
}
|
||||
tbi->map_type = VMXNET3_MAP_PAGE;
|
||||
tbi->dma_addr = pci_map_page(adapter->pdev, frag->page,
|
||||
buf_offset, buf_size,
|
||||
PCI_DMA_TODEVICE);
|
||||
|
||||
tbi->len = frag->size;
|
||||
tbi->len = buf_size;
|
||||
gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
|
||||
BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
|
||||
|
||||
gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
|
||||
BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
|
||||
gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
|
||||
gdesc->dword[2] = cpu_to_le32(dw2);
|
||||
gdesc->dword[3] = 0;
|
||||
|
||||
gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
|
||||
gdesc->dword[2] = cpu_to_le32(dw2 | frag->size);
|
||||
gdesc->dword[3] = 0;
|
||||
|
||||
dev_dbg(&adapter->pdev->dev,
|
||||
"txd[%u]: 0x%llu %u %u\n",
|
||||
tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
|
||||
le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
|
||||
vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
|
||||
dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
|
||||
vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
|
||||
dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
|
||||
dev_dbg(&adapter->pdev->dev,
|
||||
"txd[%u]: 0x%llu %u %u\n",
|
||||
tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
|
||||
le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
|
||||
len -= buf_size;
|
||||
buf_offset += buf_size;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->eop_txd = gdesc;
|
||||
|
@ -1053,6 +1066,20 @@ inline void vmxnet3_le32_add_cpu(uint32 *addTo, uint32 addThis)
|
|||
}
|
||||
|
||||
|
||||
static int txd_estimate(const struct sk_buff *skb)
|
||||
{
|
||||
int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
|
||||
const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
|
||||
count += VMXNET3_TXD_NEEDED(frag->size);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* transmit a pkt thru a given tq
|
||||
*
|
||||
|
@ -1084,8 +1111,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb,
|
|||
#endif
|
||||
|
||||
/* conservatively estimate # of descriptors to use */
|
||||
count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
|
||||
skb_shinfo(skb)->nr_frags + 1;
|
||||
count = txd_estimate(skb);
|
||||
|
||||
ctx.ipv4 = (skb->protocol == __constant_ntohs(ETH_P_IP));
|
||||
|
||||
|
@ -1203,7 +1229,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb,
|
|||
#endif
|
||||
dev_dbg(&adapter->pdev->dev,
|
||||
"txd[%u]: SOP 0x%llu 0x%x 0x%x\n",
|
||||
(u32)((union Vmxnet3_GenericDesc *)ctx.sop_txd -
|
||||
(u32)(ctx.sop_txd -
|
||||
tq->tx_ring.base), le64_to_cpu(gdesc->txd.addr),
|
||||
le32_to_cpu(gdesc->dword[2]), le32_to_cpu(gdesc->dword[3]));
|
||||
|
||||
|
@ -2232,13 +2258,20 @@ static void
|
|||
vmxnet3_netpoll(struct net_device *netdev)
|
||||
{
|
||||
struct vmxnet3_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
if (adapter->intr.mask_mode == VMXNET3_IMM_ACTIVE)
|
||||
vmxnet3_disable_all_intrs(adapter);
|
||||
|
||||
vmxnet3_do_poll(adapter, adapter->rx_queue[0].rx_ring[0].size);
|
||||
vmxnet3_enable_all_intrs(adapter);
|
||||
|
||||
switch (adapter->intr.type) {
|
||||
# ifdef CONFIG_PCI_MSI
|
||||
case VMXNET3_IT_MSIX: {
|
||||
int i;
|
||||
for (i = 0; i < adapter->num_rx_queues; i++)
|
||||
vmxnet3_msix_rx(0, &adapter->rx_queue[i], NULL);
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
case VMXNET3_IT_MSI:
|
||||
default:
|
||||
vmxnet3_intr(0, adapter->netdev, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_POLL_CONTROLLER */
|
||||
|
@ -3893,6 +3926,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
|
|||
|
||||
INIT_WORK(&adapter->reset_work, vmxnet3_reset_work);
|
||||
INIT_WORK(&adapter->resize_ring_work, vmxnet3_resize_ring_work);
|
||||
set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
|
||||
|
||||
#ifdef VMXNET3_NAPI
|
||||
if (adapter->intr.type == VMXNET3_IT_MSIX) {
|
||||
|
@ -3918,7 +3952,6 @@ vmxnet3_probe_device(struct pci_dev *pdev,
|
|||
goto err_register;
|
||||
}
|
||||
|
||||
set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
|
||||
vmxnet3_check_link(adapter, FALSE);
|
||||
atomic_inc(&devices_found);
|
||||
return 0;
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#ifndef _VMXNET3_VERSION_H_
|
||||
#define _VMXNET3_VERSION_H_
|
||||
|
||||
#define VMXNET3_DRIVER_VERSION 1.2.1.0
|
||||
#define VMXNET3_DRIVER_VERSION_COMMAS 1,2,1,0
|
||||
#define VMXNET3_DRIVER_VERSION_STRING "1.2.1.0"
|
||||
#define VMXNET3_DRIVER_VERSION 1.3.2.0
|
||||
#define VMXNET3_DRIVER_VERSION_COMMAS 1,3,2,0
|
||||
#define VMXNET3_DRIVER_VERSION_STRING "1.3.2.0"
|
||||
|
||||
/* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */
|
||||
#define VMXNET3_DRIVER_VERSION_NUM 0x01020100
|
||||
#define VMXNET3_DRIVER_VERSION_NUM 0x01030200
|
||||
|
||||
#endif /* _VMXNET3_VERSION_H_ */
|
||||
|
|
|
@ -2012,11 +2012,24 @@ static inline int readsafe_ioctl_cmd(unsigned int cmd)
|
|||
return 1;
|
||||
|
||||
/*
|
||||
* The below are needed by lsusb for some options (-v ?) but might
|
||||
* not be safe for readonly access. XXX Todo: investigate and fix.
|
||||
* libusb-1.0 uses USBDEVFS_SUBMITURB instead of USBDEVFS_CONTROL. If
|
||||
* claiming interfaces is disallowed then it is safe to allow these
|
||||
* ioctls because they internally check that the interface is claimed
|
||||
* if the target is not endpoint 0.
|
||||
*/
|
||||
case USBDEVFS_CLAIMINTERFACE:
|
||||
case USBDEVFS_RELEASEINTERFACE:
|
||||
case USBDEVFS_SUBMITURB:
|
||||
case USBDEVFS_SUBMITURB32:
|
||||
return 1;
|
||||
|
||||
/*
|
||||
* These are safe as they operate on URBs which have already been
|
||||
* submitted.
|
||||
*/
|
||||
case USBDEVFS_DISCARDURB:
|
||||
case USBDEVFS_REAPURB:
|
||||
case USBDEVFS_REAPURB32:
|
||||
case USBDEVFS_REAPURBNDELAY:
|
||||
case USBDEVFS_REAPURBNDELAY32:
|
||||
return 1;
|
||||
|
||||
/*
|
||||
|
@ -2281,7 +2294,12 @@ static unsigned int usbdev_poll(struct file *file,
|
|||
unsigned int mask = 0;
|
||||
|
||||
poll_wait(file, &ps->wait, wait);
|
||||
#if defined(__VMKLNX__)
|
||||
/* On vmkernel URBs may be submitted to "read-only" devices. */
|
||||
if (!list_empty(&ps->async_completed))
|
||||
#else
|
||||
if (file->f_mode & FMODE_WRITE && !list_empty(&ps->async_completed))
|
||||
#endif
|
||||
mask |= POLLOUT | POLLWRNORM;
|
||||
if (!connected(ps))
|
||||
mask |= POLLERR | POLLHUP;
|
||||
|
@ -2444,6 +2462,7 @@ static void usbfs_add_device(struct usb_device *dev)
|
|||
name, dev->vmklnx_major);
|
||||
} else {
|
||||
dev->dev.devt = MKDEV(USB_DEVICE_MAJOR, dev->vmklnx_major);
|
||||
usbfs_conn_disc_event();
|
||||
dev_info(&dev->dev, "usbfs: registered %s\n", name);
|
||||
}
|
||||
}
|
||||
|
@ -2482,6 +2501,8 @@ static void usbfs_remove_device(struct usb_device *dev)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
usbfs_conn_disc_event();
|
||||
}
|
||||
|
||||
static int usbfs_notify(struct notifier_block *self, unsigned long action, void *dev)
|
||||
|
|
|
@ -252,7 +252,7 @@ static int usb_probe_device(struct device *dev)
|
|||
|
||||
if (!error)
|
||||
#if defined(__VMKLNX__)
|
||||
VMKAPI_MODULE_CALL(udriver->module->moduleID,
|
||||
VMKAPI_MODULE_CALL(udriver->module->moduleID,
|
||||
error, udriver->probe, udev);
|
||||
#else
|
||||
error = udriver->probe(udev);
|
||||
|
@ -283,21 +283,21 @@ static void update_passthrough(struct usb_interface *iface)
|
|||
{
|
||||
struct usb_device *usb_dev = interface_to_usbdev(iface);
|
||||
struct usb_host_config *actconfig = usb_dev->actconfig;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (usb_dev->state == USB_STATE_NOTATTACHED || !actconfig)
|
||||
return;
|
||||
|
||||
for (i = 0; i < actconfig->desc.bNumInterfaces; i++) {
|
||||
struct usb_interface *intf = actconfig->interface[i];
|
||||
if (intf->condition == USB_INTERFACE_BOUND &&
|
||||
if (intf->condition == USB_INTERFACE_BOUND &&
|
||||
to_usb_driver(intf->dev.driver) != &usbfs_driver) {
|
||||
dev_info(&intf->dev, "interface is claimed by %s\n",
|
||||
dev_info(&intf->dev, "interface is claimed by %s\n",
|
||||
intf->dev.driver->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (i == actconfig->desc.bNumInterfaces) {
|
||||
/* none of the interfaces is claimed */
|
||||
usb_dev->passthrough = 1;
|
||||
|
@ -306,6 +306,8 @@ static void update_passthrough(struct usb_interface *iface)
|
|||
}
|
||||
dev_info(&usb_dev->dev, "device is %savailable for passthrough\n",
|
||||
usb_dev->passthrough ? "" : "not ");
|
||||
|
||||
usbfs_conn_disc_event();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1127,7 +1129,12 @@ static int usb_suspend_device(struct usb_device *udev, pm_message_t msg)
|
|||
udev->do_remote_wakeup = 0;
|
||||
udriver = &usb_generic_driver;
|
||||
}
|
||||
#if defined(__VMKLNX__)
|
||||
VMKAPI_MODULE_CALL(udriver->module->moduleID,
|
||||
status, udriver->suspend, udev, msg);
|
||||
#else
|
||||
status = udriver->suspend(udev, msg);
|
||||
#endif
|
||||
|
||||
done:
|
||||
#if defined(__VMKLNX__)
|
||||
|
@ -1175,7 +1182,12 @@ static int usb_resume_device(struct usb_device *udev, pm_message_t msg)
|
|||
udev->reset_resume = 1;
|
||||
|
||||
udriver = to_usb_device_driver(udev->dev.driver);
|
||||
#if defined(__VMKLNX__)
|
||||
VMKAPI_MODULE_CALL(udriver->module->moduleID,
|
||||
status, udriver->resume, udev, msg);
|
||||
#else
|
||||
status = udriver->resume(udev, msg);
|
||||
#endif
|
||||
|
||||
done:
|
||||
#if defined(__VMKLNX__)
|
||||
|
@ -1199,7 +1211,12 @@ static int usb_suspend_interface(struct usb_device *udev,
|
|||
driver = to_usb_driver(intf->dev.driver);
|
||||
|
||||
if (driver->suspend) {
|
||||
#if defined(__VMKLNX__)
|
||||
VMKAPI_MODULE_CALL(driver->module->moduleID,
|
||||
status, driver->suspend, intf, msg);
|
||||
#else
|
||||
status = driver->suspend(intf, msg);
|
||||
#endif
|
||||
if (status && !(msg.event & PM_EVENT_AUTO))
|
||||
dev_err(&intf->dev, "%s error %d\n",
|
||||
"suspend", status);
|
||||
|
@ -1252,7 +1269,12 @@ static int usb_resume_interface(struct usb_device *udev,
|
|||
|
||||
if (reset_resume) {
|
||||
if (driver->reset_resume) {
|
||||
#if defined(__VMKLNX__)
|
||||
VMKAPI_MODULE_CALL(driver->module->moduleID,
|
||||
status, driver->reset_resume, intf);
|
||||
#else
|
||||
status = driver->reset_resume(intf);
|
||||
#endif
|
||||
if (status)
|
||||
dev_err(&intf->dev, "%s error %d\n",
|
||||
"reset_resume", status);
|
||||
|
@ -1263,7 +1285,12 @@ static int usb_resume_interface(struct usb_device *udev,
|
|||
}
|
||||
} else {
|
||||
if (driver->resume) {
|
||||
#if defined(__VMKLNX__)
|
||||
VMKAPI_MODULE_CALL(driver->module->moduleID,
|
||||
status, driver->resume, intf);
|
||||
#else
|
||||
status = driver->resume(intf);
|
||||
#endif
|
||||
if (status)
|
||||
dev_err(&intf->dev, "%s error %d\n",
|
||||
"resume", status);
|
||||
|
@ -1989,4 +2016,7 @@ struct bus_type usb_bus_type = {
|
|||
.match = usb_device_match,
|
||||
.uevent = usb_uevent,
|
||||
.pm = &usb_bus_pm_ops,
|
||||
#if defined(__VMKLNX__)
|
||||
.owner = THIS_MODULE,
|
||||
#endif
|
||||
};
|
||||
|
|
|
@ -194,7 +194,10 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
|||
return -ENODEV;
|
||||
dev->current_state = PCI_D0;
|
||||
|
||||
if (!dev->irq) {
|
||||
/* The xHCI driver supports MSI and MSI-X,
|
||||
* so don't fail if the BIOS doesn't provide a legacy IRQ.
|
||||
*/
|
||||
if (!dev->irq && (driver->flags & HCD_MASK) != HCD_USB3) {
|
||||
dev_err(&dev->dev,
|
||||
"Found HC with no IRQ. Check BIOS/PCI %s setup!\n",
|
||||
pci_name(dev));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Portions Copyright 2008-2011 VMware, Inc.
|
||||
* Portions Copyright 2008-2013 VMware, Inc.
|
||||
*/
|
||||
/*
|
||||
* (C) Copyright Linus Torvalds 1999
|
||||
|
@ -1401,11 +1401,13 @@ static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
|
|||
urb->setup_packet,
|
||||
sizeof(struct usb_ctrlrequest),
|
||||
DMA_TO_DEVICE);
|
||||
#if! defined(__VMKLNX__)
|
||||
#if defined(__VMKLNX__)
|
||||
if (dma_mapping_error(urb->setup_dma))
|
||||
#else
|
||||
if (dma_mapping_error(hcd->self.controller,
|
||||
urb->setup_dma))
|
||||
return -EAGAIN;
|
||||
#endif
|
||||
return -EAGAIN;
|
||||
urb->transfer_flags |= URB_SETUP_MAP_SINGLE;
|
||||
} else if (hcd->driver->flags & HCD_LOCAL_MEM)
|
||||
ret = hcd_alloc_coherent(
|
||||
|
@ -1458,12 +1460,14 @@ static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
|
|||
urb->transfer_buffer,
|
||||
urb->transfer_buffer_length,
|
||||
dir);
|
||||
#if !defined(__VMKLNX__)
|
||||
#if defined(__VMKLNX__)
|
||||
if (dma_mapping_error(urb->transfer_dma))
|
||||
#else
|
||||
if (dma_mapping_error(hcd->self.controller,
|
||||
urb->transfer_dma))
|
||||
#endif
|
||||
ret = -EAGAIN;
|
||||
else
|
||||
#endif
|
||||
urb->transfer_flags |= URB_DMA_MAP_SINGLE;
|
||||
}
|
||||
} else if (hcd->driver->flags & HCD_LOCAL_MEM) {
|
||||
|
@ -2618,8 +2622,10 @@ int usb_add_hcd(struct usb_hcd *hcd,
|
|||
&& device_can_wakeup(&hcd->self.root_hub->dev))
|
||||
dev_dbg(hcd->self.controller, "supports USB remote wakeup\n");
|
||||
|
||||
/* enable irqs just before we start the controller */
|
||||
if (usb_hcd_is_primary_hcd(hcd)) {
|
||||
/* enable irqs just before we start the controller,
|
||||
* if the BIOS provides legacy PCI irqs.
|
||||
*/
|
||||
if (usb_hcd_is_primary_hcd(hcd) && irqnum) {
|
||||
retval = usb_hcd_request_irqs(hcd, irqnum, irqflags);
|
||||
if (retval)
|
||||
goto err_request_irq;
|
||||
|
|
256
vmkdrivers/src_92/drivers/usb/host/xhci/compat/hash.c
Executable file
256
vmkdrivers/src_92/drivers/usb/host/xhci/compat/hash.c
Executable file
|
@ -0,0 +1,256 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2013 Mellanox Technologies. All rights reserved.
|
||||
*
|
||||
* This software is available to you under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/errno.h>
|
||||
#include "hash.h"
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
struct hash_node {
|
||||
unsigned long key; // key for lookup
|
||||
void *p_data; // pointer to stored data
|
||||
struct hash_node *p_next; // pointer to next node
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
#define MINIMUM_HASH_TABLE_SIZE 512
|
||||
/* TODO: Need to fix expand latter */
|
||||
#ifdef __VMKERNEL_HASH_EXPAND_ENABLE__
|
||||
#define EXPAND_HASH_TABLE_LIMIT_ORDER 1
|
||||
#endif /* __VMKERNEL_HASH_EXPAND_ENABLE__ */
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
static unsigned long hash(hdl_hash_t p_table, unsigned long key)
|
||||
{
|
||||
return (key & p_table->mask);
|
||||
}
|
||||
|
||||
/************/
|
||||
void hash_print(hdl_hash_t p_table)
|
||||
{
|
||||
hash_node_t *p_node;
|
||||
unsigned long i;
|
||||
|
||||
printk("HASH ID=%p\n", p_table);
|
||||
// if empty
|
||||
if (p_table->size == 0) {
|
||||
printk("HASH is EMPTY!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
printk("HASH size=%lu\n", p_table->size);
|
||||
printk("HASH mask=%lu\n", p_table->mask);
|
||||
printk("HASH entries=%lu\n", p_table->entries);
|
||||
printk("HASH bucket:\n");
|
||||
for (i = 0; i < p_table->size; ++i) {
|
||||
p_node = p_table->bucket[i];
|
||||
printk("[%lu] ", i);
|
||||
while (p_node) {
|
||||
printk("Key=0x%lx --> ", p_node->key);
|
||||
p_node = p_node->p_next;
|
||||
}
|
||||
printk("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/************/
|
||||
int hash_init(hdl_hash_t p_table, unsigned long table_size)
|
||||
{
|
||||
p_table->entries = 0;
|
||||
p_table->size = 2;
|
||||
p_table->mask = p_table->size - 1;
|
||||
|
||||
// round to power of 2
|
||||
while (p_table->size < table_size)
|
||||
p_table->size <<= 1;
|
||||
p_table->mask = p_table->size - 1;
|
||||
|
||||
// allocate
|
||||
p_table->bucket = (hash_node_t **)kcalloc(p_table->size,
|
||||
sizeof(hash_node_t *), GFP_KERNEL);
|
||||
if (!p_table->bucket)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************/
|
||||
void hash_destroy(hdl_hash_t p_table)
|
||||
{
|
||||
hash_node_t *p_node, *p_prev_node;
|
||||
unsigned long i;
|
||||
|
||||
for (i = 0; i < p_table->size; ++i) {
|
||||
p_node = p_table->bucket[i];
|
||||
while (p_node) {
|
||||
p_prev_node = p_node;
|
||||
p_node = p_node->p_next;
|
||||
kfree(p_prev_node);
|
||||
}
|
||||
}
|
||||
kfree(p_table->bucket);
|
||||
memset(p_table, 0, sizeof(struct hash_table));
|
||||
}
|
||||
|
||||
/************/
|
||||
#ifdef __VMKERNEL_HASH_EXPAND_ENABLE__
|
||||
static int hash_expand(hdl_hash_t p_table)
|
||||
{
|
||||
hash_node_t **prev_bucket;
|
||||
hash_node_t *p_prev_node, *p_tmp_node;
|
||||
unsigned long prev_size, hash_entry, i;
|
||||
int rc = 0;
|
||||
|
||||
|
||||
prev_bucket = p_table->bucket;
|
||||
prev_size = p_table->size;
|
||||
|
||||
if ((rc = hash_init(p_table, (prev_size << 1))) != 0);
|
||||
return rc;
|
||||
for (i = 0; i < prev_size; ++i) {
|
||||
p_prev_node = prev_bucket[i];
|
||||
// we have several nodes in this hash entry
|
||||
while (p_prev_node) {
|
||||
p_tmp_node = p_prev_node;
|
||||
p_prev_node = p_prev_node->p_next;
|
||||
hash_entry = hash(p_table, p_tmp_node->key);
|
||||
p_tmp_node->p_next = p_table->bucket[hash_entry];
|
||||
p_table->bucket[hash_entry] = p_tmp_node;
|
||||
++p_table->entries;
|
||||
}
|
||||
}
|
||||
|
||||
// free only the previous bucket array, not the nodes
|
||||
// because we will use the nodes pointers in new large hash
|
||||
kfree(prev_bucket);
|
||||
return 0;
|
||||
}
|
||||
#endif /* __VMKERNEL_HASH_EXPAND_ENABLE__ */
|
||||
|
||||
/************/
|
||||
void * hash_lookup(hdl_hash_t p_table, unsigned long key)
|
||||
{
|
||||
hash_node_t *p_node;
|
||||
unsigned long hash_entry;
|
||||
|
||||
// if empty
|
||||
if (p_table->size == 0)
|
||||
return NULL;
|
||||
|
||||
hash_entry = hash(p_table, key);
|
||||
for (p_node = p_table->bucket[hash_entry]; p_node;
|
||||
p_node = p_node->p_next) {
|
||||
if (key == p_node->key)
|
||||
break;
|
||||
}
|
||||
return (p_node ? p_node->p_data : NULL);
|
||||
}
|
||||
|
||||
/************/
|
||||
int hash_insert(hdl_hash_t p_table, unsigned long key, void *p_data)
|
||||
{
|
||||
void *p_tmp_data;
|
||||
hash_node_t *p_node;
|
||||
unsigned long hash_entry;
|
||||
int rc = 0;
|
||||
|
||||
// if empty
|
||||
if (!p_table->size) {
|
||||
rc = hash_init(p_table, MINIMUM_HASH_TABLE_SIZE);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
// if data not valid
|
||||
if (!p_data)
|
||||
return -EINVAL;
|
||||
|
||||
// maybe already exists
|
||||
p_tmp_data = hash_lookup(p_table, key);
|
||||
if (p_tmp_data)
|
||||
return -EEXIST;
|
||||
|
||||
#ifdef __VMKERNEL_HASH_EXPAND_ENABLE__
|
||||
// maybe we need to expand
|
||||
while (p_table->entries >= (p_table->size >> EXPAND_HASH_TABLE_LIMIT_ORDER)) {
|
||||
if ((rc = hash_expand(p_table)) != 0)
|
||||
return rc;
|
||||
}
|
||||
#endif /* __VMKERNEL_HASH_EXPAND_ENABLE__ */
|
||||
|
||||
// allocate memory for new entry
|
||||
p_node = (hash_node_t *)kmalloc(sizeof(hash_node_t), GFP_KERNEL);
|
||||
if (!p_node)
|
||||
return -ENOMEM;
|
||||
|
||||
// insert the new entry
|
||||
p_node->p_data = p_data;
|
||||
p_node->key = key;
|
||||
hash_entry = hash(p_table, key);
|
||||
p_node->p_next = p_table->bucket[hash_entry];
|
||||
p_table->bucket[hash_entry] = p_node;
|
||||
++p_table->entries;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/************/
|
||||
void * hash_delete(hdl_hash_t p_table, unsigned long key)
|
||||
{
|
||||
hash_node_t *p_node, *p_prev_node;
|
||||
void *p_data;
|
||||
unsigned long hash_entry;
|
||||
|
||||
// if empty
|
||||
if (!p_table->size) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// find what to remove
|
||||
hash_entry = hash(p_table, key);
|
||||
for (p_node = p_table->bucket[hash_entry]; p_node;
|
||||
p_node = p_node->p_next) {
|
||||
if (key == p_node->key)
|
||||
break;
|
||||
}
|
||||
if (!p_node)
|
||||
return NULL; // nothing to remove
|
||||
|
||||
// remove the selected node
|
||||
if (p_node == p_table->bucket[hash_entry]) {
|
||||
p_table->bucket[hash_entry] = p_node->p_next;
|
||||
goto free_node;
|
||||
}
|
||||
for (p_prev_node = p_table->bucket[hash_entry];
|
||||
p_prev_node && p_prev_node->p_next;
|
||||
p_prev_node = p_prev_node->p_next) {
|
||||
if (p_prev_node->p_next == p_node)
|
||||
break;
|
||||
}
|
||||
p_prev_node->p_next = p_node->p_next;
|
||||
|
||||
free_node:
|
||||
p_data = p_node->p_data;
|
||||
kfree(p_node);
|
||||
|
||||
/*
|
||||
* TODO: maybe we will want to implement shrink of the hash
|
||||
*/
|
||||
// if empty
|
||||
if (--p_table->entries == 0)
|
||||
hash_destroy(p_table);
|
||||
|
||||
return p_data;
|
||||
}
|
40
vmkdrivers/src_92/drivers/usb/host/xhci/compat/hash.h
Executable file
40
vmkdrivers/src_92/drivers/usb/host/xhci/compat/hash.h
Executable file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2013 Mellanox Technologies. All rights reserved.
|
||||
*
|
||||
* This software is available to you under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MLNX_HASH_H
|
||||
#define _MLNX_HASH_H
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
typedef struct hash_node hash_node_t;
|
||||
|
||||
struct hash_table {
|
||||
hash_node_t **bucket; // the hash array
|
||||
unsigned long size; // size of the array
|
||||
unsigned long entries; // number of used entries in hash
|
||||
unsigned long mask; // used to select bits for hashing
|
||||
};
|
||||
|
||||
typedef struct hash_table * hdl_hash_t;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
void hash_print(hdl_hash_t p_table);
|
||||
int hash_init(hdl_hash_t p_table, unsigned long table_size);
|
||||
void hash_destroy(hdl_hash_t p_table);
|
||||
void * hash_lookup(hdl_hash_t p_table, unsigned long key);
|
||||
int hash_insert(hdl_hash_t p_table, unsigned long key, void *p_data);
|
||||
void * hash_delete(hdl_hash_t p_table, unsigned long key);
|
||||
|
||||
|
||||
#endif /* _MLNX_HASH_H */
|
44
vmkdrivers/src_92/drivers/usb/host/xhci/compat/xhci_compat.c
Normal file
44
vmkdrivers/src_92/drivers/usb/host/xhci/compat/xhci_compat.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2015 VMware, Inc.
|
||||
*
|
||||
* Copyright (c) 2011-2012 Mellanox Technologies. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "xhci_compat.h"
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
#include "hash.c"
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
78
vmkdrivers/src_92/drivers/usb/host/xhci/compat/xhci_compat.h
Normal file
78
vmkdrivers/src_92/drivers/usb/host/xhci/compat/xhci_compat.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2015 VMware, Inc.
|
||||
*
|
||||
* Copyright (c) 2011-2013 Mellanox Technologies. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
* General Public License (GPL) Version 2, available from the file
|
||||
* COPYING in the main directory of this source tree, or the
|
||||
* OpenIB.org BSD license below:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _XHCI_COMPAT_H
|
||||
#define _XHCI_COMPAT_H
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
#include "hash.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* Radix tree */
|
||||
#define radix_tree_root hash_table
|
||||
#define radix_tree_lookup xhci_radix_tree_lookup
|
||||
#define radix_tree_insert xhci_radix_tree_insert
|
||||
#define radix_tree_delete xhci_radix_tree_delete
|
||||
|
||||
#ifdef INIT_RADIX_TREE
|
||||
#undef INIT_RADIX_TREE
|
||||
#endif
|
||||
|
||||
#define INIT_RADIX_TREE(p_tree, flags) do { \
|
||||
memset((p_tree), 0, sizeof(struct hash_table)); \
|
||||
} while (0);
|
||||
|
||||
|
||||
static inline void * xhci_radix_tree_lookup(struct radix_tree_root *p_tree,
|
||||
unsigned long index) {
|
||||
return hash_lookup(p_tree, index);
|
||||
}
|
||||
|
||||
static inline int xhci_radix_tree_insert(struct radix_tree_root *p_tree,
|
||||
unsigned long index,
|
||||
void *p_data) {
|
||||
return hash_insert(p_tree, index, p_data);
|
||||
}
|
||||
|
||||
static inline void * xhci_radix_tree_delete(struct radix_tree_root *p_tree,
|
||||
unsigned long index) {
|
||||
return hash_delete(p_tree, index);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#endif /* _XHCI_COMPAT_H */
|
576
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-dbg.c
Normal file
576
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-dbg.c
Normal file
|
@ -0,0 +1,576 @@
|
|||
/*
|
||||
* xHCI host controller driver
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corp.
|
||||
*
|
||||
* Author: Sarah Sharp
|
||||
* Some code borrowed from the Linux EHCI driver.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that 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, write to the Free Software Foundation,
|
||||
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "xhci.h"
|
||||
|
||||
#define XHCI_INIT_VALUE 0x0
|
||||
|
||||
/* Add verbose debugging later, just print everything for now */
|
||||
|
||||
void xhci_dbg_regs(struct xhci_hcd *xhci)
|
||||
{
|
||||
u32 temp;
|
||||
|
||||
xhci_dbg(xhci, "// xHCI capability registers at %p:\n",
|
||||
xhci->cap_regs);
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->hc_capbase);
|
||||
xhci_dbg(xhci, "// @%p = 0x%x (CAPLENGTH AND HCIVERSION)\n",
|
||||
&xhci->cap_regs->hc_capbase, temp);
|
||||
xhci_dbg(xhci, "// CAPLENGTH: 0x%x\n",
|
||||
(unsigned int) HC_LENGTH(temp));
|
||||
#if 0
|
||||
xhci_dbg(xhci, "// HCIVERSION: 0x%x\n",
|
||||
(unsigned int) HC_VERSION(temp));
|
||||
#endif
|
||||
|
||||
xhci_dbg(xhci, "// xHCI operational registers at %p:\n", xhci->op_regs);
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->run_regs_off);
|
||||
xhci_dbg(xhci, "// @%p = 0x%x RTSOFF\n",
|
||||
&xhci->cap_regs->run_regs_off,
|
||||
(unsigned int) temp & RTSOFF_MASK);
|
||||
xhci_dbg(xhci, "// xHCI runtime registers at %p:\n", xhci->run_regs);
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->db_off);
|
||||
xhci_dbg(xhci, "// @%p = 0x%x DBOFF\n", &xhci->cap_regs->db_off, temp);
|
||||
xhci_dbg(xhci, "// Doorbell array at %p:\n", xhci->dba);
|
||||
}
|
||||
|
||||
static void xhci_print_cap_regs(struct xhci_hcd *xhci)
|
||||
{
|
||||
u32 temp;
|
||||
|
||||
xhci_dbg(xhci, "xHCI capability registers at %p:\n", xhci->cap_regs);
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->hc_capbase);
|
||||
xhci_dbg(xhci, "CAPLENGTH AND HCIVERSION 0x%x:\n",
|
||||
(unsigned int) temp);
|
||||
xhci_dbg(xhci, "CAPLENGTH: 0x%x\n",
|
||||
(unsigned int) HC_LENGTH(temp));
|
||||
xhci_dbg(xhci, "HCIVERSION: 0x%x\n",
|
||||
(unsigned int) HC_VERSION(temp));
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->hcs_params1);
|
||||
xhci_dbg(xhci, "HCSPARAMS 1: 0x%x\n",
|
||||
(unsigned int) temp);
|
||||
xhci_dbg(xhci, " Max device slots: %u\n",
|
||||
(unsigned int) HCS_MAX_SLOTS(temp));
|
||||
xhci_dbg(xhci, " Max interrupters: %u\n",
|
||||
(unsigned int) HCS_MAX_INTRS(temp));
|
||||
xhci_dbg(xhci, " Max ports: %u\n",
|
||||
(unsigned int) HCS_MAX_PORTS(temp));
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->hcs_params2);
|
||||
xhci_dbg(xhci, "HCSPARAMS 2: 0x%x\n",
|
||||
(unsigned int) temp);
|
||||
xhci_dbg(xhci, " Isoc scheduling threshold: %u\n",
|
||||
(unsigned int) HCS_IST(temp));
|
||||
xhci_dbg(xhci, " Maximum allowed segments in event ring: %u\n",
|
||||
(unsigned int) HCS_ERST_MAX(temp));
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->hcs_params3);
|
||||
xhci_dbg(xhci, "HCSPARAMS 3 0x%x:\n",
|
||||
(unsigned int) temp);
|
||||
xhci_dbg(xhci, " Worst case U1 device exit latency: %u\n",
|
||||
(unsigned int) HCS_U1_LATENCY(temp));
|
||||
xhci_dbg(xhci, " Worst case U2 device exit latency: %u\n",
|
||||
(unsigned int) HCS_U2_LATENCY(temp));
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->hcc_params);
|
||||
xhci_dbg(xhci, "HCC PARAMS 0x%x:\n", (unsigned int) temp);
|
||||
xhci_dbg(xhci, " HC generates %s bit addresses\n",
|
||||
HCC_64BIT_ADDR(temp) ? "64" : "32");
|
||||
/* FIXME */
|
||||
xhci_dbg(xhci, " FIXME: more HCCPARAMS debugging\n");
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->cap_regs->run_regs_off);
|
||||
xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK);
|
||||
}
|
||||
|
||||
static void xhci_print_command_reg(struct xhci_hcd *xhci)
|
||||
{
|
||||
u32 temp;
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->op_regs->command);
|
||||
xhci_dbg(xhci, "USBCMD 0x%x:\n", temp);
|
||||
xhci_dbg(xhci, " HC is %s\n",
|
||||
(temp & CMD_RUN) ? "running" : "being stopped");
|
||||
xhci_dbg(xhci, " HC has %sfinished hard reset\n",
|
||||
(temp & CMD_RESET) ? "not " : "");
|
||||
xhci_dbg(xhci, " Event Interrupts %s\n",
|
||||
(temp & CMD_EIE) ? "enabled " : "disabled");
|
||||
xhci_dbg(xhci, " Host System Error Interrupts %s\n",
|
||||
(temp & CMD_HSEIE) ? "enabled " : "disabled");
|
||||
xhci_dbg(xhci, " HC has %sfinished light reset\n",
|
||||
(temp & CMD_LRESET) ? "not " : "");
|
||||
}
|
||||
|
||||
static void xhci_print_status(struct xhci_hcd *xhci)
|
||||
{
|
||||
u32 temp;
|
||||
|
||||
temp = xhci_readl(xhci, &xhci->op_regs->status);
|
||||
xhci_dbg(xhci, "USBSTS 0x%x:\n", temp);
|
||||
xhci_dbg(xhci, " Event ring is %sempty\n",
|
||||
(temp & STS_EINT) ? "not " : "");
|
||||
xhci_dbg(xhci, " %sHost System Error\n",
|
||||
(temp & STS_FATAL) ? "WARNING: " : "No ");
|
||||
xhci_dbg(xhci, " HC is %s\n",
|
||||
(temp & STS_HALT) ? "halted" : "running");
|
||||
}
|
||||
|
||||
static void xhci_print_op_regs(struct xhci_hcd *xhci)
|
||||
{
|
||||
xhci_dbg(xhci, "xHCI operational registers at %p:\n", xhci->op_regs);
|
||||
xhci_print_command_reg(xhci);
|
||||
xhci_print_status(xhci);
|
||||
}
|
||||
|
||||
static void xhci_print_ports(struct xhci_hcd *xhci)
|
||||
{
|
||||
__le32 __iomem *addr;
|
||||
int i, j;
|
||||
int ports;
|
||||
char *names[NUM_PORT_REGS] = {
|
||||
"status",
|
||||
"power",
|
||||
"link",
|
||||
"reserved",
|
||||
};
|
||||
|
||||
ports = HCS_MAX_PORTS(xhci->hcs_params1);
|
||||
addr = &xhci->op_regs->port_status_base;
|
||||
for (i = 0; i < ports; i++) {
|
||||
for (j = 0; j < NUM_PORT_REGS; ++j) {
|
||||
xhci_dbg(xhci, "%p port %s reg = 0x%x\n",
|
||||
addr, names[j],
|
||||
(unsigned int) xhci_readl(xhci, addr));
|
||||
addr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num)
|
||||
{
|
||||
struct xhci_intr_reg __iomem *ir_set = &xhci->run_regs->ir_set[set_num];
|
||||
void __iomem *addr;
|
||||
u32 temp;
|
||||
u64 temp_64;
|
||||
|
||||
addr = &ir_set->irq_pending;
|
||||
temp = xhci_readl(xhci, addr);
|
||||
if (temp == XHCI_INIT_VALUE)
|
||||
return;
|
||||
|
||||
xhci_dbg(xhci, " %p: ir_set[%i]\n", ir_set, set_num);
|
||||
|
||||
xhci_dbg(xhci, " %p: ir_set.pending = 0x%x\n", addr,
|
||||
(unsigned int)temp);
|
||||
|
||||
addr = &ir_set->irq_control;
|
||||
temp = xhci_readl(xhci, addr);
|
||||
xhci_dbg(xhci, " %p: ir_set.control = 0x%x\n", addr,
|
||||
(unsigned int)temp);
|
||||
|
||||
addr = &ir_set->erst_size;
|
||||
temp = xhci_readl(xhci, addr);
|
||||
xhci_dbg(xhci, " %p: ir_set.erst_size = 0x%x\n", addr,
|
||||
(unsigned int)temp);
|
||||
|
||||
addr = &ir_set->rsvd;
|
||||
temp = xhci_readl(xhci, addr);
|
||||
if (temp != XHCI_INIT_VALUE)
|
||||
xhci_dbg(xhci, " WARN: %p: ir_set.rsvd = 0x%x\n",
|
||||
addr, (unsigned int)temp);
|
||||
|
||||
addr = &ir_set->erst_base;
|
||||
temp_64 = xhci_read_64(xhci, addr);
|
||||
xhci_dbg(xhci, " %p: ir_set.erst_base = @%08llx\n",
|
||||
addr, temp_64);
|
||||
|
||||
addr = &ir_set->erst_dequeue;
|
||||
temp_64 = xhci_read_64(xhci, addr);
|
||||
xhci_dbg(xhci, " %p: ir_set.erst_dequeue = @%08llx\n",
|
||||
addr, temp_64);
|
||||
}
|
||||
|
||||
void xhci_print_run_regs(struct xhci_hcd *xhci)
|
||||
{
|
||||
u32 temp;
|
||||
int i;
|
||||
|
||||
xhci_dbg(xhci, "xHCI runtime registers at %p:\n", xhci->run_regs);
|
||||
temp = xhci_readl(xhci, &xhci->run_regs->microframe_index);
|
||||
xhci_dbg(xhci, " %p: Microframe index = 0x%x\n",
|
||||
&xhci->run_regs->microframe_index,
|
||||
(unsigned int) temp);
|
||||
for (i = 0; i < 7; ++i) {
|
||||
temp = xhci_readl(xhci, &xhci->run_regs->rsvd[i]);
|
||||
if (temp != XHCI_INIT_VALUE)
|
||||
xhci_dbg(xhci, " WARN: %p: Rsvd[%i] = 0x%x\n",
|
||||
&xhci->run_regs->rsvd[i],
|
||||
i, (unsigned int) temp);
|
||||
}
|
||||
}
|
||||
|
||||
void xhci_print_registers(struct xhci_hcd *xhci)
|
||||
{
|
||||
xhci_print_cap_regs(xhci);
|
||||
xhci_print_op_regs(xhci);
|
||||
xhci_print_ports(xhci);
|
||||
}
|
||||
|
||||
void xhci_print_trb_offsets(struct xhci_hcd *xhci, union xhci_trb *trb)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
xhci_dbg(xhci, "Offset 0x%x = 0x%x\n",
|
||||
i*4, trb->generic.field[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug a transfer request block (TRB).
|
||||
*/
|
||||
void xhci_debug_trb(struct xhci_hcd *xhci, union xhci_trb *trb)
|
||||
{
|
||||
u64 address;
|
||||
u32 type = le32_to_cpu(trb->link.control) & TRB_TYPE_BITMASK;
|
||||
|
||||
switch (type) {
|
||||
case TRB_TYPE(TRB_LINK):
|
||||
xhci_dbg(xhci, "Link TRB:\n");
|
||||
xhci_print_trb_offsets(xhci, trb);
|
||||
|
||||
address = le64_to_cpu(trb->link.segment_ptr);
|
||||
xhci_dbg(xhci, "Next ring segment DMA address = 0x%llx\n", address);
|
||||
|
||||
xhci_dbg(xhci, "Interrupter target = 0x%x\n",
|
||||
GET_INTR_TARGET(le32_to_cpu(trb->link.intr_target)));
|
||||
xhci_dbg(xhci, "Cycle bit = %u\n",
|
||||
le32_to_cpu(trb->link.control) & TRB_CYCLE);
|
||||
xhci_dbg(xhci, "Toggle cycle bit = %u\n",
|
||||
le32_to_cpu(trb->link.control) & LINK_TOGGLE);
|
||||
xhci_dbg(xhci, "No Snoop bit = %u\n",
|
||||
le32_to_cpu(trb->link.control) & TRB_NO_SNOOP);
|
||||
break;
|
||||
case TRB_TYPE(TRB_TRANSFER):
|
||||
address = le64_to_cpu(trb->trans_event.buffer);
|
||||
/*
|
||||
* FIXME: look at flags to figure out if it's an address or if
|
||||
* the data is directly in the buffer field.
|
||||
*/
|
||||
xhci_dbg(xhci, "DMA address or buffer contents= %llu\n", address);
|
||||
break;
|
||||
case TRB_TYPE(TRB_COMPLETION):
|
||||
address = le64_to_cpu(trb->event_cmd.cmd_trb);
|
||||
xhci_dbg(xhci, "Command TRB pointer = %llu\n", address);
|
||||
xhci_dbg(xhci, "Completion status = %u\n",
|
||||
GET_COMP_CODE(le32_to_cpu(trb->event_cmd.status)));
|
||||
xhci_dbg(xhci, "Flags = 0x%x\n",
|
||||
le32_to_cpu(trb->event_cmd.flags));
|
||||
break;
|
||||
default:
|
||||
xhci_dbg(xhci, "Unknown TRB with TRB type ID %u\n",
|
||||
(unsigned int) type>>10);
|
||||
xhci_print_trb_offsets(xhci, trb);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug a segment with an xHCI ring.
|
||||
*
|
||||
* @return The Link TRB of the segment, or NULL if there is no Link TRB
|
||||
* (which is a bug, since all segments must have a Link TRB).
|
||||
*
|
||||
* Prints out all TRBs in the segment, even those after the Link TRB.
|
||||
*
|
||||
* XXX: should we print out TRBs that the HC owns? As long as we don't
|
||||
* write, that should be fine... We shouldn't expect that the memory pointed to
|
||||
* by the TRB is valid at all. Do we care about ones the HC owns? Probably,
|
||||
* for HC debugging.
|
||||
*/
|
||||
void xhci_debug_segment(struct xhci_hcd *xhci, struct xhci_segment *seg)
|
||||
{
|
||||
int i;
|
||||
u64 addr = seg->dma;
|
||||
union xhci_trb *trb = seg->trbs;
|
||||
|
||||
for (i = 0; i < TRBS_PER_SEGMENT; ++i) {
|
||||
trb = &seg->trbs[i];
|
||||
xhci_dbg(xhci, "@%016llx %08x %08x %08x %08x\n", addr,
|
||||
lower_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
||||
upper_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
||||
le32_to_cpu(trb->link.intr_target),
|
||||
le32_to_cpu(trb->link.control));
|
||||
addr += sizeof(*trb);
|
||||
}
|
||||
}
|
||||
|
||||
void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring)
|
||||
{
|
||||
xhci_dbg(xhci, "Ring deq = %p (virt), 0x%llx (dma)\n",
|
||||
ring->dequeue,
|
||||
(unsigned long long)xhci_trb_virt_to_dma(ring->deq_seg,
|
||||
ring->dequeue));
|
||||
xhci_dbg(xhci, "Ring deq updated %u times\n",
|
||||
ring->deq_updates);
|
||||
xhci_dbg(xhci, "Ring enq = %p (virt), 0x%llx (dma)\n",
|
||||
ring->enqueue,
|
||||
(unsigned long long)xhci_trb_virt_to_dma(ring->enq_seg,
|
||||
ring->enqueue));
|
||||
xhci_dbg(xhci, "Ring enq updated %u times\n",
|
||||
ring->enq_updates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Debugging for an xHCI ring, which is a queue broken into multiple segments.
|
||||
*
|
||||
* Print out each segment in the ring. Check that the DMA address in
|
||||
* each link segment actually matches the segment's stored DMA address.
|
||||
* Check that the link end bit is only set at the end of the ring.
|
||||
* Check that the dequeue and enqueue pointers point to real data in this ring
|
||||
* (not some other ring).
|
||||
*/
|
||||
void xhci_debug_ring(struct xhci_hcd *xhci, struct xhci_ring *ring)
|
||||
{
|
||||
/* FIXME: Throw an error if any segment doesn't have a Link TRB */
|
||||
struct xhci_segment *seg;
|
||||
struct xhci_segment *first_seg = ring->first_seg;
|
||||
xhci_debug_segment(xhci, first_seg);
|
||||
|
||||
if (!ring->enq_updates && !ring->deq_updates) {
|
||||
xhci_dbg(xhci, " Ring has not been updated\n");
|
||||
return;
|
||||
}
|
||||
for (seg = first_seg->next; seg != first_seg; seg = seg->next)
|
||||
xhci_debug_segment(xhci, seg);
|
||||
}
|
||||
|
||||
void xhci_dbg_ep_rings(struct xhci_hcd *xhci,
|
||||
unsigned int slot_id, unsigned int ep_index,
|
||||
struct xhci_virt_ep *ep)
|
||||
{
|
||||
int i;
|
||||
struct xhci_ring *ring;
|
||||
|
||||
if (ep->ep_state & EP_HAS_STREAMS) {
|
||||
for (i = 1; i < ep->stream_info->num_streams; i++) {
|
||||
ring = ep->stream_info->stream_rings[i];
|
||||
xhci_dbg(xhci, "Dev %d endpoint %d stream ID %d:\n",
|
||||
slot_id, ep_index, i);
|
||||
xhci_debug_segment(xhci, ring->deq_seg);
|
||||
}
|
||||
} else {
|
||||
ring = ep->ring;
|
||||
if (!ring)
|
||||
return;
|
||||
xhci_dbg(xhci, "Dev %d endpoint ring %d:\n",
|
||||
slot_id, ep_index);
|
||||
xhci_debug_segment(xhci, ring->deq_seg);
|
||||
}
|
||||
}
|
||||
|
||||
void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst)
|
||||
{
|
||||
u64 addr = erst->erst_dma_addr;
|
||||
int i;
|
||||
struct xhci_erst_entry *entry;
|
||||
|
||||
for (i = 0; i < erst->num_entries; ++i) {
|
||||
entry = &erst->entries[i];
|
||||
xhci_dbg(xhci, "@%016llx %08x %08x %08x %08x\n",
|
||||
addr,
|
||||
lower_32_bits(le64_to_cpu(entry->seg_addr)),
|
||||
upper_32_bits(le64_to_cpu(entry->seg_addr)),
|
||||
le32_to_cpu(entry->seg_size),
|
||||
le32_to_cpu(entry->rsvd));
|
||||
addr += sizeof(*entry);
|
||||
}
|
||||
}
|
||||
|
||||
void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci)
|
||||
{
|
||||
u64 val;
|
||||
|
||||
val = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
|
||||
xhci_dbg(xhci, "// xHC command ring deq ptr low bits + flags = @%08x\n",
|
||||
lower_32_bits(val));
|
||||
xhci_dbg(xhci, "// xHC command ring deq ptr high bits = @%08x\n",
|
||||
upper_32_bits(val));
|
||||
}
|
||||
|
||||
/* Print the last 32 bytes for 64-byte contexts */
|
||||
static void dbg_rsvd64(struct xhci_hcd *xhci, u64 *ctx, dma_addr_t dma)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx "
|
||||
"(dma) %#08llx - rsvd64[%d]\n",
|
||||
&ctx[4 + i], (unsigned long long)dma,
|
||||
ctx[4 + i], i);
|
||||
dma += 8;
|
||||
}
|
||||
}
|
||||
|
||||
char *xhci_get_slot_state(struct xhci_hcd *xhci,
|
||||
struct xhci_container_ctx *ctx)
|
||||
{
|
||||
struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
|
||||
|
||||
switch (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state))) {
|
||||
case SLOT_STATE_ENABLED:
|
||||
return "enabled/disabled";
|
||||
case SLOT_STATE_DEFAULT:
|
||||
return "default";
|
||||
case SLOT_STATE_ADDRESSED:
|
||||
return "addressed";
|
||||
case SLOT_STATE_CONFIGURED:
|
||||
return "configured";
|
||||
default:
|
||||
return "reserved";
|
||||
}
|
||||
}
|
||||
|
||||
static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx)
|
||||
{
|
||||
/* Fields are 32 bits wide, DMA addresses are in bytes */
|
||||
int field_size = 32 / 8;
|
||||
int i;
|
||||
|
||||
struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
|
||||
dma_addr_t dma = ctx->dma +
|
||||
((unsigned long)slot_ctx - (unsigned long)ctx->bytes);
|
||||
int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params);
|
||||
|
||||
xhci_dbg(xhci, "Slot Context:\n");
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info\n",
|
||||
&slot_ctx->dev_info,
|
||||
(unsigned long long)dma, slot_ctx->dev_info);
|
||||
dma += field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info2\n",
|
||||
&slot_ctx->dev_info2,
|
||||
(unsigned long long)dma, slot_ctx->dev_info2);
|
||||
dma += field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tt_info\n",
|
||||
&slot_ctx->tt_info,
|
||||
(unsigned long long)dma, slot_ctx->tt_info);
|
||||
dma += field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_state\n",
|
||||
&slot_ctx->dev_state,
|
||||
(unsigned long long)dma, slot_ctx->dev_state);
|
||||
dma += field_size;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
|
||||
&slot_ctx->reserved[i], (unsigned long long)dma,
|
||||
slot_ctx->reserved[i], i);
|
||||
dma += field_size;
|
||||
}
|
||||
|
||||
if (csz)
|
||||
dbg_rsvd64(xhci, (u64 *)slot_ctx, dma);
|
||||
}
|
||||
|
||||
static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci,
|
||||
struct xhci_container_ctx *ctx,
|
||||
unsigned int last_ep)
|
||||
{
|
||||
int i, j;
|
||||
int last_ep_ctx = 31;
|
||||
/* Fields are 32 bits wide, DMA addresses are in bytes */
|
||||
int field_size = 32 / 8;
|
||||
int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params);
|
||||
|
||||
if (last_ep < 31)
|
||||
last_ep_ctx = last_ep + 1;
|
||||
for (i = 0; i < last_ep_ctx; ++i) {
|
||||
struct xhci_ep_ctx *ep_ctx = xhci_get_ep_ctx(xhci, ctx, i);
|
||||
dma_addr_t dma = ctx->dma +
|
||||
((unsigned long)ep_ctx - (unsigned long)ctx->bytes);
|
||||
|
||||
xhci_dbg(xhci, "Endpoint %02d Context:\n", i);
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info\n",
|
||||
&ep_ctx->ep_info,
|
||||
(unsigned long long)dma, ep_ctx->ep_info);
|
||||
dma += field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info2\n",
|
||||
&ep_ctx->ep_info2,
|
||||
(unsigned long long)dma, ep_ctx->ep_info2);
|
||||
dma += field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08llx - deq\n",
|
||||
&ep_ctx->deq,
|
||||
(unsigned long long)dma, ep_ctx->deq);
|
||||
dma += 2*field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tx_info\n",
|
||||
&ep_ctx->tx_info,
|
||||
(unsigned long long)dma, ep_ctx->tx_info);
|
||||
dma += field_size;
|
||||
for (j = 0; j < 3; ++j) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
|
||||
&ep_ctx->reserved[j],
|
||||
(unsigned long long)dma,
|
||||
ep_ctx->reserved[j], j);
|
||||
dma += field_size;
|
||||
}
|
||||
|
||||
if (csz)
|
||||
dbg_rsvd64(xhci, (u64 *)ep_ctx, dma);
|
||||
}
|
||||
}
|
||||
|
||||
void xhci_dbg_ctx(struct xhci_hcd *xhci,
|
||||
struct xhci_container_ctx *ctx,
|
||||
unsigned int last_ep)
|
||||
{
|
||||
int i;
|
||||
/* Fields are 32 bits wide, DMA addresses are in bytes */
|
||||
int field_size = 32 / 8;
|
||||
struct xhci_slot_ctx *slot_ctx;
|
||||
dma_addr_t dma = ctx->dma;
|
||||
int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params);
|
||||
|
||||
if (ctx->type == XHCI_CTX_TYPE_INPUT) {
|
||||
struct xhci_input_control_ctx *ctrl_ctx =
|
||||
xhci_get_input_control_ctx(xhci, ctx);
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n",
|
||||
&ctrl_ctx->drop_flags, (unsigned long long)dma,
|
||||
ctrl_ctx->drop_flags);
|
||||
dma += field_size;
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - add flags\n",
|
||||
&ctrl_ctx->add_flags, (unsigned long long)dma,
|
||||
ctrl_ctx->add_flags);
|
||||
dma += field_size;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd2[%d]\n",
|
||||
&ctrl_ctx->rsvd2[i], (unsigned long long)dma,
|
||||
ctrl_ctx->rsvd2[i], i);
|
||||
dma += field_size;
|
||||
}
|
||||
|
||||
if (csz)
|
||||
dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma);
|
||||
}
|
||||
|
||||
slot_ctx = xhci_get_slot_ctx(xhci, ctx);
|
||||
xhci_dbg_slot_ctx(xhci, ctx);
|
||||
xhci_dbg_ep_ctx(xhci, ctx, last_ep);
|
||||
}
|
155
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-ext-caps.h
Normal file
155
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-ext-caps.h
Normal file
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* xHCI host controller driver
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corp.
|
||||
*
|
||||
* Author: Sarah Sharp
|
||||
* Some code borrowed from the Linux EHCI driver.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that 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, write to the Free Software Foundation,
|
||||
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* Up to 16 ms to halt an HC */
|
||||
#define XHCI_MAX_HALT_USEC (16*1000)
|
||||
/* HC not running - set to 1 when run/stop bit is cleared. */
|
||||
#define XHCI_STS_HALT (1<<0)
|
||||
|
||||
/* HCCPARAMS offset from PCI base address */
|
||||
#define XHCI_HCC_PARAMS_OFFSET 0x10
|
||||
/* HCCPARAMS contains the first extended capability pointer */
|
||||
#define XHCI_HCC_EXT_CAPS(p) (((p)>>16)&0xffff)
|
||||
|
||||
/* Command and Status registers offset from the Operational Registers address */
|
||||
#define XHCI_CMD_OFFSET 0x00
|
||||
#define XHCI_STS_OFFSET 0x04
|
||||
|
||||
#define XHCI_MAX_EXT_CAPS 50
|
||||
|
||||
/* Capability Register */
|
||||
/* bits 7:0 - how long is the Capabilities register */
|
||||
#define XHCI_HC_LENGTH(p) (((p)>>00)&0x00ff)
|
||||
|
||||
/* Extended capability register fields */
|
||||
#define XHCI_EXT_CAPS_ID(p) (((p)>>0)&0xff)
|
||||
#define XHCI_EXT_CAPS_NEXT(p) (((p)>>8)&0xff)
|
||||
#define XHCI_EXT_CAPS_VAL(p) ((p)>>16)
|
||||
/* Extended capability IDs - ID 0 reserved */
|
||||
#define XHCI_EXT_CAPS_LEGACY 1
|
||||
#define XHCI_EXT_CAPS_PROTOCOL 2
|
||||
#define XHCI_EXT_CAPS_PM 3
|
||||
#define XHCI_EXT_CAPS_VIRT 4
|
||||
#define XHCI_EXT_CAPS_ROUTE 5
|
||||
/* IDs 6-9 reserved */
|
||||
#define XHCI_EXT_CAPS_DEBUG 10
|
||||
/* USB Legacy Support Capability - section 7.1.1 */
|
||||
#define XHCI_HC_BIOS_OWNED (1 << 16)
|
||||
#define XHCI_HC_OS_OWNED (1 << 24)
|
||||
|
||||
/* USB Legacy Support Capability - section 7.1.1 */
|
||||
/* Add this offset, plus the value of xECP in HCCPARAMS to the base address */
|
||||
#define XHCI_LEGACY_SUPPORT_OFFSET (0x00)
|
||||
|
||||
/* USB Legacy Support Control and Status Register - section 7.1.2 */
|
||||
/* Add this offset, plus the value of xECP in HCCPARAMS to the base address */
|
||||
#define XHCI_LEGACY_CONTROL_OFFSET (0x04)
|
||||
/* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */
|
||||
#define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17))
|
||||
#define XHCI_LEGACY_SMI_EVENTS (0x7 << 29)
|
||||
|
||||
/* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */
|
||||
#define XHCI_L1C (1 << 16)
|
||||
|
||||
/* USB 2.0 xHCI 1.0 hardware LMP capability - section 7.2.2.1.3.2 */
|
||||
#define XHCI_HLC (1 << 19)
|
||||
|
||||
/* command register values to disable interrupts and halt the HC */
|
||||
/* start/stop HC execution - do not write unless HC is halted*/
|
||||
#define XHCI_CMD_RUN (1 << 0)
|
||||
/* Event Interrupt Enable - get irq when EINT bit is set in USBSTS register */
|
||||
#define XHCI_CMD_EIE (1 << 2)
|
||||
/* Host System Error Interrupt Enable - get irq when HSEIE bit set in USBSTS */
|
||||
#define XHCI_CMD_HSEIE (1 << 3)
|
||||
/* Enable Wrap Event - '1' means xHC generates an event when MFINDEX wraps. */
|
||||
#define XHCI_CMD_EWE (1 << 10)
|
||||
|
||||
#define XHCI_IRQS (XHCI_CMD_EIE | XHCI_CMD_HSEIE | XHCI_CMD_EWE)
|
||||
|
||||
/* true: Controller Not Ready to accept doorbell or op reg writes after reset */
|
||||
#define XHCI_STS_CNR (1 << 11)
|
||||
|
||||
#include <linux/io.h>
|
||||
|
||||
/**
|
||||
* Return the next extended capability pointer register.
|
||||
*
|
||||
* @base PCI register base address.
|
||||
*
|
||||
* @ext_offset Offset of the 32-bit register that contains the extended
|
||||
* capabilites pointer. If searching for the first extended capability, pass
|
||||
* in XHCI_HCC_PARAMS_OFFSET. If searching for the next extended capability,
|
||||
* pass in the offset of the current extended capability register.
|
||||
*
|
||||
* Returns 0 if there is no next extended capability register or returns the register offset
|
||||
* from the PCI registers base address.
|
||||
*/
|
||||
static inline int xhci_find_next_cap_offset(void __iomem *base, int ext_offset)
|
||||
{
|
||||
u32 next;
|
||||
|
||||
next = readl(base + ext_offset);
|
||||
|
||||
if (ext_offset == XHCI_HCC_PARAMS_OFFSET) {
|
||||
/* Find the first extended capability */
|
||||
next = XHCI_HCC_EXT_CAPS(next);
|
||||
ext_offset = 0;
|
||||
} else {
|
||||
/* Find the next extended capability */
|
||||
next = XHCI_EXT_CAPS_NEXT(next);
|
||||
}
|
||||
|
||||
if (!next)
|
||||
return 0;
|
||||
/*
|
||||
* Address calculation from offset of extended capabilities
|
||||
* (or HCCPARAMS) register - see section 5.3.6 and section 7.
|
||||
*/
|
||||
return ext_offset + (next << 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the offset of the extended capabilities with capability ID id.
|
||||
*
|
||||
* @base PCI MMIO registers base address.
|
||||
* @ext_offset Offset from base of the first extended capability to look at,
|
||||
* or the address of HCCPARAMS.
|
||||
* @id Extended capability ID to search for.
|
||||
*
|
||||
* This uses an arbitrary limit of XHCI_MAX_EXT_CAPS extended capabilities
|
||||
* to make sure that the list doesn't contain a loop.
|
||||
*/
|
||||
static inline int xhci_find_ext_cap_by_id(void __iomem *base, int ext_offset, int id)
|
||||
{
|
||||
u32 val;
|
||||
int limit = XHCI_MAX_EXT_CAPS;
|
||||
|
||||
while (ext_offset && limit > 0) {
|
||||
val = readl(base + ext_offset);
|
||||
if (XHCI_EXT_CAPS_ID(val) == id)
|
||||
break;
|
||||
ext_offset = xhci_find_next_cap_offset(base, ext_offset);
|
||||
limit--;
|
||||
}
|
||||
if (limit > 0)
|
||||
return ext_offset;
|
||||
return 0;
|
||||
}
|
1068
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-hub.c
Normal file
1068
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-hub.c
Normal file
File diff suppressed because it is too large
Load diff
2530
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-mem.c
Normal file
2530
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-mem.c
Normal file
File diff suppressed because it is too large
Load diff
348
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-pci.c
Normal file
348
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-pci.c
Normal file
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* xHCI host controller driver PCI Bus Glue.
|
||||
*
|
||||
* Copyright (C) 2008 Intel Corp.
|
||||
*
|
||||
* Author: Sarah Sharp
|
||||
* Some code borrowed from the Linux EHCI driver.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that 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, write to the Free Software Foundation,
|
||||
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "xhci.h"
|
||||
|
||||
/* Device for a quirk */
|
||||
#define PCI_VENDOR_ID_FRESCO_LOGIC 0x1b73
|
||||
#define PCI_DEVICE_ID_FRESCO_LOGIC_PDK 0x1000
|
||||
|
||||
#define PCI_VENDOR_ID_ETRON 0x1b6f
|
||||
#define PCI_DEVICE_ID_ASROCK_P67 0x7023
|
||||
|
||||
static const char hcd_name[] = "xhci_hcd";
|
||||
|
||||
/* called after powerup, by probe or system-pm "wakeup" */
|
||||
static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
|
||||
{
|
||||
/*
|
||||
* TODO: Implement finding debug ports later.
|
||||
* TODO: see if there are any quirks that need to be added to handle
|
||||
* new extended capabilities.
|
||||
*/
|
||||
|
||||
/* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */
|
||||
if (!pci_set_mwi(pdev))
|
||||
xhci_dbg(xhci, "MWI active\n");
|
||||
|
||||
xhci_dbg(xhci, "Finished xhci_pci_reinit\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
|
||||
/* Look for vendor-specific quirks */
|
||||
if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
|
||||
pdev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) {
|
||||
if (pdev->revision == 0x0) {
|
||||
xhci->quirks |= XHCI_RESET_EP_QUIRK;
|
||||
xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
|
||||
" endpoint cmd after reset endpoint\n");
|
||||
}
|
||||
/* Fresco Logic confirms: all revisions of this chip do not
|
||||
* support MSI, even though some of them claim to in their PCI
|
||||
* capabilities.
|
||||
*/
|
||||
xhci->quirks |= XHCI_BROKEN_MSI;
|
||||
xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
|
||||
"has broken MSI implementation\n",
|
||||
pdev->revision);
|
||||
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
|
||||
}
|
||||
|
||||
if (pdev->vendor == PCI_VENDOR_ID_NEC)
|
||||
xhci->quirks |= XHCI_NEC_HOST;
|
||||
|
||||
if (pdev->vendor == PCI_VENDOR_ID_AMD && xhci->hci_version == 0x96)
|
||||
xhci->quirks |= XHCI_AMD_0x96_HOST;
|
||||
|
||||
/* AMD PLL quirk */
|
||||
if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
|
||||
xhci->quirks |= XHCI_AMD_PLL_FIX;
|
||||
if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
|
||||
pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) {
|
||||
xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
|
||||
xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
|
||||
xhci->limit_active_eps = 64;
|
||||
xhci->quirks |= XHCI_SW_BW_CHECKING;
|
||||
}
|
||||
if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
|
||||
pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
|
||||
xhci->quirks |= XHCI_RESET_ON_RESUME;
|
||||
xhci_dbg(xhci, "QUIRK: Resetting on resume\n");
|
||||
xhci->quirks |= XHCI_TRUST_TX_LENGTH;
|
||||
}
|
||||
if (pdev->vendor == PCI_VENDOR_ID_VIA)
|
||||
xhci->quirks |= XHCI_RESET_ON_RESUME;
|
||||
}
|
||||
|
||||
/* called during probe() after chip reset completes */
|
||||
static int xhci_pci_setup(struct usb_hcd *hcd)
|
||||
{
|
||||
struct xhci_hcd *xhci;
|
||||
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
|
||||
int retval;
|
||||
|
||||
retval = xhci_gen_setup(hcd, xhci_pci_quirks);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
xhci = hcd_to_xhci(hcd);
|
||||
if (!usb_hcd_is_primary_hcd(hcd))
|
||||
return 0;
|
||||
|
||||
pci_read_config_byte(pdev, XHCI_SBRN_OFFSET, &xhci->sbrn);
|
||||
xhci_dbg(xhci, "Got SBRN %u\n", (unsigned int) xhci->sbrn);
|
||||
|
||||
/* Find any debug ports */
|
||||
retval = xhci_pci_reinit(xhci, pdev);
|
||||
if (!retval)
|
||||
return retval;
|
||||
|
||||
kfree(xhci);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to register our own PCI probe function (instead of the USB core's
|
||||
* function) in order to create a second roothub under xHCI.
|
||||
*/
|
||||
static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
int retval;
|
||||
struct xhci_hcd *xhci;
|
||||
struct hc_driver *driver;
|
||||
struct usb_hcd *hcd;
|
||||
|
||||
driver = (struct hc_driver *)id->driver_data;
|
||||
/* Register the USB 2.0 roothub.
|
||||
* FIXME: USB core must know to register the USB 2.0 roothub first.
|
||||
* This is sort of silly, because we could just set the HCD driver flags
|
||||
* to say USB 2.0, but I'm not sure what the implications would be in
|
||||
* the other parts of the HCD code.
|
||||
*/
|
||||
retval = usb_hcd_pci_probe(dev, id);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
/* USB 2.0 roothub is stored in the PCI device now. */
|
||||
hcd = dev_get_drvdata(&dev->dev);
|
||||
xhci = hcd_to_xhci(hcd);
|
||||
xhci->shared_hcd = usb_create_shared_hcd(driver, &dev->dev,
|
||||
pci_name(dev), hcd);
|
||||
if (!xhci->shared_hcd) {
|
||||
retval = -ENOMEM;
|
||||
goto dealloc_usb2_hcd;
|
||||
}
|
||||
|
||||
/* Set the xHCI pointer before xhci_pci_setup() (aka hcd_driver.reset)
|
||||
* is called by usb_add_hcd().
|
||||
*/
|
||||
*((struct xhci_hcd **) xhci->shared_hcd->hcd_priv) = xhci;
|
||||
|
||||
retval = usb_add_hcd(xhci->shared_hcd, dev->irq,
|
||||
IRQF_SHARED);
|
||||
if (retval)
|
||||
goto put_usb3_hcd;
|
||||
/* Roothub already marked as USB 3.0 speed */
|
||||
return 0;
|
||||
|
||||
put_usb3_hcd:
|
||||
usb_put_hcd(xhci->shared_hcd);
|
||||
dealloc_usb2_hcd:
|
||||
usb_hcd_pci_remove(dev);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void xhci_pci_remove(struct pci_dev *dev)
|
||||
{
|
||||
struct xhci_hcd *xhci;
|
||||
|
||||
xhci = hcd_to_xhci(pci_get_drvdata(dev));
|
||||
if (xhci->shared_hcd) {
|
||||
usb_remove_hcd(xhci->shared_hcd);
|
||||
usb_put_hcd(xhci->shared_hcd);
|
||||
}
|
||||
usb_hcd_pci_remove(dev);
|
||||
kfree(xhci);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
#if defined(__VMKLNX__)
|
||||
static int xhci_pci_suspend(struct usb_hcd *hcd)
|
||||
#else
|
||||
static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup)
|
||||
#endif
|
||||
{
|
||||
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
|
||||
int retval = 0;
|
||||
|
||||
if (hcd->state != HC_STATE_SUSPENDED ||
|
||||
xhci->shared_hcd->state != HC_STATE_SUSPENDED)
|
||||
return -EINVAL;
|
||||
|
||||
retval = xhci_suspend(xhci);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
|
||||
{
|
||||
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
|
||||
#if !defined(__VMKLNX__)
|
||||
struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
|
||||
#endif
|
||||
int retval = 0;
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
/* FXIME: revise PantherPoint policy */
|
||||
/* The BIOS on systems with the Intel Panther Point chipset may or may
|
||||
* not support xHCI natively. That means that during system resume, it
|
||||
* may switch the ports back to EHCI so that users can use their
|
||||
* keyboard to select a kernel from GRUB after resume from hibernate.
|
||||
*
|
||||
* The BIOS is supposed to remember whether the OS had xHCI ports
|
||||
* enabled before resume, and switch the ports back to xHCI when the
|
||||
* BIOS/OS semaphore is written, but we all know we can't trust BIOS
|
||||
* writers.
|
||||
*
|
||||
* Unconditionally switch the ports back to xHCI after a system resume.
|
||||
* We can't tell whether the EHCI or xHCI controller will be resumed
|
||||
* first, so we have to do the port switchover in both drivers. Writing
|
||||
* a '1' to the port switchover registers should have no effect if the
|
||||
* port was already switched over.
|
||||
*/
|
||||
if (usb_is_intel_switchable_xhci(pdev))
|
||||
usb_enable_xhci_ports(pdev);
|
||||
#endif
|
||||
|
||||
retval = xhci_resume(xhci, hibernated);
|
||||
return retval;
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
static const struct hc_driver xhci_pci_hc_driver = {
|
||||
.description = hcd_name,
|
||||
.product_desc = "xHCI Host Controller",
|
||||
.hcd_priv_size = sizeof(struct xhci_hcd *),
|
||||
|
||||
/*
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = xhci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB3 | HCD_SHARED,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
*/
|
||||
.reset = xhci_pci_setup,
|
||||
.start = xhci_run,
|
||||
#ifdef CONFIG_PM
|
||||
.pci_suspend = xhci_pci_suspend,
|
||||
.pci_resume = xhci_pci_resume,
|
||||
#endif
|
||||
.stop = xhci_stop,
|
||||
.shutdown = xhci_shutdown,
|
||||
|
||||
/*
|
||||
* managing i/o requests and associated device resources
|
||||
*/
|
||||
.urb_enqueue = xhci_urb_enqueue,
|
||||
.urb_dequeue = xhci_urb_dequeue,
|
||||
.alloc_dev = xhci_alloc_dev,
|
||||
.free_dev = xhci_free_dev,
|
||||
.alloc_streams = xhci_alloc_streams,
|
||||
.free_streams = xhci_free_streams,
|
||||
.add_endpoint = xhci_add_endpoint,
|
||||
.drop_endpoint = xhci_drop_endpoint,
|
||||
.endpoint_reset = xhci_endpoint_reset,
|
||||
.check_bandwidth = xhci_check_bandwidth,
|
||||
.reset_bandwidth = xhci_reset_bandwidth,
|
||||
.address_device = xhci_address_device,
|
||||
.update_hub_device = xhci_update_hub_device,
|
||||
.reset_device = xhci_discover_or_reset_device,
|
||||
|
||||
/*
|
||||
* scheduling support
|
||||
*/
|
||||
.get_frame_number = xhci_get_frame,
|
||||
|
||||
/* Root hub support */
|
||||
.hub_control = xhci_hub_control,
|
||||
.hub_status_data = xhci_hub_status_data,
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
.module = THIS_MODULE,
|
||||
#endif
|
||||
.bus_suspend = xhci_bus_suspend,
|
||||
.bus_resume = xhci_bus_resume,
|
||||
/*
|
||||
* call back when device connected and addressed
|
||||
*/
|
||||
.update_device = xhci_update_device,
|
||||
.set_usb2_hw_lpm = xhci_set_usb2_hardware_lpm,
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* PCI driver selection metadata; PCI hotplugging uses this */
|
||||
static const struct pci_device_id pci_ids[] = { {
|
||||
/* handle any USB 3.0 xHCI controller */
|
||||
PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_XHCI, ~0),
|
||||
.driver_data = (unsigned long) &xhci_pci_hc_driver,
|
||||
},
|
||||
{ /* end: all zeroes */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, pci_ids);
|
||||
|
||||
/* pci driver glue; this is a "new style" PCI driver module */
|
||||
static struct pci_driver xhci_pci_driver = {
|
||||
.name = (char *) hcd_name,
|
||||
.id_table = pci_ids,
|
||||
|
||||
.probe = xhci_pci_probe,
|
||||
.remove = xhci_pci_remove,
|
||||
/* suspend and resume implemented later */
|
||||
|
||||
.shutdown = usb_hcd_pci_shutdown,
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
.driver = {
|
||||
.pm = &usb_hcd_pci_pm_ops
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
int __init xhci_register_pci(void)
|
||||
{
|
||||
return pci_register_driver(&xhci_pci_driver);
|
||||
}
|
||||
|
||||
void xhci_unregister_pci(void)
|
||||
{
|
||||
pci_unregister_driver(&xhci_pci_driver);
|
||||
}
|
3726
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-ring.c
Normal file
3726
vmkdrivers/src_92/drivers/usb/host/xhci/xhci-ring.c
Normal file
File diff suppressed because it is too large
Load diff
4118
vmkdrivers/src_92/drivers/usb/host/xhci/xhci.c
Normal file
4118
vmkdrivers/src_92/drivers/usb/host/xhci/xhci.c
Normal file
File diff suppressed because it is too large
Load diff
1833
vmkdrivers/src_92/drivers/usb/host/xhci/xhci.h
Normal file
1833
vmkdrivers/src_92/drivers/usb/host/xhci/xhci.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -521,7 +521,13 @@ void __usbhid_submit_report(struct hid_device *hid, struct hid_report *report, u
|
|||
{
|
||||
int head;
|
||||
struct usbhid_device *usbhid = hid->driver_data;
|
||||
int len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
|
||||
|
||||
/*
|
||||
* 7 extra bytes are necessary to achieve proper functionality
|
||||
* of implement() working on 8 byte chunks
|
||||
*/
|
||||
|
||||
int len = ((report->size - 1) >> 3) + 1 + (report->id > 0) + 7;
|
||||
|
||||
if ((hid->quirks & HID_QUIRK_NOGET) && dir == USB_DIR_IN)
|
||||
return;
|
||||
|
|
|
@ -278,8 +278,11 @@ static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_hea
|
|||
spin_unlock(&list->lock);
|
||||
spin_lock(&dev->done.lock);
|
||||
__skb_queue_tail(&dev->done, skb);
|
||||
if (dev->done.qlen == 1)
|
||||
if (dev->done.qlen == 1) {
|
||||
spin_unlock_irqrestore(&dev->done.lock, flags);
|
||||
tasklet_schedule(&dev->bh);
|
||||
return;
|
||||
}
|
||||
spin_unlock_irqrestore(&dev->done.lock, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <linux/usb.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "usb.h"
|
||||
#include "transport.h"
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
*/
|
||||
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/module.h>
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
#if defined(__VMKLNX__)
|
||||
|
@ -118,7 +119,9 @@ void fix_inquiry_data(struct scsi_cmnd *srb, struct us_data *us)
|
|||
|
||||
void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
|
||||
{
|
||||
/* Pad the SCSI command with zeros out to 12 bytes
|
||||
/*
|
||||
* Pad the SCSI command with zeros out to 12 bytes. If the
|
||||
* command already is 12 bytes or longer, leave it alone.
|
||||
*
|
||||
* NOTE: This only works because a scsi_cmnd struct field contains
|
||||
* a unsigned char cmnd[16], so we know we have storage available
|
||||
|
@ -126,9 +129,6 @@ void usb_stor_pad12_command(struct scsi_cmnd *srb, struct us_data *us)
|
|||
for (; srb->cmd_len<12; srb->cmd_len++)
|
||||
srb->cmnd[srb->cmd_len] = 0;
|
||||
|
||||
/* set command length to 12 bytes */
|
||||
srb->cmd_len = 12;
|
||||
|
||||
/* send the command to the transport layer */
|
||||
usb_stor_invoke_transport(srb, us);
|
||||
#if defined(__VMKLNX__)
|
||||
|
|
|
@ -123,7 +123,7 @@ static int slave_alloc (struct scsi_device *sdev)
|
|||
* Let the scanning code know if this target merely sets
|
||||
* Peripheral Device Type to 0x1f to indicate no LUN.
|
||||
*/
|
||||
if (us->subclass == US_SC_UFI)
|
||||
if (us->subclass == USB_SC_UFI)
|
||||
sdev->sdev_target->pdt_1f_for_no_lun = 1;
|
||||
|
||||
return 0;
|
||||
|
@ -188,7 +188,7 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
/* Disk-type devices use MODE SENSE(6) if the protocol
|
||||
* (SubClass) is Transparent SCSI, otherwise they use
|
||||
* MODE SENSE(10). */
|
||||
if (us->subclass != US_SC_SCSI && us->subclass != US_SC_CYP_ATACB)
|
||||
if (us->subclass != USB_SC_SCSI && us->subclass != USB_SC_CYP_ATACB)
|
||||
sdev->use_10_for_ms = 1;
|
||||
|
||||
/* Many disks only accept MODE SENSE transfer lengths of
|
||||
|
@ -209,6 +209,11 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
* page x08, so we will skip it. */
|
||||
sdev->skip_ms_page_8 = 1;
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
/* Some devices don't handle VPD pages correctly */
|
||||
sdev->skip_vpd_pages = 1;
|
||||
#endif
|
||||
|
||||
/* Some disks return the total number of blocks in response
|
||||
* to READ CAPACITY rather than the highest block number.
|
||||
* If this device makes that mistake, tell the sd driver. */
|
||||
|
@ -221,12 +226,17 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
* The sd driver has to guess which is the case. */
|
||||
if (us->fflags & US_FL_CAPACITY_HEURISTICS)
|
||||
sdev->guess_capacity = 1;
|
||||
|
||||
/* Some devices cannot handle READ_CAPACITY_16 */
|
||||
if (us->fflags & US_FL_NO_READ_CAPACITY_16)
|
||||
sdev->no_read_capacity_16 = 1;
|
||||
#endif
|
||||
|
||||
/* assume SPC3 or latter devices support sense size > 18 */
|
||||
if (sdev->scsi_level > SCSI_SPC_2)
|
||||
us->fflags |= US_FL_SANE_SENSE;
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
/* Some devices report a SCSI revision level above 2 but are
|
||||
* unable to handle the REPORT LUNS command (for which
|
||||
* support is mandatory at level 3). Since we already have
|
||||
|
@ -236,6 +246,7 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
if (sdev->scsi_level > SCSI_2)
|
||||
sdev->sdev_target->scsi_level =
|
||||
sdev->scsi_level = SCSI_2;
|
||||
#endif
|
||||
|
||||
/* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable
|
||||
* Hardware Error) when any low-level error occurs,
|
||||
|
@ -261,7 +272,7 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
* capacity will be decremented or is correct. */
|
||||
if (!(us->fflags & (US_FL_FIX_CAPACITY | US_FL_CAPACITY_OK |
|
||||
US_FL_SCM_MULT_TARG)) &&
|
||||
us->protocol == US_PR_BULK)
|
||||
us->protocol == USB_PR_BULK)
|
||||
us->use_last_sector_hacks = 1;
|
||||
} else {
|
||||
|
||||
|
@ -269,6 +280,12 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
* or to force 192-byte transfer lengths for MODE SENSE.
|
||||
* But they do need to use MODE SENSE(10). */
|
||||
sdev->use_10_for_ms = 1;
|
||||
#if !defined(__VMKLNX__)
|
||||
/* Some (fake) usb cdrom devices don't like READ_DISC_INFO */
|
||||
if (us->fflags & US_FL_NO_READ_DISC_INFO)
|
||||
sdev->no_read_disc_info = 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/* The CB and CBI transports have no way to pass LUN values
|
||||
|
@ -277,7 +294,7 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
* scsi_level == 0 (UNKNOWN). Hence such devices must necessarily
|
||||
* be single-LUN.
|
||||
*/
|
||||
if ((us->protocol == US_PR_CB || us->protocol == US_PR_CBI) &&
|
||||
if ((us->protocol == USB_PR_CB || us->protocol == USB_PR_CBI) &&
|
||||
sdev->scsi_level == SCSI_UNKNOWN)
|
||||
us->max_lun = 0;
|
||||
|
||||
|
@ -291,10 +308,46 @@ static int slave_configure(struct scsi_device *sdev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int target_alloc(struct scsi_target *starget)
|
||||
{
|
||||
struct us_data *us = host_to_us(dev_to_shost(starget->dev.parent));
|
||||
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
/*
|
||||
* Some USB drives don't support REPORT LUNS, even though they
|
||||
* report a SCSI revision level above 2. Tell the SCSI layer
|
||||
* not to issue that command; it will perform a normal sequential
|
||||
* scan instead.
|
||||
*/
|
||||
starget->no_report_luns = 1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The UFI spec treats the Peripheral Qualifier bits in an
|
||||
* INQUIRY result as reserved and requires devices to set them
|
||||
* to 0. However the SCSI spec requires these bits to be set
|
||||
* to 3 to indicate when a LUN is not present.
|
||||
*
|
||||
* Let the scanning code know if this target merely sets
|
||||
* Peripheral Device Type to 0x1f to indicate no LUN.
|
||||
*/
|
||||
if (us->subclass == USB_SC_UFI)
|
||||
starget->pdt_1f_for_no_lun = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* queue a command */
|
||||
/* This is always called with scsi_lock(host) held */
|
||||
#if defined(__VMKLNX__)
|
||||
static int queuecommand(struct scsi_cmnd *srb,
|
||||
void (*done)(struct scsi_cmnd *))
|
||||
#else
|
||||
static int queuecommand_lck(struct scsi_cmnd *srb,
|
||||
void (*done)(struct scsi_cmnd *))
|
||||
#endif
|
||||
{
|
||||
struct us_data *us = host_to_us(srb->device->host);
|
||||
|
||||
|
@ -335,6 +388,14 @@ static int queuecommand(struct scsi_cmnd *srb,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
/* This macro was added into the linux 3.4.2 USB storage branch, but
|
||||
* relies on scsi additions that linux 3.4.2 has but are not in vmklinux scsi */
|
||||
static DEF_SCSI_QCMD(queuecommand)
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Error handling functions
|
||||
***********************************************************************/
|
||||
|
@ -582,6 +643,7 @@ struct scsi_host_template usb_stor_host_template = {
|
|||
|
||||
.slave_alloc = slave_alloc,
|
||||
.slave_configure = slave_configure,
|
||||
.target_alloc = target_alloc,
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
.sg_tablesize = SG_ALL,
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/usb/quirks.h>
|
||||
|
||||
|
@ -148,15 +149,12 @@ static int usb_stor_msg_common(struct us_data *us, int timeout)
|
|||
|
||||
/* fill the common fields in the URB */
|
||||
us->current_urb->context = &urb_done;
|
||||
us->current_urb->actual_length = 0;
|
||||
us->current_urb->error_count = 0;
|
||||
us->current_urb->status = 0;
|
||||
us->current_urb->transfer_flags = 0;
|
||||
|
||||
/* we assume that if transfer_buffer isn't us->iobuf then it
|
||||
* hasn't been mapped for DMA. Yes, this is clunky, but it's
|
||||
* easier than always having the caller tell us whether the
|
||||
* transfer buffer has already been mapped. */
|
||||
us->current_urb->transfer_flags = URB_NO_SETUP_DMA_MAP;
|
||||
#if defined(__VMKLNX__)
|
||||
if (us->current_urb->transfer_buffer == us->iobuf) {
|
||||
us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
|
@ -172,7 +170,6 @@ static int usb_stor_msg_common(struct us_data *us, int timeout)
|
|||
us->current_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
||||
us->current_urb->transfer_dma = us->iobuf_dma;
|
||||
#endif
|
||||
us->current_urb->setup_dma = us->cr_dma;
|
||||
|
||||
/* submit the URB */
|
||||
#if defined(__VMKLNX__)
|
||||
|
@ -865,7 +862,7 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
* unless the operation involved a data-in transfer. Devices
|
||||
* can signal most data-in errors by stalling the bulk-in pipe.
|
||||
*/
|
||||
if ((us->protocol == US_PR_CB || us->protocol == US_PR_DPCM_USB) &&
|
||||
if ((us->protocol == USB_PR_CB || us->protocol == USB_PR_DPCM_USB) &&
|
||||
srb->sc_data_direction != DMA_FROM_DEVICE) {
|
||||
_VMKLNX_USB_STOR_MSG("-- CB transport device requiring auto-sense\n", srb);
|
||||
US_DEBUGP("-- CB transport device requiring auto-sense\n");
|
||||
|
@ -917,6 +914,9 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
int temp_result;
|
||||
struct scsi_eh_save ses;
|
||||
int sense_size = US_SENSE_SIZE;
|
||||
struct scsi_sense_hdr sshdr;
|
||||
const u8 *scdd;
|
||||
u8 fm_ili;
|
||||
|
||||
/* device supports and needs bigger sense buffer */
|
||||
if (us->fflags & US_FL_SANE_SENSE)
|
||||
|
@ -933,8 +933,8 @@ Retry_Sense:
|
|||
#endif
|
||||
|
||||
/* FIXME: we must do the protocol translation here */
|
||||
if (us->subclass == US_SC_RBC || us->subclass == US_SC_SCSI ||
|
||||
us->subclass == US_SC_CYP_ATACB)
|
||||
if (us->subclass == USB_SC_RBC || us->subclass == USB_SC_SCSI ||
|
||||
us->subclass == USB_SC_CYP_ATACB)
|
||||
srb->cmd_len = 6;
|
||||
else
|
||||
srb->cmd_len = 12;
|
||||
|
@ -1010,17 +1010,15 @@ Retry_Sense:
|
|||
srb->sense_buffer[7] = (US_SENSE_SIZE - 8);
|
||||
}
|
||||
|
||||
scsi_normalize_sense(srb->sense_buffer, SCSI_SENSE_BUFFERSIZE,
|
||||
&sshdr);
|
||||
|
||||
US_DEBUGP("-- Result from auto-sense is %d\n", temp_result);
|
||||
US_DEBUGP("-- code: 0x%x, key: 0x%x, ASC: 0x%x, ASCQ: 0x%x\n",
|
||||
srb->sense_buffer[0],
|
||||
srb->sense_buffer[2] & 0xf,
|
||||
srb->sense_buffer[12],
|
||||
srb->sense_buffer[13]);
|
||||
sshdr.response_code, sshdr.sense_key,
|
||||
sshdr.asc, sshdr.ascq);
|
||||
#ifdef CONFIG_USB_STORAGE_DEBUG
|
||||
usb_stor_show_sense(
|
||||
srb->sense_buffer[2] & 0xf,
|
||||
srb->sense_buffer[12],
|
||||
srb->sense_buffer[13]);
|
||||
usb_stor_show_sense(sshdr.sense_key, sshdr.asc, sshdr.ascq);
|
||||
#endif
|
||||
|
||||
/* set the result so the higher layers expect this data */
|
||||
|
@ -1034,17 +1032,16 @@ Retry_Sense:
|
|||
}
|
||||
#endif
|
||||
|
||||
scdd = scsi_sense_desc_find(srb->sense_buffer,
|
||||
SCSI_SENSE_BUFFERSIZE, 4);
|
||||
fm_ili = (scdd ? scdd[3] : srb->sense_buffer[2]) & 0xA0;
|
||||
|
||||
/* We often get empty sense data. This could indicate that
|
||||
* everything worked or that there was an unspecified
|
||||
* problem. We have to decide which.
|
||||
*/
|
||||
if ( /* Filemark 0, ignore EOM, ILI 0, no sense */
|
||||
(srb->sense_buffer[2] & 0xaf) == 0 &&
|
||||
/* No ASC or ASCQ */
|
||||
srb->sense_buffer[12] == 0 &&
|
||||
srb->sense_buffer[13] == 0) {
|
||||
|
||||
if (sshdr.sense_key == 0 && sshdr.asc == 0 && sshdr.ascq == 0 &&
|
||||
fm_ili == 0) {
|
||||
/* If things are really okay, then let's show that.
|
||||
* Zero out the sense buffer so the higher layers
|
||||
* won't realize we did an unsolicited auto-sense.
|
||||
|
@ -1059,11 +1056,43 @@ Retry_Sense:
|
|||
*/
|
||||
} else {
|
||||
srb->result = DID_ERROR << 16;
|
||||
srb->sense_buffer[2] = HARDWARE_ERROR;
|
||||
if ((sshdr.response_code & 0x72) == 0x72)
|
||||
srb->sense_buffer[1] = HARDWARE_ERROR;
|
||||
else
|
||||
srb->sense_buffer[2] = HARDWARE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Some devices don't work or return incorrect data the first
|
||||
* time they get a READ(10) command, or for the first READ(10)
|
||||
* after a media change. If the INITIAL_READ10 flag is set,
|
||||
* keep track of whether READ(10) commands succeed. If the
|
||||
* previous one succeeded and this one failed, set the REDO_READ10
|
||||
* flag to force a retry.
|
||||
*/
|
||||
if (unlikely((us->fflags & US_FL_INITIAL_READ10) &&
|
||||
srb->cmnd[0] == READ_10)) {
|
||||
if (srb->result == SAM_STAT_GOOD) {
|
||||
set_bit(US_FLIDX_READ10_WORKED, &us->dflags);
|
||||
} else if (test_bit(US_FLIDX_READ10_WORKED, &us->dflags)) {
|
||||
clear_bit(US_FLIDX_READ10_WORKED, &us->dflags);
|
||||
set_bit(US_FLIDX_REDO_READ10, &us->dflags);
|
||||
}
|
||||
|
||||
/*
|
||||
* Next, if the REDO_READ10 flag is set, return a result
|
||||
* code that will cause the SCSI core to retry the READ(10)
|
||||
* command immediately.
|
||||
*/
|
||||
if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) {
|
||||
clear_bit(US_FLIDX_REDO_READ10, &us->dflags);
|
||||
srb->result = DID_IMM_RETRY << 16;
|
||||
srb->sense_buffer[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Did we transfer less than the minimum amount required? */
|
||||
#if defined(__VMKLNX__)
|
||||
if ((srb->result == SAM_STAT_GOOD || srb->sense_buffer[2] == 0) &&
|
||||
|
@ -1196,7 +1225,7 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
/* NOTE: CB does not have a status stage. Silly, I know. So
|
||||
* we have to catch this at a higher level.
|
||||
*/
|
||||
if (us->protocol != US_PR_CBI)
|
||||
if (us->protocol != USB_PR_CBI)
|
||||
return USB_STOR_TRANSPORT_GOOD;
|
||||
|
||||
result = usb_stor_intr_transfer(us, us->iobuf, 2);
|
||||
|
@ -1212,7 +1241,7 @@ int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
* that this means we could be ignoring a real error on these
|
||||
* commands, but that can't be helped.
|
||||
*/
|
||||
if (us->subclass == US_SC_UFI) {
|
||||
if (us->subclass == USB_SC_UFI) {
|
||||
if (srb->cmnd[0] == REQUEST_SENSE ||
|
||||
srb->cmnd[0] == INQUIRY)
|
||||
return USB_STOR_TRANSPORT_GOOD;
|
||||
|
@ -1309,7 +1338,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
|
|||
/* set up the command wrapper */
|
||||
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
|
||||
bcb->DataTransferLength = cpu_to_le32(transfer_length);
|
||||
bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0;
|
||||
bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ?
|
||||
US_BULK_FLAG_IN : 0;
|
||||
bcb->Tag = ++us->tag;
|
||||
bcb->Lun = srb->device->lun;
|
||||
if (us->fflags & US_FL_SCM_MULT_TARG)
|
||||
|
|
|
@ -41,45 +41,6 @@
|
|||
|
||||
#include <linux/blkdev.h>
|
||||
|
||||
/*
|
||||
* Bulk only data structures
|
||||
*/
|
||||
|
||||
/* command block wrapper */
|
||||
struct bulk_cb_wrap {
|
||||
__le32 Signature; /* contains 'USBC' */
|
||||
__u32 Tag; /* unique per command id */
|
||||
__le32 DataTransferLength; /* size of data */
|
||||
__u8 Flags; /* direction in bit 0 */
|
||||
__u8 Lun; /* LUN normally 0 */
|
||||
__u8 Length; /* of of the CDB */
|
||||
__u8 CDB[16]; /* max command */
|
||||
};
|
||||
|
||||
#define US_BULK_CB_WRAP_LEN 31
|
||||
#define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */
|
||||
#define US_BULK_FLAG_IN 1
|
||||
#define US_BULK_FLAG_OUT 0
|
||||
|
||||
/* command status wrapper */
|
||||
struct bulk_cs_wrap {
|
||||
__le32 Signature; /* should = 'USBS' */
|
||||
__u32 Tag; /* same as original command */
|
||||
__le32 Residue; /* amount not transferred */
|
||||
__u8 Status; /* see below */
|
||||
__u8 Filler[18];
|
||||
};
|
||||
|
||||
#define US_BULK_CS_WRAP_LEN 13
|
||||
#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
|
||||
#define US_BULK_STAT_OK 0
|
||||
#define US_BULK_STAT_FAIL 1
|
||||
#define US_BULK_STAT_PHASE 2
|
||||
|
||||
/* bulk-only class specific requests */
|
||||
#define US_BULK_RESET_REQUEST 0xff
|
||||
#define US_BULK_GET_MAX_LUN 0xfe
|
||||
|
||||
/*
|
||||
* usb_stor_bulk_transfer_xxx() return codes, in order of severity
|
||||
*/
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102,
|
||||
"Fujifilm",
|
||||
"DPC-R1 (Alauda)",
|
||||
US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
|
||||
USB_SC_SCSI, USB_PR_ALAUDA, init_alauda, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x07b4, 0x010a, 0x0102, 0x0102,
|
||||
"Olympus",
|
||||
"MAUSB-10 (Alauda)",
|
||||
US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0),
|
||||
USB_SC_SCSI, USB_PR_ALAUDA, init_alauda, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_ALAUDA) || ... */
|
||||
|
|
|
@ -23,12 +23,17 @@
|
|||
UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999,
|
||||
"Cypress",
|
||||
"Cypress AT2LP",
|
||||
US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
|
||||
USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
|
||||
|
||||
/* CY7C68310 : support atacb and atacb2 */
|
||||
UNUSUAL_DEV( 0x04b4, 0x6831, 0x0000, 0x9999,
|
||||
"Cypress",
|
||||
"Cypress ISD-300LP",
|
||||
US_SC_CYP_ATACB, US_PR_DEVICE, NULL, 0),
|
||||
USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x14cd, 0x6116, 0x0000, 0x9999,
|
||||
"Super Top",
|
||||
"USB 2.0 SATA BRIDGE",
|
||||
USB_SC_CYP_ATACB, USB_PR_DEVICE, NULL, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_CYPRESS_ATACB) || ... */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
UNUSUAL_DEV( 0x07c4, 0xa000, 0x0000, 0x0015,
|
||||
"Datafab",
|
||||
"MDCFE-B USB CF Reader",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
/*
|
||||
|
@ -38,45 +38,45 @@ UNUSUAL_DEV( 0x07c4, 0xa000, 0x0000, 0x0015,
|
|||
UNUSUAL_DEV( 0x07c4, 0xa001, 0x0000, 0xffff,
|
||||
"SIIG/Datafab",
|
||||
"SIIG/Datafab Memory Stick+CF Reader/Writer",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
/* Reported by Josef Reisinger <josef.reisinger@netcologne.de> */
|
||||
UNUSUAL_DEV( 0x07c4, 0xa002, 0x0000, 0xffff,
|
||||
"Datafab/Unknown",
|
||||
"MD2/MD3 Disk enclosure",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
US_FL_SINGLE_LUN),
|
||||
|
||||
UNUSUAL_DEV( 0x07c4, 0xa003, 0x0000, 0xffff,
|
||||
"Datafab/Unknown",
|
||||
"Datafab-based Reader",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x07c4, 0xa004, 0x0000, 0xffff,
|
||||
"Datafab/Unknown",
|
||||
"Datafab-based Reader",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x07c4, 0xa005, 0x0000, 0xffff,
|
||||
"PNY/Datafab",
|
||||
"PNY/Datafab CF+SM Reader",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x07c4, 0xa006, 0x0000, 0xffff,
|
||||
"Simple Tech/Datafab",
|
||||
"Simple Tech/Datafab CF+SM Reader",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
/* Submitted by Olaf Hering <olh@suse.de> */
|
||||
UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
|
||||
"Datafab Systems, Inc.",
|
||||
"USB to CF + SM Combo (LC1)",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
/* Reported by Felix Moeller <felix@derklecks.de>
|
||||
|
@ -86,13 +86,13 @@ UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
|
|||
UNUSUAL_DEV( 0x07c4, 0xa10b, 0x0000, 0xffff,
|
||||
"DataFab Systems Inc.",
|
||||
"USB CF+MS",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
|
||||
"Acomdata",
|
||||
"CF",
|
||||
US_SC_SCSI, US_PR_DATAFAB, NULL,
|
||||
USB_SC_SCSI, USB_PR_DATAFAB, NULL,
|
||||
US_FL_SINGLE_LUN),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_DATAFAB) || ... */
|
||||
|
|
File diff suppressed because it is too large
Load diff
26
vmkdrivers/src_92/drivers/usb/storage/unusual_ene_ub6250.h
Normal file
26
vmkdrivers/src_92/drivers/usb/storage/unusual_ene_ub6250.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that 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, write to the Free Software Foundation, Inc.,
|
||||
* 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USB_STORAGE_ENE_UB6250) || \
|
||||
defined(CONFIG_USB_STORAGE_ENE_UB6250_MODULE)
|
||||
|
||||
UNUSUAL_DEV(0x0cf2, 0x6250, 0x0000, 0x9999,
|
||||
"ENE",
|
||||
"ENE UB6250 reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, NULL, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_ENE_UB6250) || ... */
|
|
@ -21,6 +21,6 @@
|
|||
UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
|
||||
"Freecom",
|
||||
"USB-IDE",
|
||||
US_SC_QIC, US_PR_FREECOM, init_freecom, 0),
|
||||
USB_SC_QIC, USB_PR_FREECOM, init_freecom, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_FREECOM) || ... */
|
||||
|
|
|
@ -21,37 +21,37 @@
|
|||
UNUSUAL_DEV( 0x054c, 0x002b, 0x0100, 0x0110,
|
||||
"Sony",
|
||||
"Portable USB Harddrive V2",
|
||||
US_SC_ISD200, US_PR_BULK, isd200_Initialization,
|
||||
USB_SC_ISD200, USB_PR_BULK, isd200_Initialization,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x05ab, 0x0031, 0x0100, 0x0110,
|
||||
"In-System",
|
||||
"USB/IDE Bridge (ATA/ATAPI)",
|
||||
US_SC_ISD200, US_PR_BULK, isd200_Initialization,
|
||||
USB_SC_ISD200, USB_PR_BULK, isd200_Initialization,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x05ab, 0x0301, 0x0100, 0x0110,
|
||||
"In-System",
|
||||
"Portable USB Harddrive V2",
|
||||
US_SC_ISD200, US_PR_BULK, isd200_Initialization,
|
||||
USB_SC_ISD200, USB_PR_BULK, isd200_Initialization,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x05ab, 0x0351, 0x0100, 0x0110,
|
||||
"In-System",
|
||||
"Portable USB Harddrive V2",
|
||||
US_SC_ISD200, US_PR_BULK, isd200_Initialization,
|
||||
USB_SC_ISD200, USB_PR_BULK, isd200_Initialization,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x05ab, 0x5701, 0x0100, 0x0110,
|
||||
"In-System",
|
||||
"USB Storage Adapter V2",
|
||||
US_SC_ISD200, US_PR_BULK, isd200_Initialization,
|
||||
USB_SC_ISD200, USB_PR_BULK, isd200_Initialization,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
|
||||
"ATI",
|
||||
"USB Cable 205",
|
||||
US_SC_ISD200, US_PR_BULK, isd200_Initialization,
|
||||
USB_SC_ISD200, USB_PR_BULK, isd200_Initialization,
|
||||
0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_ISD200) || ... */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
UNUSUAL_DEV( 0x05dc, 0x0001, 0x0000, 0x0001,
|
||||
"Lexar",
|
||||
"Jumpshot USB CF Reader",
|
||||
US_SC_SCSI, US_PR_JUMPSHOT, NULL,
|
||||
USB_SC_SCSI, USB_PR_JUMPSHOT, NULL,
|
||||
US_FL_NEED_OVERRIDE),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_JUMPSHOT) || ... */
|
||||
|
|
|
@ -21,6 +21,6 @@
|
|||
UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101,
|
||||
"Rio",
|
||||
"Rio Karma",
|
||||
US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0),
|
||||
USB_SC_SCSI, USB_PR_KARMA, rio_karma_init, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_KARMA) || ... */
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999,
|
||||
"Maxtor",
|
||||
"OneTouch External Harddrive",
|
||||
US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, onetouch_connect_input,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999,
|
||||
"Maxtor",
|
||||
"OneTouch External Harddrive",
|
||||
US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input,
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, onetouch_connect_input,
|
||||
0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_ONETOUCH) || ... */
|
||||
|
|
41
vmkdrivers/src_92/drivers/usb/storage/unusual_realtek.h
Normal file
41
vmkdrivers/src_92/drivers/usb/storage/unusual_realtek.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* Driver for Realtek RTS51xx USB card reader
|
||||
*
|
||||
* Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that 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/>.
|
||||
*
|
||||
* Author:
|
||||
* wwang (wei_wang@realsil.com.cn)
|
||||
* No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_USB_STORAGE_REALTEK) || \
|
||||
defined(CONFIG_USB_STORAGE_REALTEK_MODULE)
|
||||
|
||||
UNUSUAL_DEV(0x0bda, 0x0138, 0x0000, 0x9999,
|
||||
"Realtek",
|
||||
"USB Card Reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
|
||||
|
||||
UNUSUAL_DEV(0x0bda, 0x0158, 0x0000, 0x9999,
|
||||
"Realtek",
|
||||
"USB Card Reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
|
||||
|
||||
UNUSUAL_DEV(0x0bda, 0x0159, 0x0000, 0x9999,
|
||||
"Realtek",
|
||||
"USB Card Reader",
|
||||
USB_SC_DEVICE, USB_PR_DEVICE, init_realtek_cr, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_REALTEK) || ... */
|
|
@ -21,36 +21,36 @@
|
|||
UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100,
|
||||
"Microtech",
|
||||
"CameraMate (DPCM_USB)",
|
||||
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0),
|
||||
USB_SC_SCSI, USB_PR_DPCM_USB, NULL, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x04e6, 0x0003, 0x0000, 0x9999,
|
||||
"Sandisk",
|
||||
"ImageMate SDDR09",
|
||||
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
|
||||
USB_SC_SCSI, USB_PR_EUSB_SDDR09, usb_stor_sddr09_init,
|
||||
0),
|
||||
|
||||
/* This entry is from Andries.Brouwer@cwi.nl */
|
||||
UNUSUAL_DEV( 0x04e6, 0x0005, 0x0100, 0x0208,
|
||||
"SCM Microsystems",
|
||||
"eUSB SmartMedia / CompactFlash Adapter",
|
||||
US_SC_SCSI, US_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
|
||||
USB_SC_SCSI, USB_PR_DPCM_USB, usb_stor_sddr09_dpcm_init,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x066b, 0x0105, 0x0100, 0x0100,
|
||||
"Olympus",
|
||||
"Camedia MAUSB-2",
|
||||
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
|
||||
USB_SC_SCSI, USB_PR_EUSB_SDDR09, usb_stor_sddr09_init,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x0781, 0x0200, 0x0000, 0x9999,
|
||||
"Sandisk",
|
||||
"ImageMate SDDR-09",
|
||||
US_SC_SCSI, US_PR_EUSB_SDDR09, usb_stor_sddr09_init,
|
||||
USB_SC_SCSI, USB_PR_EUSB_SDDR09, usb_stor_sddr09_init,
|
||||
0),
|
||||
|
||||
UNUSUAL_DEV( 0x07af, 0x0006, 0x0100, 0x0100,
|
||||
"Microtech",
|
||||
"CameraMate (DPCM_USB)",
|
||||
US_SC_SCSI, US_PR_DPCM_USB, NULL, 0),
|
||||
USB_SC_SCSI, USB_PR_DPCM_USB, NULL, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_SDDR09) || ... */
|
||||
|
|
|
@ -22,23 +22,23 @@
|
|||
UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
|
||||
"Datafab",
|
||||
"MDSM-B reader",
|
||||
US_SC_SCSI, US_PR_SDDR55, NULL,
|
||||
USB_SC_SCSI, USB_PR_SDDR55, NULL,
|
||||
US_FL_FIX_INQUIRY),
|
||||
|
||||
/* SM part - aeb <Andries.Brouwer@cwi.nl> */
|
||||
UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
|
||||
"Datafab Systems, Inc.",
|
||||
"USB to CF + SM Combo (LC1)",
|
||||
US_SC_SCSI, US_PR_SDDR55, NULL, 0),
|
||||
USB_SC_SCSI, USB_PR_SDDR55, NULL, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
|
||||
"Acomdata",
|
||||
"SM",
|
||||
US_SC_SCSI, US_PR_SDDR55, NULL, 0),
|
||||
USB_SC_SCSI, USB_PR_SDDR55, NULL, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
|
||||
"Sandisk",
|
||||
"ImageMate SDDR55",
|
||||
US_SC_SCSI, US_PR_SDDR55, NULL, 0),
|
||||
USB_SC_SCSI, USB_PR_SDDR55, NULL, 0),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_SDDR55) || ... */
|
||||
|
|
|
@ -21,23 +21,23 @@
|
|||
UNUSUAL_DEV( 0x03f0, 0x0207, 0x0001, 0x0001,
|
||||
"HP",
|
||||
"CD-Writer+ 8200e",
|
||||
US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
|
||||
USB_SC_8070, USB_PR_USBAT, init_usbat_cd, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x03f0, 0x0307, 0x0001, 0x0001,
|
||||
"HP",
|
||||
"CD-Writer+ CD-4e",
|
||||
US_SC_8070, US_PR_USBAT, init_usbat_cd, 0),
|
||||
USB_SC_8070, USB_PR_USBAT, init_usbat_cd, 0),
|
||||
|
||||
UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999,
|
||||
"Shuttle/SCM",
|
||||
"USBAT-02",
|
||||
US_SC_SCSI, US_PR_USBAT, init_usbat_flash,
|
||||
USB_SC_SCSI, USB_PR_USBAT, init_usbat_flash,
|
||||
US_FL_SINGLE_LUN),
|
||||
|
||||
UNUSUAL_DEV( 0x0781, 0x0005, 0x0005, 0x0005,
|
||||
"Sandisk",
|
||||
"ImageMate SDDR-05b",
|
||||
US_SC_SCSI, US_PR_USBAT, init_usbat_flash,
|
||||
USB_SC_SCSI, USB_PR_USBAT, init_usbat_flash,
|
||||
US_FL_SINGLE_LUN),
|
||||
|
||||
#endif /* defined(CONFIG_USB_STORAGE_USBAT) || ... */
|
||||
|
|
|
@ -143,6 +143,9 @@ static struct us_unusual_dev us_unusual_dev_list[] = {
|
|||
{ } /* Terminating entry */
|
||||
};
|
||||
|
||||
static struct us_unusual_dev for_dynamic_ids =
|
||||
USUAL_DEV(USB_SC_SCSI, USB_PR_BULK, 0);
|
||||
|
||||
#undef UNUSUAL_DEV
|
||||
#undef COMPLIANT_DEV
|
||||
#undef USUAL_DEV
|
||||
|
@ -259,6 +262,36 @@ static void cached_names_remove(struct us_data *us)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
|
||||
static struct lock_class_key us_interface_key[USB_MAXINTERFACES];
|
||||
|
||||
static void us_set_lock_class(struct mutex *mutex,
|
||||
struct usb_interface *intf)
|
||||
{
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
struct usb_host_config *config = udev->actconfig;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < config->desc.bNumInterfaces; i++) {
|
||||
if (config->interface[i] == intf)
|
||||
break;
|
||||
}
|
||||
|
||||
BUG_ON(i == config->desc.bNumInterfaces);
|
||||
|
||||
lockdep_set_class(mutex, &us_interface_key[i]);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void us_set_lock_class(struct mutex *mutex,
|
||||
struct usb_interface *intf)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CONFIG_PM /* Minimal support for suspend and resume */
|
||||
|
||||
|
@ -528,6 +561,7 @@ static int usb_stor_control_thread(void * __us)
|
|||
else {
|
||||
US_DEBUG(usb_stor_show_command(us->srb));
|
||||
us->proto_handler(us->srb, us);
|
||||
usb_mark_last_busy(us->pusb_dev);
|
||||
}
|
||||
|
||||
/* lock access to the state */
|
||||
|
@ -613,15 +647,14 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
|
|||
/* Store our private data in the interface */
|
||||
usb_set_intfdata(intf, us);
|
||||
|
||||
/* Allocate the device-related DMA-mapped buffers */
|
||||
us->cr = usb_buffer_alloc(us->pusb_dev, sizeof(*us->cr),
|
||||
GFP_KERNEL, &us->cr_dma);
|
||||
/* Allocate the control/setup and DMA-mapped buffers */
|
||||
us->cr = kmalloc(sizeof(*us->cr), GFP_KERNEL);
|
||||
if (!us->cr) {
|
||||
US_DEBUGP("usb_ctrlrequest allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
us->iobuf = usb_buffer_alloc(us->pusb_dev, US_IOBUF_SIZE,
|
||||
us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE,
|
||||
GFP_KERNEL, &us->iobuf_dma);
|
||||
if (!us->iobuf) {
|
||||
US_DEBUGP("I/O buffer allocation failed\n");
|
||||
|
@ -629,7 +662,7 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf)
|
|||
}
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
us->sensebuf = usb_buffer_alloc(us->pusb_dev, US_SENSE_SIZE,
|
||||
us->sensebuf = usb_alloc_coherent(us->pusb_dev, US_SENSE_SIZE,
|
||||
GFP_KERNEL, &us->sensebuf_dma);
|
||||
if (!us->sensebuf) {
|
||||
US_DEBUGP("Sense buffer allocation failed\n");
|
||||
|
@ -654,7 +687,9 @@ static void adjust_quirks(struct us_data *us)
|
|||
US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE |
|
||||
US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 |
|
||||
US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE |
|
||||
US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT);
|
||||
US_FL_SINGLE_LUN | US_FL_NO_WP_DETECT |
|
||||
US_FL_NO_READ_DISC_INFO | US_FL_NO_READ_CAPACITY_16 |
|
||||
US_FL_INITIAL_READ10);
|
||||
|
||||
p = quirks;
|
||||
while (*p) {
|
||||
|
@ -686,6 +721,12 @@ static void adjust_quirks(struct us_data *us)
|
|||
case 'c':
|
||||
f |= US_FL_FIX_CAPACITY;
|
||||
break;
|
||||
case 'd':
|
||||
f |= US_FL_NO_READ_DISC_INFO;
|
||||
break;
|
||||
case 'e':
|
||||
f |= US_FL_NO_READ_CAPACITY_16;
|
||||
break;
|
||||
case 'h':
|
||||
f |= US_FL_CAPACITY_HEURISTICS;
|
||||
break;
|
||||
|
@ -698,6 +739,9 @@ static void adjust_quirks(struct us_data *us)
|
|||
case 'm':
|
||||
f |= US_FL_MAX_SECTORS_64;
|
||||
break;
|
||||
case 'n':
|
||||
f |= US_FL_INITIAL_READ10;
|
||||
break;
|
||||
case 'o':
|
||||
f |= US_FL_CAPACITY_OK;
|
||||
break;
|
||||
|
@ -714,9 +758,6 @@ static void adjust_quirks(struct us_data *us)
|
|||
}
|
||||
}
|
||||
us->fflags = (us->fflags & ~mask) | f;
|
||||
dev_info(&us->pusb_intf->dev, "Quirks match for "
|
||||
"vid %04x pid %04x: %x\n",
|
||||
vid, pid, f);
|
||||
}
|
||||
|
||||
/* Get the unusual_devs entries and the string descriptors */
|
||||
|
@ -726,20 +767,21 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
|
|||
struct usb_device *dev = us->pusb_dev;
|
||||
struct usb_interface_descriptor *idesc =
|
||||
&us->pusb_intf->cur_altsetting->desc;
|
||||
struct device *pdev = &us->pusb_intf->dev;
|
||||
|
||||
/* Store the entries */
|
||||
us->unusual_dev = unusual_dev;
|
||||
us->subclass = (unusual_dev->useProtocol == US_SC_DEVICE) ?
|
||||
us->subclass = (unusual_dev->useProtocol == USB_SC_DEVICE) ?
|
||||
idesc->bInterfaceSubClass :
|
||||
unusual_dev->useProtocol;
|
||||
us->protocol = (unusual_dev->useTransport == US_PR_DEVICE) ?
|
||||
us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ?
|
||||
idesc->bInterfaceProtocol :
|
||||
unusual_dev->useTransport;
|
||||
us->fflags = USB_US_ORIG_FLAGS(id->driver_info);
|
||||
adjust_quirks(us);
|
||||
|
||||
if (us->fflags & US_FL_IGNORE_DEVICE) {
|
||||
printk(KERN_INFO USB_STORAGE "device ignored\n");
|
||||
dev_info(pdev, "device ignored\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -750,6 +792,12 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
|
|||
if (dev->speed != USB_SPEED_HIGH)
|
||||
us->fflags &= ~US_FL_GO_SLOW;
|
||||
|
||||
if (us->fflags)
|
||||
dev_info(pdev, "Quirks match for vid %04x pid %04x: %lx\n",
|
||||
le16_to_cpu(dev->descriptor.idVendor),
|
||||
le16_to_cpu(dev->descriptor.idProduct),
|
||||
us->fflags);
|
||||
|
||||
/* Log a message if a non-generic unusual_dev entry contains an
|
||||
* unnecessary subclass or protocol override. This may stimulate
|
||||
* reports from users that will help us remove unneeded entries
|
||||
|
@ -763,26 +811,26 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
|
|||
struct usb_device_descriptor *ddesc = &dev->descriptor;
|
||||
int msg = -1;
|
||||
|
||||
if (unusual_dev->useProtocol != US_SC_DEVICE &&
|
||||
if (unusual_dev->useProtocol != USB_SC_DEVICE &&
|
||||
us->subclass == idesc->bInterfaceSubClass)
|
||||
msg += 1;
|
||||
if (unusual_dev->useTransport != US_PR_DEVICE &&
|
||||
if (unusual_dev->useTransport != USB_PR_DEVICE &&
|
||||
us->protocol == idesc->bInterfaceProtocol)
|
||||
msg += 2;
|
||||
if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE))
|
||||
printk(KERN_NOTICE USB_STORAGE "This device "
|
||||
"(%04x,%04x,%04x S %02x P %02x)"
|
||||
" has %s in unusual_devs.h (kernel"
|
||||
" %s)\n"
|
||||
" Please send a copy of this message to "
|
||||
"<linux-usb@vger.kernel.org> and "
|
||||
"<usb-storage@lists.one-eyed-alien.net>\n",
|
||||
le16_to_cpu(ddesc->idVendor),
|
||||
le16_to_cpu(ddesc->idProduct),
|
||||
le16_to_cpu(ddesc->bcdDevice),
|
||||
idesc->bInterfaceSubClass,
|
||||
idesc->bInterfaceProtocol,
|
||||
msgs[msg],
|
||||
dev_notice(pdev, "This device "
|
||||
"(%04x,%04x,%04x S %02x P %02x)"
|
||||
" has %s in unusual_devs.h (kernel"
|
||||
" %s)\n"
|
||||
" Please send a copy of this message to "
|
||||
"<linux-usb@vger.kernel.org> and "
|
||||
"<usb-storage@lists.one-eyed-alien.net>\n",
|
||||
le16_to_cpu(ddesc->idVendor),
|
||||
le16_to_cpu(ddesc->idProduct),
|
||||
le16_to_cpu(ddesc->bcdDevice),
|
||||
idesc->bInterfaceSubClass,
|
||||
idesc->bInterfaceProtocol,
|
||||
msgs[msg],
|
||||
#if defined(__VMKLNX__)
|
||||
"vmklinux");
|
||||
#else
|
||||
|
@ -797,21 +845,21 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
|
|||
static void get_transport(struct us_data *us)
|
||||
{
|
||||
switch (us->protocol) {
|
||||
case US_PR_CB:
|
||||
case USB_PR_CB:
|
||||
us->transport_name = "Control/Bulk";
|
||||
us->transport = usb_stor_CB_transport;
|
||||
us->transport_reset = usb_stor_CB_reset;
|
||||
us->max_lun = 7;
|
||||
break;
|
||||
|
||||
case US_PR_CBI:
|
||||
case USB_PR_CBI:
|
||||
us->transport_name = "Control/Bulk/Interrupt";
|
||||
us->transport = usb_stor_CB_transport;
|
||||
us->transport_reset = usb_stor_CB_reset;
|
||||
us->max_lun = 7;
|
||||
break;
|
||||
|
||||
case US_PR_BULK:
|
||||
case USB_PR_BULK:
|
||||
us->transport_name = "Bulk";
|
||||
us->transport = usb_stor_Bulk_transport;
|
||||
us->transport_reset = usb_stor_Bulk_reset;
|
||||
|
@ -823,35 +871,35 @@ static void get_transport(struct us_data *us)
|
|||
static void get_protocol(struct us_data *us)
|
||||
{
|
||||
switch (us->subclass) {
|
||||
case US_SC_RBC:
|
||||
case USB_SC_RBC:
|
||||
us->protocol_name = "Reduced Block Commands (RBC)";
|
||||
us->proto_handler = usb_stor_transparent_scsi_command;
|
||||
break;
|
||||
|
||||
case US_SC_8020:
|
||||
case USB_SC_8020:
|
||||
us->protocol_name = "8020i";
|
||||
us->proto_handler = usb_stor_pad12_command;
|
||||
us->max_lun = 0;
|
||||
break;
|
||||
|
||||
case US_SC_QIC:
|
||||
case USB_SC_QIC:
|
||||
us->protocol_name = "QIC-157";
|
||||
us->proto_handler = usb_stor_pad12_command;
|
||||
us->max_lun = 0;
|
||||
break;
|
||||
|
||||
case US_SC_8070:
|
||||
case USB_SC_8070:
|
||||
us->protocol_name = "8070i";
|
||||
us->proto_handler = usb_stor_pad12_command;
|
||||
us->max_lun = 0;
|
||||
break;
|
||||
|
||||
case US_SC_SCSI:
|
||||
case USB_SC_SCSI:
|
||||
us->protocol_name = "Transparent SCSI";
|
||||
us->proto_handler = usb_stor_transparent_scsi_command;
|
||||
break;
|
||||
|
||||
case US_SC_UFI:
|
||||
case USB_SC_UFI:
|
||||
us->protocol_name = "Uniform Floppy Interface (UFI)";
|
||||
us->proto_handler = usb_stor_ufi_command;
|
||||
break;
|
||||
|
@ -894,13 +942,13 @@ static int get_pipes(struct us_data *us)
|
|||
}
|
||||
}
|
||||
|
||||
if (!ep_in || !ep_out || (us->protocol == US_PR_CBI && !ep_int)) {
|
||||
if (!ep_in || !ep_out || (us->protocol == USB_PR_CBI && !ep_int)) {
|
||||
US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
if (us->protocol == US_PR_CBI || us->protocol == US_PR_CB) {
|
||||
if (us->protocol == USB_PR_CBI || us->protocol == USB_PR_CB) {
|
||||
printk(KERN_WARNING USB_STORAGE
|
||||
"Unsupported USB floppy (CBI or CB) device! Rejecting device.\n");
|
||||
return -EIO;
|
||||
|
@ -945,8 +993,8 @@ static int usb_stor_acquire_resources(struct us_data *us)
|
|||
/* Start up our control thread */
|
||||
th = kthread_run(usb_stor_control_thread, us, "usb-storage");
|
||||
if (IS_ERR(th)) {
|
||||
printk(KERN_WARNING USB_STORAGE
|
||||
"Unable to start control thread\n");
|
||||
dev_warn(&us->pusb_intf->dev,
|
||||
"Unable to start control thread\n");
|
||||
return PTR_ERR(th);
|
||||
}
|
||||
us->ctl_thread = th;
|
||||
|
@ -989,13 +1037,9 @@ static void dissociate_dev(struct us_data *us)
|
|||
us->sensebuf_dma);
|
||||
#endif
|
||||
|
||||
/* Free the device-related DMA-mapped buffers */
|
||||
if (us->cr)
|
||||
usb_buffer_free(us->pusb_dev, sizeof(*us->cr), us->cr,
|
||||
us->cr_dma);
|
||||
if (us->iobuf)
|
||||
usb_buffer_free(us->pusb_dev, US_IOBUF_SIZE, us->iobuf,
|
||||
us->iobuf_dma);
|
||||
/* Free the buffers */
|
||||
kfree(us->cr);
|
||||
usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma);
|
||||
|
||||
/* Remove our private data from the interface */
|
||||
usb_set_intfdata(us->pusb_intf, NULL);
|
||||
|
@ -1009,15 +1053,19 @@ static void quiesce_and_remove_host(struct us_data *us)
|
|||
struct Scsi_Host *host = us_to_host(us);
|
||||
|
||||
/* If the device is really gone, cut short reset delays */
|
||||
if (us->pusb_dev->state == USB_STATE_NOTATTACHED)
|
||||
if (us->pusb_dev->state == USB_STATE_NOTATTACHED) {
|
||||
set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
|
||||
wake_up(&us->delay_wait);
|
||||
}
|
||||
|
||||
/* Prevent SCSI-scanning (if it hasn't started yet)
|
||||
* and wait for the SCSI-scanning thread to stop.
|
||||
/* Prevent SCSI scanning (if it hasn't started yet)
|
||||
* or wait for the SCSI-scanning routine to stop.
|
||||
*/
|
||||
set_bit(US_FLIDX_DONT_SCAN, &us->dflags);
|
||||
wake_up(&us->delay_wait);
|
||||
wait_for_completion(&us->scanning_done);
|
||||
cancel_delayed_work_sync(&us->scan_dwork);
|
||||
|
||||
/* Balance autopm calls if scanning was cancelled */
|
||||
if (test_bit(US_FLIDX_SCAN_PENDING, &us->dflags))
|
||||
usb_autopm_put_interface_no_suspend(us->pusb_intf);
|
||||
|
||||
/* Removing the host will perform an orderly shutdown: caches
|
||||
* synchronized, disks spun down, etc.
|
||||
|
@ -1051,33 +1099,14 @@ static void release_everything(struct us_data *us)
|
|||
scsi_host_put(us_to_host(us));
|
||||
}
|
||||
|
||||
/* Thread to carry out delayed SCSI-device scanning */
|
||||
static int usb_stor_scan_thread(void * __us)
|
||||
/* Delayed-work routine to carry out SCSI-device scanning */
|
||||
static void usb_stor_scan_dwork(struct work_struct *work)
|
||||
{
|
||||
struct us_data *us = (struct us_data *)__us;
|
||||
struct us_data *us = container_of(work, struct us_data,
|
||||
scan_dwork.work);
|
||||
struct device *dev = &us->pusb_intf->dev;
|
||||
|
||||
dev_dbg(&us->pusb_intf->dev, "device found\n");
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
set_freezable();
|
||||
#endif
|
||||
/* Wait for the timeout to expire or for a disconnect */
|
||||
if (delay_use > 0) {
|
||||
dev_dbg(&us->pusb_intf->dev, "waiting for device to settle "
|
||||
"before scanning\n");
|
||||
#if defined(__VMKLNX__)
|
||||
wait_event_interruptible_timeout(us->delay_wait,
|
||||
test_bit(US_FLIDX_DISCONNECTING, &us->dflags),
|
||||
delay_use * HZ);
|
||||
#else
|
||||
wait_event_freezable_timeout(us->delay_wait,
|
||||
test_bit(US_FLIDX_DONT_SCAN, &us->dflags),
|
||||
delay_use * HZ);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* If the device is still connected, perform the scanning */
|
||||
if (!test_bit(US_FLIDX_DONT_SCAN, &us->dflags)) {
|
||||
dev_dbg(dev, "starting scan\n");
|
||||
|
||||
#if !defined(__VMKLNX__) /* done in probe2 */
|
||||
/* For bulk-only devices, determine the max LUN value */
|
||||
|
@ -1088,16 +1117,13 @@ static int usb_stor_scan_thread(void * __us)
|
|||
mutex_unlock(&us->dev_mutex);
|
||||
}
|
||||
#endif
|
||||
scsi_scan_host(us_to_host(us));
|
||||
dev_dbg(&us->pusb_intf->dev, "scan complete\n");
|
||||
scsi_scan_host(us_to_host(us));
|
||||
dev_dbg(dev, "scan complete\n");
|
||||
|
||||
/* Should we unbind if no devices were detected? */
|
||||
}
|
||||
/* Should we unbind if no devices were detected? */
|
||||
|
||||
complete_and_exit(&us->scanning_done, 0);
|
||||
#if defined(__VMKLNX__)
|
||||
return 0;
|
||||
#endif
|
||||
usb_autopm_put_interface(us->pusb_intf);
|
||||
clear_bit(US_FLIDX_SCAN_PENDING, &us->dflags);
|
||||
}
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
|
@ -1158,8 +1184,8 @@ int usb_stor_probe1(struct us_data **pus,
|
|||
*/
|
||||
host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us));
|
||||
if (!host) {
|
||||
printk(KERN_WARNING USB_STORAGE
|
||||
"Unable to allocate the scsi host\n");
|
||||
dev_warn(&intf->dev,
|
||||
"Unable to allocate the scsi host\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1174,10 +1200,11 @@ int usb_stor_probe1(struct us_data **pus,
|
|||
us->devtype = 0xff; /* uninitialized */
|
||||
#endif
|
||||
mutex_init(&(us->dev_mutex));
|
||||
us_set_lock_class(&us->dev_mutex, intf);
|
||||
init_completion(&us->cmnd_ready);
|
||||
init_completion(&(us->notify));
|
||||
init_waitqueue_head(&us->delay_wait);
|
||||
init_completion(&us->scanning_done);
|
||||
INIT_DELAYED_WORK(&us->scan_dwork, usb_stor_scan_dwork);
|
||||
#if defined(__VMKLNX__)
|
||||
INIT_WORK(&us->unclaim_work, storage_unclaim);
|
||||
#endif
|
||||
|
@ -1217,8 +1244,8 @@ EXPORT_SYMBOL_GPL(usb_stor_probe1);
|
|||
/* Second part of general USB mass-storage probing */
|
||||
int usb_stor_probe2(struct us_data *us)
|
||||
{
|
||||
struct task_struct *th;
|
||||
int result;
|
||||
struct device *dev = &us->pusb_intf->dev;
|
||||
|
||||
/* Make sure the transport and protocol have both been set */
|
||||
if (!us->transport || !us->proto_handler) {
|
||||
|
@ -1237,6 +1264,13 @@ int usb_stor_probe2(struct us_data *us)
|
|||
if (result)
|
||||
goto BadDevice;
|
||||
|
||||
/*
|
||||
* If the device returns invalid data for the first READ(10)
|
||||
* command, indicate the command should be retried.
|
||||
*/
|
||||
if (us->fflags & US_FL_INITIAL_READ10)
|
||||
set_bit(US_FLIDX_REDO_READ10, &us->dflags);
|
||||
|
||||
/* Acquire all the other resources and add the host */
|
||||
result = usb_stor_acquire_resources(us);
|
||||
if (result)
|
||||
|
@ -1260,7 +1294,7 @@ int usb_stor_probe2(struct us_data *us)
|
|||
host->max_sectors = 64;
|
||||
|
||||
/* For bulk-only devices, determine the max LUN value */
|
||||
if (us->protocol == US_PR_BULK &&
|
||||
if (us->protocol == USB_PR_BULK &&
|
||||
!(us->fflags & US_FL_SINGLE_LUN)) {
|
||||
us->max_lun = usb_stor_Bulk_max_lun(us);
|
||||
}
|
||||
|
@ -1271,26 +1305,28 @@ int usb_stor_probe2(struct us_data *us)
|
|||
#endif
|
||||
snprintf(us->scsi_name, sizeof(us->scsi_name), "usb-storage %s",
|
||||
dev_name(&us->pusb_intf->dev));
|
||||
result = scsi_add_host(us_to_host(us), &us->pusb_intf->dev);
|
||||
result = scsi_add_host(us_to_host(us), dev);
|
||||
if (result) {
|
||||
printk(KERN_WARNING USB_STORAGE
|
||||
"Unable to add the scsi host\n");
|
||||
dev_warn(dev,
|
||||
"Unable to add the scsi host\n");
|
||||
goto BadDevice;
|
||||
}
|
||||
|
||||
/* Start up the thread for delayed SCSI-device scanning */
|
||||
th = kthread_create(usb_stor_scan_thread, us, "usb-stor-scan");
|
||||
if (IS_ERR(th)) {
|
||||
printk(KERN_WARNING USB_STORAGE
|
||||
"Unable to start the device-scanning thread\n");
|
||||
complete(&us->scanning_done);
|
||||
quiesce_and_remove_host(us);
|
||||
result = PTR_ERR(th);
|
||||
goto BadDevice;
|
||||
}
|
||||
/* Submit the delayed_work for SCSI-device scanning */
|
||||
usb_autopm_get_interface_no_resume(us->pusb_intf);
|
||||
set_bit(US_FLIDX_SCAN_PENDING, &us->dflags);
|
||||
|
||||
wake_up_process(th);
|
||||
if (delay_use > 0)
|
||||
dev_dbg(dev, "waiting for device to settle before scanning\n");
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
/* Original VMKLNX code did not schedule anywork as freezable */
|
||||
|
||||
schedule_delayed_work(&us->scan_dwork, delay_use * HZ);
|
||||
#else
|
||||
queue_delayed_work(system_freezable_wq, &us->scan_dwork,
|
||||
delay_use * HZ);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
/* We come here if there are any problems */
|
||||
|
@ -1316,8 +1352,10 @@ EXPORT_SYMBOL_GPL(usb_stor_disconnect);
|
|||
static int storage_probe(struct usb_interface *intf,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct us_unusual_dev *unusual_dev;
|
||||
struct us_data *us;
|
||||
int result;
|
||||
int size;
|
||||
|
||||
/*
|
||||
* If libusual is configured, let it decide whether a standard
|
||||
|
@ -1336,8 +1374,19 @@ static int storage_probe(struct usb_interface *intf,
|
|||
* table, so we use the index of the id entry to find the
|
||||
* corresponding unusual_devs entry.
|
||||
*/
|
||||
result = usb_stor_probe1(&us, intf, id,
|
||||
(id - usb_storage_usb_ids) + us_unusual_dev_list);
|
||||
|
||||
size = ARRAY_SIZE(us_unusual_dev_list);
|
||||
if (id >= usb_storage_usb_ids && id < usb_storage_usb_ids + size) {
|
||||
unusual_dev = (id - usb_storage_usb_ids) + us_unusual_dev_list;
|
||||
} else {
|
||||
unusual_dev = &for_dynamic_ids;
|
||||
|
||||
US_DEBUGP("%s %s 0x%04x 0x%04x\n", "Use Bulk-Only transport",
|
||||
"with the Transparent SCSI protocol for dynamic id:",
|
||||
id->idVendor, id->idProduct);
|
||||
}
|
||||
|
||||
result = usb_stor_probe1(&us, intf, id, unusual_dev);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
|
@ -1410,10 +1459,11 @@ static struct usb_driver usb_storage_driver = {
|
|||
.pre_reset = usb_stor_pre_reset,
|
||||
.post_reset = usb_stor_post_reset,
|
||||
.id_table = usb_storage_usb_ids,
|
||||
.supports_autosuspend = 1,
|
||||
.soft_unbind = 1,
|
||||
#if defined(__VMKLNX__)
|
||||
.ioctl = storage_ioctl,
|
||||
.module = THIS_MODULE,
|
||||
.ioctl = storage_ioctl,
|
||||
.module = THIS_MODULE,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -1421,7 +1471,7 @@ static int __init usb_stor_init(void)
|
|||
{
|
||||
int retval;
|
||||
|
||||
printk(KERN_INFO "Initializing USB Mass Storage driver...\n");
|
||||
pr_info("Initializing USB Mass Storage driver...\n");
|
||||
#if defined(__VMKLNX__)
|
||||
cached_names_init();
|
||||
#endif
|
||||
|
@ -1429,7 +1479,7 @@ static int __init usb_stor_init(void)
|
|||
/* register the driver, return usb_register return code if error */
|
||||
retval = usb_register(&usb_storage_driver);
|
||||
if (retval == 0) {
|
||||
printk(KERN_INFO "USB Mass Storage support registered.\n");
|
||||
pr_info("USB Mass Storage support registered.\n");
|
||||
usb_usual_set_present(USB_US_TYPE_STOR);
|
||||
}
|
||||
#if defined (__VMKLNX__)
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <linux/blkdev.h>
|
||||
#include <linux/completion.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
#if defined(__VMKLNX__)
|
||||
#include "debug.h"
|
||||
|
@ -78,7 +79,9 @@ struct us_unusual_dev {
|
|||
#define US_FLIDX_DISCONNECTING 3 /* disconnect in progress */
|
||||
#define US_FLIDX_RESETTING 4 /* device reset in progress */
|
||||
#define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */
|
||||
#define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */
|
||||
#define US_FLIDX_SCAN_PENDING 6 /* scanning not yet done */
|
||||
#define US_FLIDX_REDO_READ10 7 /* redo READ(10) command */
|
||||
#define US_FLIDX_READ10_WORKED 8 /* previous READ(10) succeeded */
|
||||
|
||||
#define USB_STOR_STRING_LEN 32
|
||||
|
||||
|
@ -145,8 +148,7 @@ struct us_data {
|
|||
struct usb_ctrlrequest *cr; /* control requests */
|
||||
struct usb_sg_request current_sg; /* scatter-gather req. */
|
||||
unsigned char *iobuf; /* I/O buffer */
|
||||
dma_addr_t cr_dma; /* buffer DMA addresses */
|
||||
dma_addr_t iobuf_dma;
|
||||
dma_addr_t iobuf_dma; /* buffer DMA addresses */
|
||||
#if defined(__VMKLNX__)
|
||||
unsigned char *sensebuf; /* sense data buffer */
|
||||
dma_addr_t sensebuf_dma;
|
||||
|
@ -160,8 +162,8 @@ struct us_data {
|
|||
/* mutual exclusion and synchronization structures */
|
||||
struct completion cmnd_ready; /* to sleep thread on */
|
||||
struct completion notify; /* thread begin/end */
|
||||
wait_queue_head_t delay_wait; /* wait during scan, reset */
|
||||
struct completion scanning_done; /* wait for scan thread */
|
||||
wait_queue_head_t delay_wait; /* wait during reset */
|
||||
struct delayed_work scan_dwork; /* for async scanning */
|
||||
|
||||
/* subdriver information */
|
||||
void *extra; /* Any extra data */
|
||||
|
|
|
@ -80,11 +80,13 @@ static struct ignore_entry ignore_ids[] = {
|
|||
# include "unusual_alauda.h"
|
||||
# include "unusual_cypress.h"
|
||||
# include "unusual_datafab.h"
|
||||
# include "unusual_ene_ub6250.h"
|
||||
# include "unusual_freecom.h"
|
||||
# include "unusual_isd200.h"
|
||||
# include "unusual_jumpshot.h"
|
||||
# include "unusual_karma.h"
|
||||
# include "unusual_onetouch.h"
|
||||
# include "unusual_realtek.h"
|
||||
# include "unusual_sddr09.h"
|
||||
# include "unusual_sddr55.h"
|
||||
# include "unusual_usbat.h"
|
||||
|
|
|
@ -279,7 +279,9 @@ extern int dir_notify_enable;
|
|||
#include <linux/cache.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/list.h>
|
||||
#if !defined(__VMKLNX__)
|
||||
#include <linux/radix-tree.h>
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
#include <linux/prio_tree.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/sched.h>
|
||||
|
@ -435,7 +437,12 @@ struct address_space_operations {
|
|||
struct backing_dev_info;
|
||||
struct address_space {
|
||||
struct inode *host; /* owner: inode, block_device */
|
||||
#if !defined(__VMKLNX__)
|
||||
struct radix_tree_root page_tree; /* radix tree of all pages */
|
||||
#else
|
||||
unsigned long long unused1; /* for alignment only */
|
||||
unsigned long long unused2; /* for alignment only */
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
rwlock_t tree_lock; /* and rwlock protecting it */
|
||||
unsigned int i_mmap_writable;/* count VM_SHARED mappings */
|
||||
struct prio_tree_root i_mmap; /* tree of private and shared mappings */
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#define MPT_SAS_MINOR 222
|
||||
#define MEGASAS_MINOR 223
|
||||
#define MPT2_SAS_MINOR 224
|
||||
#define MPT3_SAS_MINOR 225
|
||||
#define MEGARAID_PERC9_MINOR 226
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
#define MISC_DYNAMIC_MINOR 255
|
||||
|
||||
|
|
|
@ -1,267 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2001 Momchil Velikov
|
||||
* Portions Copyright (C) 2001 Christoph Hellwig
|
||||
* Copyright (C) 2006 Nick Piggin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that 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, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#ifndef _LINUX_RADIX_TREE_H
|
||||
#define _LINUX_RADIX_TREE_H
|
||||
|
||||
#include <linux/preempt.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
/*
|
||||
* An indirect pointer (root->rnode pointing to a radix_tree_node, rather
|
||||
* than a data item) is signalled by the low bit set in the root->rnode
|
||||
* pointer.
|
||||
*
|
||||
* In this case root->height is > 0, but the indirect pointer tests are
|
||||
* needed for RCU lookups (because root->height is unreliable). The only
|
||||
* time callers need worry about this is when doing a lookup_slot under
|
||||
* RCU.
|
||||
*
|
||||
* Indirect pointer in fact is also used to tag the last pointer of a node
|
||||
* when it is shrunk, before we rcu free the node. See shrink code for
|
||||
* details.
|
||||
*/
|
||||
#define RADIX_TREE_INDIRECT_PTR 1
|
||||
/*
|
||||
* A common use of the radix tree is to store pointers to struct pages;
|
||||
* but shmem/tmpfs needs also to store swap entries in the same tree:
|
||||
* those are marked as exceptional entries to distinguish them.
|
||||
* EXCEPTIONAL_ENTRY tests the bit, EXCEPTIONAL_SHIFT shifts content past it.
|
||||
*/
|
||||
#define RADIX_TREE_EXCEPTIONAL_ENTRY 2
|
||||
#define RADIX_TREE_EXCEPTIONAL_SHIFT 2
|
||||
|
||||
static inline int radix_tree_is_indirect_ptr(void *ptr)
|
||||
{
|
||||
return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR);
|
||||
}
|
||||
|
||||
/*** radix-tree API starts here ***/
|
||||
|
||||
#define RADIX_TREE_MAX_TAGS 3
|
||||
|
||||
/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
|
||||
struct radix_tree_root {
|
||||
unsigned int height;
|
||||
gfp_t gfp_mask;
|
||||
struct radix_tree_node __rcu *rnode;
|
||||
};
|
||||
|
||||
#define RADIX_TREE_INIT(mask) { \
|
||||
.height = 0, \
|
||||
.gfp_mask = (mask), \
|
||||
.rnode = NULL, \
|
||||
}
|
||||
|
||||
#define RADIX_TREE(name, mask) \
|
||||
struct radix_tree_root name = RADIX_TREE_INIT(mask)
|
||||
|
||||
#define INIT_RADIX_TREE(root, mask) \
|
||||
do { \
|
||||
(root)->height = 0; \
|
||||
(root)->gfp_mask = (mask); \
|
||||
(root)->rnode = NULL; \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Radix-tree synchronization
|
||||
*
|
||||
* The radix-tree API requires that users provide all synchronisation (with
|
||||
* specific exceptions, noted below).
|
||||
*
|
||||
* Synchronization of access to the data items being stored in the tree, and
|
||||
* management of their lifetimes must be completely managed by API users.
|
||||
*
|
||||
* For API usage, in general,
|
||||
* - any function _modifying_ the tree or tags (inserting or deleting
|
||||
* items, setting or clearing tags) must exclude other modifications, and
|
||||
* exclude any functions reading the tree.
|
||||
* - any function _reading_ the tree or tags (looking up items or tags,
|
||||
* gang lookups) must exclude modifications to the tree, but may occur
|
||||
* concurrently with other readers.
|
||||
*
|
||||
* The notable exceptions to this rule are the following functions:
|
||||
* radix_tree_lookup
|
||||
* radix_tree_lookup_slot
|
||||
* radix_tree_tag_get
|
||||
* radix_tree_gang_lookup
|
||||
* radix_tree_gang_lookup_slot
|
||||
* radix_tree_gang_lookup_tag
|
||||
* radix_tree_gang_lookup_tag_slot
|
||||
* radix_tree_tagged
|
||||
*
|
||||
* The first 7 functions are able to be called locklessly, using RCU. The
|
||||
* caller must ensure calls to these functions are made within rcu_read_lock()
|
||||
* regions. Other readers (lock-free or otherwise) and modifications may be
|
||||
* running concurrently.
|
||||
*
|
||||
* It is still required that the caller manage the synchronization and lifetimes
|
||||
* of the items. So if RCU lock-free lookups are used, typically this would mean
|
||||
* that the items have their own locks, or are amenable to lock-free access; and
|
||||
* that the items are freed by RCU (or only freed after having been deleted from
|
||||
* the radix tree *and* a synchronize_rcu() grace period).
|
||||
*
|
||||
* (Note, rcu_assign_pointer and rcu_dereference are not needed to control
|
||||
* access to data items when inserting into or looking up from the radix tree)
|
||||
*
|
||||
* Note that the value returned by radix_tree_tag_get() may not be relied upon
|
||||
* if only the RCU read lock is held. Functions to set/clear tags and to
|
||||
* delete nodes running concurrently with it may affect its result such that
|
||||
* two consecutive reads in the same locked section may return different
|
||||
* values. If reliability is required, modification functions must also be
|
||||
* excluded from concurrency.
|
||||
*
|
||||
* radix_tree_tagged is able to be called without locking or RCU.
|
||||
*/
|
||||
|
||||
/**
|
||||
* radix_tree_deref_slot - dereference a slot
|
||||
* @pslot: pointer to slot, returned by radix_tree_lookup_slot
|
||||
* Returns: item that was stored in that slot with any direct pointer flag
|
||||
* removed.
|
||||
*
|
||||
* For use with radix_tree_lookup_slot(). Caller must hold tree at least read
|
||||
* locked across slot lookup and dereference. Not required if write lock is
|
||||
* held (ie. items cannot be concurrently inserted).
|
||||
*
|
||||
* radix_tree_deref_retry must be used to confirm validity of the pointer if
|
||||
* only the read lock is held.
|
||||
*/
|
||||
static inline void *radix_tree_deref_slot(void **pslot)
|
||||
{
|
||||
return rcu_dereference(*pslot);
|
||||
}
|
||||
|
||||
/**
|
||||
* radix_tree_deref_slot_protected - dereference a slot without RCU lock but with tree lock held
|
||||
* @pslot: pointer to slot, returned by radix_tree_lookup_slot
|
||||
* Returns: item that was stored in that slot with any direct pointer flag
|
||||
* removed.
|
||||
*
|
||||
* Similar to radix_tree_deref_slot but only used during migration when a pages
|
||||
* mapping is being moved. The caller does not hold the RCU read lock but it
|
||||
* must hold the tree lock to prevent parallel updates.
|
||||
*/
|
||||
static inline void *radix_tree_deref_slot_protected(void **pslot,
|
||||
spinlock_t *treelock)
|
||||
{
|
||||
return rcu_dereference_protected(*pslot, lockdep_is_held(treelock));
|
||||
}
|
||||
|
||||
/**
|
||||
* radix_tree_deref_retry - check radix_tree_deref_slot
|
||||
* @arg: pointer returned by radix_tree_deref_slot
|
||||
* Returns: 0 if retry is not required, otherwise retry is required
|
||||
*
|
||||
* radix_tree_deref_retry must be used with radix_tree_deref_slot.
|
||||
*/
|
||||
static inline int radix_tree_deref_retry(void *arg)
|
||||
{
|
||||
return unlikely((unsigned long)arg & RADIX_TREE_INDIRECT_PTR);
|
||||
}
|
||||
|
||||
/**
|
||||
* radix_tree_exceptional_entry - radix_tree_deref_slot gave exceptional entry?
|
||||
* @arg: value returned by radix_tree_deref_slot
|
||||
* Returns: 0 if well-aligned pointer, non-0 if exceptional entry.
|
||||
*/
|
||||
static inline int radix_tree_exceptional_entry(void *arg)
|
||||
{
|
||||
/* Not unlikely because radix_tree_exception often tested first */
|
||||
return (unsigned long)arg & RADIX_TREE_EXCEPTIONAL_ENTRY;
|
||||
}
|
||||
|
||||
/**
|
||||
* radix_tree_exception - radix_tree_deref_slot returned either exception?
|
||||
* @arg: value returned by radix_tree_deref_slot
|
||||
* Returns: 0 if well-aligned pointer, non-0 if either kind of exception.
|
||||
*/
|
||||
static inline int radix_tree_exception(void *arg)
|
||||
{
|
||||
return unlikely((unsigned long)arg &
|
||||
(RADIX_TREE_INDIRECT_PTR | RADIX_TREE_EXCEPTIONAL_ENTRY));
|
||||
}
|
||||
|
||||
/**
|
||||
* radix_tree_replace_slot - replace item in a slot
|
||||
* @pslot: pointer to slot, returned by radix_tree_lookup_slot
|
||||
* @item: new item to store in the slot.
|
||||
*
|
||||
* For use with radix_tree_lookup_slot(). Caller must hold tree write locked
|
||||
* across slot lookup and replacement.
|
||||
*/
|
||||
static inline void radix_tree_replace_slot(void **pslot, void *item)
|
||||
{
|
||||
BUG_ON(radix_tree_is_indirect_ptr(item));
|
||||
rcu_assign_pointer(*pslot, item);
|
||||
}
|
||||
|
||||
int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
|
||||
void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
|
||||
void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
|
||||
void *radix_tree_delete(struct radix_tree_root *, unsigned long);
|
||||
unsigned int
|
||||
radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
|
||||
unsigned long first_index, unsigned int max_items);
|
||||
unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root,
|
||||
void ***results, unsigned long *indices,
|
||||
unsigned long first_index, unsigned int max_items);
|
||||
unsigned long radix_tree_next_hole(struct radix_tree_root *root,
|
||||
unsigned long index, unsigned long max_scan);
|
||||
unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
|
||||
unsigned long index, unsigned long max_scan);
|
||||
#if !defined(__VMKLNX__)
|
||||
int radix_tree_preload(gfp_t gfp_mask);
|
||||
#endif
|
||||
void radix_tree_init(void);
|
||||
void *radix_tree_tag_set(struct radix_tree_root *root,
|
||||
unsigned long index, unsigned int tag);
|
||||
void *radix_tree_tag_clear(struct radix_tree_root *root,
|
||||
unsigned long index, unsigned int tag);
|
||||
int radix_tree_tag_get(struct radix_tree_root *root,
|
||||
unsigned long index, unsigned int tag);
|
||||
unsigned int
|
||||
radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
|
||||
unsigned long first_index, unsigned int max_items,
|
||||
unsigned int tag);
|
||||
unsigned int
|
||||
radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
|
||||
unsigned long first_index, unsigned int max_items,
|
||||
unsigned int tag);
|
||||
unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
|
||||
unsigned long *first_indexp, unsigned long last_index,
|
||||
unsigned long nr_to_tag,
|
||||
unsigned int fromtag, unsigned int totag);
|
||||
int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
|
||||
unsigned long radix_tree_locate_item(struct radix_tree_root *root, void *item);
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
static inline void radix_tree_preload_end(void)
|
||||
{
|
||||
preempt_enable();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
void radix_tree_init_maxindex(void);
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_RADIX_TREE_H */
|
86
vmkdrivers/src_92/include/linux/usb/storage.h
Normal file
86
vmkdrivers/src_92/include/linux/usb/storage.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
#ifndef __LINUX_USB_STORAGE_H
|
||||
#define __LINUX_USB_STORAGE_H
|
||||
|
||||
/*
|
||||
* linux/usb/storage.h
|
||||
*
|
||||
* Copyright Matthew Wilcox for Intel Corp, 2010
|
||||
*
|
||||
* This file contains definitions taken from the
|
||||
* USB Mass Storage Class Specification Overview
|
||||
*
|
||||
* Distributed under the terms of the GNU GPL, version two.
|
||||
*/
|
||||
|
||||
/* Storage subclass codes */
|
||||
|
||||
#define USB_SC_RBC 0x01 /* Typically, flash devices */
|
||||
#define USB_SC_8020 0x02 /* CD-ROM */
|
||||
#define USB_SC_QIC 0x03 /* QIC-157 Tapes */
|
||||
#define USB_SC_UFI 0x04 /* Floppy */
|
||||
#define USB_SC_8070 0x05 /* Removable media */
|
||||
#define USB_SC_SCSI 0x06 /* Transparent */
|
||||
#define USB_SC_LOCKABLE 0x07 /* Password-protected */
|
||||
|
||||
#define USB_SC_ISD200 0xf0 /* ISD200 ATA */
|
||||
#define USB_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
|
||||
#define USB_SC_DEVICE 0xff /* Use device's value */
|
||||
|
||||
/* Storage protocol codes */
|
||||
|
||||
#define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */
|
||||
#define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */
|
||||
#define USB_PR_BULK 0x50 /* bulk only */
|
||||
#define USB_PR_UAS 0x62 /* USB Attached SCSI */
|
||||
|
||||
#define USB_PR_USBAT 0x80 /* SCM-ATAPI bridge */
|
||||
#define USB_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
|
||||
#define USB_PR_SDDR55 0x82 /* SDDR-55 (made up) */
|
||||
#define USB_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
|
||||
#define USB_PR_FREECOM 0xf1 /* Freecom */
|
||||
#define USB_PR_DATAFAB 0xf2 /* Datafab chipsets */
|
||||
#define USB_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
|
||||
#define USB_PR_ALAUDA 0xf4 /* Alauda chipsets */
|
||||
#define USB_PR_KARMA 0xf5 /* Rio Karma */
|
||||
|
||||
#define USB_PR_DEVICE 0xff /* Use device's value */
|
||||
|
||||
/*
|
||||
* Bulk only data structures
|
||||
*/
|
||||
|
||||
/* command block wrapper */
|
||||
struct bulk_cb_wrap {
|
||||
__le32 Signature; /* contains 'USBC' */
|
||||
__u32 Tag; /* unique per command id */
|
||||
__le32 DataTransferLength; /* size of data */
|
||||
__u8 Flags; /* direction in bit 0 */
|
||||
__u8 Lun; /* LUN normally 0 */
|
||||
__u8 Length; /* of of the CDB */
|
||||
__u8 CDB[16]; /* max command */
|
||||
};
|
||||
|
||||
#define US_BULK_CB_WRAP_LEN 31
|
||||
#define US_BULK_CB_SIGN 0x43425355 /*spells out USBC */
|
||||
#define US_BULK_FLAG_IN (1 << 7)
|
||||
#define US_BULK_FLAG_OUT 0
|
||||
|
||||
/* command status wrapper */
|
||||
struct bulk_cs_wrap {
|
||||
__le32 Signature; /* should = 'USBS' */
|
||||
__u32 Tag; /* same as original command */
|
||||
__le32 Residue; /* amount not transferred */
|
||||
__u8 Status; /* see below */
|
||||
};
|
||||
|
||||
#define US_BULK_CS_WRAP_LEN 13
|
||||
#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
|
||||
#define US_BULK_STAT_OK 0
|
||||
#define US_BULK_STAT_FAIL 1
|
||||
#define US_BULK_STAT_PHASE 2
|
||||
|
||||
/* bulk-only class specific requests */
|
||||
#define US_BULK_RESET_REQUEST 0xff
|
||||
#define US_BULK_GET_MAX_LUN 0xfe
|
||||
|
||||
#endif
|
|
@ -62,6 +62,12 @@
|
|||
/* READ CAPACITY response is correct */ \
|
||||
US_FLAG(BAD_SENSE, 0x00020000) \
|
||||
/* Bad Sense (never more than 18 bytes) */ \
|
||||
US_FLAG(NO_READ_DISC_INFO, 0x00040000) \
|
||||
/* cannot handle READ_DISC_INFO */ \
|
||||
US_FLAG(NO_READ_CAPACITY_16, 0x00080000) \
|
||||
/* cannot handle READ_CAPACITY_16 */ \
|
||||
US_FLAG(INITIAL_READ10, 0x00100000) \
|
||||
/* Initial READ(10) (and others) must be retried */ \
|
||||
US_FLAG(VMKLNX_NO_FILTERING, 0x00040000) \
|
||||
/* Don't filter SCSI commands */ \
|
||||
US_FLAG(VMKLNX_NO_UNCLAIM, 0x00080000) \
|
||||
|
@ -98,42 +104,7 @@ enum { US_DO_ALL_FLAGS };
|
|||
/* _VMKLNX_CODECHECK_: USB_US_ORIG_FLAGS */
|
||||
#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
|
||||
|
||||
/*
|
||||
* This is probably not the best place to keep these constants, conceptually.
|
||||
* But it's the only header included into all places which need them.
|
||||
*/
|
||||
|
||||
/* Sub Classes */
|
||||
|
||||
#define US_SC_RBC 0x01 /* Typically, flash devices */
|
||||
#define US_SC_8020 0x02 /* CD-ROM */
|
||||
#define US_SC_QIC 0x03 /* QIC-157 Tapes */
|
||||
#define US_SC_UFI 0x04 /* Floppy */
|
||||
#define US_SC_8070 0x05 /* Removable media */
|
||||
#define US_SC_SCSI 0x06 /* Transparent */
|
||||
#define US_SC_LOCKABLE 0x07 /* Password-protected */
|
||||
|
||||
#define US_SC_ISD200 0xf0 /* ISD200 ATA */
|
||||
#define US_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
|
||||
#define US_SC_DEVICE 0xff /* Use device's value */
|
||||
|
||||
/* Protocols */
|
||||
|
||||
#define US_PR_CBI 0x00 /* Control/Bulk/Interrupt */
|
||||
#define US_PR_CB 0x01 /* Control/Bulk w/o interrupt */
|
||||
#define US_PR_BULK 0x50 /* bulk only */
|
||||
|
||||
#define US_PR_USBAT 0x80 /* SCM-ATAPI bridge */
|
||||
#define US_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
|
||||
#define US_PR_SDDR55 0x82 /* SDDR-55 (made up) */
|
||||
#define US_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
|
||||
#define US_PR_FREECOM 0xf1 /* Freecom */
|
||||
#define US_PR_DATAFAB 0xf2 /* Datafab chipsets */
|
||||
#define US_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
|
||||
#define US_PR_ALAUDA 0xf4 /* Alauda chipsets */
|
||||
#define US_PR_KARMA 0xf5 /* Rio Karma */
|
||||
|
||||
#define US_PR_DEVICE 0xff /* Use device's value */
|
||||
#include <linux/usb/storage.h>
|
||||
|
||||
/*
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
* VMKLNX notes:
|
||||
* From Linux 2.6.34.1, git commit 3db48f5c1a68e801146ca58ff94f3898c6fbf90e.
|
||||
* "dev->power." is changed to "dev->power2->" throughout;
|
||||
* other changes are marked with __VMKLNX__.
|
||||
* other changes are marked with __VMKLNX__ or VMKAPI_MODULE_CALL().
|
||||
*/
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
|
@ -96,20 +96,23 @@ static int __pm_runtime_idle(struct device *dev)
|
|||
if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_idle) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
dev->bus->pm->runtime_idle(dev);
|
||||
VMKAPI_MODULE_CALL_VOID(dev->bus->owner->moduleID,
|
||||
dev->bus->pm->runtime_idle, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
} else if (dev->type && dev->type->pm && dev->type->pm->runtime_idle) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
dev->type->pm->runtime_idle(dev);
|
||||
VMKAPI_MODULE_CALL_VOID(dev->driver->owner->moduleID,
|
||||
dev->type->pm->runtime_idle, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
} else if (dev->class && dev->class->pm
|
||||
&& dev->class->pm->runtime_idle) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
dev->class->pm->runtime_idle(dev);
|
||||
VMKAPI_MODULE_CALL_VOID(dev->class->owner->moduleID,
|
||||
dev->class->pm->runtime_idle, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
}
|
||||
|
@ -220,7 +223,8 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq)
|
|||
if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
retval = dev->bus->pm->runtime_suspend(dev);
|
||||
VMKAPI_MODULE_CALL(dev->bus->owner->moduleID, retval,
|
||||
dev->bus->pm->runtime_suspend, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
dev->power2->runtime_error = retval;
|
||||
|
@ -228,7 +232,8 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq)
|
|||
&& dev->type->pm->runtime_suspend) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
retval = dev->type->pm->runtime_suspend(dev);
|
||||
VMKAPI_MODULE_CALL(dev->driver->owner->moduleID, retval,
|
||||
dev->type->pm->runtime_suspend, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
dev->power2->runtime_error = retval;
|
||||
|
@ -236,7 +241,8 @@ int __pm_runtime_suspend(struct device *dev, bool from_wq)
|
|||
&& dev->class->pm->runtime_suspend) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
retval = dev->class->pm->runtime_suspend(dev);
|
||||
VMKAPI_MODULE_CALL(dev->class->owner->moduleID, retval,
|
||||
dev->class->pm->runtime_suspend, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
dev->power2->runtime_error = retval;
|
||||
|
@ -404,7 +410,8 @@ int __pm_runtime_resume(struct device *dev, bool from_wq)
|
|||
if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
retval = dev->bus->pm->runtime_resume(dev);
|
||||
VMKAPI_MODULE_CALL(dev->bus->owner->moduleID, retval,
|
||||
dev->bus->pm->runtime_resume, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
dev->power2->runtime_error = retval;
|
||||
|
@ -412,7 +419,8 @@ int __pm_runtime_resume(struct device *dev, bool from_wq)
|
|||
&& dev->type->pm->runtime_resume) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
retval = dev->type->pm->runtime_resume(dev);
|
||||
VMKAPI_MODULE_CALL(dev->driver->owner->moduleID, retval,
|
||||
dev->type->pm->runtime_resume, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
dev->power2->runtime_error = retval;
|
||||
|
@ -420,7 +428,8 @@ int __pm_runtime_resume(struct device *dev, bool from_wq)
|
|||
&& dev->class->pm->runtime_resume) {
|
||||
spin_unlock_irq(&dev->power2->lock);
|
||||
|
||||
retval = dev->class->pm->runtime_resume(dev);
|
||||
VMKAPI_MODULE_CALL(dev->class->owner->moduleID, retval,
|
||||
dev->class->pm->runtime_resume, dev);
|
||||
|
||||
spin_lock_irq(&dev->power2->lock);
|
||||
dev->power2->runtime_error = retval;
|
||||
|
|
|
@ -1932,7 +1932,9 @@ int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
|
|||
sizeof(cmd->sense_buffer), sshdr);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_command_normalize_sense);
|
||||
#endif /* !defined(__VMKLNX__) */
|
||||
|
||||
#if defined(__VMKLNX__)
|
||||
/**
|
||||
* scsi_sense_desc_find - search for a given descriptor type in
|
||||
* descriptor sense data format.
|
||||
|
@ -1948,6 +1950,7 @@ EXPORT_SYMBOL(scsi_command_normalize_sense);
|
|||
* Return value:
|
||||
* pointer to start of (first) descriptor if found else NULL
|
||||
**/
|
||||
/* _VMKLNX_CODECHECK_: scsi_sense_desc_find */
|
||||
const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len,
|
||||
int desc_type)
|
||||
{
|
||||
|
@ -1973,7 +1976,9 @@ const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len,
|
|||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_sense_desc_find);
|
||||
#endif /* defined(__VMKLNX__) */
|
||||
|
||||
#if !defined(__VMKLNX__)
|
||||
/**
|
||||
* scsi_get_sense_info_fld - attempts to get information field from
|
||||
* sense data (either fixed or descriptor format)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2542,11 +2542,7 @@ netdev_tx_internal(struct net_device *dev,
|
|||
atomic_inc(&(skb_shinfo(skb)->fragsref));
|
||||
dev_kfree_skb_any(skb);
|
||||
|
||||
/*
|
||||
* sticking pkt back this way may cause tx re-ordering,
|
||||
* but this should be very rare.
|
||||
*/
|
||||
vmk_PktListAppendPkt(pktList, pkt);
|
||||
vmk_PktListPrependPkt(pktList, pkt);
|
||||
if (xmit_status == NETDEV_TX_BUSY) {
|
||||
ret = VMK_BUSY;
|
||||
} else {
|
||||
|
@ -3884,6 +3880,10 @@ LinNet_DestroyDMAEngine(struct net_device *device)
|
|||
* port 2 - vmnic1000402
|
||||
* port 3 - vmnic1000403
|
||||
*
|
||||
* if module parameter vmklnx_low_port2numbering is set to 1,
|
||||
* then the port2 alias is determined using 63 - k, where k is
|
||||
* the first port's pciIndex.
|
||||
*
|
||||
* This formula allows to have 99 pseudo logical devices.
|
||||
*
|
||||
* Results:
|
||||
|
@ -3903,6 +3903,7 @@ create_pseudo_dev_name(char *name, int length, struct pci_dev *pdev)
|
|||
LinuxPCIDevExt *pe;
|
||||
VMK_ReturnStatus status;
|
||||
char pci_name[VMK_DEVICE_NAME_MAX_LENGTH];
|
||||
int port2_alias;
|
||||
|
||||
pe = container_of(pdev, LinuxPCIDevExt, linuxDev);
|
||||
status = vmk_PCIGetDeviceName(pe->vmkDev, pci_name, length);
|
||||
|
@ -3921,6 +3922,23 @@ create_pseudo_dev_name(char *name, int length, struct pci_dev *pdev)
|
|||
|
||||
nameCounter += baseCounter + (pciIndex*maxDevs);
|
||||
maxCounter = baseCounter + (pciIndex*maxDevs) + maxDevs;
|
||||
if (vmklnx_get_low_port2numbering() == 1) {
|
||||
/*
|
||||
* 2nd port gets alias using 63 - k where k is picked
|
||||
* from 1st port.
|
||||
*/
|
||||
port2_alias = 63 - pciIndex;
|
||||
snprintf(name, length, "vmnic%d", port2_alias);
|
||||
if (vmk_UplinkIsNameAvailable(name)) {
|
||||
return VMK_OK;
|
||||
} else {
|
||||
/*
|
||||
* Need to fail the netdev registration.
|
||||
*/
|
||||
VMKLNX_ALERT("Unable to assign lower port2 device name");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
VMKLNX_INFO("maxCounter %d\n", maxCounter);
|
||||
|
||||
|
@ -3999,12 +4017,11 @@ VMK_ReturnStatus
|
|||
validate_driver_defined_name(struct net_device *dev, char *name)
|
||||
{
|
||||
int number,ret;
|
||||
|
||||
|
||||
ret = sscanf(name, "vmnic%d", &number);
|
||||
if (ret == 1) {
|
||||
if (ret == 1) {
|
||||
return VMK_FAILURE;
|
||||
}
|
||||
|
||||
if (!vmk_UplinkIsNameAvailable(name)) {
|
||||
return VMK_FAILURE;
|
||||
}
|
||||
|
@ -4230,15 +4247,13 @@ unregister_netdev(struct net_device *dev)
|
|||
VMKLNX_DEBUG(0, "Unregistering %s", dev->name);
|
||||
|
||||
if (!(dev->features & NETIF_F_CNA)) {
|
||||
if ((dev->pdev == NULL) && !(dev->features & NETIF_F_PSEUDO_REG)) {
|
||||
/*
|
||||
* For pseudo NIC, close the uplink here.
|
||||
* For real PCI NIC, the uplink is closed via vmk_PCIDoPreRemove().
|
||||
* XXX: this is redundant, module's preUnload callback will do this
|
||||
* for all NICs owned by the module.
|
||||
*/
|
||||
vmk_UplinkClose(dev->uplinkDev);
|
||||
}
|
||||
/*
|
||||
* For pseudo NIC, close the uplink here.
|
||||
* For real PCI NIC, the uplink is closed via vmk_PCIDoPreRemove().
|
||||
* XXX: this is redundant, module's preUnload callback will do this
|
||||
* for all NICs owned by the module.
|
||||
*/
|
||||
vmk_UplinkClose(dev->uplinkDev);
|
||||
|
||||
LinNet_DisconnectUplink(dev);
|
||||
}
|
||||
|
@ -8143,7 +8158,7 @@ SetCoalesceParams(vmk_AddrCookie cookie, vmk_UplinkCoalesceParams *coalesceParam
|
|||
struct ethtool_coalesce coalesce;
|
||||
VMK_ReturnStatus status;
|
||||
|
||||
if (!ops || !ops->set_coalesce) {
|
||||
if (!ops || !ops->set_coalesce || !ops->get_coalesce) {
|
||||
status = VMK_NOT_SUPPORTED;
|
||||
} else {
|
||||
int ret = -1;
|
||||
|
@ -8693,12 +8708,12 @@ GetNICSupportedModes(struct net_device *dev,
|
|||
i++;
|
||||
}
|
||||
if (mask & SUPPORTED_20000baseMLD2_Full) {
|
||||
supportedModes[i].speed = 20000;
|
||||
supportedModes[i].speed = VMK_LINK_SPEED_20000_MBPS;
|
||||
supportedModes[i].duplex = VMK_LINK_DUPLEX_FULL;
|
||||
i++;
|
||||
}
|
||||
if (mask & SUPPORTED_20000baseKR2_Full) {
|
||||
supportedModes[i].speed = 20000;
|
||||
supportedModes[i].speed = VMK_LINK_SPEED_20000_MBPS;
|
||||
supportedModes[i].duplex = VMK_LINK_DUPLEX_FULL;
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
struct bus_type pci_bus_type = {
|
||||
.name = "pci",
|
||||
#if defined(__VMKLNX__)
|
||||
.owner = THIS_MODULE,
|
||||
#endif
|
||||
};
|
||||
EXPORT_SYMBOL(pci_bus_type);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue