Project

General

Profile

Bug #1050 ยป nfe_diff.txt

sepherosa, 07/07/2008 08:55 AM

 
? nfe_diff.txt
Index: if_nfe.c
===================================================================
RCS file: /dcvs/src/sys/dev/netif/nfe/if_nfe.c,v
retrieving revision 1.31
diff -u -p -r1.31 if_nfe.c
--- if_nfe.c 5 Jul 2008 07:29:44 -0000 1.31
+++ if_nfe.c 7 Jul 2008 08:50:15 -0000
@@ -373,7 +373,8 @@ nfe_probe(device_t dev)
case PCI_PRODUCT_NVIDIA_NFORCE_LAN:
case PCI_PRODUCT_NVIDIA_NFORCE2_LAN:
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN1:
- sc->sc_caps = NFE_NO_PWRCTL;
+ sc->sc_caps = NFE_NO_PWRCTL |
+ NFE_FIX_EADDR;
break;
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN2:
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN3:
@@ -381,10 +382,13 @@ nfe_probe(device_t dev)
case PCI_PRODUCT_NVIDIA_NFORCE3_LAN5:
sc->sc_caps = NFE_JUMBO_SUP |
NFE_HW_CSUM |
- NFE_NO_PWRCTL;
+ NFE_NO_PWRCTL |
+ NFE_FIX_EADDR;
break;
case PCI_PRODUCT_NVIDIA_MCP51_LAN1:
case PCI_PRODUCT_NVIDIA_MCP51_LAN2:
+ sc->sc_caps = NFE_FIX_EADDR;
+ /* FALL THROUGH */
case PCI_PRODUCT_NVIDIA_MCP61_LAN1:
case PCI_PRODUCT_NVIDIA_MCP61_LAN2:
case PCI_PRODUCT_NVIDIA_MCP61_LAN3:
@@ -397,7 +401,7 @@ nfe_probe(device_t dev)
case PCI_PRODUCT_NVIDIA_MCP73_LAN2:
case PCI_PRODUCT_NVIDIA_MCP73_LAN3:
case PCI_PRODUCT_NVIDIA_MCP73_LAN4:
- sc->sc_caps = NFE_40BIT_ADDR;
+ sc->sc_caps |= NFE_40BIT_ADDR;
break;
case PCI_PRODUCT_NVIDIA_CK804_LAN1:
case PCI_PRODUCT_NVIDIA_CK804_LAN2:
@@ -406,7 +410,8 @@ nfe_probe(device_t dev)
sc->sc_caps = NFE_JUMBO_SUP |
NFE_40BIT_ADDR |
NFE_HW_CSUM |
- NFE_NO_PWRCTL;
+ NFE_NO_PWRCTL |
+ NFE_FIX_EADDR;
break;
case PCI_PRODUCT_NVIDIA_MCP65_LAN1:
case PCI_PRODUCT_NVIDIA_MCP65_LAN2:
@@ -420,7 +425,8 @@ nfe_probe(device_t dev)
sc->sc_caps = NFE_JUMBO_SUP |
NFE_40BIT_ADDR |
NFE_HW_CSUM |
- NFE_HW_VLAN;
+ NFE_HW_VLAN |
+ NFE_FIX_EADDR;
break;
case PCI_PRODUCT_NVIDIA_MCP77_LAN1:
case PCI_PRODUCT_NVIDIA_MCP77_LAN2:
@@ -2114,17 +2120,27 @@ done:
static void
nfe_get_macaddr(struct nfe_softc *sc, uint8_t *addr)
{
- uint32_t tmp;
+ uint32_t lo, hi;
+
+ lo = NFE_READ(sc, NFE_MACADDR_LO);
+ hi = NFE_READ(sc, NFE_MACADDR_HI);
+ if (sc->sc_caps & NFE_FIX_EADDR) {
+ addr[0] = (lo >> 8) & 0xff;
+ addr[1] = (lo & 0xff);
+
+ addr[2] = (hi >> 24) & 0xff;
+ addr[3] = (hi >> 16) & 0xff;
+ addr[4] = (hi >> 8) & 0xff;
+ addr[5] = (hi & 0xff);
+ } else {
+ addr[0] = (hi & 0xff);
+ addr[1] = (hi >> 8) & 0xff;
+ addr[2] = (hi >> 16) & 0xff;
+ addr[3] = (hi >> 24) & 0xff;
- tmp = NFE_READ(sc, NFE_MACADDR_LO);
- addr[0] = (tmp >> 8) & 0xff;
- addr[1] = (tmp & 0xff);
-
- tmp = NFE_READ(sc, NFE_MACADDR_HI);
- addr[2] = (tmp >> 24) & 0xff;
- addr[3] = (tmp >> 16) & 0xff;
- addr[4] = (tmp >> 8) & 0xff;
- addr[5] = (tmp & 0xff);
+ addr[4] = (lo & 0xff);
+ addr[5] = (lo >> 8) & 0xff;
+ }
}
static void
Index: if_nfevar.h
===================================================================
RCS file: /dcvs/src/sys/dev/netif/nfe/if_nfevar.h,v
retrieving revision 1.9
diff -u -p -r1.9 if_nfevar.h
--- if_nfevar.h 5 Jul 2008 07:29:44 -0000 1.9
+++ if_nfevar.h 7 Jul 2008 08:50:15 -0000
@@ -97,6 +97,7 @@ struct nfe_softc {
#define NFE_40BIT_ADDR 0x02
#define NFE_HW_CSUM 0x04
#define NFE_HW_VLAN 0x08
+#define NFE_FIX_EADDR 0x10
#define NFE_NO_PWRCTL 0x20
uint32_t sc_flags;
    (1-1/1)