Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci PR/41258: Elias Benali: Try to get the ethernet ...



details:   https://anonhg.NetBSD.org/src/rev/f3263fb59baa
branches:  trunk
changeset: 764416:f3263fb59baa
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Apr 20 20:15:03 2011 +0000

description:
PR/41258: Elias Benali: Try to get the ethernet address from the BIOS before
failing.

diffstat:

 sys/dev/pci/if_lii.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (46 lines):

diff -r e20bbd04dd5d -r f3263fb59baa sys/dev/pci/if_lii.c
--- a/sys/dev/pci/if_lii.c      Wed Apr 20 20:02:58 2011 +0000
+++ b/sys/dev/pci/if_lii.c      Wed Apr 20 20:15:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_lii.c,v 1.9 2010/04/05 07:20:26 joerg Exp $ */
+/*     $NetBSD: if_lii.c,v 1.10 2011/04/20 20:15:03 christos Exp $     */
 
 /*
  *  Copyright (c) 2008 The NetBSD Foundation.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.9 2010/04/05 07:20:26 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lii.c,v 1.10 2011/04/20 20:15:03 christos Exp $");
 
 
 #include <sys/param.h>
@@ -551,17 +551,18 @@
        }
 
        if (found < 2) {
-               aprint_error_dev(sc->sc_dev, "error reading MAC address\n");
-               return 1;
-       }
-
-       addr0 = htole32(addr0);
-       addr1 = htole32(addr1);
-
-       if ((addr0 == 0xffffff && (addr1 & 0xffff) == 0xffff) ||
-           (addr0 == 0 && (addr1 & 0xffff) == 0)) {
+               /* Make sure we try the BIOS method before giving up */
                addr0 = htole32(AT_READ_4(sc, ATL2_MAC_ADDR_0));
                addr1 = htole32(AT_READ_4(sc, ATL2_MAC_ADDR_1));
+               if ((addr0 == 0xffffff && (addr1 & 0xffff) == 0xffff) ||
+                   (addr0 == 0 && (addr1 & 0xffff) == 0)) {
+                       aprint_error_dev(sc->sc_dev,
+                           "error reading MAC address\n");
+                       return 1;
+               }
+       } else {
+               addr0 = htole32(addr0);
+               addr1 = htole32(addr1);
        }
 
        ea[0] = (addr1 & 0x0000ff00) >> 8;



Home | Main Index | Thread Index | Old Index