2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * PROM component device tree code.
8 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 1999 Silicon Graphics, Inc.
12 #include <linux/init.h>
13 #include <asm/arc/types.h>
14 #include <asm/sgialib.h>
16 #undef DEBUG_PROM_TREE
19 ArcGetPeer(pcomponent *Current)
21 if (Current == PROM_NULL_COMPONENT)
22 return PROM_NULL_COMPONENT;
24 return (pcomponent *) ARC_CALL1(next_component, Current);
28 ArcGetChild(pcomponent *Current)
30 return (pcomponent *) ARC_CALL1(child_component, Current);
34 ArcGetParent(pcomponent *Current)
36 if (Current == PROM_NULL_COMPONENT)
37 return PROM_NULL_COMPONENT;
39 return (pcomponent *) ARC_CALL1(parent_component, Current);
43 ArcGetConfigurationData(VOID *Buffer, pcomponent *Current)
45 return ARC_CALL2(component_data, Buffer, Current);
49 ArcAddChild(pcomponent *Current, pcomponent *Template, VOID *ConfigurationData)
52 ARC_CALL3(child_add, Current, Template, ConfigurationData);
56 ArcDeleteComponent(pcomponent *ComponentToDelete)
58 return ARC_CALL1(comp_del, ComponentToDelete);
62 ArcGetComponent(CHAR *Path)
64 return (pcomponent *)ARC_CALL1(component_by_path, Path);
67 #ifdef DEBUG_PROM_TREE
69 static char *classes[] = {
70 "system", "processor", "cache", "adapter", "controller", "peripheral",
74 static char *types[] = {
75 "arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache",
76 "sccache", "memdev", "eisa adapter", "tc adapter", "scsi adapter",
77 "dti adapter", "multi-func adapter", "disk controller",
78 "tp controller", "cdrom controller", "worm controller",
79 "serial controller", "net controller", "display controller",
80 "parallel controller", "pointer controller", "keyboard controller",
81 "audio controller", "misc controller", "disk peripheral",
82 "floppy peripheral", "tp peripheral", "modem peripheral",
83 "monitor peripheral", "printer peripheral", "pointer peripheral",
84 "keyboard peripheral", "terminal peripheral", "line peripheral",
85 "net peripheral", "misc peripheral", "anonymous"
88 static char *iflags[] = {
89 "bogus", "read only", "removable", "console in", "console out",
94 dump_component(pcomponent *p)
96 prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
97 p, classes[p->class], types[p->type],
98 iflags[p->iflags], p->vers, p->rev);
99 prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
100 p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
104 traverse(pcomponent *p, int op)
108 traverse(ArcGetChild(p), 1);
109 if(ArcGetPeer(p) && op)
110 traverse(ArcGetPeer(p), 1);
118 p = ArcGetChild(PROM_NULL_COMPONENT);
127 #endif /* DEBUG_PROM_TREE */