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 use OpenFirmware, not prom version ...



details:   https://anonhg.NetBSD.org/src/rev/853007588b6a
branches:  trunk
changeset: 499386:853007588b6a
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Nov 18 23:45:05 2000 +0000

description:
use OpenFirmware, not prom version 0, operations.  eeprom(8) works now.

diffstat:

 sys/arch/sparc64/sparc64/openprom.c |  38 ++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 11 deletions(-)

diffs (112 lines):

diff -r 5ea0774704df -r 853007588b6a sys/arch/sparc64/sparc64/openprom.c
--- a/sys/arch/sparc64/sparc64/openprom.c       Sat Nov 18 23:43:06 2000 +0000
+++ b/sys/arch/sparc64/sparc64/openprom.c       Sat Nov 18 23:45:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openprom.c,v 1.1.1.1 1998/06/20 04:58:52 eeh Exp $ */
+/*     $NetBSD: openprom.c,v 1.2 2000/11/18 23:45:05 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -58,6 +58,8 @@
 #include <machine/autoconf.h>
 #include <machine/conf.h>
 
+#include <dev/ofw/openfirm.h>
+
 static int lastnode;                   /* speed hack */
 extern int optionsnode;                /* node ID of ROM's options */
 extern struct promvec *promvec;
@@ -133,10 +135,9 @@
        int flags;
        struct proc *p;
 {
-       register struct opiocdesc *op;
-       register int node, len, ok, error, s;
+       struct opiocdesc *op;
+       int node, len, ok, error, s;
        char *name, *value, *nextprop;
-       register struct nodeops *no;
 
        /* All too easy... */
        if (cmd == OPIOCGETOPTNODE) {
@@ -158,7 +159,6 @@
        }
 
        name = value = NULL;
-       no = promvec->pv_nodeops;
        error = 0;
        switch (cmd) {
 
@@ -171,7 +171,7 @@
                if (error)
                        break;
                s = splhigh();
-               len = no->no_proplen(node, name);
+               len = getproplen(node, name);
                splx(s);
                if (len > op->op_buflen) {
                        error = ENOMEM;
@@ -183,8 +183,10 @@
                        break;
                value = malloc(len, M_TEMP, M_WAITOK);
                s = splhigh();
-               (void)no->no_getprop(node, name, value);
+               error = getprop(node, name, 1, &len, (void **)&value);
                splx(s);
+               if (error != 0)
+                       break;
                error = copyout(value, op->op_buf, len);
                break;
 
@@ -200,7 +202,7 @@
                if (error)
                        break;
                s = splhigh();
-               len = no->no_setprop(node, name, value, op->op_buflen + 1);
+               len = OF_setprop(node, name, value, op->op_buflen + 1);
                splx(s);
                if (len != op->op_buflen)
                        error = EINVAL;
@@ -214,9 +216,23 @@
                error = openpromgetstr(op->op_namelen, op->op_name, &name);
                if (error)
                        break;
+               value = nextprop = malloc(op->op_buflen, M_TEMP, M_WAITOK);
+               if (nextprop == NULL) {
+                       error = ENOMEM;
+                       break;
+               }
                s = splhigh();
-               nextprop = no->no_nextprop(node, name);
+               error = OF_nextprop(node, name, nextprop);
                splx(s);
+               if (error == 0) {
+                       op->op_buflen = len;
+                       error = subyte(op->op_buf, 0);
+                       break;
+               }
+               if (error == -1) {
+                       error = EINVAL;
+                       break;
+               }
                len = strlen(nextprop);
                if (len > op->op_buflen)
                        len = op->op_buflen;
@@ -229,7 +245,7 @@
                if ((flags & FREAD) == 0)
                        return (EBADF);
                s = splhigh();
-               node = no->no_nextnode(node);
+               node = nextsibling(node);
                splx(s);
                *(int *)data = lastnode = node;
                break;
@@ -240,7 +256,7 @@
                if (node == 0)
                        return (EINVAL);
                s = splhigh();
-               node = no->no_child(node);
+               node = firstchild(node);
                splx(s);
                *(int *)data = lastnode = node;
                break;



Home | Main Index | Thread Index | Old Index