summaryrefslogtreecommitdiffstats
path: root/sys/dev/ofw
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-06-07 18:34:04 +0000
committerjake <jake@FreeBSD.org>2003-06-07 18:34:04 +0000
commitb5d362bc532139b1cd676ee21ec53643aacead85 (patch)
tree90a401e65fb20e15d7ff2f139ca82453524f6685 /sys/dev/ofw
parentf6787e2d572a825437cd1f02e96337640dc4f534 (diff)
downloadFreeBSD-src-b5d362bc532139b1cd676ee21ec53643aacead85.zip
FreeBSD-src-b5d362bc532139b1cd676ee21ec53643aacead85.tar.gz
Implement OF_interpret.
Obtained from: netbsd
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r--sys/dev/ofw/openfirm.c32
-rw-r--r--sys/dev/ofw/openfirm.h4
2 files changed, 34 insertions, 2 deletions
diff --git a/sys/dev/ofw/openfirm.c b/sys/dev/ofw/openfirm.c
index 7704109..472cd67 100644
--- a/sys/dev/ofw/openfirm.c
+++ b/sys/dev/ofw/openfirm.c
@@ -127,6 +127,38 @@ OF_test(char *name)
return args.missing;
}
+int
+OF_interpret(char *cmd, int nreturns, ...)
+{
+ va_list ap;
+ static struct {
+ cell_t name;
+ cell_t nargs;
+ cell_t nreturns;
+ cell_t slot[16];
+ } args = {
+ (cell_t)"interpret",
+ 1
+ };
+ cell_t status;
+ int i = 0;
+
+ args.nreturns = ++nreturns;
+ args.slot[i++] = (cell_t)cmd;
+ va_start(ap, nreturns);
+ while (i < 1)
+ args.slot[i++] = va_arg(ap, cell_t);
+ if (openfirmware(&args) == -1) {
+ va_end(ap);
+ return (-1);
+ }
+ status = args.slot[i++];
+ while (i < 1 + nreturns)
+ *va_arg(ap, cell_t *) = args.slot[i++];
+ va_end(ap);
+ return (status);
+}
+
/* Return firmware millisecond count. */
int
OF_milliseconds()
diff --git a/sys/dev/ofw/openfirm.h b/sys/dev/ofw/openfirm.h
index 903b452..77223c8 100644
--- a/sys/dev/ofw/openfirm.h
+++ b/sys/dev/ofw/openfirm.h
@@ -128,9 +128,9 @@ void OF_exit(void) __attribute__((noreturn));
void OF_chain(void *, u_int,
void (*)(void *, u_int, void *, void *, u_int), void *, u_int);
-#if 0
/* User interface functions */
-/* OF_interpret */
+int OF_interpret(char *, int, ...);
+#if 0
void *OF_set_callback(void *);
void OF_set_symbol_lookup(void *, void *);
#endif
OpenPOWER on IntegriCloud