Deleted Added
full compact
if_lem.c (205987) if_lem.c (206001)
1/******************************************************************************
2
3 Copyright (c) 2001-2010, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32******************************************************************************/
1/******************************************************************************
2
3 Copyright (c) 2001-2010, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8

--- 16 unchanged lines hidden (view full) ---

25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32******************************************************************************/
33/*$FreeBSD: head/sys/dev/e1000/if_lem.c 205987 2010-03-31 16:42:22Z jfv $*/
33/*$FreeBSD: head/sys/dev/e1000/if_lem.c 206001 2010-03-31 20:43:24Z marius $*/
34
35#ifdef HAVE_KERNEL_OPTION_HEADERS
36#include "opt_device_polling.h"
37#include "opt_inet.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>

--- 32 unchanged lines hidden (view full) ---

74#include <netinet/in.h>
75#include <netinet/if_ether.h>
76#include <netinet/ip.h>
77#include <netinet/ip6.h>
78#include <netinet/tcp.h>
79#include <netinet/udp.h>
80
81#include <machine/in_cksum.h>
34
35#ifdef HAVE_KERNEL_OPTION_HEADERS
36#include "opt_device_polling.h"
37#include "opt_inet.h"
38#endif
39
40#include <sys/param.h>
41#include <sys/systm.h>

--- 32 unchanged lines hidden (view full) ---

74#include <netinet/in.h>
75#include <netinet/if_ether.h>
76#include <netinet/ip.h>
77#include <netinet/ip6.h>
78#include <netinet/tcp.h>
79#include <netinet/udp.h>
80
81#include <machine/in_cksum.h>
82#include <dev/led/led.h>
82#include <dev/pci/pcivar.h>
83#include <dev/pci/pcireg.h>
84
85#include "e1000_api.h"
86#include "if_lem.h"
87
88/*********************************************************************
89 * Set this to one to display debug statistics

--- 158 unchanged lines hidden (view full) ---

248/* Management and WOL Support */
249static void lem_init_manageability(struct adapter *);
250static void lem_release_manageability(struct adapter *);
251static void lem_get_hw_control(struct adapter *);
252static void lem_release_hw_control(struct adapter *);
253static void lem_get_wakeup(device_t);
254static void lem_enable_wakeup(device_t);
255static int lem_enable_phy_wakeup(struct adapter *);
83#include <dev/pci/pcivar.h>
84#include <dev/pci/pcireg.h>
85
86#include "e1000_api.h"
87#include "if_lem.h"
88
89/*********************************************************************
90 * Set this to one to display debug statistics

--- 158 unchanged lines hidden (view full) ---

249/* Management and WOL Support */
250static void lem_init_manageability(struct adapter *);
251static void lem_release_manageability(struct adapter *);
252static void lem_get_hw_control(struct adapter *);
253static void lem_release_hw_control(struct adapter *);
254static void lem_get_wakeup(device_t);
255static void lem_enable_wakeup(device_t);
256static int lem_enable_phy_wakeup(struct adapter *);
257static void lem_led_func(void *, int);
256
257#ifdef EM_LEGACY_IRQ
258static void lem_intr(void *);
259#else /* FAST IRQ */
260#if __FreeBSD_version < 700000
261static void lem_irq_fast(void *);
262#else
263static int lem_irq_fast(void *);

--- 398 unchanged lines hidden (view full) ---

662
663 /* Non-AMT based hardware can now take control from firmware */
664 if (adapter->has_manage && !adapter->has_amt)
665 lem_get_hw_control(adapter);
666
667 /* Tell the stack that the interface is not active */
668 adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
669
258
259#ifdef EM_LEGACY_IRQ
260static void lem_intr(void *);
261#else /* FAST IRQ */
262#if __FreeBSD_version < 700000
263static void lem_irq_fast(void *);
264#else
265static int lem_irq_fast(void *);

--- 398 unchanged lines hidden (view full) ---

664
665 /* Non-AMT based hardware can now take control from firmware */
666 if (adapter->has_manage && !adapter->has_amt)
667 lem_get_hw_control(adapter);
668
669 /* Tell the stack that the interface is not active */
670 adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
671
672 adapter->led_dev = led_create(lem_led_func, adapter,
673 device_get_nameunit(dev));
674
670 INIT_DEBUGOUT("lem_attach: end");
671
672 return (0);
673
674err_rx_struct:
675 lem_free_transmit_structures(adapter);
676err_tx_struct:
677err_hw_init:

--- 39 unchanged lines hidden (view full) ---

717 return (EBUSY);
718 }
719
720#ifdef DEVICE_POLLING
721 if (ifp->if_capenable & IFCAP_POLLING)
722 ether_poll_deregister(ifp);
723#endif
724
675 INIT_DEBUGOUT("lem_attach: end");
676
677 return (0);
678
679err_rx_struct:
680 lem_free_transmit_structures(adapter);
681err_tx_struct:
682err_hw_init:

--- 39 unchanged lines hidden (view full) ---

