patch-2.4.19 linux-2.4.19/arch/mips/arc/tree.c
Next file: linux-2.4.19/arch/mips/au1000/common/Makefile
Previous file: linux-2.4.19/arch/mips/arc/time.c
Back to the patch index
Back to the overall index
- Lines: 171
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/arch/mips/arc/tree.c
- Orig date:
Sat May 13 08:29:14 2000
diff -urN linux-2.4.18/arch/mips/arc/tree.c linux-2.4.19/arch/mips/arc/tree.c
@@ -1,72 +1,88 @@
/*
- * tree.c: PROM component device tree code.
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
*
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ * PROM component device tree code.
*
- * $Id: tree.c,v 1.1 1998/10/18 13:32:10 tsbogend Exp $
+ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
+ * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
#include <linux/init.h>
+#include <asm/arc/types.h>
#include <asm/sgialib.h>
-#define DEBUG_PROM_TREE
+#undef DEBUG_PROM_TREE
-pcomponent * __init prom_getsibling(pcomponent *this)
+pcomponent * __init
+ArcGetPeer(pcomponent *Current)
{
- if(this == PROM_NULL_COMPONENT)
+ if (Current == PROM_NULL_COMPONENT)
return PROM_NULL_COMPONENT;
- return romvec->next_component(this);
+
+ return (pcomponent *) ARC_CALL1(next_component, Current);
}
-pcomponent * __init prom_getchild(pcomponent *this)
+pcomponent * __init
+ArcGetChild(pcomponent *Current)
{
- return romvec->child_component(this);
+ return (pcomponent *) ARC_CALL1(child_component, Current);
}
-pcomponent * __init prom_getparent(pcomponent *child)
+pcomponent * __init
+ArcGetParent(pcomponent *Current)
{
- if(child == PROM_NULL_COMPONENT)
+ if (Current == PROM_NULL_COMPONENT)
return PROM_NULL_COMPONENT;
- return romvec->parent_component(child);
+
+ return (pcomponent *) ARC_CALL1(parent_component, Current);
}
-long __init prom_getcdata(void *buffer, pcomponent *this)
+LONG __init
+ArcGetConfigurationData(VOID *Buffer, pcomponent *Current)
{
- return romvec->component_data(buffer, this);
+ return ARC_CALL2(component_data, Buffer, Current);
}
-pcomponent * __init prom_childadd(pcomponent *this, pcomponent *tmp, void *data)
+pcomponent * __init
+ArcAddChild(pcomponent *Current, pcomponent *Template, VOID *ConfigurationData)
{
- return romvec->child_add(this, tmp, data);
+ return (pcomponent *)
+ ARC_CALL3(child_add, Current, Template, ConfigurationData);
}
-long __init prom_delcomponent(pcomponent *this)
+LONG __init
+ArcDeleteComponent(pcomponent *ComponentToDelete)
{
- return romvec->comp_del(this);
+ return ARC_CALL1(comp_del, ComponentToDelete);
}
-pcomponent * __init prom_componentbypath(char *path)
+pcomponent * __init
+ArcGetComponent(CHAR *Path)
{
- return romvec->component_by_path(path);
+ return (pcomponent *)ARC_CALL1(component_by_path, Path);
}
#ifdef DEBUG_PROM_TREE
+
static char *classes[] = {
"system", "processor", "cache", "adapter", "controller", "peripheral",
"memory"
};
static char *types[] = {
- "arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache", "sccache",
- "memdev", "eisa adapter", "tc adapter", "scsi adapter", "dti adapter",
- "multi-func adapter", "disk controller", "tp controller",
- "cdrom controller", "worm controller", "serial controller",
- "net controller", "display controller", "parallel controller",
- "pointer controller", "keyboard controller", "audio controller",
- "misc controller", "disk peripheral", "floppy peripheral",
- "tp peripheral", "modem peripheral", "monitor peripheral",
- "printer peripheral", "pointer peripheral", "keyboard peripheral",
- "terminal peripheral", "line peripheral", "net peripheral",
- "misc peripheral", "anonymous"
+ "arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache",
+ "sccache", "memdev", "eisa adapter", "tc adapter", "scsi adapter",
+ "dti adapter", "multi-func adapter", "disk controller",
+ "tp controller", "cdrom controller", "worm controller",
+ "serial controller", "net controller", "display controller",
+ "parallel controller", "pointer controller", "keyboard controller",
+ "audio controller", "misc controller", "disk peripheral",
+ "floppy peripheral", "tp peripheral", "modem peripheral",
+ "monitor peripheral", "printer peripheral", "pointer peripheral",
+ "keyboard peripheral", "terminal peripheral", "line peripheral",
+ "net peripheral", "misc peripheral", "anonymous"
};
static char *iflags[] = {
@@ -74,7 +90,8 @@
"input", "output"
};
-static void __init dump_component(pcomponent *p)
+static void __init
+dump_component(pcomponent *p)
{
prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
p, classes[p->class], types[p->type],
@@ -83,27 +100,28 @@
p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
}
-static void __init traverse(pcomponent *p, int op)
+static void __init
+traverse(pcomponent *p, int op)
{
dump_component(p);
- if(prom_getchild(p))
- traverse(prom_getchild(p), 1);
- if(prom_getsibling(p) && op)
- traverse(prom_getsibling(p), 1);
+ if(ArcGetChild(p))
+ traverse(ArcGetChild(p), 1);
+ if(ArcGetPeer(p) && op)
+ traverse(ArcGetPeer(p), 1);
}
-void __init prom_testtree(void)
+void __init
+prom_testtree(void)
{
pcomponent *p;
- p = prom_getchild(PROM_NULL_COMPONENT);
+ p = ArcGetChild(PROM_NULL_COMPONENT);
dump_component(p);
- p = prom_getchild(p);
+ p = ArcGetChild(p);
while(p) {
dump_component(p);
- p = prom_getsibling(p);
+ p = ArcGetPeer(p);
}
- prom_printf("press a key\n");
- prom_getchar();
}
-#endif
+
+#endif /* DEBUG_PROM_TREE */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)