Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add support for device properties to override th...
details: https://anonhg.NetBSD.org/src/rev/3abc6b066354
branches: trunk
changeset: 751109:3abc6b066354
user: martin <martin%NetBSD.org@localhost>
date: Sun Jan 24 23:09:26 2010 +0000
description:
Add support for device properties to override the mac address and set
the BGE_NO_EEPROM flag if we have an onboard device w/o SEEPROM.
diffstat:
sys/dev/pci/if_bge.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diffs (73 lines):
diff -r 42319bca96cf -r 3abc6b066354 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c Sun Jan 24 22:56:12 2010 +0000
+++ b/sys/dev/pci/if_bge.c Sun Jan 24 23:09:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.173 2010/01/24 17:56:54 msaitoh Exp $ */
+/* $NetBSD: if_bge.c,v 1.174 2010/01/24 23:09:26 martin Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.173 2010/01/24 17:56:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.174 2010/01/24 23:09:26 martin Exp $");
#include "vlan.h"
#include "rnd.h"
@@ -2365,6 +2365,8 @@
bus_addr_t memaddr;
bus_size_t memsize;
uint32_t pm_ctl;
+ prop_data_t eaddrprop;
+ bool no_seeprom;
bp = bge_lookup(pa);
KASSERT(bp != NULL);
@@ -2611,8 +2613,16 @@
sc->bge_flags |= BGE_PHY_BER_BUG;
}
- /* SEEPROM check. Check the 'ROM failed' bit on the RX CPU */
- if (CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL)
+ /*
+ * SEEPROM check.
+ * First check if firmware knows we do not have SEEPROM.
+ */
+ if (prop_dictionary_get_bool(device_properties(self),
+ "without-seeprom", &no_seeprom) && no_seeprom)
+ sc->bge_flags |= BGE_NO_EEPROM;
+
+ /* Now check the 'ROM failed' bit on the RX CPU */
+ else if (CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL)
sc->bge_flags |= BGE_NO_EEPROM;
/* Try to reset the chip. */
@@ -2626,8 +2636,17 @@
}
/*
- * Get station address from the EEPROM.
+ * Get station address from the EEPROM (or use firmware values
+ * if provided via device properties)
*/
+ eaddrprop = prop_dictionary_get(device_properties(self), "mac-address");
+
+ if (eaddrprop != NULL && prop_data_size(eaddrprop) == ETHER_ADDR_LEN) {
+ memcpy(eaddr, prop_data_data_nocopy(eaddrprop),
+ ETHER_ADDR_LEN);
+ goto got_eaddr;
+ }
+
if (bge_get_eaddr(sc, eaddr)) {
aprint_error_dev(sc->bge_dev,
"failed to read station address\n");
@@ -2635,6 +2654,7 @@
return;
}
+got_eaddr:
br = bge_lookup_rev(sc->bge_chipid);
if (br == NULL) {
Home |
Main Index |
Thread Index |
Old Index