Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 sync with sparc port. add support for OF_s...



details:   https://anonhg.NetBSD.org/src/rev/5ea0774704df
branches:  trunk
changeset: 499385:5ea0774704df
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Nov 18 23:43:06 2000 +0000

description:
sync with sparc port.  add support for OF_setprop(), OF_nextprop(),
OF_interpret() and OF_milliseconds().

diffstat:

 sys/arch/sparc64/include/openfirm.h |   22 ++++---
 sys/arch/sparc64/sparc64/openfirm.c |  101 +++++++++++++++++++++++++++++++++++-
 2 files changed, 111 insertions(+), 12 deletions(-)

diffs (164 lines):

diff -r 13da87ef6970 -r 5ea0774704df sys/arch/sparc64/include/openfirm.h
--- a/sys/arch/sparc64/include/openfirm.h       Sat Nov 18 22:46:07 2000 +0000
+++ b/sys/arch/sparc64/include/openfirm.h       Sat Nov 18 23:43:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openfirm.h,v 1.6 1999/01/31 09:21:19 mrg Exp $ */
+/*     $NetBSD: openfirm.h,v 1.7 2000/11/18 23:43:06 mrg Exp $ */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -46,13 +46,15 @@
 #define ADR2CELL(x)    (cell_t)(u_int)(int)(x)
 #endif
 
-int OF_test __P((char* service));
-int OF_test_method __P((int handle, char* method));
-int OF_getproplen __P((int handle, char* prop));
+int OF_test (char* service);
+int OF_test_method (int handle, char* method);
+int OF_getproplen (int handle, char* prop);
 
-int OF_stdin __P((void));
-int OF_stdout __P((void));
-void OF_poweroff __P((void)) __attribute__((__noreturn__));
-void OF_set_symbol_lookup __P((void (*s2v)(void *), void (*v2s)(void *)));
-void OF_sym2val __P((void *));
-void OF_val2sym __P((void *));
+int OF_stdin (void);
+int OF_stdout (void);
+void OF_set_symbol_lookup (void (*s2v)(void *), void (*v2s)(void *));
+void OF_poweroff (void) __attribute__((__noreturn__));
+void OF_sym2val (void *);
+void OF_val2sym (void *);
+void OF_interpret (char *);
+int  OF_milliseconds (void);
diff -r 13da87ef6970 -r 5ea0774704df sys/arch/sparc64/sparc64/openfirm.c
--- a/sys/arch/sparc64/sparc64/openfirm.c       Sat Nov 18 22:46:07 2000 +0000
+++ b/sys/arch/sparc64/sparc64/openfirm.c       Sat Nov 18 23:43:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: openfirm.c,v 1.10 2000/06/12 23:26:38 eeh Exp $        */
+/*     $NetBSD: openfirm.c,v 1.11 2000/11/18 23:43:07 mrg Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -39,7 +39,6 @@
 
 #define min(x,y)       ((x<y)?(x):(y))
 
-
 int
 OF_peer(phandle)
        int phandle;
@@ -182,6 +181,65 @@
 }
 
 int
+OF_setprop(handle, prop, buf, buflen)
+       int handle;
+       char *prop;
+       const void *buf;
+       int buflen;
+{
+       struct {
+               cell_t name;
+               cell_t nargs;
+               cell_t nreturns;
+               cell_t phandle;
+               cell_t prop;
+               cell_t buf;
+               cell_t buflen;
+               cell_t size;
+       } args;
+       
+       if (buflen > NBPG)
+               return -1;
+       args.name = ADR2CELL(&"setprop");
+       args.nargs = 4;
+       args.nreturns = 1;
+       args.phandle = HDL2CELL(handle);
+       args.prop = ADR2CELL(prop);
+       args.buf = ADR2CELL(buf);
+       args.buflen = buflen;
+       if (openfirmware(&args) == -1)
+               return -1;
+       return args.size;
+}
+
+int
+OF_nextprop(handle, prop, buf)
+       int handle;
+       char *prop;
+       void *buf;
+{
+       struct {
+               cell_t name;
+               cell_t nargs;
+               cell_t nreturns;
+               cell_t phandle;
+               cell_t prev;
+               cell_t buf;
+               cell_t next;
+       } args;
+       
+       args.name = ADR2CELL(&"nextprop");
+       args.nargs = 3;
+       args.nreturns = 1;
+       args.phandle = HDL2CELL(handle);
+       args.prev = ADR2CELL(prop);
+       args.buf = ADR2CELL(buf);
+       if (openfirmware(&args) == -1)
+               return -1;
+       return args.next;
+}
+
+int
 OF_finddevice(name)
 char *name;
 {
@@ -657,7 +715,46 @@
        (void)openfirmware(&args);
 }
 
+void
+OF_interpret(s)
+       char *s;
+{
+       struct {
+               cell_t name;
+               cell_t nargs;
+               cell_t nreturns;
+               cell_t verbs;
+               cell_t status;
+       } args;
+       
+       args.name = ADR2CELL(&"interpret");
+       args.nargs = 1;
+       args.nreturns = 1;
+       args.verbs = ADR2CELL(s);
+       openfirmware(&args);
+}
+
+int
+OF_milliseconds()
+{
+       struct {
+               cell_t name;
+               cell_t nargs;
+               cell_t nreturns;
+               cell_t ticks;
+       } args;
+       
+       args.name = ADR2CELL(&"milliseconds");
+       args.nargs = 0;
+       args.nreturns = 1;
+       openfirmware(&args);
+       return (args.ticks);
+}
+
+#if defined(_KERNEL) && !defined(_LKM)
 #include "opt_ddb.h"
+#endif
+
 #ifdef DDB
 #include <machine/db_machdep.h>
 #include <ddb/db_sym.h>



Home | Main Index | Thread Index | Old Index