Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/arcbios Add routines to walk the ARC BIOS component ...
details: https://anonhg.NetBSD.org/src/rev/7d82decda681
branches: trunk
changeset: 512287:7d82decda681
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Jul 08 22:57:10 2001 +0000
description:
Add routines to walk the ARC BIOS component tree.
diffstat:
sys/dev/arcbios/arcbios.c | 38 +++++++++++++++++++++++++++++++++++++-
sys/dev/arcbios/arcbiosvar.h | 13 ++++++++++++-
2 files changed, 49 insertions(+), 2 deletions(-)
diffs (82 lines):
diff -r c2261a5d65ee -r 7d82decda681 sys/dev/arcbios/arcbios.c
--- a/sys/dev/arcbios/arcbios.c Sun Jul 08 22:30:15 2001 +0000
+++ b/sys/dev/arcbios/arcbios.c Sun Jul 08 22:57:10 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arcbios.c,v 1.1 2001/07/08 19:58:02 thorpej Exp $ */
+/* $NetBSD: arcbios.c,v 1.2 2001/07/08 22:57:10 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -85,6 +85,42 @@
return (0);
}
+/****************************************************************************
+ * ARC component tree walking routines.
+ ****************************************************************************/
+
+static void
+arcbios_subtree_walk(struct arcbios_component *node,
+ void (*func)(struct arcbios_component *, struct arcbios_treewalk_context *),
+ struct arcbios_treewalk_context *atc)
+{
+
+ for (node = (*ARCBIOS->GetChild)(node);
+ node != NULL && atc->atc_terminate == 0;
+ node = (*ARCBIOS->GetPeer)(node)) {
+ (*func)(node, atc);
+ if (atc->atc_terminate)
+ return;
+ arcbios_subtree_walk(node, func, atc);
+ }
+}
+
+void
+arcbios_tree_walk(void (*func)(struct arcbios_component *,
+ struct arcbios_treewalk_context *), void *cookie)
+{
+ struct arcbios_treewalk_context atc;
+
+ atc.atc_cookie = cookie;
+ atc.atc_terminate = 0;
+
+ arcbios_subtree_walk(NULL, func, &atc);
+}
+
+/****************************************************************************
+ * Bootstrap console routines.
+ ****************************************************************************/
+
int
arcbios_cngetc(dev_t dev)
{
diff -r c2261a5d65ee -r 7d82decda681 sys/dev/arcbios/arcbiosvar.h
--- a/sys/dev/arcbios/arcbiosvar.h Sun Jul 08 22:30:15 2001 +0000
+++ b/sys/dev/arcbios/arcbiosvar.h Sun Jul 08 22:57:10 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arcbiosvar.h,v 1.1 2001/07/08 19:58:03 thorpej Exp $ */
+/* $NetBSD: arcbiosvar.h,v 1.2 2001/07/08 22:57:10 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,9 +38,20 @@
#ifdef _KERNEL
+/*
+ * Context used when walking the ARC BIOS component tree.
+ */
+struct arcbios_treewalk_context {
+ void *atc_cookie; /* client context */
+ int atc_terminate; /* to short-cut to the end */
+};
+
extern const struct arcbios_spb *ARCBIOS_SPB;
extern const struct arcbios_fv *ARCBIOS;
int arcbios_init(vaddr_t);
+void arcbios_tree_walk(void (*)(struct arcbios_component *,
+ struct arcbios_treewalk_context *), void *);
+
#endif /* _KERNEL */
Home |
Main Index |
Thread Index |
Old Index