722 return (EBUSY);
723 }
724
725#ifdef DEVICE_POLLING
726 if (ifp->if_capenable & IFCAP_POLLING)
727 ether_poll_deregister(ifp);
728#endif
729
730 if (adapter->led_dev != NULL)
731 led_destroy(adapter->led_dev);
732
725 EM_CORE_LOCK(adapter);
726 EM_TX_LOCK(adapter);
727 adapter->in_detach = 1;
728 lem_stop(adapter);
729 e1000_phy_hw_reset(&adapter->hw);
730
731 lem_release_manageability(adapter);
732

--- 1514 unchanged lines hidden (view full) ---

2247 callout_stop(&adapter->tx_fifo_timer);
2248
2249 /* Tell the stack that the interface is no longer active */
2250 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
2251
2252 e1000_reset_hw(&adapter->hw);
2253 if (adapter->hw.mac.type >= e1000_82544)
2254 E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0);
733 EM_CORE_LOCK(adapter);
734 EM_TX_LOCK(adapter);
735 adapter->in_detach = 1;
736 lem_stop(adapter);
737 e1000_phy_hw_reset(&adapter->hw);
738
739 lem_release_manageability(adapter);
740

--- 1514 unchanged lines hidden (view full) ---

2255 callout_stop(&adapter->tx_fifo_timer);
2256
2257 /* Tell the stack that the interface is no longer active */
2258 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
2259
2260 e1000_reset_hw(&adapter->hw);
2261 if (adapter->hw.mac.type >= e1000_82544)
2262 E1000_WRITE_REG(&adapter->hw, E1000_WUC, 0);
2263
2264 e1000_led_off(&adapter->hw);
2265 e1000_cleanup_led(&adapter->hw);
2255}
2256
2257
2258/*********************************************************************
2259 *
2260 * Determine hardware revision.
2261 *
2262 **********************************************************************/

--- 1858 unchanged lines hidden (view full) ---

4121 }
4122 return;
4123}
4124
4125
4126/*
4127 * Enable PCI Wake On Lan capability
4128 */
2266}
2267
2268
2269/*********************************************************************
2270 *
2271 * Determine hardware revision.
2272 *
2273 **********************************************************************/

--- 1858 unchanged lines hidden (view full) ---

4132 }
4133 return;
4134}
4135
4136
4137/*
4138 * Enable PCI Wake On Lan capability
4139 */
4129void
4140static void
4130lem_enable_wakeup(device_t dev)
4131{
4132 struct adapter *adapter = device_get_softc(dev);
4133 struct ifnet *ifp = adapter->ifp;
4134 u32 pmc, ctrl, ctrl_ext, rctl;
4135 u16 status;
4136
4137 if ((pci_find_extcap(dev, PCIY_PMG, &pmc) != 0))

--- 125 unchanged lines hidden (view full) ---

4263 if (ret)
4264 printf("Could not set PHY Host Wakeup bit\n");
4265out:
4266 hw->phy.ops.release(hw);
4267
4268 return ret;
4269}
4270
4141lem_enable_wakeup(device_t dev)
4142{
4143 struct adapter *adapter = device_get_softc(dev);
4144 struct ifnet *ifp = adapter->ifp;
4145 u32 pmc, ctrl, ctrl_ext, rctl;
4146 u16 status;
4147
4148 if ((pci_find_extcap(dev, PCIY_PMG, &pmc) != 0))

--- 125 unchanged lines hidden (view full) ---

4274 if (ret)
4275 printf("Could not set PHY Host Wakeup bit\n");
4276out:
4277 hw->phy.ops.release(hw);
4278
4279 return ret;
4280}
4281
4282static void
4283lem_led_func(void *arg, int onoff)
4284{
4285 struct adapter *adapter = arg;
4271
4286
4287 EM_CORE_LOCK(adapter);
4288 if (onoff) {
4289 e1000_setup_led(&adapter->hw);
4290 e1000_led_on(&adapter->hw);
4291 } else {
4292 e1000_led_off(&adapter->hw);
4293 e1000_cleanup_led(&adapter->hw);
4294 }
4295 EM_CORE_UNLOCK(adapter);
4296}
4297
4272/*********************************************************************
4273* 82544 Coexistence issue workaround.
4274* There are 2 issues.
4275* 1. Transmit Hang issue.
4276* To detect this issue, following equation can be used...
4277* SIZE[3:0] + ADDR[2:0] = SUM[3:0].
4278* If SUM[3:0] is in between 1 to 4, we will have this issue.
4279*

--- 401 unchanged lines hidden ---
4298/*********************************************************************
4299* 82544 Coexistence issue workaround.
4300* There are 2 issues.
4301* 1. Transmit Hang issue.
4302* To detect this issue, following equation can be used...
4303* SIZE[3:0] + ADDR[2:0] = SUM[3:0].
4304* If SUM[3:0] is in between 1 to 4, we will have this issue.
4305*

--- 401 unchanged lines hidden ---