Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 Switch to promlib interface.



details:   https://anonhg.NetBSD.org/src/rev/72f5fd7b21c3
branches:  trunk
changeset: 559648:72f5fd7b21c3
user:      pk <pk%NetBSD.org@localhost>
date:      Sun Mar 21 14:15:35 2004 +0000

description:
Switch to promlib interface.

diffstat:

 sys/arch/sparc64/sparc64/db_interface.c |  14 ++++++--------
 sys/arch/sparc64/sparc64/rbus_machdep.c |  29 ++++++++++++++++-------------
 2 files changed, 22 insertions(+), 21 deletions(-)

diffs (123 lines):

diff -r 3cc49a8d187a -r 72f5fd7b21c3 sys/arch/sparc64/sparc64/db_interface.c
--- a/sys/arch/sparc64/sparc64/db_interface.c   Sun Mar 21 14:13:15 2004 +0000
+++ b/sys/arch/sparc64/sparc64/db_interface.c   Sun Mar 21 14:15:35 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.75 2004/03/14 18:18:54 chs Exp $ */
+/*     $NetBSD: db_interface.c,v 1.76 2004/03/21 14:15:35 pk Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.75 2004/03/14 18:18:54 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.76 2004/03/21 14:15:35 pk Exp $");
 
 #include "opt_ddb.h"
 
@@ -59,15 +59,13 @@
 
 #include <machine/instr.h>
 #include <machine/cpu.h>
-#include <machine/openfirm.h>
+#include <machine/promlib.h>
 #include <machine/ctlreg.h>
 #include <machine/pmap.h>
 
 #include "fb.h"
 #include "esp_sbus.h"
 
-extern void OF_enter __P((void));
-
 db_regs_t              ddb_regs;
 
 extern struct traptrace {
@@ -304,9 +302,9 @@
        default:
                printf("kernel trap %x: %s\n", type, trap_type[type & 0x1ff]);
                if (db_recover != 0) {
-                       OF_enter();
+                       prom_abort();
                        db_error("Faulted in DDB; continuing...\n");
-                       OF_enter();
+                       prom_abort();
                        /*NOTREACHED*/
                }
                db_recover = (label_t *)1;
@@ -444,7 +442,7 @@
        char *modif;
 {
 
-       OF_enter();
+       prom_abort();
 }
 
 void
diff -r 3cc49a8d187a -r 72f5fd7b21c3 sys/arch/sparc64/sparc64/rbus_machdep.c
--- a/sys/arch/sparc64/sparc64/rbus_machdep.c   Sun Mar 21 14:13:15 2004 +0000
+++ b/sys/arch/sparc64/sparc64/rbus_machdep.c   Sun Mar 21 14:15:35 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rbus_machdep.c,v 1.5 2003/08/29 12:36:44 nakayama Exp $        */
+/*     $NetBSD: rbus_machdep.c,v 1.6 2004/03/21 14:15:35 pk Exp $      */
 
 /*
  * Copyright (c) 2003 Takeshi Nakayama.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.5 2003/08/29 12:36:44 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.6 2004/03/21 14:15:35 pk Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -137,7 +137,8 @@
        struct psycho_pbm *pp = pc->cookie;
        pcireg_t reg;
        int node = PCITAG_NODE(pa->pa_tag);
-       int bus, br[2];
+       int error;
+       int bus, *br;
        int len, intr;
 
        /*
@@ -145,7 +146,9 @@
         *      if OBP didn't assign a bus number to the cardbus bridge,
         *      then assign it here.
         */
-       if (OF_getprop(node, "bus-range", br, sizeof(br)) == sizeof(br)) {
+       br = 0;
+       error = prom_getprop(node, "bus-range", sizeof(br), &len, &brp);
+       if (error == 0 && len == 2) {
                bus = br[0];
                DPRINTF("pccbb_attach_hook: bus-range %d-%d\n", br[0], br[1]);
                if (bus < 0 || bus >= 256)
@@ -189,18 +192,18 @@
         *      interrupt numbers assigned by OBP are [0x00,0x3f],
         *      so they map to [0x40,0x7f] due to inhibit the value 0x00.
         */
-       len = OF_getproplen(node, "interrupts");
-       if (len < sizeof(intr))
-               printf("pccbb_attach_hook: interrupts len %d too small\n",
-                      len);
-       else if (OF_getprop(node, "interrupts", &intr, sizeof(intr)) != len)
+       if ((intr = prom_getpropint(node, "interrupts", -1) == -1) {
                printf("pccbb_attach_hook: could not read interrupts\n");
-       else if (OF_mapintr(node, &intr, sizeof(intr), sizeof(intr)) < 0)
+               return;
+       }
+
+       if (OF_mapintr(node, &intr, sizeof(intr), sizeof(intr)) < 0) {
                printf("pccbb_attach_hook: OF_mapintr failed\n");
-       else {
-               pa->pa_intrline = intr | 0x40;
-               DPRINTF("pccbb_attach_hook: interrupt line %d\n", intr);
+               return;
        }
+
+       pa->pa_intrline = intr | 0x40;
+       DPRINTF("pccbb_attach_hook: interrupt line %d\n", intr);
 }
 
 /*



Home | Main Index | Thread Index | Old Index