Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sandpoint/stand/altboot Handle devices with two net...



details:   https://anonhg.NetBSD.org/src/rev/1f0ae9cf3c63
branches:  trunk
changeset: 772391:1f0ae9cf3c63
user:      phx <phx%NetBSD.org@localhost>
date:      Sun Jan 01 18:25:03 2012 +0000

description:
Handle devices with two network interfaces (e.g. a DSM-G600 with stge(4)
and ath(4)).

diffstat:

 sys/arch/sandpoint/stand/altboot/main.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (63 lines):

diff -r 94aa2d0b9f06 -r 1f0ae9cf3c63 sys/arch/sandpoint/stand/altboot/main.c
--- a/sys/arch/sandpoint/stand/altboot/main.c   Sun Jan 01 17:31:42 2012 +0000
+++ b/sys/arch/sandpoint/stand/altboot/main.c   Sun Jan 01 18:25:03 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.15 2011/11/06 20:20:57 phx Exp $ */
+/* $NetBSD: main.c,v 1.16 2012/01/01 18:25:03 phx Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
 extern char newaltboot[], newaltboot_end[];
 
 struct pcidev lata[2];
-struct pcidev lnif[1];
+struct pcidev lnif[2];
 struct pcidev lusb[3];
 int nata, nnif, nusb;
 
@@ -137,7 +137,7 @@
                nata = pcilookup(PCI_CLASS_MISCSTORAGE, lata, 2);
        if (nata == 0)
                nata = pcilookup(PCI_CLASS_SCSI, lata, 2);
-       nnif = pcilookup(PCI_CLASS_ETH, lnif, 1);
+       nnif = pcilookup(PCI_CLASS_ETH, lnif, 2);
        nusb = pcilookup(PCI_CLASS_USB, lusb, 3);
 
 #ifdef DEBUG
@@ -153,10 +153,10 @@
        }
        if (nnif == 0)
                printf("no NET found\n");
-       else {
+       else for (n = 0; n < nnif; n++) {
                int b, d, f, bdf, pvd;
-               bdf = lnif[0].bdf;
-               pvd = lnif[0].pvd;
+               bdf = lnif[n].bdf;
+               pvd = lnif[n].pvd;
                pcidecomposetag(bdf, &b, &d, &f);
                printf("%04x.%04x NET %02d:%02d:%02d\n",
                    PCI_VENDOR(pvd), PCI_PRODUCT(pvd), b, d, f);
@@ -176,11 +176,18 @@
        pcisetup();
        pcifixup();
 
-       if (dskdv_init(&lata[0]) == 0
-           || (nata == 2 && dskdv_init(&lata[1]) == 0))
+       /* intialize a disk driver */
+       for (n = 0; n < nata; n++)
+               if (dskdv_init(&lata[n]) != 0)
+                       break;
+       if (n >= nata)
                printf("IDE/SATA device driver was not found\n");
 
-       if (netif_init(&lnif[0]) == 0)
+       /* initialize a network interface */
+       for (n = 0; n < nnif; n++)
+               if (netif_init(&lnif[n]) != 0)
+                       break;
+       if (n >= nnif)
                printf("no NET device driver was found\n");
 
        /*



Home | Main Index | Thread Index | Old Index