Rev 1628 | Rev 1633 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1628 | Rev 1631 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | #include |
3 | #include |
4 | #include |
4 | #include |
5 | #include |
5 | #include |
6 | 6 | ||
Line 7... | Line -... | ||
7 | LIST_HEAD(pci_root_buses); |
- | |
Line 8... | Line 7... | ||
8 | 7 | ||
9 | #define IO_SPACE_LIMIT 0xffff |
8 | #define IO_SPACE_LIMIT 0xffff |
Line 10... | Line 9... | ||
10 | #define PCIBIOS_SUCCESSFUL 0x00 |
9 | #define PCIBIOS_SUCCESSFUL 0x00 |
Line 106... | Line 105... | ||
106 | return pos; |
105 | return pos; |
107 | } |
106 | } |
Line 108... | Line -... | ||
108 | - | ||
109 | - | ||
110 | static struct pci_bus * pci_alloc_bus(void) |
- | |
111 | { |
- | |
112 | struct pci_bus *b; |
- | |
113 | - | ||
114 | b = kzalloc(sizeof(*b), GFP_KERNEL); |
- | |
115 | if (b) { |
- | |
116 | INIT_LIST_HEAD(&b->node); |
- | |
117 | INIT_LIST_HEAD(&b->children); |
- | |
118 | INIT_LIST_HEAD(&b->devices); |
- | |
119 | INIT_LIST_HEAD(&b->slots); |
- | |
120 | INIT_LIST_HEAD(&b->resources); |
- | |
121 | } |
- | |
122 | return b; |
- | |
123 | } |
- | |
124 | - | ||
125 | struct pci_bus * pci_create_bus(int bus, struct pci_ops *ops, void *sysdata) |
- | |
126 | { |
- | |
127 | int error; |
- | |
128 | struct pci_bus *b, *b2; |
- | |
129 | - | ||
130 | b = pci_alloc_bus(); |
- | |
131 | if (!b) |
- | |
132 | return NULL; |
- | |
133 | - | ||
134 | b->sysdata = sysdata; |
- | |
135 | b->ops = ops; |
- | |
136 | - | ||
137 | b2 = pci_find_bus(pci_domain_nr(b), bus); |
- | |
138 | if (b2) { |
- | |
139 | /* If we already got to this bus through a different bridge, ignore it */ |
- | |
140 | dbgprintf("bus already known\n"); |
- | |
141 | goto err_out; |
- | |
142 | } |
- | |
143 | - | ||
144 | // down_write(&pci_bus_sem); |
- | |
145 | list_add_tail(&b->node, &pci_root_buses); |
- | |
146 | // up_write(&pci_bus_sem); |
- | |
147 | - | ||
148 | b->number = b->secondary = bus; |
- | |
149 | b->resource[0] = &ioport_resource; |
- | |
150 | b->resource[1] = &iomem_resource; |
- | |
151 | - | ||
152 | return b; |
- | |
153 | - | ||
154 | err_out: |
- | |
155 | kfree(b); |
- | |
156 | return NULL; |
- | |
157 | } |
- | |
158 | - | ||
159 | - | ||
160 | - | ||
161 | 107 | ||
162 | 108 | ||
163 | static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) |
109 | static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) |
164 | { |
110 | { |
Line 314... | Line 260... | ||
314 | 260 | ||
Line 315... | Line 261... | ||
315 | return 0; |
261 | return 0; |
316 | }>=>> |
262 | } |
Line -... | Line 263... | ||
- | 263 | ||
- | 264 | #if 0 |
|
- | 265 | ||
- | 266 | u32 pci_probe = 0; |
|
- | 267 | ||
- | 268 | #define PCI_NOASSIGN_ROMS 0x80000 |
|
- | 269 | #define PCI_NOASSIGN_BARS 0x200000 |
|
- | 270 | ||
- | 271 | static void pcibios_fixup_device_resources(struct pci_dev *dev) |
|
- | 272 | { |
|
- | 273 | struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE]; |
|
- | 274 | struct resource *bar_r; |
|
- | 275 | int bar; |
|
- | 276 | ||
- | 277 | if (pci_probe & PCI_NOASSIGN_BARS) { |
|
- | 278 | /* |
|
- | 279 | * If the BIOS did not assign the BAR, zero out the |
|
- | 280 | * resource so the kernel doesn't attmept to assign |
|
- | 281 | * it later on in pci_assign_unassigned_resources |
|
- | 282 | */ |
|
- | 283 | for (bar = 0; bar <= PCI_STD_RESOURCE_END; bar++) { |
|
- | 284 | bar_r = &dev->resource[bar]; |
|
- | 285 | if (bar_r->start == 0 && bar_r->end != 0) { |
|
- | 286 | bar_r->flags = 0; |
|
- | 287 | bar_r->end = 0; |
|
- | 288 | } |
|
- | 289 | } |
|
- | 290 | } |
|
- | 291 | ||
- | 292 | if (pci_probe & PCI_NOASSIGN_ROMS) { |
|
- | 293 | if (rom_r->parent) |
|
- | 294 | return; |
|
- | 295 | if (rom_r->start) { |
|
- | 296 | /* we deal with BIOS assigned ROM later */ |
|
- | 297 | return; |
|
- | 298 | } |
|
- | 299 | rom_r->start = rom_r->end = rom_r->flags = 0; |
|
- | 300 | } |
|
- | 301 | } |
|
- | 302 | ||
- | 303 | /* |
|
- | 304 | * Called after each bus is probed, but before its children |
|
- | 305 | * are examined. |
|
- | 306 | */ |
|
- | 307 | ||
- | 308 | void pcibios_fixup_bus(struct pci_bus *b) |
|
- | 309 | { |
|
- | 310 | struct pci_dev *dev; |
|
- | 311 | ||
- | 312 | /* root bus? */ |
|
- | 313 | // if (!b->parent) |
|
- | 314 | // x86_pci_root_bus_res_quirks(b); |
|
- | 315 | pci_read_bridge_bases(b); |
|
- | 316 | list_for_each_entry(dev, &b->devices, bus_list) |
|
- | 317 | pcibios_fixup_device_resources(dev); |
|
- | 318 | } |
|
- | 319 |