Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/arch/sparc/stand/common Pull up revision 1.9 (reque...



details:   https://anonhg.NetBSD.org/src/rev/a78fc177fa60
branches:  netbsd-1-5
changeset: 490573:a78fc177fa60
user:      he <he%NetBSD.org@localhost>
date:      Sat Feb 03 17:51:49 2001 +0000

description:
Pull up revision 1.9 (requested by pk):
  On V0 proms, read the ``idprom'' property at the root node to
  get to the station's ethernet address.  Fixes netbooting on some
  older SPARCstations where the boot program would otherwise crash.

diffstat:

 sys/arch/sparc/stand/common/promdev.c |  40 ++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 10 deletions(-)

diffs (69 lines):

diff -r 33ade6f3746b -r a78fc177fa60 sys/arch/sparc/stand/common/promdev.c
--- a/sys/arch/sparc/stand/common/promdev.c     Sat Feb 03 17:45:12 2001 +0000
+++ b/sys/arch/sparc/stand/common/promdev.c     Sat Feb 03 17:51:49 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: promdev.c,v 1.8 1999/04/28 13:20:55 christos Exp $ */
+/*     $NetBSD: promdev.c,v 1.8.12.1 2001/02/03 17:51:49 he Exp $ */
 
 /*
  * Copyright (c) 1993 Paul Kranenburg
@@ -457,30 +457,50 @@
        u_char *ea;
 {
 static struct idprom idprom;
-       char buf[64];
-       u_char *src, *dst;
-       int len, x;
 
        switch (prom_version()) {
        case PROM_OLDMON:
                if (idprom.id_format == 0) {
-                       dst = (char*)&idprom;
-                       src = (char*)AC_IDPROM;
-                       len = sizeof(struct idprom);
+                       int len = sizeof(struct idprom);
+                       u_char *src = (char *)AC_IDPROM;
+                       u_char *dst = (char *)&idprom;
                        do {
-                               x = lduba(src++, ASI_CONTROL);
-                               *dst++ = x;
+                               *dst++ = lduba(src++, ASI_CONTROL);
                        } while (--len > 0);
                }
                bcopy(idprom.id_ether, ea, 6);
                break;
+
+       /*
+        * XXX - maybe we should simply always look at the `idprom' property
+        *       and not bother with `pv_enaddr' or `prom_interpret()' at all.
+        */
        case PROM_OBP_V0:
+               if (idprom.id_format == 0) {
+                       void *buf = &idprom;
+                       int len = sizeof(struct idprom);
+                       int node = prom_findroot();
+                       if (getprop(node, "idprom", 1, &len, &buf) != 0) {
+                               printf("`idprom' property cannot be read: "
+                                       "cannot get ethernet address");
+                               /*
+                                * Copy ethernet address into `ea' anyway,
+                                * so that it will be zeroed.
+                                */
+                       }
+               }
+               bcopy(idprom.id_ether, ea, 6);
+               break;
+
        case PROM_OBP_V2:
                (void)(*obpvec->pv_enaddr)(fd, (char *)ea);
                break;
-       case PROM_OBP_V3:
+
+       case PROM_OBP_V3: {
+               char buf[64];
                sprintf(buf, "%lx mac-address drop swap 6 cmove", (u_long)ea);
                prom_interpret(buf);
+               }
                break;
        }
 }



Home | Main Index | Thread Index | Old Index