This source file includes following definitions.
- prom_build_devtree
- prom_find_dev_on_bus
- prom_find_next_dev
1
2
3
4
5
6
7 #include <asm/openprom.h>
8 #include <asm/oplib.h>
9
10
11 enum bus_t {
12 OBIO_BUS,
13 SBUS_BUS,
14 PCI_BUS,
15 PMEM_BUS,
16 CPU_BUS,
17 };
18
19 struct sdevmapping {
20 unsigned long physpage;
21 int mapsz;
22 enum bus_t where;
23 };
24
25
26 #define NUM_SPARC_IRQS 15
27
28 struct sdev_irqs {
29 int level;
30 int vector;
31 };
32
33 struct sparcdev {
34 struct sparcdev *next;
35 struct sparcdev *prev;
36 int node;
37 char *name;
38 int num_mappings;
39 struct sdevmapping *maps;
40 int num_irqs;
41 struct sdev_irqs irqinfo[NUM_SPARC_IRQS];
42 };
43
44 struct sparcbus {
45 struct sparcbus *next;
46 enum bus_t type;
47 struct sparcdev *device_list;
48 };
49
50
51 struct sparcbus obiobus_info = { 0, OBIO_BUS, { 0, 0}, };
52 struct sparcbus sbusbus_info = { 0, SBUS_BUS, { 0, 0}, };
53 struct sparcbus pcibus_info = { 0, PCI_BUS, { 0, 0}, };
54 struct sparcbus pmembus_info = { 0, PMEM_BUS, { 0, 0}, };
55 struct sparcbus cpubus_info = { 0, CPU_BUS, { 0, 0}, };
56
57 struct sparcbus *sparcbus_list = 0;
58
59
60 int prom_build_devtree(unsigned long start_mem, unsigned long end_mem)
61 {
62 }
63
64
65
66
67
68
69 struct sparcdev *prom_find_dev_on_bus(bus_t bustype, char **name_vector, int num_names)
70 {
71 struct sparcdev *sdp;
72 struct sparcbus *thebus;
73 int niter;
74
75 if(!num_names)
76 return 0;
77
78 if(!sparcbus_list) {
79 prom_printf("prom_find_dev_on_bus: Device list not initted yet!\n");
80 prom_halt();
81 }
82
83 while(thebus = sparcbus_list; thebus; thebus = thebus->next)
84 if(thebus->type == bustype)
85 break;
86 if(!thebus || !thebus->device_list)
87 return 0;
88
89 for(sdp = thebus->device_list; sdp; sdp = sdp->next) {
90 for(niter = 0; niter < num_names; niter++)
91 if(!strcmp(sdp->name, name_vector[niter]))
92 break;
93 }
94 return sdp;
95 }
96
97
98
99
100
101 struct sparcdev *prom_find_next_dev(struct sparcdev *start_dev, char **name_vector, int num_names)
102 {
103 struct sparcdev *sdp;
104 int niter;
105
106 if(!start_dev->next || !num_names)
107 return 0;
108 for(sdp = start_dev->next; sdp; sdp = sdp->next) {
109 for(niter = 0; niter < num_names; niter++)
110 if(!strcmp(sdp->name, name_vector[niter]))
111 break;
112 }
113 return sdp;
114 }