diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 21:50:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-11 21:50:26 -0500 |
commit | 7b67e751479d50b7f84d1a3cc5216eed5e534b66 (patch) | |
tree | a1a6746857cf65f04dde739fe271bf4143d55eaf /arch/x86 | |
parent | 9f13a1fd452f11c18004ba2422a6384b424ec8a9 (diff) | |
parent | 76ccc297018d25d55b789bbd508861ef1e2cdb0c (diff) |
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci: (80 commits)
x86/PCI: Expand the x86_msi_ops to have a restore MSIs.
PCI: Increase resource array mask bit size in pcim_iomap_regions()
PCI: DEVICE_COUNT_RESOURCE should be equal to PCI_NUM_RESOURCES
PCI: pci_ids: add device ids for STA2X11 device (aka ConneXT)
PNP: work around Dell 1536/1546 BIOS MMCONFIG bug that breaks USB
x86/PCI: amd: factor out MMCONFIG discovery
PCI: Enable ATS at the device state restore
PCI: msi: fix imbalanced refcount of msi irq sysfs objects
PCI: kconfig: English typo in pci/pcie/Kconfig
PCI/PM/Runtime: make PCI traces quieter
PCI: remove pci_create_bus()
xtensa/PCI: convert to pci_scan_root_bus() for correct root bus resources
x86/PCI: convert to pci_create_root_bus() and pci_scan_root_bus()
x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented()
x86/PCI: read Broadcom CNB20LE host bridge info before PCI scan
sparc32, leon/PCI: convert to pci_scan_root_bus() for correct root bus resources
sparc/PCI: convert to pci_create_root_bus()
sh/PCI: convert to pci_scan_root_bus() for correct root bus resources
powerpc/PCI: convert to pci_create_root_bus()
powerpc/PCI: split PHB part out of pcibios_map_io_space()
...
Fix up conflicts in drivers/pci/msi.c and include/linux/pci_regs.h due
to the same patches being applied in other branches.
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/amd_nb.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/pci.h | 9 | ||||
-rw-r--r-- | arch/x86/include/asm/pci_x86.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/topology.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/amd_nb.c | 31 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 1 | ||||
-rw-r--r-- | arch/x86/pci/acpi.c | 75 | ||||
-rw-r--r-- | arch/x86/pci/amd_bus.c | 43 | ||||
-rw-r--r-- | arch/x86/pci/broadcom_bus.c | 62 | ||||
-rw-r--r-- | arch/x86/pci/bus_numa.c | 31 | ||||
-rw-r--r-- | arch/x86/pci/common.c | 19 | ||||
-rw-r--r-- | arch/x86/pci/i386.c | 20 | ||||
-rw-r--r-- | arch/x86/pci/legacy.c | 3 | ||||
-rw-r--r-- | arch/x86/pci/numaq_32.c | 2 |
15 files changed, 184 insertions, 119 deletions
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h index 8e41071704a5..49ad773f4b9f 100644 --- a/arch/x86/include/asm/amd_nb.h +++ b/arch/x86/include/asm/amd_nb.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ASM_X86_AMD_NB_H | 1 | #ifndef _ASM_X86_AMD_NB_H |
2 | #define _ASM_X86_AMD_NB_H | 2 | #define _ASM_X86_AMD_NB_H |
3 | 3 | ||
4 | #include <linux/ioport.h> | ||
4 | #include <linux/pci.h> | 5 | #include <linux/pci.h> |
5 | 6 | ||
6 | struct amd_nb_bus_dev_range { | 7 | struct amd_nb_bus_dev_range { |
@@ -13,6 +14,7 @@ extern const struct pci_device_id amd_nb_misc_ids[]; | |||
13 | extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[]; | 14 | extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[]; |
14 | 15 | ||
15 | extern bool early_is_amd_nb(u32 value); | 16 | extern bool early_is_amd_nb(u32 value); |
17 | extern struct resource *amd_get_mmconfig_range(struct resource *res); | ||
16 | extern int amd_cache_northbridges(void); | 18 | extern int amd_cache_northbridges(void); |
17 | extern void amd_flush_garts(void); | 19 | extern void amd_flush_garts(void); |
18 | extern int amd_numa_init(void); | 20 | extern int amd_numa_init(void); |
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index d498943b906c..df75d07571ce 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h | |||
@@ -112,19 +112,28 @@ static inline void x86_teardown_msi_irq(unsigned int irq) | |||
112 | { | 112 | { |
113 | x86_msi.teardown_msi_irq(irq); | 113 | x86_msi.teardown_msi_irq(irq); |
114 | } | 114 | } |
115 | static inline void x86_restore_msi_irqs(struct pci_dev *dev, int irq) | ||
116 | { | ||
117 | x86_msi.restore_msi_irqs(dev, irq); | ||
118 | } | ||
115 | #define arch_setup_msi_irqs x86_setup_msi_irqs | 119 | #define arch_setup_msi_irqs x86_setup_msi_irqs |
116 | #define arch_teardown_msi_irqs x86_teardown_msi_irqs | 120 | #define arch_teardown_msi_irqs x86_teardown_msi_irqs |
117 | #define arch_teardown_msi_irq x86_teardown_msi_irq | 121 | #define arch_teardown_msi_irq x86_teardown_msi_irq |
122 | #define arch_restore_msi_irqs x86_restore_msi_irqs | ||
118 | /* implemented in arch/x86/kernel/apic/io_apic. */ | 123 | /* implemented in arch/x86/kernel/apic/io_apic. */ |
119 | int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); | 124 | int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); |
120 | void native_teardown_msi_irq(unsigned int irq); | 125 | void native_teardown_msi_irq(unsigned int irq); |
126 | void native_restore_msi_irqs(struct pci_dev *dev, int irq); | ||
121 | /* default to the implementation in drivers/lib/msi.c */ | 127 | /* default to the implementation in drivers/lib/msi.c */ |
122 | #define HAVE_DEFAULT_MSI_TEARDOWN_IRQS | 128 | #define HAVE_DEFAULT_MSI_TEARDOWN_IRQS |
129 | #define HAVE_DEFAULT_MSI_RESTORE_IRQS | ||
123 | void default_teardown_msi_irqs(struct pci_dev *dev); | 130 | void default_teardown_msi_irqs(struct pci_dev *dev); |
131 | void default_restore_msi_irqs(struct pci_dev *dev, int irq); | ||
124 | #else | 132 | #else |
125 | #define native_setup_msi_irqs NULL | 133 | #define native_setup_msi_irqs NULL |
126 | #define native_teardown_msi_irq NULL | 134 | #define native_teardown_msi_irq NULL |
127 | #define default_teardown_msi_irqs NULL | 135 | #define default_teardown_msi_irqs NULL |
136 | #define default_restore_msi_irqs NULL | ||
128 | #endif | 137 | #endif |
129 | 138 | ||
130 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) | 139 | #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) |
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h index e38197806853..b3a531746026 100644 --- a/arch/x86/include/asm/pci_x86.h +++ b/arch/x86/include/asm/pci_x86.h | |||
@@ -44,8 +44,6 @@ enum pci_bf_sort_state { | |||
44 | 44 | ||
45 | /* pci-i386.c */ | 45 | /* pci-i386.c */ |
46 | 46 | ||
47 | extern unsigned int pcibios_max_latency; | ||
48 | |||
49 | void pcibios_resource_survey(void); | 47 | void pcibios_resource_survey(void); |
50 | void pcibios_set_cache_line_size(void); | 48 | void pcibios_set_cache_line_size(void); |
51 | 49 | ||
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 800f77c60051..b9676ae37ada 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -172,7 +172,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | struct pci_bus; | 174 | struct pci_bus; |
175 | void x86_pci_root_bus_res_quirks(struct pci_bus *b); | 175 | void x86_pci_root_bus_resources(int bus, struct list_head *resources); |
176 | 176 | ||
177 | #ifdef CONFIG_SMP | 177 | #ifdef CONFIG_SMP |
178 | #define mc_capable() ((boot_cpu_data.x86_max_cores > 1) && \ | 178 | #define mc_capable() ((boot_cpu_data.x86_max_cores > 1) && \ |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 1ac860a09849..517d4767ffdd 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -179,6 +179,7 @@ struct x86_msi_ops { | |||
179 | int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); | 179 | int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type); |
180 | void (*teardown_msi_irq)(unsigned int irq); | 180 | void (*teardown_msi_irq)(unsigned int irq); |
181 | void (*teardown_msi_irqs)(struct pci_dev *dev); | 181 | void (*teardown_msi_irqs)(struct pci_dev *dev); |
182 | void (*restore_msi_irqs)(struct pci_dev *dev, int irq); | ||
182 | }; | 183 | }; |
183 | 184 | ||
184 | extern struct x86_init_ops x86_init; | 185 | extern struct x86_init_ops x86_init; |
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c index 013c1810ce72..be16854591cc 100644 --- a/arch/x86/kernel/amd_nb.c +++ b/arch/x86/kernel/amd_nb.c | |||
@@ -119,6 +119,37 @@ bool __init early_is_amd_nb(u32 device) | |||
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | 121 | ||
122 | struct resource *amd_get_mmconfig_range(struct resource *res) | ||
123 | { | ||
124 | u32 address; | ||
125 | u64 base, msr; | ||
126 | unsigned segn_busn_bits; | ||
127 | |||
128 | if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) | ||
129 | return NULL; | ||
130 | |||
131 | /* assume all cpus from fam10h have mmconfig */ | ||
132 | if (boot_cpu_data.x86 < 0x10) | ||
133 | return NULL; | ||
134 | |||
135 | address = MSR_FAM10H_MMIO_CONF_BASE; | ||
136 | rdmsrl(address, msr); | ||
137 | |||
138 | /* mmconfig is not enabled */ | ||
139 | if (!(msr & FAM10H_MMIO_CONF_ENABLE)) | ||
140 | return NULL; | ||
141 | |||
142 | base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT); | ||
143 | |||
144 | segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) & | ||
145 | FAM10H_MMIO_CONF_BUSRANGE_MASK; | ||
146 | |||
147 | res->flags = IORESOURCE_MEM; | ||
148 | res->start = base; | ||
149 | res->end = base + (1ULL<<(segn_busn_bits + 20)) - 1; | ||
150 | return res; | ||
151 | } | ||
152 | |||
122 | int amd_get_subcaches(int cpu) | 153 | int amd_get_subcaches(int cpu) |
123 | { | 154 | { |
124 | struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link; | 155 | struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link; |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 91f83e21b989..947a06ccc673 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -115,4 +115,5 @@ struct x86_msi_ops x86_msi = { | |||
115 | .setup_msi_irqs = native_setup_msi_irqs, | 115 | .setup_msi_irqs = native_setup_msi_irqs, |
116 | .teardown_msi_irq = native_teardown_msi_irq, | 116 | .teardown_msi_irq = native_teardown_msi_irq, |
117 | .teardown_msi_irqs = default_teardown_msi_irqs, | 117 | .teardown_msi_irqs = default_teardown_msi_irqs, |
118 | .restore_msi_irqs = default_restore_msi_irqs, | ||
118 | }; | 119 | }; |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 404f21a3ff9e..a312e76063a7 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -12,7 +12,7 @@ struct pci_root_info { | |||
12 | char *name; | 12 | char *name; |
13 | unsigned int res_num; | 13 | unsigned int res_num; |
14 | struct resource *res; | 14 | struct resource *res; |
15 | struct pci_bus *bus; | 15 | struct list_head *resources; |
16 | int busnum; | 16 | int busnum; |
17 | }; | 17 | }; |
18 | 18 | ||
@@ -24,6 +24,12 @@ static int __init set_use_crs(const struct dmi_system_id *id) | |||
24 | return 0; | 24 | return 0; |
25 | } | 25 | } |
26 | 26 | ||
27 | static int __init set_nouse_crs(const struct dmi_system_id *id) | ||
28 | { | ||
29 | pci_use_crs = false; | ||
30 | return 0; | ||
31 | } | ||
32 | |||
27 | static const struct dmi_system_id pci_use_crs_table[] __initconst = { | 33 | static const struct dmi_system_id pci_use_crs_table[] __initconst = { |
28 | /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */ | 34 | /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */ |
29 | { | 35 | { |
@@ -54,6 +60,29 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = { | |||
54 | DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."), | 60 | DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."), |
55 | }, | 61 | }, |
56 | }, | 62 | }, |
63 | |||
64 | /* Now for the blacklist.. */ | ||
65 | |||
66 | /* https://bugzilla.redhat.com/show_bug.cgi?id=769657 */ | ||
67 | { | ||
68 | .callback = set_nouse_crs, | ||
69 | .ident = "Dell Studio 1557", | ||
70 | .matches = { | ||
71 | DMI_MATCH(DMI_BOARD_VENDOR, "Dell Inc."), | ||
72 | DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"), | ||
73 | DMI_MATCH(DMI_BIOS_VERSION, "A09"), | ||
74 | }, | ||
75 | }, | ||
76 | /* https://bugzilla.redhat.com/show_bug.cgi?id=769657 */ | ||
77 | { | ||
78 | .callback = set_nouse_crs, | ||
79 | .ident = "Thinkpad SL510", | ||
80 | .matches = { | ||
81 | DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), | ||
82 | DMI_MATCH(DMI_BOARD_NAME, "2847DFG"), | ||
83 | DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"), | ||
84 | }, | ||
85 | }, | ||
57 | {} | 86 | {} |
58 | }; | 87 | }; |
59 | 88 | ||
@@ -149,7 +178,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
149 | struct acpi_resource_address64 addr; | 178 | struct acpi_resource_address64 addr; |
150 | acpi_status status; | 179 | acpi_status status; |
151 | unsigned long flags; | 180 | unsigned long flags; |
152 | u64 start, end; | 181 | u64 start, orig_end, end; |
153 | 182 | ||
154 | status = resource_to_addr(acpi_res, &addr); | 183 | status = resource_to_addr(acpi_res, &addr); |
155 | if (!ACPI_SUCCESS(status)) | 184 | if (!ACPI_SUCCESS(status)) |
@@ -165,7 +194,21 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
165 | return AE_OK; | 194 | return AE_OK; |
166 | 195 | ||
167 | start = addr.minimum + addr.translation_offset; | 196 | start = addr.minimum + addr.translation_offset; |
168 | end = addr.maximum + addr.translation_offset; | 197 | orig_end = end = addr.maximum + addr.translation_offset; |
198 | |||
199 | /* Exclude non-addressable range or non-addressable portion of range */ | ||
200 | end = min(end, (u64)iomem_resource.end); | ||
201 | if (end <= start) { | ||
202 | dev_info(&info->bridge->dev, | ||
203 | "host bridge window [%#llx-%#llx] " | ||
204 | "(ignored, not CPU addressable)\n", start, orig_end); | ||
205 | return AE_OK; | ||
206 | } else if (orig_end != end) { | ||
207 | dev_info(&info->bridge->dev, | ||
208 | "host bridge window [%#llx-%#llx] " | ||
209 | "([%#llx-%#llx] ignored, not CPU addressable)\n", | ||
210 | start, orig_end, end + 1, orig_end); | ||
211 | } | ||
169 | 212 | ||
170 | res = &info->res[info->res_num]; | 213 | res = &info->res[info->res_num]; |
171 | res->name = info->name; | 214 | res->name = info->name; |
@@ -261,23 +304,20 @@ static void add_resources(struct pci_root_info *info) | |||
261 | "ignoring host bridge window %pR (conflicts with %s %pR)\n", | 304 | "ignoring host bridge window %pR (conflicts with %s %pR)\n", |
262 | res, conflict->name, conflict); | 305 | res, conflict->name, conflict); |
263 | else | 306 | else |
264 | pci_bus_add_resource(info->bus, res, 0); | 307 | pci_add_resource(info->resources, res); |
265 | } | 308 | } |
266 | } | 309 | } |
267 | 310 | ||
268 | static void | 311 | static void |
269 | get_current_resources(struct acpi_device *device, int busnum, | 312 | get_current_resources(struct acpi_device *device, int busnum, |
270 | int domain, struct pci_bus *bus) | 313 | int domain, struct list_head *resources) |
271 | { | 314 | { |
272 | struct pci_root_info info; | 315 | struct pci_root_info info; |
273 | size_t size; | 316 | size_t size; |
274 | 317 | ||
275 | if (pci_use_crs) | ||
276 | pci_bus_remove_resources(bus); | ||
277 | |||
278 | info.bridge = device; | 318 | info.bridge = device; |
279 | info.bus = bus; | ||
280 | info.res_num = 0; | 319 | info.res_num = 0; |
320 | info.resources = resources; | ||
281 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, | 321 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, |
282 | &info); | 322 | &info); |
283 | if (!info.res_num) | 323 | if (!info.res_num) |
@@ -286,7 +326,7 @@ get_current_resources(struct acpi_device *device, int busnum, | |||
286 | size = sizeof(*info.res) * info.res_num; | 326 | size = sizeof(*info.res) * info.res_num; |
287 | info.res = kmalloc(size, GFP_KERNEL); | 327 | info.res = kmalloc(size, GFP_KERNEL); |
288 | if (!info.res) | 328 | if (!info.res) |
289 | goto res_alloc_fail; | 329 | return; |
290 | 330 | ||
291 | info.name = kasprintf(GFP_KERNEL, "PCI Bus %04x:%02x", domain, busnum); | 331 | info.name = kasprintf(GFP_KERNEL, "PCI Bus %04x:%02x", domain, busnum); |
292 | if (!info.name) | 332 | if (!info.name) |
@@ -301,8 +341,6 @@ get_current_resources(struct acpi_device *device, int busnum, | |||
301 | 341 | ||
302 | name_alloc_fail: | 342 | name_alloc_fail: |
303 | kfree(info.res); | 343 | kfree(info.res); |
304 | res_alloc_fail: | ||
305 | return; | ||
306 | } | 344 | } |
307 | 345 | ||
308 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) | 346 | struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) |
@@ -310,6 +348,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) | |||
310 | struct acpi_device *device = root->device; | 348 | struct acpi_device *device = root->device; |
311 | int domain = root->segment; | 349 | int domain = root->segment; |
312 | int busnum = root->secondary.start; | 350 | int busnum = root->secondary.start; |
351 | LIST_HEAD(resources); | ||
313 | struct pci_bus *bus; | 352 | struct pci_bus *bus; |
314 | struct pci_sysdata *sd; | 353 | struct pci_sysdata *sd; |
315 | int node; | 354 | int node; |
@@ -364,11 +403,15 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) | |||
364 | memcpy(bus->sysdata, sd, sizeof(*sd)); | 403 | memcpy(bus->sysdata, sd, sizeof(*sd)); |
365 | kfree(sd); | 404 | kfree(sd); |
366 | } else { | 405 | } else { |
367 | bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); | 406 | get_current_resources(device, busnum, domain, &resources); |
368 | if (bus) { | 407 | if (list_empty(&resources)) |
369 | get_current_resources(device, busnum, domain, bus); | 408 | x86_pci_root_bus_resources(busnum, &resources); |
409 | bus = pci_create_root_bus(NULL, busnum, &pci_root_ops, sd, | ||
410 | &resources); | ||
411 | if (bus) | ||
370 | bus->subordinate = pci_scan_child_bus(bus); | 412 | bus->subordinate = pci_scan_child_bus(bus); |
371 | } | 413 | else |
414 | pci_free_resource_list(&resources); | ||
372 | } | 415 | } |
373 | 416 | ||
374 | /* After the PCI-E bus has been walked and all devices discovered, | 417 | /* After the PCI-E bus has been walked and all devices discovered, |
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index 026e4931d162..0567df3890e1 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -30,34 +30,6 @@ static struct pci_hostbridge_probe pci_probes[] __initdata = { | |||
30 | { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1300 }, | 30 | { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1300 }, |
31 | }; | 31 | }; |
32 | 32 | ||
33 | static u64 __initdata fam10h_mmconf_start; | ||
34 | static u64 __initdata fam10h_mmconf_end; | ||
35 | static void __init get_pci_mmcfg_amd_fam10h_range(void) | ||
36 | { | ||
37 | u32 address; | ||
38 | u64 base, msr; | ||
39 | unsigned segn_busn_bits; | ||
40 | |||
41 | /* assume all cpus from fam10h have mmconf */ | ||
42 | if (boot_cpu_data.x86 < 0x10) | ||
43 | return; | ||
44 | |||
45 | address = MSR_FAM10H_MMIO_CONF_BASE; | ||
46 | rdmsrl(address, msr); | ||
47 | |||
48 | /* mmconfig is not enable */ | ||
49 | if (!(msr & FAM10H_MMIO_CONF_ENABLE)) | ||
50 | return; | ||
51 | |||
52 | base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT); | ||
53 | |||
54 | segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) & | ||
55 | FAM10H_MMIO_CONF_BUSRANGE_MASK; | ||
56 | |||
57 | fam10h_mmconf_start = base; | ||
58 | fam10h_mmconf_end = base + (1ULL<<(segn_busn_bits + 20)) - 1; | ||
59 | } | ||
60 | |||
61 | #define RANGE_NUM 16 | 33 | #define RANGE_NUM 16 |
62 | 34 | ||
63 | /** | 35 | /** |
@@ -85,6 +57,9 @@ static int __init early_fill_mp_bus_info(void) | |||
85 | u64 val; | 57 | u64 val; |
86 | u32 address; | 58 | u32 address; |
87 | bool found; | 59 | bool found; |
60 | struct resource fam10h_mmconf_res, *fam10h_mmconf; | ||
61 | u64 fam10h_mmconf_start; | ||
62 | u64 fam10h_mmconf_end; | ||
88 | 63 | ||
89 | if (!early_pci_allowed()) | 64 | if (!early_pci_allowed()) |
90 | return -1; | 65 | return -1; |
@@ -211,12 +186,17 @@ static int __init early_fill_mp_bus_info(void) | |||
211 | subtract_range(range, RANGE_NUM, 0, end); | 186 | subtract_range(range, RANGE_NUM, 0, end); |
212 | 187 | ||
213 | /* get mmconfig */ | 188 | /* get mmconfig */ |
214 | get_pci_mmcfg_amd_fam10h_range(); | 189 | fam10h_mmconf = amd_get_mmconfig_range(&fam10h_mmconf_res); |
215 | /* need to take out mmconf range */ | 190 | /* need to take out mmconf range */ |
216 | if (fam10h_mmconf_end) { | 191 | if (fam10h_mmconf) { |
217 | printk(KERN_DEBUG "Fam 10h mmconf [%llx, %llx]\n", fam10h_mmconf_start, fam10h_mmconf_end); | 192 | printk(KERN_DEBUG "Fam 10h mmconf %pR\n", fam10h_mmconf); |
193 | fam10h_mmconf_start = fam10h_mmconf->start; | ||
194 | fam10h_mmconf_end = fam10h_mmconf->end; | ||
218 | subtract_range(range, RANGE_NUM, fam10h_mmconf_start, | 195 | subtract_range(range, RANGE_NUM, fam10h_mmconf_start, |
219 | fam10h_mmconf_end + 1); | 196 | fam10h_mmconf_end + 1); |
197 | } else { | ||
198 | fam10h_mmconf_start = 0; | ||
199 | fam10h_mmconf_end = 0; | ||
220 | } | 200 | } |
221 | 201 | ||
222 | /* mmio resource */ | 202 | /* mmio resource */ |
@@ -403,7 +383,6 @@ static void __init pci_enable_pci_io_ecs(void) | |||
403 | ++n; | 383 | ++n; |
404 | } | 384 | } |
405 | } | 385 | } |
406 | pr_info("Extended Config Space enabled on %u nodes\n", n); | ||
407 | #endif | 386 | #endif |
408 | } | 387 | } |
409 | 388 | ||
diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c index ab8269b0da29..f3a7c569a403 100644 --- a/arch/x86/pci/broadcom_bus.c +++ b/arch/x86/pci/broadcom_bus.c | |||
@@ -15,10 +15,11 @@ | |||
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <asm/pci_x86.h> | 17 | #include <asm/pci_x86.h> |
18 | #include <asm/pci-direct.h> | ||
18 | 19 | ||
19 | #include "bus_numa.h" | 20 | #include "bus_numa.h" |
20 | 21 | ||
21 | static void __devinit cnb20le_res(struct pci_dev *dev) | 22 | static void __init cnb20le_res(u8 bus, u8 slot, u8 func) |
22 | { | 23 | { |
23 | struct pci_root_info *info; | 24 | struct pci_root_info *info; |
24 | struct resource res; | 25 | struct resource res; |
@@ -26,21 +27,12 @@ static void __devinit cnb20le_res(struct pci_dev *dev) | |||
26 | u8 fbus, lbus; | 27 | u8 fbus, lbus; |
27 | int i; | 28 | int i; |
28 | 29 | ||
29 | #ifdef CONFIG_ACPI | ||
30 | /* | ||
31 | * We should get host bridge information from ACPI unless the BIOS | ||
32 | * doesn't support it. | ||
33 | */ | ||
34 | if (acpi_os_get_root_pointer()) | ||
35 | return; | ||
36 | #endif | ||
37 | |||
38 | info = &pci_root_info[pci_root_num]; | 30 | info = &pci_root_info[pci_root_num]; |
39 | pci_root_num++; | 31 | pci_root_num++; |
40 | 32 | ||
41 | /* read the PCI bus numbers */ | 33 | /* read the PCI bus numbers */ |
42 | pci_read_config_byte(dev, 0x44, &fbus); | 34 | fbus = read_pci_config_byte(bus, slot, func, 0x44); |
43 | pci_read_config_byte(dev, 0x45, &lbus); | 35 | lbus = read_pci_config_byte(bus, slot, func, 0x45); |
44 | info->bus_min = fbus; | 36 | info->bus_min = fbus; |
45 | info->bus_max = lbus; | 37 | info->bus_max = lbus; |
46 | 38 | ||
@@ -59,8 +51,8 @@ static void __devinit cnb20le_res(struct pci_dev *dev) | |||
59 | } | 51 | } |
60 | 52 | ||
61 | /* read the non-prefetchable memory window */ | 53 | /* read the non-prefetchable memory window */ |
62 | pci_read_config_word(dev, 0xc0, &word1); | 54 | word1 = read_pci_config_16(bus, slot, func, 0xc0); |
63 | pci_read_config_word(dev, 0xc2, &word2); | 55 | word2 = read_pci_config_16(bus, slot, func, 0xc2); |
64 | if (word1 != word2) { | 56 | if (word1 != word2) { |
65 | res.start = (word1 << 16) | 0x0000; | 57 | res.start = (word1 << 16) | 0x0000; |
66 | res.end = (word2 << 16) | 0xffff; | 58 | res.end = (word2 << 16) | 0xffff; |
@@ -69,8 +61,8 @@ static void __devinit cnb20le_res(struct pci_dev *dev) | |||
69 | } | 61 | } |
70 | 62 | ||
71 | /* read the prefetchable memory window */ | 63 | /* read the prefetchable memory window */ |
72 | pci_read_config_word(dev, 0xc4, &word1); | 64 | word1 = read_pci_config_16(bus, slot, func, 0xc4); |
73 | pci_read_config_word(dev, 0xc6, &word2); | 65 | word2 = read_pci_config_16(bus, slot, func, 0xc6); |
74 | if (word1 != word2) { | 66 | if (word1 != word2) { |
75 | res.start = (word1 << 16) | 0x0000; | 67 | res.start = (word1 << 16) | 0x0000; |
76 | res.end = (word2 << 16) | 0xffff; | 68 | res.end = (word2 << 16) | 0xffff; |
@@ -79,8 +71,8 @@ static void __devinit cnb20le_res(struct pci_dev *dev) | |||
79 | } | 71 | } |
80 | 72 | ||
81 | /* read the IO port window */ | 73 | /* read the IO port window */ |
82 | pci_read_config_word(dev, 0xd0, &word1); | 74 | word1 = read_pci_config_16(bus, slot, func, 0xd0); |
83 | pci_read_config_word(dev, 0xd2, &word2); | 75 | word2 = read_pci_config_16(bus, slot, func, 0xd2); |
84 | if (word1 != word2) { | 76 | if (word1 != word2) { |
85 | res.start = word1; | 77 | res.start = word1; |
86 | res.end = word2; | 78 | res.end = word2; |
@@ -92,13 +84,37 @@ static void __devinit cnb20le_res(struct pci_dev *dev) | |||
92 | res.start = fbus; | 84 | res.start = fbus; |
93 | res.end = lbus; | 85 | res.end = lbus; |
94 | res.flags = IORESOURCE_BUS; | 86 | res.flags = IORESOURCE_BUS; |
95 | dev_info(&dev->dev, "CNB20LE PCI Host Bridge (domain %04x %pR)\n", | 87 | printk(KERN_INFO "CNB20LE PCI Host Bridge (domain 0000 %pR)\n", &res); |
96 | pci_domain_nr(dev->bus), &res); | ||
97 | 88 | ||
98 | for (i = 0; i < info->res_num; i++) | 89 | for (i = 0; i < info->res_num; i++) |
99 | dev_info(&dev->dev, "host bridge window %pR\n", &info->res[i]); | 90 | printk(KERN_INFO "host bridge window %pR\n", &info->res[i]); |
100 | } | 91 | } |
101 | 92 | ||
102 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE, | 93 | static int __init broadcom_postcore_init(void) |
103 | cnb20le_res); | 94 | { |
95 | u8 bus = 0, slot = 0; | ||
96 | u32 id; | ||
97 | u16 vendor, device; | ||
98 | |||
99 | #ifdef CONFIG_ACPI | ||
100 | /* | ||
101 | * We should get host bridge information from ACPI unless the BIOS | ||
102 | * doesn't support it. | ||
103 | */ | ||
104 | if (acpi_os_get_root_pointer()) | ||
105 | return 0; | ||
106 | #endif | ||
107 | |||
108 | id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID); | ||
109 | vendor = id & 0xffff; | ||
110 | device = (id >> 16) & 0xffff; | ||
111 | |||
112 | if (vendor == PCI_VENDOR_ID_SERVERWORKS && | ||
113 | device == PCI_DEVICE_ID_SERVERWORKS_LE) { | ||
114 | cnb20le_res(bus, slot, 0); | ||
115 | cnb20le_res(bus, slot, 1); | ||
116 | } | ||
117 | return 0; | ||
118 | } | ||
104 | 119 | ||
120 | postcore_initcall(broadcom_postcore_init); | ||
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c index 64a122883896..fd3f65510e9d 100644 --- a/arch/x86/pci/bus_numa.c +++ b/arch/x86/pci/bus_numa.c | |||
@@ -7,45 +7,50 @@ | |||
7 | int pci_root_num; | 7 | int pci_root_num; |
8 | struct pci_root_info pci_root_info[PCI_ROOT_NR]; | 8 | struct pci_root_info pci_root_info[PCI_ROOT_NR]; |
9 | 9 | ||
10 | void x86_pci_root_bus_res_quirks(struct pci_bus *b) | 10 | void x86_pci_root_bus_resources(int bus, struct list_head *resources) |
11 | { | 11 | { |
12 | int i; | 12 | int i; |
13 | int j; | 13 | int j; |
14 | struct pci_root_info *info; | 14 | struct pci_root_info *info; |
15 | 15 | ||
16 | /* don't go for it if _CRS is used already */ | ||
17 | if (b->resource[0] != &ioport_resource || | ||
18 | b->resource[1] != &iomem_resource) | ||
19 | return; | ||
20 | |||
21 | if (!pci_root_num) | 16 | if (!pci_root_num) |
22 | return; | 17 | goto default_resources; |
23 | 18 | ||
24 | for (i = 0; i < pci_root_num; i++) { | 19 | for (i = 0; i < pci_root_num; i++) { |
25 | if (pci_root_info[i].bus_min == b->number) | 20 | if (pci_root_info[i].bus_min == bus) |
26 | break; | 21 | break; |
27 | } | 22 | } |
28 | 23 | ||
29 | if (i == pci_root_num) | 24 | if (i == pci_root_num) |
30 | return; | 25 | goto default_resources; |
31 | 26 | ||
32 | printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n", | 27 | printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n", |
33 | b->number); | 28 | bus); |
34 | 29 | ||
35 | pci_bus_remove_resources(b); | ||
36 | info = &pci_root_info[i]; | 30 | info = &pci_root_info[i]; |
37 | for (j = 0; j < info->res_num; j++) { | 31 | for (j = 0; j < info->res_num; j++) { |
38 | struct resource *res; | 32 | struct resource *res; |
39 | struct resource *root; | 33 | struct resource *root; |
40 | 34 | ||
41 | res = &info->res[j]; | 35 | res = &info->res[j]; |
42 | pci_bus_add_resource(b, res, 0); | 36 | pci_add_resource(resources, res); |
43 | if (res->flags & IORESOURCE_IO) | 37 | if (res->flags & IORESOURCE_IO) |
44 | root = &ioport_resource; | 38 | root = &ioport_resource; |
45 | else | 39 | else |
46 | root = &iomem_resource; | 40 | root = &iomem_resource; |
47 | insert_resource(root, res); | 41 | insert_resource(root, res); |
48 | } | 42 | } |
43 | return; | ||
44 | |||
45 | default_resources: | ||
46 | /* | ||
47 | * We don't have any host bridge aperture information from the | ||
48 | * "native host bridge drivers," e.g., amd_bus or broadcom_bus, | ||
49 | * so fall back to the defaults historically used by pci_create_bus(). | ||
50 | */ | ||
51 | printk(KERN_DEBUG "PCI: root bus %02x: using default resources\n", bus); | ||
52 | pci_add_resource(resources, &ioport_resource); | ||
53 | pci_add_resource(resources, &iomem_resource); | ||
49 | } | 54 | } |
50 | 55 | ||
51 | void __devinit update_res(struct pci_root_info *info, resource_size_t start, | 56 | void __devinit update_res(struct pci_root_info *info, resource_size_t start, |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 7962ccb4d9b2..323481e06ef8 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -164,9 +164,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *b) | |||
164 | { | 164 | { |
165 | struct pci_dev *dev; | 165 | struct pci_dev *dev; |
166 | 166 | ||
167 | /* root bus? */ | ||
168 | if (!b->parent) | ||
169 | x86_pci_root_bus_res_quirks(b); | ||
170 | pci_read_bridge_bases(b); | 167 | pci_read_bridge_bases(b); |
171 | list_for_each_entry(dev, &b->devices, bus_list) | 168 | list_for_each_entry(dev, &b->devices, bus_list) |
172 | pcibios_fixup_device_resources(dev); | 169 | pcibios_fixup_device_resources(dev); |
@@ -433,6 +430,7 @@ void __init dmi_check_pciprobe(void) | |||
433 | 430 | ||
434 | struct pci_bus * __devinit pcibios_scan_root(int busnum) | 431 | struct pci_bus * __devinit pcibios_scan_root(int busnum) |
435 | { | 432 | { |
433 | LIST_HEAD(resources); | ||
436 | struct pci_bus *bus = NULL; | 434 | struct pci_bus *bus = NULL; |
437 | struct pci_sysdata *sd; | 435 | struct pci_sysdata *sd; |
438 | 436 | ||
@@ -456,9 +454,12 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum) | |||
456 | sd->node = get_mp_bus_to_node(busnum); | 454 | sd->node = get_mp_bus_to_node(busnum); |
457 | 455 | ||
458 | printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum); | 456 | printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum); |
459 | bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); | 457 | x86_pci_root_bus_resources(busnum, &resources); |
460 | if (!bus) | 458 | bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources); |
459 | if (!bus) { | ||
460 | pci_free_resource_list(&resources); | ||
461 | kfree(sd); | 461 | kfree(sd); |
462 | } | ||
462 | 463 | ||
463 | return bus; | 464 | return bus; |
464 | } | 465 | } |
@@ -639,6 +640,7 @@ int pci_ext_cfg_avail(struct pci_dev *dev) | |||
639 | 640 | ||
640 | struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) | 641 | struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node) |
641 | { | 642 | { |
643 | LIST_HEAD(resources); | ||
642 | struct pci_bus *bus = NULL; | 644 | struct pci_bus *bus = NULL; |
643 | struct pci_sysdata *sd; | 645 | struct pci_sysdata *sd; |
644 | 646 | ||
@@ -653,9 +655,12 @@ struct pci_bus * __devinit pci_scan_bus_on_node(int busno, struct pci_ops *ops, | |||
653 | return NULL; | 655 | return NULL; |
654 | } | 656 | } |
655 | sd->node = node; | 657 | sd->node = node; |
656 | bus = pci_scan_bus(busno, ops, sd); | 658 | x86_pci_root_bus_resources(busno, &resources); |
657 | if (!bus) | 659 | bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources); |
660 | if (!bus) { | ||
661 | pci_free_resource_list(&resources); | ||
658 | kfree(sd); | 662 | kfree(sd); |
663 | } | ||
659 | 664 | ||
660 | return bus; | 665 | return bus; |
661 | } | 666 | } |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 794b092d01ae..91821a1a0c3a 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -254,26 +254,6 @@ void __init pcibios_resource_survey(void) | |||
254 | */ | 254 | */ |
255 | fs_initcall(pcibios_assign_resources); | 255 | fs_initcall(pcibios_assign_resources); |
256 | 256 | ||
257 | /* | ||
258 | * If we set up a device for bus mastering, we need to check the latency | ||
259 | * timer as certain crappy BIOSes forget to set it properly. | ||
260 | */ | ||
261 | unsigned int pcibios_max_latency = 255; | ||
262 | |||
263 | void pcibios_set_master(struct pci_dev *dev) | ||
264 | { | ||
265 | u8 lat; | ||
266 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); | ||
267 | if (lat < 16) | ||
268 | lat = (64 <= pcibios_max_latency) ? 64 : pcibios_max_latency; | ||
269 | else if (lat > pcibios_max_latency) | ||
270 | lat = pcibios_max_latency; | ||
271 | else | ||
272 | return; | ||
273 | dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat); | ||
274 | pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); | ||
275 | } | ||
276 | |||
277 | static const struct vm_operations_struct pci_mmap_ops = { | 257 | static const struct vm_operations_struct pci_mmap_ops = { |
278 | .access = generic_access_phys, | 258 | .access = generic_access_phys, |
279 | }; | 259 | }; |
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c index 2c2aeabc2609..a1df191129d3 100644 --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c | |||
@@ -31,9 +31,6 @@ int __init pci_legacy_init(void) | |||
31 | 31 | ||
32 | printk("PCI: Probing PCI hardware\n"); | 32 | printk("PCI: Probing PCI hardware\n"); |
33 | pci_root_bus = pcibios_scan_root(0); | 33 | pci_root_bus = pcibios_scan_root(0); |
34 | if (pci_root_bus) | ||
35 | pci_bus_add_devices(pci_root_bus); | ||
36 | |||
37 | return 0; | 34 | return 0; |
38 | } | 35 | } |
39 | 36 | ||
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c index 51abf02f9226..83e125b95ca6 100644 --- a/arch/x86/pci/numaq_32.c +++ b/arch/x86/pci/numaq_32.c | |||
@@ -153,8 +153,6 @@ int __init pci_numaq_init(void) | |||
153 | raw_pci_ops = &pci_direct_conf1_mq; | 153 | raw_pci_ops = &pci_direct_conf1_mq; |
154 | 154 | ||
155 | pci_root_bus = pcibios_scan_root(0); | 155 | pci_root_bus = pcibios_scan_root(0); |
156 | if (pci_root_bus) | ||
157 | pci_bus_add_devices(pci_root_bus); | ||
158 | if (num_online_nodes() > 1) | 156 | if (num_online_nodes() > 1) |
159 | for_each_online_node(quad) { | 157 | for_each_online_node(quad) { |
160 | if (quad == 0) | 158 | if (quad == 0) |