diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-06-24 23:00:12 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-06-30 16:44:24 -0400 |
commit | 626fdfec1588ac1341a37805809d03a719d977e0 (patch) | |
tree | 0f2bb4bcb5b36b3e856e2baadf89da8f9c3a541d /arch/x86 | |
parent | 2cdb3f1d834aab27a927be7555fbf4f9e43e9261 (diff) |
x86/PCI: get root CRS before scanning children
This allows us to remove adjust_transparent_bridge_resources and give
x86_pci_root_bus_res_quirks a chance when _CRS is not used or not there.
Acked-by: Gary Hade <garyhade@us.ibm.com>
Tested-by: Gary Hade <garyhade@us.ibm.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/pci/acpi.c | 32 | ||||
-rw-r--r-- | arch/x86/pci/amd_bus.c | 8 |
2 files changed, 15 insertions, 25 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 8bf152910eb0..1014eb4bfc37 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -118,23 +118,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | static void | 120 | static void |
121 | adjust_transparent_bridge_resources(struct pci_bus *bus) | ||
122 | { | ||
123 | struct pci_dev *dev; | ||
124 | |||
125 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
126 | int i; | ||
127 | u16 class = dev->class >> 8; | ||
128 | |||
129 | if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent) { | ||
130 | for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) | ||
131 | dev->subordinate->resource[i] = | ||
132 | dev->bus->resource[i - 3]; | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | |||
137 | static void | ||
138 | get_current_resources(struct acpi_device *device, int busnum, | 121 | get_current_resources(struct acpi_device *device, int busnum, |
139 | int domain, struct pci_bus *bus) | 122 | int domain, struct pci_bus *bus) |
140 | { | 123 | { |
@@ -161,8 +144,6 @@ get_current_resources(struct acpi_device *device, int busnum, | |||
161 | info.res_num = 0; | 144 | info.res_num = 0; |
162 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, | 145 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, |
163 | &info); | 146 | &info); |
164 | if (info.res_num) | ||
165 | adjust_transparent_bridge_resources(bus); | ||
166 | 147 | ||
167 | return; | 148 | return; |
168 | 149 | ||
@@ -225,8 +206,15 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
225 | */ | 206 | */ |
226 | memcpy(bus->sysdata, sd, sizeof(*sd)); | 207 | memcpy(bus->sysdata, sd, sizeof(*sd)); |
227 | kfree(sd); | 208 | kfree(sd); |
228 | } else | 209 | } else { |
229 | bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); | 210 | bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); |
211 | if (bus) { | ||
212 | if (pci_probe & PCI_USE__CRS) | ||
213 | get_current_resources(device, busnum, domain, | ||
214 | bus); | ||
215 | bus->subordinate = pci_scan_child_bus(bus); | ||
216 | } | ||
217 | } | ||
230 | 218 | ||
231 | if (!bus) | 219 | if (!bus) |
232 | kfree(sd); | 220 | kfree(sd); |
@@ -241,8 +229,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
241 | #endif | 229 | #endif |
242 | } | 230 | } |
243 | 231 | ||
244 | if (bus && (pci_probe & PCI_USE__CRS)) | ||
245 | get_current_resources(device, busnum, domain, bus); | ||
246 | return bus; | 232 | return bus; |
247 | } | 233 | } |
248 | 234 | ||
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index f893d6a6e803..3ffa10df20b9 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -100,8 +100,9 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b) | |||
100 | int j; | 100 | int j; |
101 | struct pci_root_info *info; | 101 | struct pci_root_info *info; |
102 | 102 | ||
103 | /* don't go for it if _CRS is used */ | 103 | /* don't go for it if _CRS is used already */ |
104 | if (pci_probe & PCI_USE__CRS) | 104 | if (b->resource[0] != &ioport_resource || |
105 | b->resource[1] != &iomem_resource) | ||
105 | return; | 106 | return; |
106 | 107 | ||
107 | /* if only one root bus, don't need to anything */ | 108 | /* if only one root bus, don't need to anything */ |
@@ -116,6 +117,9 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b) | |||
116 | if (i == pci_root_num) | 117 | if (i == pci_root_num) |
117 | return; | 118 | return; |
118 | 119 | ||
120 | printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n", | ||
121 | b->number); | ||
122 | |||
119 | info = &pci_root_info[i]; | 123 | info = &pci_root_info[i]; |
120 | for (j = 0; j < info->res_num; j++) { | 124 | for (j = 0; j < info->res_num; j++) { |
121 | struct resource *res; | 125 | struct resource *res; |