Rev 1628 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1627 | serge | 1 | |
2 | #include |
||
3 | #include |
||
4 | #include |
||
5 | #include |
||
6 | |||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | .name = "PCI IO", |
||
13 | .start = 0, |
||
14 | .end = IO_SPACE_LIMIT, |
||
15 | .flags = IORESOURCE_IO, |
||
16 | }; |
||
17 | |||
18 | |||
19 | .name = "PCI mem", |
||
20 | .start = 0, |
||
21 | .end = -1, |
||
22 | .flags = IORESOURCE_MEM, |
||
23 | }; |
||
24 | |||
25 | |||
26 | |||
27 | { |
||
28 | struct pci_sysdata *sd = bus->sysdata; |
||
29 | return sd->domain; |
||
30 | } |
||
31 | |||
32 | |||
33 | { |
||
34 | struct pci_bus *b; |
||
35 | |||
36 | |||
37 | if (b) { |
||
38 | INIT_LIST_HEAD(&b->node); |
||
39 | INIT_LIST_HEAD(&b->children); |
||
40 | INIT_LIST_HEAD(&b->devices); |
||
41 | INIT_LIST_HEAD(&b->slots); |
||
42 | INIT_LIST_HEAD(&b->resources); |
||
43 | } |
||
44 | return b; |
||
45 | } |
||
46 | |||
47 | |||
48 | { |
||
49 | int error; |
||
50 | struct pci_bus *b, *b2; |
||
51 | |||
52 | |||
53 | if (!b) |
||
54 | return NULL; |
||
55 | |||
56 | |||
57 | b->ops = ops; |
||
58 | |||
59 | |||
60 | if (b2) { |
||
61 | /* If we already got to this bus through a different bridge, ignore it */ |
||
62 | dbgprintf("bus already known\n"); |
||
63 | goto err_out; |
||
64 | } |
||
65 | |||
66 | |||
67 | list_add_tail(&b->node, &pci_root_buses); |
||
68 | // up_write(&pci_bus_sem); |
||
69 | |||
70 | |||
71 | b->resource[0] = &ioport_resource; |
||
72 | b->resource[1] = &iomem_resource; |
||
73 | |||
74 | |||
75 | |||
76 | |||
77 | kfree(b); |
||
78 | return NULL; |
||
79 | } |
||
80 | |||
81 | |||
82 | |||
83 | |||
84 | |||
85 | |||
86 | { |
||
87 | struct pci_bus* child; |
||
88 | struct list_head *tmp; |
||
89 | |||
90 | |||
91 | return bus; |
||
92 | |||
93 | |||
94 | child = pci_do_find_bus(pci_bus_b(tmp), busnr); |
||
95 | if(child) |
||
96 | return child; |
||
97 | } |
||
98 | return NULL; |
||
99 | } |
||
100 | |||
101 | |||
102 | |||
103 | * pci_find_bus - locate PCI bus from a given domain and bus number |
||
104 | * @domain: number of PCI domain to search |
||
105 | * @busnr: number of desired PCI bus |
||
106 | * |
||
107 | * Given a PCI bus number and domain number, the desired PCI bus is located |
||
108 | * in the global list of PCI buses. If the bus is found, a pointer to its |
||
109 | * data structure is returned. If no bus is found, %NULL is returned. |
||
110 | */ |
||
111 | struct pci_bus * pci_find_bus(int domain, int busnr) |
||
112 | { |
||
113 | struct pci_bus *bus = NULL; |
||
114 | struct pci_bus *tmp_bus; |
||
115 | |||
116 | |||
117 | if (pci_domain_nr(bus) != domain) |
||
118 | continue; |
||
119 | tmp_bus = pci_do_find_bus(bus, busnr); |
||
120 | if (tmp_bus) |
||
121 | return tmp_bus; |
||
122 | } |
||
123 | return NULL; |
||
124 | } |
||
125 | |||
126 | |||
127 | * pci_find_next_bus - begin or continue searching for a PCI bus |
||
128 | * @from: Previous PCI bus found, or %NULL for new search. |
||
129 | * |
||
130 | * Iterates through the list of known PCI busses. A new search is |
||
131 | * initiated by passing %NULL as the @from argument. Otherwise if |
||
132 | * @from is not %NULL, searches continue from next device on the |
||
133 | * global list. |
||
134 | */ |
||
135 | struct pci_bus * |
||
136 | pci_find_next_bus(const struct pci_bus *from) |
||
137 | { |
||
138 | struct list_head *n; |
||
139 | struct pci_bus *b = NULL; |
||
140 | |||
141 | |||
142 | // down_read(&pci_bus_sem); |
||
143 | n = from ? from->node.next : pci_root_buses.next; |
||
144 | if (n != &pci_root_buses) |
||
145 | b = pci_bus_b(n); |
||
146 | // up_read(&pci_bus_sem); |
||
147 | return b; |
||
148 | } |
||
149 |