#include "e1000e.h"Go to the source code of this file.
Defines | |
| #define | SPEED_MODE_BIT (1 << 21) |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER) | |
| static s32 | e1000e_get_variants_82571 (struct e1000_adapter *adapter) |
| static s32 | e1000e_get_variants_ich8lan (struct e1000_adapter *adapter) |
| s32 | e1000e_read_pcie_cap_reg (struct e1000_hw *hw, u32 reg, u16 *value) |
| static void | e1000e_irq_disable (struct e1000_adapter *adapter) |
| e1000e_irq_disable - Mask off interrupt generation on the NIC | |
| static void | e1000e_irq_enable (struct e1000_adapter *adapter) |
| e1000e_irq_enable - Enable default interrupt generation settings | |
| static void | e1000e_get_hw_control (struct e1000_adapter *adapter) |
| e1000_get_hw_control - get control of the h/w from f/w : address of board private structure | |
| void | e1000e_power_up_phy (struct e1000_adapter *adapter) |
| e1000e_power_up_phy - restore link in case the phy was powered down : address of board private structure | |
| void | e1000e_power_down_phy (struct e1000_adapter *adapter) |
| e1000_power_down_phy - Power down the PHY | |
| void | e1000e_reset (struct e1000_adapter *adapter) |
| e1000e_reset - bring the hardware into a known good state | |
| static int | e1000e_sw_init (struct e1000_adapter *adapter) |
| static int | e1000e_setup_tx_resources (struct e1000_adapter *adapter) |
| e1000_setup_tx_resources - allocate Tx resources (Descriptors) | |
| static void | e1000e_process_tx_packets (struct net_device *netdev) |
| e1000_process_tx_packets - process transmitted packets | |
| static void | e1000e_free_tx_resources (struct e1000_adapter *adapter) |
| static void | e1000e_configure_tx (struct e1000_adapter *adapter) |
| e1000_configure_tx - Configure 8254x Transmit Unit after Reset : board private structure | |
| static void | e1000e_free_rx_resources (struct e1000_adapter *adapter) |
| static int | e1000e_refill_rx_ring (struct e1000_adapter *adapter) |
| e1000_refill_rx_ring - allocate Rx io_buffers | |
| static int | e1000e_setup_rx_resources (struct e1000_adapter *adapter) |
| e1000_setup_rx_resources - allocate Rx resources (Descriptors) | |
| static void | e1000e_configure_rx (struct e1000_adapter *adapter) |
| e1000_configure_rx - Configure 8254x Receive Unit after Reset : board private structure | |
| static void | e1000e_process_rx_packets (struct net_device *netdev) |
| e1000_process_rx_packets - process received packets | |
| static void | e1000e_close (struct net_device *netdev) |
| Functions that implement the gPXE driver API. | |
| static int | e1000e_transmit (struct net_device *netdev, struct io_buffer *iobuf) |
| e1000_transmit - Transmit a packet | |
| static void | e1000e_poll (struct net_device *netdev) |
| e1000_poll - Poll for received packets | |
| static void | e1000e_irq (struct net_device *netdev, int enable) |
| e1000_irq - enable or Disable interrupts | |
| int | e1000e_probe (struct pci_device *pdev, const struct pci_device_id *ent) |
| e1000_probe - Initial configuration of e1000 NIC | |
| void | e1000e_remove (struct pci_device *pdev) |
| e1000e_remove - Device Removal Routine | |
| static int | e1000e_open (struct net_device *netdev) |
| e1000e_open - Called when a network interface is made active | |
Variables | |
| static struct e1000_info | e1000_82571_info |
| static struct e1000_info | e1000_82572_info |
| static struct e1000_info | e1000_82573_info |
| static struct e1000_info | e1000_82574_info |
| static struct e1000_info | e1000_82583_info |
| static struct e1000_info | e1000_es2_info |
| static struct e1000_info | e1000_ich8_info |
| static struct e1000_info | e1000_ich9_info |
| static struct e1000_info | e1000_ich10_info |
| static struct e1000_info | e1000_pch_info |
| static struct e1000_info * | e1000_info_tbl [] |
| static struct net_device_operations | e1000e_operations |
| e1000e net device operations | |
| #define SPEED_MODE_BIT (1 << 21) |
Referenced by e1000e_configure_tx().
| FILE_LICENCE | ( | GPL2_OR_LATER | ) |
| static s32 e1000e_get_variants_82571 | ( | struct e1000_adapter * | adapter | ) | [static] |
Definition at line 37 of file e1000e_main.c.
References DEFAULT_JUMBO, pci_device::device, e1000_82571, e1000_82573, E1000_DEV_ID_82571EB_COPPER, E1000_DEV_ID_82571EB_FIBER, E1000_DEV_ID_82571EB_QUAD_COPPER, E1000_DEV_ID_82571EB_QUAD_COPPER_LP, E1000_DEV_ID_82571EB_QUAD_FIBER, E1000_DEV_ID_82571EB_SERDES, E1000_DEV_ID_82571EB_SERDES_QUAD, E1000_DEV_ID_82571PT_QUAD_COPPER, E1000_DEV_ID_82573L, E1000_STATUS_FUNC_1, e1000e_read_nvm(), er32, FLAG_HAS_JUMBO_FRAMES, FLAG_HAS_WOL, FLAG_IS_QUAD_PORT, FLAG_IS_QUAD_PORT_A, e1000_adapter::flags, e1000_adapter::hw, e1000_hw::mac, e1000_adapter::max_hw_frame_size, NVM_INIT_3GIO_3, NVM_WORD1A_ASPM_MASK, e1000_adapter::pdev, e1000_mac_info::type, and u16.
00038 { 00039 struct e1000_hw *hw = &adapter->hw; 00040 static int global_quad_port_a; /* global port a indication */ 00041 struct pci_device *pdev = adapter->pdev; 00042 u16 eeprom_data = 0; 00043 int is_port_b = er32(STATUS) & E1000_STATUS_FUNC_1; 00044 00045 /* tag quad port adapters first, it's used below */ 00046 switch (pdev->device) { 00047 case E1000_DEV_ID_82571EB_QUAD_COPPER: 00048 case E1000_DEV_ID_82571EB_QUAD_FIBER: 00049 case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: 00050 case E1000_DEV_ID_82571PT_QUAD_COPPER: 00051 adapter->flags |= FLAG_IS_QUAD_PORT; 00052 /* mark the first port */ 00053 if (global_quad_port_a == 0) 00054 adapter->flags |= FLAG_IS_QUAD_PORT_A; 00055 /* Reset for multiple quad port adapters */ 00056 global_quad_port_a++; 00057 if (global_quad_port_a == 4) 00058 global_quad_port_a = 0; 00059 break; 00060 default: 00061 break; 00062 } 00063 00064 switch (adapter->hw.mac.type) { 00065 case e1000_82571: 00066 /* these dual ports don't have WoL on port B at all */ 00067 if (((pdev->device == E1000_DEV_ID_82571EB_FIBER) || 00068 (pdev->device == E1000_DEV_ID_82571EB_SERDES) || 00069 (pdev->device == E1000_DEV_ID_82571EB_COPPER)) && 00070 (is_port_b)) 00071 adapter->flags &= ~FLAG_HAS_WOL; 00072 /* quad ports only support WoL on port A */ 00073 if (adapter->flags & FLAG_IS_QUAD_PORT && 00074 (!(adapter->flags & FLAG_IS_QUAD_PORT_A))) 00075 adapter->flags &= ~FLAG_HAS_WOL; 00076 /* Does not support WoL on any port */ 00077 if (pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD) 00078 adapter->flags &= ~FLAG_HAS_WOL; 00079 break; 00080 00081 case e1000_82573: 00082 if (pdev->device == E1000_DEV_ID_82573L) { 00083 if (e1000e_read_nvm(&adapter->hw, NVM_INIT_3GIO_3, 1, 00084 &eeprom_data) < 0) 00085 break; 00086 if (!(eeprom_data & NVM_WORD1A_ASPM_MASK)) { 00087 adapter->flags |= FLAG_HAS_JUMBO_FRAMES; 00088 adapter->max_hw_frame_size = DEFAULT_JUMBO; 00089 } 00090 } 00091 break; 00092 00093 default: 00094 break; 00095 } 00096 00097 return 0; 00098 }
| static s32 e1000e_get_variants_ich8lan | ( | struct e1000_adapter * | adapter | ) | [static] |
Definition at line 202 of file e1000e_main.c.
References e1000_ich8lan, e1000_phy_ife, e1000_phy_igp_3, ETH_FCS_LEN, ETH_FRAME_LEN, FLAG_HAS_JUMBO_FRAMES, FLAG_LSC_GIG_SPEED_DROP, e1000_adapter::flags, e1000_adapter::hw, e1000_hw::mac, e1000_adapter::max_hw_frame_size, e1000_hw::phy, e1000_mac_info::type, and e1000_phy_info::type.
00203 { 00204 if (adapter->hw.phy.type == e1000_phy_ife) { 00205 adapter->flags &= ~FLAG_HAS_JUMBO_FRAMES; 00206 adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN; 00207 } 00208 00209 if ((adapter->hw.mac.type == e1000_ich8lan) && 00210 (adapter->hw.phy.type == e1000_phy_igp_3)) 00211 adapter->flags |= FLAG_LSC_GIG_SPEED_DROP; 00212 00213 return 0; 00214 }
Definition at line 297 of file e1000e_main.c.
References e1000_hw::adapter, E1000_ERR_CONFIG, E1000_SUCCESS, PCI_CAP_ID_EXP, pci_find_capability(), pci_read_config_word(), e1000_adapter::pdev, and u16.
Referenced by e1000e_get_bus_info_pcie().
00298 { 00299 u16 cap_offset; 00300 00301 cap_offset = pci_find_capability(hw->adapter->pdev, PCI_CAP_ID_EXP); 00302 if (!cap_offset) 00303 return -E1000_ERR_CONFIG; 00304 00305 pci_read_config_word(hw->adapter->pdev, cap_offset + reg, value); 00306 00307 return E1000_SUCCESS; 00308 }
| static void e1000e_irq_disable | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000e_irq_disable - Mask off interrupt generation on the NIC
Definition at line 313 of file e1000e_main.c.
References e1e_flush, ew32, and e1000_adapter::hw.
Referenced by e1000e_close(), e1000e_irq(), and e1000e_sw_init().
00314 { 00315 struct e1000_hw *hw = &adapter->hw; 00316 00317 ew32(IMC, ~0); 00318 e1e_flush(); 00319 }
| static void e1000e_irq_enable | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000e_irq_enable - Enable default interrupt generation settings
Definition at line 324 of file e1000e_main.c.
References e1e_flush, ew32, e1000_adapter::hw, and IMS_ENABLE_MASK.
Referenced by e1000e_irq().
00325 { 00326 struct e1000_hw *hw = &adapter->hw; 00327 00328 ew32(IMS, IMS_ENABLE_MASK); 00329 e1e_flush(); 00330 }
| static void e1000e_get_hw_control | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000_get_hw_control - get control of the h/w from f/w : address of board private structure
e1000_get_hw_control sets {CTRL_EXT|SWSM}:DRV_LOAD bit. For ASF and Pass Through versions of f/w this means that the driver is loaded. For AMT version (only with 82573) of the f/w this means that the network i/f is open.
Definition at line 341 of file e1000e_main.c.
References E1000_CTRL_EXT_DRV_LOAD, E1000_SWSM_DRV_LOAD, er32, ew32, FLAG_HAS_CTRLEXT_ON_LOAD, FLAG_HAS_SWSM_ON_LOAD, e1000_adapter::flags, e1000_adapter::hw, and u32.
Referenced by e1000e_reset().
00342 { 00343 struct e1000_hw *hw = &adapter->hw; 00344 u32 ctrl_ext; 00345 u32 swsm; 00346 00347 /* Let firmware know the driver has taken over */ 00348 if (adapter->flags & FLAG_HAS_SWSM_ON_LOAD) { 00349 swsm = er32(SWSM); 00350 ew32(SWSM, swsm | E1000_SWSM_DRV_LOAD); 00351 } else if (adapter->flags & FLAG_HAS_CTRLEXT_ON_LOAD) { 00352 ctrl_ext = er32(CTRL_EXT); 00353 ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_DRV_LOAD); 00354 } 00355 }
| void e1000e_power_up_phy | ( | struct e1000_adapter * | adapter | ) |
e1000e_power_up_phy - restore link in case the phy was powered down : address of board private structure
The phy may be powered down to save power and turn off link when the driver is unloaded and wake on lan is not enabled (among others) *** this routine MUST be followed by a call to e1000e_reset ***
Definition at line 365 of file e1000e_main.c.
References e1000_adapter::hw, e1000_hw::mac, e1000_mac_info::ops, e1000_phy_info::ops, e1000_hw::phy, e1000_phy_operations::power_up, and e1000_mac_operations::setup_link.
00366 { 00367 if (adapter->hw.phy.ops.power_up) 00368 adapter->hw.phy.ops.power_up(&adapter->hw); 00369 00370 adapter->hw.mac.ops.setup_link(&adapter->hw); 00371 }
| void e1000e_power_down_phy | ( | struct e1000_adapter * | adapter | ) |
e1000_power_down_phy - Power down the PHY
Power down the PHY so no link is implied when interface is down. The PHY cannot be powered down if management or WoL is active.
Definition at line 379 of file e1000e_main.c.
References e1000_adapter::hw, e1000_phy_info::ops, e1000_hw::phy, e1000_phy_operations::power_down, and e1000_adapter::wol.
00380 { 00381 /* WoL is enabled */ 00382 if (adapter->wol) 00383 return; 00384 00385 if (adapter->hw.phy.ops.power_down) 00386 adapter->hw.phy.ops.power_down(&adapter->hw); 00387 }
| void e1000e_reset | ( | struct e1000_adapter * | adapter | ) |
e1000e_reset - bring the hardware into a known good state
This function boots the hardware and enables some settings that require a configuration cycle of the hardware - those cannot be set/changed during runtime. After reset the device needs to be properly configured for Rx, Tx etc.
Definition at line 397 of file e1000e_main.c.
References BM_WUC, e1000_fc_info::current_mode, DBG, e1000_fc_none, e1000_pchlan, e1000e_get_hw_control(), e1000e_get_phy_info(), e1000e_reset_adaptive(), e1e_rphy(), e1e_wphy(), ew32, e1000_hw::fc, FLAG2_HAS_PHY_WAKEUP, FLAG_HAS_AMT, FLAG_HAS_SMART_POWER_DOWN, FLAG_SMART_POWER_DOWN, e1000_adapter::flags, e1000_adapter::flags2, e1000_adapter::hw, IGP02E1000_PHY_POWER_MGMT, IGP02E1000_PM_SPD, e1000_mac_operations::init_hw, e1000_hw::mac, e1000_mac_info::ops, e1000_adapter::pba, e1000_fc_info::requested_mode, e1000_mac_operations::reset_hw, e1000_mac_info::type, u16, and u32.
Referenced by e1000e_close(), e1000e_open(), e1000e_probe(), and e1000e_remove().
00398 { 00399 struct e1000_mac_info *mac = &adapter->hw.mac; 00400 struct e1000_fc_info *fc = &adapter->hw.fc; 00401 u32 pba = adapter->pba; 00402 struct e1000_hw *hw = &adapter->hw; 00403 00404 /* Reset Packet Buffer Allocation to default */ 00405 ew32(PBA, pba); 00406 00407 hw->fc.requested_mode = e1000_fc_none; 00408 fc->current_mode = fc->requested_mode; 00409 00410 /* Allow time for pending master requests to run */ 00411 mac->ops.reset_hw(hw); 00412 00413 /* 00414 * For parts with AMT enabled, let the firmware know 00415 * that the network interface is in control 00416 */ 00417 if (adapter->flags & FLAG_HAS_AMT) 00418 e1000e_get_hw_control(adapter); 00419 00420 ew32(WUC, 0); 00421 if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) 00422 e1e_wphy(&adapter->hw, BM_WUC, 0); 00423 00424 if (mac->ops.init_hw(hw)) 00425 DBG("Hardware Error\n"); 00426 00427 /* additional part of the flow-control workaround above */ 00428 if (hw->mac.type == e1000_pchlan) 00429 ew32(FCRTV_PCH, 0x1000); 00430 00431 e1000e_reset_adaptive(hw); 00432 00433 e1000e_get_phy_info(hw); 00434 00435 if ((adapter->flags & FLAG_HAS_SMART_POWER_DOWN) && 00436 !(adapter->flags & FLAG_SMART_POWER_DOWN)) { 00437 u16 phy_data = 0; 00438 /* 00439 * speed up time to link by disabling smart power down, ignore 00440 * the return value of this function because there is nothing 00441 * different we would do if it failed 00442 */ 00443 e1e_rphy(hw, IGP02E1000_PHY_POWER_MGMT, &phy_data); 00444 phy_data &= ~IGP02E1000_PM_SPD; 00445 e1e_wphy(hw, IGP02E1000_PHY_POWER_MGMT, phy_data); 00446 } 00447 }
| static int e1000e_sw_init | ( | struct e1000_adapter * | adapter | ) | [static] |
Definition at line 449 of file e1000e_main.c.
References E1000_SUCCESS, e1000e_irq_disable(), e1000_adapter::ei, e1000_adapter::hw, e1000_info::init_ops, e1000_phy_operations::init_params, e1000_nvm_operations::init_params, e1000_mac_operations::init_params, e1000_hw::mac, e1000_hw::nvm, e1000_phy_info::ops, e1000_nvm_info::ops, e1000_mac_info::ops, and e1000_hw::phy.
Referenced by e1000e_probe().
00450 { 00451 s32 rc; 00452 00453 /* Set various function pointers */ 00454 adapter->ei->init_ops(&adapter->hw); 00455 00456 rc = adapter->hw.mac.ops.init_params(&adapter->hw); 00457 if (rc) 00458 return rc; 00459 00460 rc = adapter->hw.nvm.ops.init_params(&adapter->hw); 00461 if (rc) 00462 return rc; 00463 00464 rc = adapter->hw.phy.ops.init_params(&adapter->hw); 00465 if (rc) 00466 return rc; 00467 00468 /* Explicitly disable IRQ since the NIC can be in any state. */ 00469 e1000e_irq_disable(adapter); 00470 00471 return E1000_SUCCESS; 00472 }
| static int e1000e_setup_tx_resources | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000_setup_tx_resources - allocate Tx resources (Descriptors)
| adapter | e1000 private structure |
| rc | Returns 0 on success, negative on failure |
Definition at line 483 of file e1000e_main.c.
References DBG, DBGP, ENOMEM, malloc_dma(), memset(), e1000_adapter::tx_base, e1000_adapter::tx_ring_size, and virt_to_bus().
Referenced by e1000e_open().
00484 { 00485 DBGP ( "e1000_setup_tx_resources\n" ); 00486 00487 /* Allocate transmit descriptor ring memory. 00488 It must not cross a 64K boundary because of hardware errata #23 00489 so we use malloc_dma() requesting a 128 byte block that is 00490 128 byte aligned. This should guarantee that the memory 00491 allocated will not cross a 64K boundary, because 128 is an 00492 even multiple of 65536 ( 65536 / 128 == 512 ), so all possible 00493 allocations of 128 bytes on a 128 byte boundary will not 00494 cross 64K bytes. 00495 */ 00496 00497 adapter->tx_base = 00498 malloc_dma ( adapter->tx_ring_size, adapter->tx_ring_size ); 00499 00500 if ( ! adapter->tx_base ) { 00501 return -ENOMEM; 00502 } 00503 00504 memset ( adapter->tx_base, 0, adapter->tx_ring_size ); 00505 00506 DBG ( "adapter->tx_base = %#08lx\n", virt_to_bus ( adapter->tx_base ) ); 00507 00508 return 0; 00509 }
| static void e1000e_process_tx_packets | ( | struct net_device * | netdev | ) | [static] |
e1000_process_tx_packets - process transmitted packets
Definition at line 516 of file e1000e_main.c.
References e1000_tx_desc::data, DBG, E1000_TXD_STAT_DD, E1000_TXD_STAT_EC, E1000_TXD_STAT_LC, E1000_TXD_STAT_TU, EINVAL, memset(), netdev_priv(), netdev_tx_complete(), netdev_tx_complete_err(), NUM_TX_DESC, e1000_adapter::tx_base, e1000_adapter::tx_fill_ctr, e1000_adapter::tx_head, e1000_adapter::tx_iobuf, e1000_adapter::tx_tail, e1000_tx_desc::upper, and virt_to_bus().
Referenced by e1000e_poll().
00517 { 00518 struct e1000_adapter *adapter = netdev_priv ( netdev ); 00519 uint32_t i; 00520 uint32_t tx_status; 00521 struct e1000_tx_desc *tx_curr_desc; 00522 00523 /* Check status of transmitted packets 00524 */ 00525 DBG ( "process_tx_packets: tx_head = %d, tx_tail = %d\n", adapter->tx_head, 00526 adapter->tx_tail ); 00527 00528 while ( ( i = adapter->tx_head ) != adapter->tx_tail ) { 00529 00530 tx_curr_desc = ( void * ) ( adapter->tx_base ) + 00531 ( i * sizeof ( *adapter->tx_base ) ); 00532 00533 tx_status = tx_curr_desc->upper.data; 00534 00535 DBG ( " tx_curr_desc = %#08lx\n", virt_to_bus ( tx_curr_desc ) ); 00536 DBG ( " tx_status = %#08x\n", tx_status ); 00537 00538 /* if the packet at tx_head is not owned by hardware it is for us */ 00539 if ( ! ( tx_status & E1000_TXD_STAT_DD ) ) 00540 break; 00541 00542 DBG ( "Sent packet. tx_head: %d tx_tail: %d tx_status: %#08x\n", 00543 adapter->tx_head, adapter->tx_tail, tx_status ); 00544 00545 if ( tx_status & ( E1000_TXD_STAT_EC | E1000_TXD_STAT_LC | 00546 E1000_TXD_STAT_TU ) ) { 00547 netdev_tx_complete_err ( netdev, adapter->tx_iobuf[i], -EINVAL ); 00548 DBG ( "Error transmitting packet, tx_status: %#08x\n", 00549 tx_status ); 00550 } else { 00551 netdev_tx_complete ( netdev, adapter->tx_iobuf[i] ); 00552 DBG ( "Success transmitting packet, tx_status: %#08x\n", 00553 tx_status ); 00554 } 00555 00556 /* Decrement count of used descriptors, clear this descriptor 00557 */ 00558 adapter->tx_fill_ctr--; 00559 memset ( tx_curr_desc, 0, sizeof ( *tx_curr_desc ) ); 00560 00561 adapter->tx_head = ( adapter->tx_head + 1 ) % NUM_TX_DESC; 00562 } 00563 }
| static void e1000e_free_tx_resources | ( | struct e1000_adapter * | adapter | ) | [static] |
Definition at line 565 of file e1000e_main.c.
References DBGP, free_dma(), e1000_adapter::tx_base, and e1000_adapter::tx_ring_size.
Referenced by e1000e_close(), and e1000e_open().
00566 { 00567 DBGP ( "e1000_free_tx_resources\n" ); 00568 00569 free_dma ( adapter->tx_base, adapter->tx_ring_size ); 00570 }
| static void e1000e_configure_tx | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000_configure_tx - Configure 8254x Transmit Unit after Reset : board private structure
Configure the Tx unit of the MAC after a reset.
Definition at line 578 of file e1000e_main.c.
References DBG, DBGP, DEFAULT_80003ES2LAN_TIPG_IPGR2, DEFAULT_82543_TIPG_IPGR1, DEFAULT_82543_TIPG_IPGR2, DEFAULT_82543_TIPG_IPGT_COPPER, E1000_COLLISION_THRESHOLD, E1000_CT_SHIFT, E1000_READ_REG, E1000_TCTL, E1000_TCTL_CT, E1000_TCTL_EN, E1000_TCTL_PSP, E1000_TCTL_RTLC, E1000_TDBAH, E1000_TDBAL, E1000_TDH, E1000_TDLEN, E1000_TDT, E1000_TIPG_IPGR1_SHIFT, E1000_TIPG_IPGR2_SHIFT, E1000_TXD_CMD_EOP, E1000_TXD_CMD_IFCS, E1000_TXD_CMD_RS, E1000_WRITE_REG, e1000e_config_collision_dist(), e1e_flush, er32, ew32, FLAG_TARC_SET_BIT_ZERO, FLAG_TARC_SPEED_MODE_BIT, FLAG_TIPG_MEDIUM_FOR_80003ESLAN, e1000_adapter::flags, e1000_adapter::hw, mdelay(), SPEED_MODE_BIT, e1000_adapter::tx_base, e1000_adapter::tx_fill_ctr, e1000_adapter::tx_head, e1000_adapter::tx_ring_size, e1000_adapter::tx_tail, e1000_adapter::txd_cmd, u32, and virt_to_bus().
Referenced by e1000e_open().
00579 { 00580 struct e1000_hw *hw = &adapter->hw; 00581 u32 tctl, tipg, tarc; 00582 u32 ipgr1, ipgr2; 00583 00584 DBGP ( "e1000_configure_tx\n" ); 00585 00586 /* disable transmits while setting up the descriptors */ 00587 tctl = E1000_READ_REG ( hw, E1000_TCTL ); 00588 E1000_WRITE_REG ( hw, E1000_TCTL, tctl & ~E1000_TCTL_EN ); 00589 e1e_flush(); 00590 mdelay(10); 00591 00592 E1000_WRITE_REG ( hw, E1000_TDBAH(0), 0 ); 00593 E1000_WRITE_REG ( hw, E1000_TDBAL(0), virt_to_bus ( adapter->tx_base ) ); 00594 E1000_WRITE_REG ( hw, E1000_TDLEN(0), adapter->tx_ring_size ); 00595 00596 DBG ( "E1000_TDBAL(0): %#08x\n", E1000_READ_REG ( hw, E1000_TDBAL(0) ) ); 00597 DBG ( "E1000_TDLEN(0): %d\n", E1000_READ_REG ( hw, E1000_TDLEN(0) ) ); 00598 00599 /* Setup the HW Tx Head and Tail descriptor pointers */ 00600 E1000_WRITE_REG ( hw, E1000_TDH(0), 0 ); 00601 E1000_WRITE_REG ( hw, E1000_TDT(0), 0 ); 00602 00603 adapter->tx_head = 0; 00604 adapter->tx_tail = 0; 00605 adapter->tx_fill_ctr = 0; 00606 00607 /* Set the default values for the Tx Inter Packet Gap timer */ 00608 tipg = DEFAULT_82543_TIPG_IPGT_COPPER; /* 8 */ 00609 ipgr1 = DEFAULT_82543_TIPG_IPGR1; /* 8 */ 00610 ipgr2 = DEFAULT_82543_TIPG_IPGR2; /* 6 */ 00611 00612 if (adapter->flags & FLAG_TIPG_MEDIUM_FOR_80003ESLAN) 00613 ipgr2 = DEFAULT_80003ES2LAN_TIPG_IPGR2; /* 7 */ 00614 00615 tipg |= ipgr1 << E1000_TIPG_IPGR1_SHIFT; 00616 tipg |= ipgr2 << E1000_TIPG_IPGR2_SHIFT; 00617 ew32(TIPG, tipg); 00618 00619 /* Program the Transmit Control Register */ 00620 tctl = er32(TCTL); 00621 tctl &= ~E1000_TCTL_CT; 00622 tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC | 00623 (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT); 00624 00625 if (adapter->flags & FLAG_TARC_SPEED_MODE_BIT) { 00626 tarc = er32(TARC(0)); 00627 /* 00628 * set the speed mode bit, we'll clear it if we're not at 00629 * gigabit link later 00630 */ 00631 #define SPEED_MODE_BIT (1 << 21) 00632 tarc |= SPEED_MODE_BIT; 00633 ew32(TARC(0), tarc); 00634 } 00635 00636 /* errata: program both queues to unweighted RR */ 00637 if (adapter->flags & FLAG_TARC_SET_BIT_ZERO) { 00638 tarc = er32(TARC(0)); 00639 tarc |= 1; 00640 ew32(TARC(0), tarc); 00641 tarc = er32(TARC(1)); 00642 tarc |= 1; 00643 ew32(TARC(1), tarc); 00644 } 00645 00646 /* Setup Transmit Descriptor Settings for eop descriptor */ 00647 adapter->txd_cmd = E1000_TXD_CMD_EOP | E1000_TXD_CMD_IFCS; 00648 00649 /* enable Report Status bit */ 00650 adapter->txd_cmd |= E1000_TXD_CMD_RS; 00651 00652 /* 00653 * enable transmits in the hardware, need to do this 00654 * after setting TARC(0) 00655 */ 00656 tctl |= E1000_TCTL_EN; 00657 ew32(TCTL, tctl); 00658 e1e_flush(); 00659 00660 e1000e_config_collision_dist(hw); 00661 }
| static void e1000e_free_rx_resources | ( | struct e1000_adapter * | adapter | ) | [static] |
Definition at line 665 of file e1000e_main.c.
References DBGP, free_dma(), free_iob(), NUM_RX_DESC, e1000_adapter::rx_base, e1000_adapter::rx_iobuf, and e1000_adapter::rx_ring_size.
Referenced by e1000e_close(), and e1000e_setup_rx_resources().
00666 { 00667 int i; 00668 00669 DBGP ( "e1000_free_rx_resources\n" ); 00670 00671 free_dma ( adapter->rx_base, adapter->rx_ring_size ); 00672 00673 for ( i = 0; i < NUM_RX_DESC; i++ ) { 00674 free_iob ( adapter->rx_iobuf[i] ); 00675 } 00676 }
| static int e1000e_refill_rx_ring | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000_refill_rx_ring - allocate Rx io_buffers
| adapter | e1000 private structure |
| rc | Returns 0 on success, negative on failure |
Definition at line 685 of file e1000e_main.c.
References alloc_iob(), e1000_rx_desc::buffer_addr, io_buffer::data, DBG, DBG2, DBGP, E1000_RDT, E1000_RXD_STAT_DD, E1000_WRITE_REG, ENOMEM, e1000_adapter::hw, MAXIMUM_ETHERNET_VLAN_SIZE, NULL, NUM_RX_DESC, e1000_adapter::rx_base, e1000_adapter::rx_curr, e1000_adapter::rx_iobuf, e1000_rx_desc::status, and virt_to_bus().
Referenced by e1000e_poll(), and e1000e_setup_rx_resources().
00686 { 00687 int i, rx_curr; 00688 int rc = 0; 00689 struct e1000_rx_desc *rx_curr_desc; 00690 struct e1000_hw *hw = &adapter->hw; 00691 struct io_buffer *iob; 00692 00693 DBGP ("e1000_refill_rx_ring\n"); 00694 00695 for ( i = 0; i < NUM_RX_DESC; i++ ) { 00696 rx_curr = ( ( adapter->rx_curr + i ) % NUM_RX_DESC ); 00697 rx_curr_desc = adapter->rx_base + rx_curr; 00698 00699 if ( rx_curr_desc->status & E1000_RXD_STAT_DD ) 00700 continue; 00701 00702 if ( adapter->rx_iobuf[rx_curr] != NULL ) 00703 continue; 00704 00705 DBG2 ( "Refilling rx desc %d\n", rx_curr ); 00706 00707 iob = alloc_iob ( MAXIMUM_ETHERNET_VLAN_SIZE ); 00708 adapter->rx_iobuf[rx_curr] = iob; 00709 00710 if ( ! iob ) { 00711 DBG ( "alloc_iob failed\n" ); 00712 rc = -ENOMEM; 00713 break; 00714 } else { 00715 rx_curr_desc->buffer_addr = virt_to_bus ( iob->data ); 00716 00717 E1000_WRITE_REG ( hw, E1000_RDT(0), rx_curr ); 00718 } 00719 } 00720 return rc; 00721 }
| static int e1000e_setup_rx_resources | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000_setup_rx_resources - allocate Rx resources (Descriptors)
| adapter | e1000 private structure |
| rc | Returns 0 on success, negative on failure |
Definition at line 730 of file e1000e_main.c.
References DBGP, e1000e_free_rx_resources(), e1000e_refill_rx_ring(), ENOMEM, malloc_dma(), memset(), NULL, NUM_RX_DESC, e1000_adapter::rx_base, e1000_adapter::rx_iobuf, and e1000_adapter::rx_ring_size.
Referenced by e1000e_open().
00731 { 00732 int i, rc = 0; 00733 00734 DBGP ( "e1000_setup_rx_resources\n" ); 00735 00736 /* Allocate receive descriptor ring memory. 00737 It must not cross a 64K boundary because of hardware errata 00738 */ 00739 00740 adapter->rx_base = 00741 malloc_dma ( adapter->rx_ring_size, adapter->rx_ring_size ); 00742 00743 if ( ! adapter->rx_base ) { 00744 return -ENOMEM; 00745 } 00746 memset ( adapter->rx_base, 0, adapter->rx_ring_size ); 00747 00748 for ( i = 0; i < NUM_RX_DESC; i++ ) { 00749 /* let e1000_refill_rx_ring() io_buffer allocations */ 00750 adapter->rx_iobuf[i] = NULL; 00751 } 00752 00753 /* allocate io_buffers */ 00754 rc = e1000e_refill_rx_ring ( adapter ); 00755 if ( rc < 0 ) 00756 e1000e_free_rx_resources ( adapter ); 00757 00758 return rc; 00759 }
| static void e1000e_configure_rx | ( | struct e1000_adapter * | adapter | ) | [static] |
e1000_configure_rx - Configure 8254x Receive Unit after Reset : board private structure
Configure the Rx unit of the MAC after a reset.
Definition at line 767 of file e1000e_main.c.
References DBG, DBGP, E1000_RCTL, E1000_RCTL_BAM, E1000_RCTL_EN, E1000_RCTL_MPE, E1000_RCTL_SZ_2048, E1000_RDBAH, E1000_RDBAL, E1000_RDH, E1000_RDLEN, E1000_RDT, E1000_READ_REG, E1000_WRITE_REG, e1e_flush, e1000_adapter::hw, mdelay(), NUM_RX_DESC, e1000_adapter::rx_base, e1000_adapter::rx_curr, e1000_adapter::rx_ring_size, and virt_to_bus().
Referenced by e1000e_open().
00768 { 00769 struct e1000_hw *hw = &adapter->hw; 00770 uint32_t rctl; 00771 00772 DBGP ( "e1000_configure_rx\n" ); 00773 00774 /* disable receives while setting up the descriptors */ 00775 rctl = E1000_READ_REG ( hw, E1000_RCTL ); 00776 E1000_WRITE_REG ( hw, E1000_RCTL, rctl & ~E1000_RCTL_EN ); 00777 e1e_flush(); 00778 mdelay(10); 00779 00780 adapter->rx_curr = 0; 00781 00782 /* Setup the HW Rx Head and Tail Descriptor Pointers and 00783 * the Base and Length of the Rx Descriptor Ring */ 00784 00785 E1000_WRITE_REG ( hw, E1000_RDBAL(0), virt_to_bus ( adapter->rx_base ) ); 00786 E1000_WRITE_REG ( hw, E1000_RDBAH(0), 0 ); 00787 E1000_WRITE_REG ( hw, E1000_RDLEN(0), adapter->rx_ring_size ); 00788 00789 E1000_WRITE_REG ( hw, E1000_RDH(0), 0 ); 00790 E1000_WRITE_REG ( hw, E1000_RDT(0), NUM_RX_DESC - 1 ); 00791 00792 /* Enable Receives */ 00793 rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 | 00794 E1000_RCTL_MPE; 00795 E1000_WRITE_REG ( hw, E1000_RCTL, rctl ); 00796 e1e_flush(); 00797 00798 DBG ( "E1000_RDBAL(0): %#08x\n", E1000_READ_REG ( hw, E1000_RDBAL(0) ) ); 00799 DBG ( "E1000_RDLEN(0): %d\n", E1000_READ_REG ( hw, E1000_RDLEN(0) ) ); 00800 DBG ( "E1000_RCTL: %#08x\n", E1000_READ_REG ( hw, E1000_RCTL ) ); 00801 }
| static void e1000e_process_rx_packets | ( | struct net_device * | netdev | ) | [static] |
e1000_process_rx_packets - process received packets
Definition at line 808 of file e1000e_main.c.
References DBG, DBG2, E1000_RCTL, E1000_READ_REG, E1000_RXD_ERR_FRAME_ERR_MASK, E1000_RXD_STAT_DD, EINVAL, e1000_rx_desc::errors, e1000_adapter::hw, iob_put, e1000_rx_desc::length, memset(), netdev_priv(), netdev_rx(), netdev_rx_err(), NULL, NUM_RX_DESC, e1000_adapter::rx_base, e1000_adapter::rx_curr, e1000_adapter::rx_iobuf, and e1000_rx_desc::status.
Referenced by e1000e_poll().
00809 { 00810 struct e1000_adapter *adapter = netdev_priv ( netdev ); 00811 uint32_t i; 00812 uint32_t rx_status; 00813 uint32_t rx_len; 00814 uint32_t rx_err; 00815 struct e1000_rx_desc *rx_curr_desc; 00816 00817 /* Process received packets 00818 */ 00819 while ( 1 ) { 00820 00821 i = adapter->rx_curr; 00822 00823 rx_curr_desc = ( void * ) ( adapter->rx_base ) + 00824 ( i * sizeof ( *adapter->rx_base ) ); 00825 rx_status = rx_curr_desc->status; 00826 00827 DBG2 ( "Before DD Check RX_status: %#08x\n", rx_status ); 00828 00829 if ( ! ( rx_status & E1000_RXD_STAT_DD ) ) 00830 break; 00831 00832 if ( adapter->rx_iobuf[i] == NULL ) 00833 break; 00834 00835 DBG ( "E1000_RCTL = %#08x\n", E1000_READ_REG ( &adapter->hw, E1000_RCTL ) ); 00836 00837 rx_len = rx_curr_desc->length; 00838 00839 DBG ( "Received packet, rx_curr: %d rx_status: %#08x rx_len: %d\n", 00840 i, rx_status, rx_len ); 00841 00842 rx_err = rx_curr_desc->errors; 00843 00844 iob_put ( adapter->rx_iobuf[i], rx_len ); 00845 00846 if ( rx_err & E1000_RXD_ERR_FRAME_ERR_MASK ) { 00847 00848 netdev_rx_err ( netdev, adapter->rx_iobuf[i], -EINVAL ); 00849 DBG ( "e1000_poll: Corrupted packet received!" 00850 " rx_err: %#08x\n", rx_err ); 00851 } else { 00852 /* Add this packet to the receive queue. */ 00853 netdev_rx ( netdev, adapter->rx_iobuf[i] ); 00854 } 00855 adapter->rx_iobuf[i] = NULL; 00856 00857 memset ( rx_curr_desc, 0, sizeof ( *rx_curr_desc ) ); 00858 00859 adapter->rx_curr = ( adapter->rx_curr + 1 ) % NUM_RX_DESC; 00860 } 00861 }
| static void e1000e_close | ( | struct net_device * | netdev | ) | [static] |
Functions that implement the gPXE driver API.
e1000_close - Disables a network interface
Definition at line 871 of file e1000e_main.c.
References DBGP, E1000_ICR, E1000_RCTL, E1000_RCTL_EN, E1000_READ_REG, E1000_WRITE_REG, e1000e_free_rx_resources(), e1000e_free_tx_resources(), e1000e_irq_disable(), e1000e_reset(), e1e_flush, e1000_adapter::hw, and netdev_priv().
00872 { 00873 struct e1000_adapter *adapter = netdev_priv ( netdev ); 00874 struct e1000_hw *hw = &adapter->hw; 00875 uint32_t rctl; 00876 uint32_t icr; 00877 00878 DBGP ( "e1000_close\n" ); 00879 00880 /* Acknowledge interrupts */ 00881 icr = E1000_READ_REG ( hw, E1000_ICR ); 00882 00883 e1000e_irq_disable ( adapter ); 00884 00885 /* disable receives */ 00886 rctl = E1000_READ_REG ( hw, E1000_RCTL ); 00887 E1000_WRITE_REG ( hw, E1000_RCTL, rctl & ~E1000_RCTL_EN ); 00888 e1e_flush(); 00889 00890 e1000e_reset ( adapter ); 00891 00892 e1000e_free_tx_resources ( adapter ); 00893 e1000e_free_rx_resources ( adapter ); 00894 }
| static int e1000e_transmit | ( | struct net_device * | netdev, | |
| struct io_buffer * | iobuf | |||
| ) | [static] |
e1000_transmit - Transmit a packet
| netdev | Network device | |
| iobuf | I/O buffer |
| rc | Returns 0 on success, negative on failure |
Definition at line 904 of file e1000e_main.c.
References e1000_tx_desc::buffer_addr, e1000_tx_desc::data, io_buffer::data, DBG, DBGP, E1000_TDT, E1000_WRITE_REG, e1e_flush, ENOBUFS, e1000_adapter::hw, iob_len(), e1000_tx_desc::lower, netdev_priv(), NUM_TX_DESC, e1000_adapter::tx_base, e1000_adapter::tx_fill_ctr, e1000_adapter::tx_iobuf, e1000_adapter::tx_tail, e1000_adapter::txd_cmd, e1000_tx_desc::upper, and virt_to_bus().
00905 { 00906 struct e1000_adapter *adapter = netdev_priv( netdev ); 00907 struct e1000_hw *hw = &adapter->hw; 00908 uint32_t tx_curr = adapter->tx_tail; 00909 struct e1000_tx_desc *tx_curr_desc; 00910 00911 DBGP ("e1000_transmit\n"); 00912 00913 if ( adapter->tx_fill_ctr == NUM_TX_DESC ) { 00914 DBG ("TX overflow\n"); 00915 return -ENOBUFS; 00916 } 00917 00918 /* Save pointer to iobuf we have been given to transmit, 00919 netdev_tx_complete() will need it later 00920 */ 00921 adapter->tx_iobuf[tx_curr] = iobuf; 00922 00923 tx_curr_desc = ( void * ) ( adapter->tx_base ) + 00924 ( tx_curr * sizeof ( *adapter->tx_base ) ); 00925 00926 DBG ( "tx_curr_desc = %#08lx\n", virt_to_bus ( tx_curr_desc ) ); 00927 DBG ( "tx_curr_desc + 16 = %#08lx\n", virt_to_bus ( tx_curr_desc ) + 16 ); 00928 DBG ( "iobuf->data = %#08lx\n", virt_to_bus ( iobuf->data ) ); 00929 00930 /* Add the packet to TX ring 00931 */ 00932 tx_curr_desc->buffer_addr = virt_to_bus ( iobuf->data ); 00933 tx_curr_desc->upper.data = 0; 00934 tx_curr_desc->lower.data = adapter->txd_cmd | iob_len ( iobuf ); 00935 00936 DBG ( "TX fill: %d tx_curr: %d addr: %#08lx len: %zd\n", adapter->tx_fill_ctr, 00937 tx_curr, virt_to_bus ( iobuf->data ), iob_len ( iobuf ) ); 00938 00939 /* Point to next free descriptor */ 00940 adapter->tx_tail = ( adapter->tx_tail + 1 ) % NUM_TX_DESC; 00941 adapter->tx_fill_ctr++; 00942 00943 /* Write new tail to NIC, making packet available for transmit 00944 */ 00945 E1000_WRITE_REG ( hw, E1000_TDT(0), adapter->tx_tail ); 00946 e1e_flush(); 00947 00948 return 0; 00949 }
| static void e1000e_poll | ( | struct net_device * | netdev | ) | [static] |
e1000_poll - Poll for received packets
| netdev | Network device |
Definition at line 956 of file e1000e_main.c.
References DBG, DBGP, E1000_ICR, E1000_READ_REG, e1000e_process_rx_packets(), e1000e_process_tx_packets(), e1000e_refill_rx_ring(), e1000_adapter::hw, and netdev_priv().
00957 { 00958 struct e1000_adapter *adapter = netdev_priv( netdev ); 00959 struct e1000_hw *hw = &adapter->hw; 00960 00961 uint32_t icr; 00962 00963 DBGP ( "e1000_poll\n" ); 00964 00965 /* Acknowledge interrupts */ 00966 icr = E1000_READ_REG ( hw, E1000_ICR ); 00967 if ( ! icr ) 00968 return; 00969 00970 DBG ( "e1000_poll: intr_status = %#08x\n", icr ); 00971 00972 e1000e_process_tx_packets ( netdev ); 00973 00974 e1000e_process_rx_packets ( netdev ); 00975 00976 e1000e_refill_rx_ring(adapter); 00977 }
| static void e1000e_irq | ( | struct net_device * | netdev, | |
| int | enable | |||
| ) | [static] |
e1000_irq - enable or Disable interrupts
| adapter | e1000 adapter | |
| action | requested interrupt action |
Definition at line 985 of file e1000e_main.c.
References DBGP, e1000e_irq_disable(), e1000e_irq_enable(), and netdev_priv().
00986 { 00987 struct e1000_adapter *adapter = netdev_priv ( netdev ); 00988 00989 DBGP ( "e1000_irq\n" ); 00990 00991 if ( enable ) { 00992 e1000e_irq_enable ( adapter ); 00993 } else { 00994 e1000e_irq_disable ( adapter ); 00995 } 00996 }
| int e1000e_probe | ( | struct pci_device * | pdev, | |
| const struct pci_device_id * | ent | |||
| ) |
e1000_probe - Initial configuration of e1000 NIC
| pci | PCI device | |
| id | PCI IDs |
| rc | Return status code |
Definition at line 1008 of file e1000e_main.c.
References e1000_hw::adapter, e1000_mac_info::adaptive_ifs, adjust_pci_device(), alloc_etherdev(), AUTO_ALL_MODES, e1000_mac_info::autoneg, e1000_phy_info::autoneg_wait_to_complete, e1000_hw::back, e1000_fc_info::current_mode, DBG, DBGP, pci_device::dev, net_device::dev, pci_device::device, e1000_hw::device_id, e1000_phy_info::disable_polarity_correction, pci_device_id::driver_data, e1000_fc_default, e1000_media_type_copper, e1000_ms_hw_default, e1000e_check_reset_block(), e1000e_operations, e1000e_phy_hw_reset(), e1000e_read_mac_addr(), e1000e_reset(), e1000e_sw_init(), e1000e_validate_nvm_checksum(), e1000_adapter::ei, EIO, ENOMEM, ETH_ALEN, ETH_FCS_LEN, ETH_FRAME_LEN, e1000_hw::fc, e1000_adapter::fc_autoneg, FLAG_HAS_FLASH, e1000_info::flags, e1000_adapter::flags, e1000_info::flags2, e1000_adapter::flags2, e1000_hw::flash_address, e1000_info::get_variants, e1000_adapter::hw, net_device::hw_addr, e1000_hw::hw_addr, e1000_hw::io_base, pci_device::ioaddr, e1000_adapter::ioaddr, ioremap(), iounmap(), pci_device::irq, e1000_adapter::irqno, net_device::ll_addr, e1000_info::mac, e1000_hw::mac, e1000_adapter::max_hw_frame_size, e1000_phy_info::mdix, e1000_phy_info::media_type, memcpy, memset(), e1000_phy_info::ms_type, e1000_adapter::netdev, netdev, netdev_init(), netdev_link_up(), netdev_priv(), netdev_put(), NUM_RX_DESC, NUM_TX_DESC, e1000_mac_info::ops, e1000_info::pba, e1000_adapter::pba, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_1, pci_set_drvdata(), e1000_adapter::pdev, e1000_mac_info::perm_addr, e1000_hw::phy, register_netdev(), e1000_fc_info::requested_mode, e1000_mac_operations::reset_hw, e1000_adapter::rx_base, e1000_adapter::rx_ring_size, e1000_adapter::tx_base, e1000_adapter::tx_ring_size, and e1000_mac_info::type.
01010 { 01011 int i, err; 01012 struct net_device *netdev; 01013 struct e1000_adapter *adapter; 01014 unsigned long mmio_start, mmio_len; 01015 unsigned long flash_start, flash_len; 01016 struct e1000_hw *hw; 01017 const struct e1000_info *ei = e1000_info_tbl[ent->driver_data]; 01018 01019 DBGP ( "e1000_probe\n" ); 01020 01021 err = -ENOMEM; 01022 01023 /* Allocate net device ( also allocates memory for netdev->priv 01024 and makes netdev-priv point to it ) */ 01025 netdev = alloc_etherdev ( sizeof ( struct e1000_adapter ) ); 01026 if ( ! netdev ) { 01027 DBG ( "err_alloc_etherdev\n" ); 01028 goto err_alloc_etherdev; 01029 } 01030 01031 /* Associate e1000-specific network operations operations with 01032 * generic network device layer */ 01033 netdev_init ( netdev, &e1000e_operations ); 01034 01035 /* Associate this network device with given PCI device */ 01036 pci_set_drvdata ( pdev, netdev ); 01037 netdev->dev = &pdev->dev; 01038 01039 /* Initialize driver private storage */ 01040 adapter = netdev_priv ( netdev ); 01041 memset ( adapter, 0, ( sizeof ( *adapter ) ) ); 01042 01043 adapter->pdev = pdev; 01044 01045 adapter->ioaddr = pdev->ioaddr; 01046 adapter->hw.io_base = pdev->ioaddr; 01047 01048 hw = &adapter->hw; 01049 hw->device_id = pdev->device; 01050 01051 adapter->irqno = pdev->irq; 01052 adapter->netdev = netdev; 01053 adapter->hw.back = adapter; 01054 01055 adapter->ei = ei; 01056 adapter->pba = ei->pba; 01057 adapter->flags = ei->flags; 01058 adapter->flags2 = ei->flags2; 01059 01060 adapter->hw.adapter = adapter; 01061 adapter->hw.mac.type = ei->mac; 01062 adapter->max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN; 01063 01064 adapter->tx_ring_size = sizeof ( *adapter->tx_base ) * NUM_TX_DESC; 01065 adapter->rx_ring_size = sizeof ( *adapter->rx_base ) * NUM_RX_DESC; 01066 01067 /* Fix up PCI device */ 01068 adjust_pci_device ( pdev ); 01069 01070 err = -EIO; 01071 01072 mmio_start = pci_bar_start ( pdev, PCI_BASE_ADDRESS_0 ); 01073 mmio_len = pci_bar_size ( pdev, PCI_BASE_ADDRESS_0 ); 01074 01075 DBG ( "mmio_start: %#08lx\n", mmio_start ); 01076 DBG ( "mmio_len: %#08lx\n", mmio_len ); 01077 01078 adapter->hw.hw_addr = ioremap ( mmio_start, mmio_len ); 01079 DBG ( "adapter->hw.hw_addr: %p\n", adapter->hw.hw_addr ); 01080 01081 if ( ! adapter->hw.hw_addr ) { 01082 DBG ( "err_ioremap\n" ); 01083 goto err_ioremap; 01084 } 01085 01086 /* Flash BAR mapping depends on mac_type */ 01087 if ( ( adapter->flags & FLAG_HAS_FLASH) && ( pdev->ioaddr ) ) { 01088 flash_start = pci_bar_start ( pdev, PCI_BASE_ADDRESS_1 ); 01089 flash_len = pci_bar_size ( pdev, PCI_BASE_ADDRESS_1 ); 01090 adapter->hw.flash_address = ioremap ( flash_start, flash_len ); 01091 if ( ! adapter->hw.flash_address ) { 01092 DBG ( "err_flashmap\n" ); 01093 goto err_flashmap; 01094 } 01095 } 01096 01097 /* setup adapter struct */ 01098 err = e1000e_sw_init ( adapter ); 01099 if (err) { 01100 DBG ( "err_sw_init\n" ); 01101 goto err_sw_init; 01102 } 01103 01104 if (ei->get_variants) { 01105 err = ei->get_variants(adapter); 01106 if (err) { 01107 DBG ( "err_hw_initr\n" ); 01108 goto err_hw_init; 01109 } 01110 } 01111 01112 /* Copper options */ 01113 if (adapter->hw.phy.media_type == e1000_media_type_copper) { 01114 adapter->hw.phy.mdix = AUTO_ALL_MODES; 01115 adapter->hw.phy.disable_polarity_correction = 0; 01116 adapter->hw.phy.ms_type = e1000_ms_hw_default; 01117 } 01118 01119 DBG ( "adapter->hw.mac.type: %#08x\n", adapter->hw.mac.type ); 01120 01121 /* Force auto-negotiation */ 01122 adapter->hw.mac.autoneg = 1; 01123 adapter->fc_autoneg = 1; 01124 adapter->hw.phy.autoneg_wait_to_complete = true; 01125 adapter->hw.mac.adaptive_ifs = true; 01126 adapter->hw.fc.requested_mode = e1000_fc_default; 01127 adapter->hw.fc.current_mode = e1000_fc_default; 01128 01129 /* 01130 * before reading the NVM, reset the controller to 01131 * put the device in a known good starting state 01132 */ 01133 adapter->hw.mac.ops.reset_hw(&adapter->hw); 01134 01135 /* 01136 * systems with ASPM and others may see the checksum fail on the first 01137 * attempt. Let's give it a few tries 01138 */ 01139 for (i = 0;; i++) { 01140 if (e1000e_validate_nvm_checksum(&adapter->hw) >= 0) 01141 break; 01142 if (i == 2) { 01143 DBG("The NVM Checksum Is Not Valid\n"); 01144 err = -EIO; 01145 goto err_eeprom; 01146 } 01147 } 01148 01149 /* copy the MAC address out of the EEPROM */ 01150 if ( e1000e_read_mac_addr ( &adapter->hw ) ) 01151 DBG ( "EEPROM Read Error\n" ); 01152 01153 memcpy ( netdev->hw_addr, adapter->hw.mac.perm_addr, ETH_ALEN ); 01154 01155 /* reset the hardware with the new settings */ 01156 e1000e_reset ( adapter ); 01157 01158 /* Mark as link up; we don't yet handle link state */ 01159 netdev_link_up ( netdev ); 01160 01161 if ( ( err = register_netdev ( netdev ) ) != 0) { 01162 DBG ( "err_register\n" ); 01163 goto err_register; 01164 } 01165 01166 for (i = 0; i < 6; i++) 01167 DBG ("%02x%s", netdev->ll_addr[i], i == 5 ? "\n" : ":"); 01168 01169 DBG ( "e1000e_probe succeeded!\n" ); 01170 01171 /* No errors, return success */ 01172 return 0; 01173 01174 /* Error return paths */ 01175 err_register: 01176 err_hw_init: 01177 err_eeprom: 01178 err_flashmap: 01179 if (!e1000e_check_reset_block(&adapter->hw)) 01180 e1000e_phy_hw_reset(&adapter->hw); 01181 if (adapter->hw.flash_address) 01182 iounmap(adapter->hw.flash_address); 01183 err_sw_init: 01184 iounmap ( adapter->hw.hw_addr ); 01185 err_ioremap: 01186 netdev_put ( netdev ); 01187 err_alloc_etherdev: 01188 return err; 01189 }
| void e1000e_remove | ( | struct pci_device * | pdev | ) |
e1000e_remove - Device Removal Routine
| pdev | PCI device information struct |
Definition at line 1197 of file e1000e_main.c.
References DBGP, e1000e_reset(), e1000_hw::flash_address, e1000_adapter::hw, e1000_hw::hw_addr, iounmap(), netdev, netdev_nullify(), netdev_priv(), netdev_put(), pci_get_drvdata(), and unregister_netdev().
01198 { 01199 struct net_device *netdev = pci_get_drvdata ( pdev ); 01200 struct e1000_adapter *adapter = netdev_priv ( netdev ); 01201 01202 DBGP ( "e1000e_remove\n" ); 01203 01204 if ( adapter->hw.flash_address ) 01205 iounmap ( adapter->hw.flash_address ); 01206 if ( adapter->hw.hw_addr ) 01207 iounmap ( adapter->hw.hw_addr ); 01208 01209 unregister_netdev ( netdev ); 01210 e1000e_reset ( adapter ); 01211 netdev_nullify ( netdev ); 01212 netdev_put ( netdev ); 01213 }
| static int e1000e_open | ( | struct net_device * | netdev | ) | [static] |
e1000e_open - Called when a network interface is made active
| rc | Return status code, 0 on success, negative value on failure |
Definition at line 1222 of file e1000e_main.c.
References DBG, DBGP, E1000_READ_REG, E1000_RXDCTL, e1000e_configure_rx(), e1000e_configure_tx(), e1000e_free_tx_resources(), e1000e_reset(), e1000e_setup_rx_resources(), e1000e_setup_tx_resources(), e1000_adapter::hw, and netdev_priv().
01223 { 01224 struct e1000_adapter *adapter = netdev_priv(netdev); 01225 int err; 01226 01227 DBGP ( "e1000e_open\n" ); 01228 01229 /* allocate transmit descriptors */ 01230 err = e1000e_setup_tx_resources ( adapter ); 01231 if ( err ) { 01232 DBG ( "Error setting up TX resources!\n" ); 01233 goto err_setup_tx; 01234 } 01235 01236 /* allocate receive descriptors */ 01237 err = e1000e_setup_rx_resources ( adapter ); 01238 if ( err ) { 01239 DBG ( "Error setting up RX resources!\n" ); 01240 goto err_setup_rx; 01241 } 01242 01243 e1000e_configure_tx ( adapter ); 01244 01245 e1000e_configure_rx ( adapter ); 01246 01247 DBG ( "E1000_RXDCTL(0): %#08x\n", E1000_READ_REG ( &adapter->hw, E1000_RXDCTL(0) ) ); 01248 01249 return 0; 01250 01251 err_setup_rx: 01252 DBG ( "err_setup_rx\n" ); 01253 e1000e_free_tx_resources ( adapter ); 01254 err_setup_tx: 01255 DBG ( "err_setup_tx\n" ); 01256 e1000e_reset ( adapter ); 01257 01258 return err; 01259 }
struct e1000_info e1000_82571_info [static] |
Initial value:
{
.mac = e1000_82571,
.flags = FLAG_HAS_HW_VLAN_FILTER
| FLAG_HAS_JUMBO_FRAMES
| FLAG_HAS_WOL
| FLAG_APME_IN_CTRL3
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_RESET_OVERWRITES_LAA
| FLAG_TARC_SPEED_MODE_BIT
| FLAG_APME_CHECK_PORT_B,
.pba = 38,
.max_hw_frame_size = DEFAULT_JUMBO,
.init_ops = e1000e_init_function_pointers_82571,
.get_variants = e1000e_get_variants_82571,
}
Definition at line 100 of file e1000e_main.c.
struct e1000_info e1000_82572_info [static] |
Initial value:
{
.mac = e1000_82572,
.flags = FLAG_HAS_HW_VLAN_FILTER
| FLAG_HAS_JUMBO_FRAMES
| FLAG_HAS_WOL
| FLAG_APME_IN_CTRL3
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_TARC_SPEED_MODE_BIT,
.pba = 38,
.max_hw_frame_size = DEFAULT_JUMBO,
.init_ops = e1000e_init_function_pointers_82571,
.get_variants = e1000e_get_variants_82571,
}
Definition at line 118 of file e1000e_main.c.
struct e1000_info e1000_82573_info [static] |
Initial value:
{
.mac = e1000_82573,
.flags = FLAG_HAS_HW_VLAN_FILTER
| FLAG_HAS_WOL
| FLAG_APME_IN_CTRL3
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_HAS_AMT
| FLAG_HAS_ERT
| FLAG_HAS_SWSM_ON_LOAD,
.pba = 20,
.max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
.init_ops = e1000e_init_function_pointers_82571,
.get_variants = e1000e_get_variants_82571,
}
Definition at line 133 of file e1000e_main.c.
struct e1000_info e1000_82574_info [static] |
Initial value:
{
.mac = e1000_82574,
.flags = FLAG_HAS_HW_VLAN_FILTER
| FLAG_HAS_JUMBO_FRAMES
| FLAG_HAS_WOL
| FLAG_APME_IN_CTRL3
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_HAS_AMT
| FLAG_HAS_CTRLEXT_ON_LOAD,
.pba = 20,
.max_hw_frame_size = DEFAULT_JUMBO,
.init_ops = e1000e_init_function_pointers_82571,
.get_variants = e1000e_get_variants_82571,
}
Definition at line 149 of file e1000e_main.c.
struct e1000_info e1000_82583_info [static] |
Initial value:
{
.mac = e1000_82583,
.flags = FLAG_HAS_HW_VLAN_FILTER
| FLAG_HAS_WOL
| FLAG_APME_IN_CTRL3
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_SMART_POWER_DOWN
| FLAG_HAS_AMT
| FLAG_HAS_CTRLEXT_ON_LOAD,
.pba = 20,
.max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
.init_ops = e1000e_init_function_pointers_82571,
.get_variants = e1000e_get_variants_82571,
}
Definition at line 168 of file e1000e_main.c.
struct e1000_info e1000_es2_info [static] |
Initial value:
{
.mac = e1000_80003es2lan,
.flags = FLAG_HAS_HW_VLAN_FILTER
| FLAG_HAS_JUMBO_FRAMES
| FLAG_HAS_WOL
| FLAG_APME_IN_CTRL3
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_RX_NEEDS_RESTART
| FLAG_TARC_SET_BIT_ZERO
| FLAG_APME_CHECK_PORT_B
| FLAG_DISABLE_FC_PAUSE_TIME
| FLAG_TIPG_MEDIUM_FOR_80003ESLAN,
.pba = 38,
.max_hw_frame_size = DEFAULT_JUMBO,
.init_ops = e1000e_init_function_pointers_80003es2lan,
.get_variants = NULL,
}
Definition at line 183 of file e1000e_main.c.
struct e1000_info e1000_ich8_info [static] |
Initial value:
{
.mac = e1000_ich8lan,
.flags = FLAG_HAS_WOL
| FLAG_IS_ICH
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_HAS_AMT
| FLAG_HAS_FLASH
| FLAG_APME_IN_WUC,
.pba = 8,
.max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN,
.init_ops = e1000e_init_function_pointers_ich8lan,
.get_variants = e1000e_get_variants_ich8lan,
}
Definition at line 216 of file e1000e_main.c.
struct e1000_info e1000_ich9_info [static] |
Initial value:
{
.mac = e1000_ich9lan,
.flags = FLAG_HAS_JUMBO_FRAMES
| FLAG_IS_ICH
| FLAG_HAS_WOL
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_HAS_AMT
| FLAG_HAS_ERT
| FLAG_HAS_FLASH
| FLAG_APME_IN_WUC,
.pba = 10,
.max_hw_frame_size = DEFAULT_JUMBO,
.init_ops = e1000e_init_function_pointers_ich8lan,
.get_variants = e1000e_get_variants_ich8lan,
}
Definition at line 231 of file e1000e_main.c.
struct e1000_info e1000_ich10_info [static] |
Initial value:
{
.mac = e1000_ich10lan,
.flags = FLAG_HAS_JUMBO_FRAMES
| FLAG_IS_ICH
| FLAG_HAS_WOL
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_HAS_AMT
| FLAG_HAS_ERT
| FLAG_HAS_FLASH
| FLAG_APME_IN_WUC,
.pba = 10,
.max_hw_frame_size = DEFAULT_JUMBO,
.init_ops = e1000e_init_function_pointers_ich8lan,
.get_variants = e1000e_get_variants_ich8lan,
}
Definition at line 248 of file e1000e_main.c.
struct e1000_info e1000_pch_info [static] |
Initial value:
{
.mac = e1000_pchlan,
.flags = FLAG_IS_ICH
| FLAG_HAS_WOL
| FLAG_RX_CSUM_ENABLED
| FLAG_HAS_CTRLEXT_ON_LOAD
| FLAG_HAS_AMT
| FLAG_HAS_FLASH
| FLAG_HAS_JUMBO_FRAMES
| FLAG_DISABLE_FC_PAUSE_TIME
| FLAG_APME_IN_WUC,
.pba = 26,
.max_hw_frame_size = 4096,
.init_ops = e1000e_init_function_pointers_ich8lan,
.get_variants = e1000e_get_variants_ich8lan,
}
Definition at line 265 of file e1000e_main.c.
struct e1000_info* e1000_info_tbl[] [static] |
Initial value:
{
[board_82571] = &e1000_82571_info,
[board_82572] = &e1000_82572_info,
[board_82573] = &e1000_82573_info,
[board_82574] = &e1000_82574_info,
[board_82583] = &e1000_82583_info,
[board_80003es2lan] = &e1000_es2_info,
[board_ich8lan] = &e1000_ich8_info,
[board_ich9lan] = &e1000_ich9_info,
[board_ich10lan] = &e1000_ich10_info,
[board_pchlan] = &e1000_pch_info,
}
Definition at line 282 of file e1000e_main.c.
static struct net_device_operations e1000e_operations [static, read] |
Initial value:
{
.open = e1000e_open,
.close = e1000e_close,
.transmit = e1000e_transmit,
.poll = e1000e_poll,
.irq = e1000e_irq,
}
Definition at line 998 of file e1000e_main.c.
Referenced by e1000e_probe().
1.5.7.1