diff options
-rw-r--r-- | arch/x86/pci/acpi.c | 46 | ||||
-rw-r--r-- | arch/x86/pci/common.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_bind.c | 12 | ||||
-rw-r--r-- | drivers/acpi/pci_irq.c | 17 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 165 | ||||
-rw-r--r-- | drivers/pci/ioapic.c | 2 | ||||
-rw-r--r-- | drivers/pci/iov.c | 87 | ||||
-rw-r--r-- | drivers/pci/irq.c | 10 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci-stub.c | 2 | ||||
-rw-r--r-- | drivers/pci/pci-sysfs.c | 172 | ||||
-rw-r--r-- | drivers/pci/pci.c | 33 | ||||
-rw-r--r-- | drivers/pci/pci.h | 8 | ||||
-rw-r--r-- | drivers/pci/pcie/aspm.c | 7 | ||||
-rw-r--r-- | drivers/pci/probe.c | 23 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 39 | ||||
-rw-r--r-- | drivers/pci/remove.c | 36 | ||||
-rw-r--r-- | drivers/pci/setup-bus.c | 22 | ||||
-rw-r--r-- | include/acpi/acpi_drivers.h | 4 | ||||
-rw-r--r-- | include/linux/pci.h | 16 | ||||
-rw-r--r-- | include/uapi/linux/pci_regs.h | 6 |
21 files changed, 538 insertions, 177 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 192397c98606..0c01261fe5a8 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -12,6 +12,7 @@ struct pci_root_info { | |||
12 | char name[16]; | 12 | char name[16]; |
13 | unsigned int res_num; | 13 | unsigned int res_num; |
14 | struct resource *res; | 14 | struct resource *res; |
15 | resource_size_t *res_offset; | ||
15 | struct pci_sysdata sd; | 16 | struct pci_sysdata sd; |
16 | #ifdef CONFIG_PCI_MMCONFIG | 17 | #ifdef CONFIG_PCI_MMCONFIG |
17 | bool mcfg_added; | 18 | bool mcfg_added; |
@@ -22,6 +23,7 @@ struct pci_root_info { | |||
22 | }; | 23 | }; |
23 | 24 | ||
24 | static bool pci_use_crs = true; | 25 | static bool pci_use_crs = true; |
26 | static bool pci_ignore_seg = false; | ||
25 | 27 | ||
26 | static int __init set_use_crs(const struct dmi_system_id *id) | 28 | static int __init set_use_crs(const struct dmi_system_id *id) |
27 | { | 29 | { |
@@ -35,7 +37,14 @@ static int __init set_nouse_crs(const struct dmi_system_id *id) | |||
35 | return 0; | 37 | return 0; |
36 | } | 38 | } |
37 | 39 | ||
38 | static const struct dmi_system_id pci_use_crs_table[] __initconst = { | 40 | static int __init set_ignore_seg(const struct dmi_system_id *id) |
41 | { | ||
42 | printk(KERN_INFO "PCI: %s detected: ignoring ACPI _SEG\n", id->ident); | ||
43 | pci_ignore_seg = true; | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static const struct dmi_system_id pci_crs_quirks[] __initconst = { | ||
39 | /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */ | 48 | /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */ |
40 | { | 49 | { |
41 | .callback = set_use_crs, | 50 | .callback = set_use_crs, |
@@ -98,6 +107,16 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = { | |||
98 | DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"), | 107 | DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"), |
99 | }, | 108 | }, |
100 | }, | 109 | }, |
110 | |||
111 | /* https://bugzilla.kernel.org/show_bug.cgi?id=15362 */ | ||
112 | { | ||
113 | .callback = set_ignore_seg, | ||
114 | .ident = "HP xw9300", | ||
115 | .matches = { | ||
116 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
117 | DMI_MATCH(DMI_PRODUCT_NAME, "HP xw9300 Workstation"), | ||
118 | }, | ||
119 | }, | ||
101 | {} | 120 | {} |
102 | }; | 121 | }; |
103 | 122 | ||
@@ -108,7 +127,7 @@ void __init pci_acpi_crs_quirks(void) | |||
108 | if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year < 2008) | 127 | if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) && year < 2008) |
109 | pci_use_crs = false; | 128 | pci_use_crs = false; |
110 | 129 | ||
111 | dmi_check_system(pci_use_crs_table); | 130 | dmi_check_system(pci_crs_quirks); |
112 | 131 | ||
113 | /* | 132 | /* |
114 | * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that | 133 | * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that |
@@ -305,6 +324,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
305 | res->flags = flags; | 324 | res->flags = flags; |
306 | res->start = start; | 325 | res->start = start; |
307 | res->end = end; | 326 | res->end = end; |
327 | info->res_offset[info->res_num] = addr.translation_offset; | ||
308 | 328 | ||
309 | if (!pci_use_crs) { | 329 | if (!pci_use_crs) { |
310 | dev_printk(KERN_DEBUG, &info->bridge->dev, | 330 | dev_printk(KERN_DEBUG, &info->bridge->dev, |
@@ -374,7 +394,8 @@ static void add_resources(struct pci_root_info *info, | |||
374 | "ignoring host bridge window %pR (conflicts with %s %pR)\n", | 394 | "ignoring host bridge window %pR (conflicts with %s %pR)\n", |
375 | res, conflict->name, conflict); | 395 | res, conflict->name, conflict); |
376 | else | 396 | else |
377 | pci_add_resource(resources, res); | 397 | pci_add_resource_offset(resources, res, |
398 | info->res_offset[i]); | ||
378 | } | 399 | } |
379 | } | 400 | } |
380 | 401 | ||
@@ -382,6 +403,8 @@ static void free_pci_root_info_res(struct pci_root_info *info) | |||
382 | { | 403 | { |
383 | kfree(info->res); | 404 | kfree(info->res); |
384 | info->res = NULL; | 405 | info->res = NULL; |
406 | kfree(info->res_offset); | ||
407 | info->res_offset = NULL; | ||
385 | info->res_num = 0; | 408 | info->res_num = 0; |
386 | } | 409 | } |
387 | 410 | ||
@@ -432,10 +455,20 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, | |||
432 | return; | 455 | return; |
433 | 456 | ||
434 | size = sizeof(*info->res) * info->res_num; | 457 | size = sizeof(*info->res) * info->res_num; |
435 | info->res_num = 0; | ||
436 | info->res = kzalloc(size, GFP_KERNEL); | 458 | info->res = kzalloc(size, GFP_KERNEL); |
437 | if (!info->res) | 459 | if (!info->res) { |
460 | info->res_num = 0; | ||
461 | return; | ||
462 | } | ||
463 | |||
464 | size = sizeof(*info->res_offset) * info->res_num; | ||
465 | info->res_num = 0; | ||
466 | info->res_offset = kzalloc(size, GFP_KERNEL); | ||
467 | if (!info->res_offset) { | ||
468 | kfree(info->res); | ||
469 | info->res = NULL; | ||
438 | return; | 470 | return; |
471 | } | ||
439 | 472 | ||
440 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, | 473 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, |
441 | info); | 474 | info); |
@@ -455,6 +488,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root) | |||
455 | int pxm; | 488 | int pxm; |
456 | #endif | 489 | #endif |
457 | 490 | ||
491 | if (pci_ignore_seg) | ||
492 | domain = 0; | ||
493 | |||
458 | if (domain && !pci_domains_supported) { | 494 | if (domain && !pci_domains_supported) { |
459 | printk(KERN_WARNING "pci_bus %04x:%02x: " | 495 | printk(KERN_WARNING "pci_bus %04x:%02x: " |
460 | "ignored (multiple domains not supported)\n", | 496 | "ignored (multiple domains not supported)\n", |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 720e973fc34a..52dbf1aeeb63 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -626,7 +626,7 @@ void pcibios_disable_device (struct pci_dev *dev) | |||
626 | pcibios_disable_irq(dev); | 626 | pcibios_disable_irq(dev); |
627 | } | 627 | } |
628 | 628 | ||
629 | int pci_ext_cfg_avail(struct pci_dev *dev) | 629 | int pci_ext_cfg_avail(void) |
630 | { | 630 | { |
631 | if (raw_pci_ext_ops) | 631 | if (raw_pci_ext_ops) |
632 | return 1; | 632 | return 1; |
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index 2ef04098cc1d..a1dee29beed3 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -45,11 +45,12 @@ static int acpi_pci_unbind(struct acpi_device *device) | |||
45 | 45 | ||
46 | device_set_run_wake(&dev->dev, false); | 46 | device_set_run_wake(&dev->dev, false); |
47 | pci_acpi_remove_pm_notifier(device); | 47 | pci_acpi_remove_pm_notifier(device); |
48 | acpi_power_resource_unregister_device(&dev->dev, device->handle); | ||
48 | 49 | ||
49 | if (!dev->subordinate) | 50 | if (!dev->subordinate) |
50 | goto out; | 51 | goto out; |
51 | 52 | ||
52 | acpi_pci_irq_del_prt(dev->subordinate); | 53 | acpi_pci_irq_del_prt(pci_domain_nr(dev->bus), dev->subordinate->number); |
53 | 54 | ||
54 | device->ops.bind = NULL; | 55 | device->ops.bind = NULL; |
55 | device->ops.unbind = NULL; | 56 | device->ops.unbind = NULL; |
@@ -63,7 +64,7 @@ static int acpi_pci_bind(struct acpi_device *device) | |||
63 | { | 64 | { |
64 | acpi_status status; | 65 | acpi_status status; |
65 | acpi_handle handle; | 66 | acpi_handle handle; |
66 | struct pci_bus *bus; | 67 | unsigned char bus; |
67 | struct pci_dev *dev; | 68 | struct pci_dev *dev; |
68 | 69 | ||
69 | dev = acpi_get_pci_dev(device->handle); | 70 | dev = acpi_get_pci_dev(device->handle); |
@@ -71,6 +72,7 @@ static int acpi_pci_bind(struct acpi_device *device) | |||
71 | return 0; | 72 | return 0; |
72 | 73 | ||
73 | pci_acpi_add_pm_notifier(device, dev); | 74 | pci_acpi_add_pm_notifier(device, dev); |
75 | acpi_power_resource_register_device(&dev->dev, device->handle); | ||
74 | if (device->wakeup.flags.run_wake) | 76 | if (device->wakeup.flags.run_wake) |
75 | device_set_run_wake(&dev->dev, true); | 77 | device_set_run_wake(&dev->dev, true); |
76 | 78 | ||
@@ -100,11 +102,11 @@ static int acpi_pci_bind(struct acpi_device *device) | |||
100 | goto out; | 102 | goto out; |
101 | 103 | ||
102 | if (dev->subordinate) | 104 | if (dev->subordinate) |
103 | bus = dev->subordinate; | 105 | bus = dev->subordinate->number; |
104 | else | 106 | else |
105 | bus = dev->bus; | 107 | bus = dev->bus->number; |
106 | 108 | ||
107 | acpi_pci_irq_add_prt(device->handle, bus); | 109 | acpi_pci_irq_add_prt(device->handle, pci_domain_nr(dev->bus), bus); |
108 | 110 | ||
109 | out: | 111 | out: |
110 | pci_dev_put(dev); | 112 | pci_dev_put(dev); |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 0eefa12e648c..8835cc38aa30 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -184,7 +184,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, | |||
184 | } | 184 | } |
185 | } | 185 | } |
186 | 186 | ||
187 | static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, | 187 | static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, |
188 | struct acpi_pci_routing_table *prt) | 188 | struct acpi_pci_routing_table *prt) |
189 | { | 189 | { |
190 | struct acpi_prt_entry *entry; | 190 | struct acpi_prt_entry *entry; |
@@ -198,8 +198,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, | |||
198 | * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert | 198 | * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert |
199 | * it here. | 199 | * it here. |
200 | */ | 200 | */ |
201 | entry->id.segment = pci_domain_nr(bus); | 201 | entry->id.segment = segment; |
202 | entry->id.bus = bus->number; | 202 | entry->id.bus = bus; |
203 | entry->id.device = (prt->address >> 16) & 0xFFFF; | 203 | entry->id.device = (prt->address >> 16) & 0xFFFF; |
204 | entry->pin = prt->pin + 1; | 204 | entry->pin = prt->pin + 1; |
205 | 205 | ||
@@ -244,7 +244,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus, | |||
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | 246 | ||
247 | int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) | 247 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) |
248 | { | 248 | { |
249 | acpi_status status; | 249 | acpi_status status; |
250 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 250 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -273,7 +273,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) | |||
273 | 273 | ||
274 | entry = buffer.pointer; | 274 | entry = buffer.pointer; |
275 | while (entry && (entry->length > 0)) { | 275 | while (entry && (entry->length > 0)) { |
276 | acpi_pci_irq_add_entry(handle, bus, entry); | 276 | acpi_pci_irq_add_entry(handle, segment, bus, entry); |
277 | entry = (struct acpi_pci_routing_table *) | 277 | entry = (struct acpi_pci_routing_table *) |
278 | ((unsigned long)entry + entry->length); | 278 | ((unsigned long)entry + entry->length); |
279 | } | 279 | } |
@@ -282,17 +282,16 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus) | |||
282 | return 0; | 282 | return 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | void acpi_pci_irq_del_prt(struct pci_bus *bus) | 285 | void acpi_pci_irq_del_prt(int segment, int bus) |
286 | { | 286 | { |
287 | struct acpi_prt_entry *entry, *tmp; | 287 | struct acpi_prt_entry *entry, *tmp; |
288 | 288 | ||
289 | printk(KERN_DEBUG | 289 | printk(KERN_DEBUG |
290 | "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", | 290 | "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", |
291 | pci_domain_nr(bus), bus->number); | 291 | segment, bus); |
292 | spin_lock(&acpi_prt_lock); | 292 | spin_lock(&acpi_prt_lock); |
293 | list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { | 293 | list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { |
294 | if (pci_domain_nr(bus) == entry->id.segment | 294 | if (segment == entry->id.segment && bus == entry->id.bus) { |
295 | && bus->number == entry->id.bus) { | ||
296 | list_del(&entry->list); | 295 | list_del(&entry->list); |
297 | kfree(entry); | 296 | kfree(entry); |
298 | } | 297 | } |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index bce469c0b48a..ab781f00e32d 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -454,6 +454,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
454 | acpi_handle handle; | 454 | acpi_handle handle; |
455 | struct acpi_device *child; | 455 | struct acpi_device *child; |
456 | u32 flags, base_flags; | 456 | u32 flags, base_flags; |
457 | bool is_osc_granted = false; | ||
457 | 458 | ||
458 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); | 459 | root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
459 | if (!root) | 460 | if (!root) |
@@ -501,85 +502,47 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
501 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); | 502 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); |
502 | device->driver_data = root; | 503 | device->driver_data = root; |
503 | 504 | ||
504 | root->mcfg_addr = acpi_pci_root_get_mcfg_addr(device->handle); | ||
505 | |||
506 | /* | ||
507 | * All supported architectures that use ACPI have support for | ||
508 | * PCI domains, so we indicate this in _OSC support capabilities. | ||
509 | */ | ||
510 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; | ||
511 | acpi_pci_osc_support(root, flags); | ||
512 | |||
513 | /* | ||
514 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
515 | */ | ||
516 | |||
517 | mutex_lock(&acpi_pci_root_lock); | ||
518 | list_add_tail(&root->node, &acpi_pci_roots); | ||
519 | mutex_unlock(&acpi_pci_root_lock); | ||
520 | |||
521 | printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n", | 505 | printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n", |
522 | acpi_device_name(device), acpi_device_bid(device), | 506 | acpi_device_name(device), acpi_device_bid(device), |
523 | root->segment, &root->secondary); | 507 | root->segment, &root->secondary); |
524 | 508 | ||
525 | /* | 509 | /* |
526 | * Scan the Root Bridge | ||
527 | * -------------------- | ||
528 | * Must do this prior to any attempt to bind the root device, as the | ||
529 | * PCI namespace does not get created until this call is made (and | ||
530 | * thus the root bridge's pci_dev does not exist). | ||
531 | */ | ||
532 | root->bus = pci_acpi_scan_root(root); | ||
533 | if (!root->bus) { | ||
534 | printk(KERN_ERR PREFIX | ||
535 | "Bus %04x:%02x not present in PCI namespace\n", | ||
536 | root->segment, (unsigned int)root->secondary.start); | ||
537 | result = -ENODEV; | ||
538 | goto out_del_root; | ||
539 | } | ||
540 | |||
541 | /* | ||
542 | * Attach ACPI-PCI Context | ||
543 | * ----------------------- | ||
544 | * Thus binding the ACPI and PCI devices. | ||
545 | */ | ||
546 | result = acpi_pci_bind_root(device); | ||
547 | if (result) | ||
548 | goto out_del_root; | ||
549 | |||
550 | /* | ||
551 | * PCI Routing Table | 510 | * PCI Routing Table |
552 | * ----------------- | 511 | * ----------------- |
553 | * Evaluate and parse _PRT, if exists. | 512 | * Evaluate and parse _PRT, if exists. |
554 | */ | 513 | */ |
555 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); | 514 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); |
556 | if (ACPI_SUCCESS(status)) | 515 | if (ACPI_SUCCESS(status)) |
557 | result = acpi_pci_irq_add_prt(device->handle, root->bus); | 516 | result = acpi_pci_irq_add_prt(device->handle, root->segment, |
517 | root->secondary.start); | ||
518 | |||
519 | root->mcfg_addr = acpi_pci_root_get_mcfg_addr(device->handle); | ||
558 | 520 | ||
559 | /* | 521 | /* |
560 | * Scan and bind all _ADR-Based Devices | 522 | * All supported architectures that use ACPI have support for |
523 | * PCI domains, so we indicate this in _OSC support capabilities. | ||
561 | */ | 524 | */ |
562 | list_for_each_entry(child, &device->children, node) | 525 | flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; |
563 | acpi_pci_bridge_scan(child); | 526 | acpi_pci_osc_support(root, flags); |
564 | 527 | ||
565 | /* Indicate support for various _OSC capabilities. */ | 528 | /* Indicate support for various _OSC capabilities. */ |
566 | if (pci_ext_cfg_avail(root->bus->self)) | 529 | if (pci_ext_cfg_avail()) |
567 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; | 530 | flags |= OSC_EXT_PCI_CONFIG_SUPPORT; |
568 | if (pcie_aspm_support_enabled()) | 531 | if (pcie_aspm_support_enabled()) { |
569 | flags |= OSC_ACTIVE_STATE_PWR_SUPPORT | | 532 | flags |= OSC_ACTIVE_STATE_PWR_SUPPORT | |
570 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT; | 533 | OSC_CLOCK_PWR_CAPABILITY_SUPPORT; |
534 | } | ||
571 | if (pci_msi_enabled()) | 535 | if (pci_msi_enabled()) |
572 | flags |= OSC_MSI_SUPPORT; | 536 | flags |= OSC_MSI_SUPPORT; |
573 | if (flags != base_flags) { | 537 | if (flags != base_flags) { |
574 | status = acpi_pci_osc_support(root, flags); | 538 | status = acpi_pci_osc_support(root, flags); |
575 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
576 | dev_info(root->bus->bridge, "ACPI _OSC support " | 540 | dev_info(&device->dev, "ACPI _OSC support " |
577 | "notification failed, disabling PCIe ASPM\n"); | 541 | "notification failed, disabling PCIe ASPM\n"); |
578 | pcie_no_aspm(); | 542 | pcie_no_aspm(); |
579 | flags = base_flags; | 543 | flags = base_flags; |
580 | } | 544 | } |
581 | } | 545 | } |
582 | |||
583 | if (!pcie_ports_disabled | 546 | if (!pcie_ports_disabled |
584 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | 547 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { |
585 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | 548 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL |
@@ -588,40 +551,81 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
588 | 551 | ||
589 | if (pci_aer_available()) { | 552 | if (pci_aer_available()) { |
590 | if (aer_acpi_firmware_first()) | 553 | if (aer_acpi_firmware_first()) |
591 | dev_dbg(root->bus->bridge, | 554 | dev_dbg(&device->dev, |
592 | "PCIe errors handled by BIOS.\n"); | 555 | "PCIe errors handled by BIOS.\n"); |
593 | else | 556 | else |
594 | flags |= OSC_PCI_EXPRESS_AER_CONTROL; | 557 | flags |= OSC_PCI_EXPRESS_AER_CONTROL; |
595 | } | 558 | } |
596 | 559 | ||
597 | dev_info(root->bus->bridge, | 560 | dev_info(&device->dev, |
598 | "Requesting ACPI _OSC control (0x%02x)\n", flags); | 561 | "Requesting ACPI _OSC control (0x%02x)\n", flags); |
599 | 562 | ||
600 | status = acpi_pci_osc_control_set(device->handle, &flags, | 563 | status = acpi_pci_osc_control_set(device->handle, &flags, |
601 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | 564 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); |
602 | if (ACPI_SUCCESS(status)) { | 565 | if (ACPI_SUCCESS(status)) { |
603 | dev_info(root->bus->bridge, | 566 | is_osc_granted = true; |
567 | dev_info(&device->dev, | ||
604 | "ACPI _OSC control (0x%02x) granted\n", flags); | 568 | "ACPI _OSC control (0x%02x) granted\n", flags); |
605 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | ||
606 | /* | ||
607 | * We have ASPM control, but the FADT indicates | ||
608 | * that it's unsupported. Clear it. | ||
609 | */ | ||
610 | pcie_clear_aspm(root->bus); | ||
611 | } | ||
612 | } else { | 569 | } else { |
613 | dev_info(root->bus->bridge, | 570 | is_osc_granted = false; |
571 | dev_info(&device->dev, | ||
614 | "ACPI _OSC request failed (%s), " | 572 | "ACPI _OSC request failed (%s), " |
615 | "returned control mask: 0x%02x\n", | 573 | "returned control mask: 0x%02x\n", |
616 | acpi_format_exception(status), flags); | 574 | acpi_format_exception(status), flags); |
617 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
618 | "disabling ASPM\n"); | ||
619 | pcie_no_aspm(); | ||
620 | } | 575 | } |
621 | } else { | 576 | } else { |
622 | dev_info(root->bus->bridge, | 577 | dev_info(&device->dev, |
623 | "Unable to request _OSC control " | 578 | "Unable to request _OSC control " |
624 | "(_OSC support mask: 0x%02x)\n", flags); | 579 | "(_OSC support mask: 0x%02x)\n", flags); |
580 | } | ||
581 | |||
582 | /* | ||
583 | * TBD: Need PCI interface for enumeration/configuration of roots. | ||
584 | */ | ||
585 | |||
586 | mutex_lock(&acpi_pci_root_lock); | ||
587 | list_add_tail(&root->node, &acpi_pci_roots); | ||
588 | mutex_unlock(&acpi_pci_root_lock); | ||
589 | |||
590 | /* | ||
591 | * Scan the Root Bridge | ||
592 | * -------------------- | ||
593 | * Must do this prior to any attempt to bind the root device, as the | ||
594 | * PCI namespace does not get created until this call is made (and | ||
595 | * thus the root bridge's pci_dev does not exist). | ||
596 | */ | ||
597 | root->bus = pci_acpi_scan_root(root); | ||
598 | if (!root->bus) { | ||
599 | printk(KERN_ERR PREFIX | ||
600 | "Bus %04x:%02x not present in PCI namespace\n", | ||
601 | root->segment, (unsigned int)root->secondary.start); | ||
602 | result = -ENODEV; | ||
603 | goto out_del_root; | ||
604 | } | ||
605 | |||
606 | /* | ||
607 | * Attach ACPI-PCI Context | ||
608 | * ----------------------- | ||
609 | * Thus binding the ACPI and PCI devices. | ||
610 | */ | ||
611 | result = acpi_pci_bind_root(device); | ||
612 | if (result) | ||
613 | goto out_del_root; | ||
614 | |||
615 | /* | ||
616 | * Scan and bind all _ADR-Based Devices | ||
617 | */ | ||
618 | list_for_each_entry(child, &device->children, node) | ||
619 | acpi_pci_bridge_scan(child); | ||
620 | |||
621 | /* ASPM setting */ | ||
622 | if (is_osc_granted) { | ||
623 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) | ||
624 | pcie_clear_aspm(root->bus); | ||
625 | } else { | ||
626 | pr_info("ACPI _OSC control for PCIe not granted, " | ||
627 | "disabling ASPM\n"); | ||
628 | pcie_no_aspm(); | ||
625 | } | 629 | } |
626 | 630 | ||
627 | pci_acpi_add_bus_pm_notifier(device, root->bus); | 631 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
@@ -634,6 +638,8 @@ out_del_root: | |||
634 | mutex_lock(&acpi_pci_root_lock); | 638 | mutex_lock(&acpi_pci_root_lock); |
635 | list_del(&root->node); | 639 | list_del(&root->node); |
636 | mutex_unlock(&acpi_pci_root_lock); | 640 | mutex_unlock(&acpi_pci_root_lock); |
641 | |||
642 | acpi_pci_irq_del_prt(root->segment, root->secondary.start); | ||
637 | end: | 643 | end: |
638 | kfree(root); | 644 | kfree(root); |
639 | return result; | 645 | return result; |
@@ -644,12 +650,19 @@ static int acpi_pci_root_start(struct acpi_device *device) | |||
644 | struct acpi_pci_root *root = acpi_driver_data(device); | 650 | struct acpi_pci_root *root = acpi_driver_data(device); |
645 | struct acpi_pci_driver *driver; | 651 | struct acpi_pci_driver *driver; |
646 | 652 | ||
653 | if (system_state != SYSTEM_BOOTING) | ||
654 | pci_assign_unassigned_bus_resources(root->bus); | ||
655 | |||
647 | mutex_lock(&acpi_pci_root_lock); | 656 | mutex_lock(&acpi_pci_root_lock); |
648 | list_for_each_entry(driver, &acpi_pci_drivers, node) | 657 | list_for_each_entry(driver, &acpi_pci_drivers, node) |
649 | if (driver->add) | 658 | if (driver->add) |
650 | driver->add(root); | 659 | driver->add(root); |
651 | mutex_unlock(&acpi_pci_root_lock); | 660 | mutex_unlock(&acpi_pci_root_lock); |
652 | 661 | ||
662 | /* need to after hot-added ioapic is registered */ | ||
663 | if (system_state != SYSTEM_BOOTING) | ||
664 | pci_enable_bridges(root->bus); | ||
665 | |||
653 | pci_bus_add_devices(root->bus); | 666 | pci_bus_add_devices(root->bus); |
654 | 667 | ||
655 | return 0; | 668 | return 0; |
@@ -657,17 +670,29 @@ static int acpi_pci_root_start(struct acpi_device *device) | |||
657 | 670 | ||
658 | static int acpi_pci_root_remove(struct acpi_device *device, int type) | 671 | static int acpi_pci_root_remove(struct acpi_device *device, int type) |
659 | { | 672 | { |
673 | acpi_status status; | ||
674 | acpi_handle handle; | ||
660 | struct acpi_pci_root *root = acpi_driver_data(device); | 675 | struct acpi_pci_root *root = acpi_driver_data(device); |
661 | struct acpi_pci_driver *driver; | 676 | struct acpi_pci_driver *driver; |
662 | 677 | ||
678 | pci_stop_root_bus(root->bus); | ||
679 | |||
663 | mutex_lock(&acpi_pci_root_lock); | 680 | mutex_lock(&acpi_pci_root_lock); |
664 | list_for_each_entry(driver, &acpi_pci_drivers, node) | 681 | list_for_each_entry_reverse(driver, &acpi_pci_drivers, node) |
665 | if (driver->remove) | 682 | if (driver->remove) |
666 | driver->remove(root); | 683 | driver->remove(root); |
684 | mutex_unlock(&acpi_pci_root_lock); | ||
667 | 685 | ||
668 | device_set_run_wake(root->bus->bridge, false); | 686 | device_set_run_wake(root->bus->bridge, false); |
669 | pci_acpi_remove_bus_pm_notifier(device); | 687 | pci_acpi_remove_bus_pm_notifier(device); |
670 | 688 | ||
689 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); | ||
690 | if (ACPI_SUCCESS(status)) | ||
691 | acpi_pci_irq_del_prt(root->segment, root->secondary.start); | ||
692 | |||
693 | pci_remove_root_bus(root->bus); | ||
694 | |||
695 | mutex_lock(&acpi_pci_root_lock); | ||
671 | list_del(&root->node); | 696 | list_del(&root->node); |
672 | mutex_unlock(&acpi_pci_root_lock); | 697 | mutex_unlock(&acpi_pci_root_lock); |
673 | kfree(root); | 698 | kfree(root); |
diff --git a/drivers/pci/ioapic.c b/drivers/pci/ioapic.c index 205af8dc83c2..22436f74eb50 100644 --- a/drivers/pci/ioapic.c +++ b/drivers/pci/ioapic.c | |||
@@ -125,3 +125,5 @@ static void __exit ioapic_exit(void) | |||
125 | 125 | ||
126 | module_init(ioapic_init); | 126 | module_init(ioapic_init); |
127 | module_exit(ioapic_exit); | 127 | module_exit(ioapic_exit); |
128 | |||
129 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index aeccc911abb8..bafd2bbcaf65 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c | |||
@@ -106,7 +106,7 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset) | |||
106 | virtfn->resource[i].name = pci_name(virtfn); | 106 | virtfn->resource[i].name = pci_name(virtfn); |
107 | virtfn->resource[i].flags = res->flags; | 107 | virtfn->resource[i].flags = res->flags; |
108 | size = resource_size(res); | 108 | size = resource_size(res); |
109 | do_div(size, iov->total); | 109 | do_div(size, iov->total_VFs); |
110 | virtfn->resource[i].start = res->start + size * id; | 110 | virtfn->resource[i].start = res->start + size * id; |
111 | virtfn->resource[i].end = virtfn->resource[i].start + size - 1; | 111 | virtfn->resource[i].end = virtfn->resource[i].start + size - 1; |
112 | rc = request_resource(res, &virtfn->resource[i]); | 112 | rc = request_resource(res, &virtfn->resource[i]); |
@@ -194,7 +194,7 @@ static int sriov_migration(struct pci_dev *dev) | |||
194 | u16 status; | 194 | u16 status; |
195 | struct pci_sriov *iov = dev->sriov; | 195 | struct pci_sriov *iov = dev->sriov; |
196 | 196 | ||
197 | if (!iov->nr_virtfn) | 197 | if (!iov->num_VFs) |
198 | return 0; | 198 | return 0; |
199 | 199 | ||
200 | if (!(iov->cap & PCI_SRIOV_CAP_VFM)) | 200 | if (!(iov->cap & PCI_SRIOV_CAP_VFM)) |
@@ -216,7 +216,7 @@ static void sriov_migration_task(struct work_struct *work) | |||
216 | u16 status; | 216 | u16 status; |
217 | struct pci_sriov *iov = container_of(work, struct pci_sriov, mtask); | 217 | struct pci_sriov *iov = container_of(work, struct pci_sriov, mtask); |
218 | 218 | ||
219 | for (i = iov->initial; i < iov->nr_virtfn; i++) { | 219 | for (i = iov->initial_VFs; i < iov->num_VFs; i++) { |
220 | state = readb(iov->mstate + i); | 220 | state = readb(iov->mstate + i); |
221 | if (state == PCI_SRIOV_VFM_MI) { | 221 | if (state == PCI_SRIOV_VFM_MI) { |
222 | writeb(PCI_SRIOV_VFM_AV, iov->mstate + i); | 222 | writeb(PCI_SRIOV_VFM_AV, iov->mstate + i); |
@@ -244,7 +244,7 @@ static int sriov_enable_migration(struct pci_dev *dev, int nr_virtfn) | |||
244 | resource_size_t pa; | 244 | resource_size_t pa; |
245 | struct pci_sriov *iov = dev->sriov; | 245 | struct pci_sriov *iov = dev->sriov; |
246 | 246 | ||
247 | if (nr_virtfn <= iov->initial) | 247 | if (nr_virtfn <= iov->initial_VFs) |
248 | return 0; | 248 | return 0; |
249 | 249 | ||
250 | pci_read_config_dword(dev, iov->pos + PCI_SRIOV_VFM, &table); | 250 | pci_read_config_dword(dev, iov->pos + PCI_SRIOV_VFM, &table); |
@@ -294,15 +294,15 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
294 | if (!nr_virtfn) | 294 | if (!nr_virtfn) |
295 | return 0; | 295 | return 0; |
296 | 296 | ||
297 | if (iov->nr_virtfn) | 297 | if (iov->num_VFs) |
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | 299 | ||
300 | pci_read_config_word(dev, iov->pos + PCI_SRIOV_INITIAL_VF, &initial); | 300 | pci_read_config_word(dev, iov->pos + PCI_SRIOV_INITIAL_VF, &initial); |
301 | if (initial > iov->total || | 301 | if (initial > iov->total_VFs || |
302 | (!(iov->cap & PCI_SRIOV_CAP_VFM) && (initial != iov->total))) | 302 | (!(iov->cap & PCI_SRIOV_CAP_VFM) && (initial != iov->total_VFs))) |
303 | return -EIO; | 303 | return -EIO; |
304 | 304 | ||
305 | if (nr_virtfn < 0 || nr_virtfn > iov->total || | 305 | if (nr_virtfn < 0 || nr_virtfn > iov->total_VFs || |
306 | (!(iov->cap & PCI_SRIOV_CAP_VFM) && (nr_virtfn > initial))) | 306 | (!(iov->cap & PCI_SRIOV_CAP_VFM) && (nr_virtfn > initial))) |
307 | return -EINVAL; | 307 | return -EINVAL; |
308 | 308 | ||
@@ -359,7 +359,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
359 | msleep(100); | 359 | msleep(100); |
360 | pci_cfg_access_unlock(dev); | 360 | pci_cfg_access_unlock(dev); |
361 | 361 | ||
362 | iov->initial = initial; | 362 | iov->initial_VFs = initial; |
363 | if (nr_virtfn < initial) | 363 | if (nr_virtfn < initial) |
364 | initial = nr_virtfn; | 364 | initial = nr_virtfn; |
365 | 365 | ||
@@ -376,7 +376,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) | |||
376 | } | 376 | } |
377 | 377 | ||
378 | kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); | 378 | kobject_uevent(&dev->dev.kobj, KOBJ_CHANGE); |
379 | iov->nr_virtfn = nr_virtfn; | 379 | iov->num_VFs = nr_virtfn; |
380 | 380 | ||
381 | return 0; | 381 | return 0; |
382 | 382 | ||
@@ -401,13 +401,13 @@ static void sriov_disable(struct pci_dev *dev) | |||
401 | int i; | 401 | int i; |
402 | struct pci_sriov *iov = dev->sriov; | 402 | struct pci_sriov *iov = dev->sriov; |
403 | 403 | ||
404 | if (!iov->nr_virtfn) | 404 | if (!iov->num_VFs) |
405 | return; | 405 | return; |
406 | 406 | ||
407 | if (iov->cap & PCI_SRIOV_CAP_VFM) | 407 | if (iov->cap & PCI_SRIOV_CAP_VFM) |
408 | sriov_disable_migration(dev); | 408 | sriov_disable_migration(dev); |
409 | 409 | ||
410 | for (i = 0; i < iov->nr_virtfn; i++) | 410 | for (i = 0; i < iov->num_VFs; i++) |
411 | virtfn_remove(dev, i, 0); | 411 | virtfn_remove(dev, i, 0); |
412 | 412 | ||
413 | iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); | 413 | iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE); |
@@ -419,7 +419,7 @@ static void sriov_disable(struct pci_dev *dev) | |||
419 | if (iov->link != dev->devfn) | 419 | if (iov->link != dev->devfn) |
420 | sysfs_remove_link(&dev->dev.kobj, "dep_link"); | 420 | sysfs_remove_link(&dev->dev.kobj, "dep_link"); |
421 | 421 | ||
422 | iov->nr_virtfn = 0; | 422 | iov->num_VFs = 0; |
423 | } | 423 | } |
424 | 424 | ||
425 | static int sriov_init(struct pci_dev *dev, int pos) | 425 | static int sriov_init(struct pci_dev *dev, int pos) |
@@ -496,7 +496,7 @@ found: | |||
496 | iov->pos = pos; | 496 | iov->pos = pos; |
497 | iov->nres = nres; | 497 | iov->nres = nres; |
498 | iov->ctrl = ctrl; | 498 | iov->ctrl = ctrl; |
499 | iov->total = total; | 499 | iov->total_VFs = total; |
500 | iov->offset = offset; | 500 | iov->offset = offset; |
501 | iov->stride = stride; | 501 | iov->stride = stride; |
502 | iov->pgsz = pgsz; | 502 | iov->pgsz = pgsz; |
@@ -529,7 +529,7 @@ failed: | |||
529 | 529 | ||
530 | static void sriov_release(struct pci_dev *dev) | 530 | static void sriov_release(struct pci_dev *dev) |
531 | { | 531 | { |
532 | BUG_ON(dev->sriov->nr_virtfn); | 532 | BUG_ON(dev->sriov->num_VFs); |
533 | 533 | ||
534 | if (dev != dev->sriov->dev) | 534 | if (dev != dev->sriov->dev) |
535 | pci_dev_put(dev->sriov->dev); | 535 | pci_dev_put(dev->sriov->dev); |
@@ -554,7 +554,7 @@ static void sriov_restore_state(struct pci_dev *dev) | |||
554 | pci_update_resource(dev, i); | 554 | pci_update_resource(dev, i); |
555 | 555 | ||
556 | pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz); | 556 | pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz); |
557 | pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, iov->nr_virtfn); | 557 | pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, iov->num_VFs); |
558 | pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); | 558 | pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); |
559 | if (iov->ctrl & PCI_SRIOV_CTRL_VFE) | 559 | if (iov->ctrl & PCI_SRIOV_CTRL_VFE) |
560 | msleep(100); | 560 | msleep(100); |
@@ -661,7 +661,7 @@ int pci_iov_bus_range(struct pci_bus *bus) | |||
661 | list_for_each_entry(dev, &bus->devices, bus_list) { | 661 | list_for_each_entry(dev, &bus->devices, bus_list) { |
662 | if (!dev->is_physfn) | 662 | if (!dev->is_physfn) |
663 | continue; | 663 | continue; |
664 | busnr = virtfn_bus(dev, dev->sriov->total - 1); | 664 | busnr = virtfn_bus(dev, dev->sriov->total_VFs - 1); |
665 | if (busnr > max) | 665 | if (busnr > max) |
666 | max = busnr; | 666 | max = busnr; |
667 | } | 667 | } |
@@ -729,9 +729,56 @@ EXPORT_SYMBOL_GPL(pci_sriov_migration); | |||
729 | */ | 729 | */ |
730 | int pci_num_vf(struct pci_dev *dev) | 730 | int pci_num_vf(struct pci_dev *dev) |
731 | { | 731 | { |
732 | if (!dev || !dev->is_physfn) | 732 | if (!dev->is_physfn) |
733 | return 0; | 733 | return 0; |
734 | else | 734 | |
735 | return dev->sriov->nr_virtfn; | 735 | return dev->sriov->num_VFs; |
736 | } | 736 | } |
737 | EXPORT_SYMBOL_GPL(pci_num_vf); | 737 | EXPORT_SYMBOL_GPL(pci_num_vf); |
738 | |||
739 | /** | ||
740 | * pci_sriov_set_totalvfs -- reduce the TotalVFs available | ||
741 | * @dev: the PCI PF device | ||
742 | * numvfs: number that should be used for TotalVFs supported | ||
743 | * | ||
744 | * Should be called from PF driver's probe routine with | ||
745 | * device's mutex held. | ||
746 | * | ||
747 | * Returns 0 if PF is an SRIOV-capable device and | ||
748 | * value of numvfs valid. If not a PF with VFS, return -EINVAL; | ||
749 | * if VFs already enabled, return -EBUSY. | ||
750 | */ | ||
751 | int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) | ||
752 | { | ||
753 | if (!dev->is_physfn || (numvfs > dev->sriov->total_VFs)) | ||
754 | return -EINVAL; | ||
755 | |||
756 | /* Shouldn't change if VFs already enabled */ | ||
757 | if (dev->sriov->ctrl & PCI_SRIOV_CTRL_VFE) | ||
758 | return -EBUSY; | ||
759 | else | ||
760 | dev->sriov->driver_max_VFs = numvfs; | ||
761 | |||
762 | return 0; | ||
763 | } | ||
764 | EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs); | ||
765 | |||
766 | /** | ||
767 | * pci_sriov_get_totalvfs -- get total VFs supported on this devic3 | ||
768 | * @dev: the PCI PF device | ||
769 | * | ||
770 | * For a PCIe device with SRIOV support, return the PCIe | ||
771 | * SRIOV capability value of TotalVFs or the value of driver_max_VFs | ||
772 | * if the driver reduced it. Otherwise, -EINVAL. | ||
773 | */ | ||
774 | int pci_sriov_get_totalvfs(struct pci_dev *dev) | ||
775 | { | ||
776 | if (!dev->is_physfn) | ||
777 | return -EINVAL; | ||
778 | |||
779 | if (dev->sriov->driver_max_VFs) | ||
780 | return dev->sriov->driver_max_VFs; | ||
781 | |||
782 | return dev->sriov->total_VFs; | ||
783 | } | ||
784 | EXPORT_SYMBOL_GPL(pci_sriov_get_totalvfs); | ||
diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c index e5f69a43b1b1..b008cf86b9c3 100644 --- a/drivers/pci/irq.c +++ b/drivers/pci/irq.c | |||
@@ -14,11 +14,11 @@ static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason) | |||
14 | { | 14 | { |
15 | struct pci_dev *parent = to_pci_dev(pdev->dev.parent); | 15 | struct pci_dev *parent = to_pci_dev(pdev->dev.parent); |
16 | 16 | ||
17 | dev_printk(KERN_ERR, &pdev->dev, | 17 | dev_err(&pdev->dev, |
18 | "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n", | 18 | "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n", |
19 | dev_name(&parent->dev), parent->vendor, parent->device); | 19 | dev_name(&parent->dev), parent->vendor, parent->device); |
20 | dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason); | 20 | dev_err(&pdev->dev, "%s\n", reason); |
21 | dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n"); | 21 | dev_err(&pdev->dev, "Please report to linux-kernel@vger.kernel.org\n"); |
22 | WARN_ON(1); | 22 | WARN_ON(1); |
23 | } | 23 | } |
24 | 24 | ||
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 6c94fc9489e7..24aa44c6ed02 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -1015,10 +1015,10 @@ static int pci_pm_runtime_suspend(struct device *dev) | |||
1015 | return 0; | 1015 | return 0; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | if (!pci_dev->state_saved) | 1018 | if (!pci_dev->state_saved) { |
1019 | pci_save_state(pci_dev); | 1019 | pci_save_state(pci_dev); |
1020 | 1020 | pci_finish_runtime_suspend(pci_dev); | |
1021 | pci_finish_runtime_suspend(pci_dev); | 1021 | } |
1022 | 1022 | ||
1023 | return 0; | 1023 | return 0; |
1024 | } | 1024 | } |
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c index 775e933c2225..6e47c519c510 100644 --- a/drivers/pci/pci-stub.c +++ b/drivers/pci/pci-stub.c | |||
@@ -28,7 +28,7 @@ MODULE_PARM_DESC(ids, "Initial PCI IDs to add to the stub driver, format is " | |||
28 | 28 | ||
29 | static int pci_stub_probe(struct pci_dev *dev, const struct pci_device_id *id) | 29 | static int pci_stub_probe(struct pci_dev *dev, const struct pci_device_id *id) |
30 | { | 30 | { |
31 | dev_printk(KERN_INFO, &dev->dev, "claimed by stub\n"); | 31 | dev_info(&dev->dev, "claimed by stub\n"); |
32 | return 0; | 32 | return 0; |
33 | } | 33 | } |
34 | 34 | ||
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index f39378d9da15..5d883a152789 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -404,6 +404,106 @@ static ssize_t d3cold_allowed_show(struct device *dev, | |||
404 | } | 404 | } |
405 | #endif | 405 | #endif |
406 | 406 | ||
407 | #ifdef CONFIG_PCI_IOV | ||
408 | static ssize_t sriov_totalvfs_show(struct device *dev, | ||
409 | struct device_attribute *attr, | ||
410 | char *buf) | ||
411 | { | ||
412 | struct pci_dev *pdev = to_pci_dev(dev); | ||
413 | |||
414 | return sprintf(buf, "%u\n", pci_sriov_get_totalvfs(pdev)); | ||
415 | } | ||
416 | |||
417 | |||
418 | static ssize_t sriov_numvfs_show(struct device *dev, | ||
419 | struct device_attribute *attr, | ||
420 | char *buf) | ||
421 | { | ||
422 | struct pci_dev *pdev = to_pci_dev(dev); | ||
423 | |||
424 | return sprintf(buf, "%u\n", pdev->sriov->num_VFs); | ||
425 | } | ||
426 | |||
427 | /* | ||
428 | * num_vfs > 0; number of vfs to enable | ||
429 | * num_vfs = 0; disable all vfs | ||
430 | * | ||
431 | * Note: SRIOV spec doesn't allow partial VF | ||
432 | * disable, so its all or none. | ||
433 | */ | ||
434 | static ssize_t sriov_numvfs_store(struct device *dev, | ||
435 | struct device_attribute *attr, | ||
436 | const char *buf, size_t count) | ||
437 | { | ||
438 | struct pci_dev *pdev = to_pci_dev(dev); | ||
439 | int num_vfs_enabled = 0; | ||
440 | int num_vfs; | ||
441 | int ret = 0; | ||
442 | u16 total; | ||
443 | |||
444 | if (kstrtoint(buf, 0, &num_vfs) < 0) | ||
445 | return -EINVAL; | ||
446 | |||
447 | /* is PF driver loaded w/callback */ | ||
448 | if (!pdev->driver || !pdev->driver->sriov_configure) { | ||
449 | dev_info(&pdev->dev, | ||
450 | "Driver doesn't support SRIOV configuration via sysfs\n"); | ||
451 | return -ENOSYS; | ||
452 | } | ||
453 | |||
454 | /* if enabling vf's ... */ | ||
455 | total = pci_sriov_get_totalvfs(pdev); | ||
456 | /* Requested VFs to enable < totalvfs and none enabled already */ | ||
457 | if ((num_vfs > 0) && (num_vfs <= total)) { | ||
458 | if (pdev->sriov->num_VFs == 0) { | ||
459 | num_vfs_enabled = | ||
460 | pdev->driver->sriov_configure(pdev, num_vfs); | ||
461 | if ((num_vfs_enabled >= 0) && | ||
462 | (num_vfs_enabled != num_vfs)) { | ||
463 | dev_warn(&pdev->dev, | ||
464 | "Only %d VFs enabled\n", | ||
465 | num_vfs_enabled); | ||
466 | return count; | ||
467 | } else if (num_vfs_enabled < 0) | ||
468 | /* error code from driver callback */ | ||
469 | return num_vfs_enabled; | ||
470 | } else if (num_vfs == pdev->sriov->num_VFs) { | ||
471 | dev_warn(&pdev->dev, | ||
472 | "%d VFs already enabled; no enable action taken\n", | ||
473 | num_vfs); | ||
474 | return count; | ||
475 | } else { | ||
476 | dev_warn(&pdev->dev, | ||
477 | "%d VFs already enabled. Disable before enabling %d VFs\n", | ||
478 | pdev->sriov->num_VFs, num_vfs); | ||
479 | return -EINVAL; | ||
480 | } | ||
481 | } | ||
482 | |||
483 | /* disable vfs */ | ||
484 | if (num_vfs == 0) { | ||
485 | if (pdev->sriov->num_VFs != 0) { | ||
486 | ret = pdev->driver->sriov_configure(pdev, 0); | ||
487 | return ret ? ret : count; | ||
488 | } else { | ||
489 | dev_warn(&pdev->dev, | ||
490 | "All VFs disabled; no disable action taken\n"); | ||
491 | return count; | ||
492 | } | ||
493 | } | ||
494 | |||
495 | dev_err(&pdev->dev, | ||
496 | "Invalid value for number of VFs to enable: %d\n", num_vfs); | ||
497 | |||
498 | return -EINVAL; | ||
499 | } | ||
500 | |||
501 | static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); | ||
502 | static struct device_attribute sriov_numvfs_attr = | ||
503 | __ATTR(sriov_numvfs, (S_IRUGO|S_IWUSR|S_IWGRP), | ||
504 | sriov_numvfs_show, sriov_numvfs_store); | ||
505 | #endif /* CONFIG_PCI_IOV */ | ||
506 | |||
407 | struct device_attribute pci_dev_attrs[] = { | 507 | struct device_attribute pci_dev_attrs[] = { |
408 | __ATTR_RO(resource), | 508 | __ATTR_RO(resource), |
409 | __ATTR_RO(vendor), | 509 | __ATTR_RO(vendor), |
@@ -1269,29 +1369,20 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
1269 | pdev->rom_attr = attr; | 1369 | pdev->rom_attr = attr; |
1270 | } | 1370 | } |
1271 | 1371 | ||
1272 | if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) { | ||
1273 | retval = device_create_file(&pdev->dev, &vga_attr); | ||
1274 | if (retval) | ||
1275 | goto err_rom_file; | ||
1276 | } | ||
1277 | |||
1278 | /* add platform-specific attributes */ | 1372 | /* add platform-specific attributes */ |
1279 | retval = pcibios_add_platform_entries(pdev); | 1373 | retval = pcibios_add_platform_entries(pdev); |
1280 | if (retval) | 1374 | if (retval) |
1281 | goto err_vga_file; | 1375 | goto err_rom_file; |
1282 | 1376 | ||
1283 | /* add sysfs entries for various capabilities */ | 1377 | /* add sysfs entries for various capabilities */ |
1284 | retval = pci_create_capabilities_sysfs(pdev); | 1378 | retval = pci_create_capabilities_sysfs(pdev); |
1285 | if (retval) | 1379 | if (retval) |
1286 | goto err_vga_file; | 1380 | goto err_rom_file; |
1287 | 1381 | ||
1288 | pci_create_firmware_label_files(pdev); | 1382 | pci_create_firmware_label_files(pdev); |
1289 | 1383 | ||
1290 | return 0; | 1384 | return 0; |
1291 | 1385 | ||
1292 | err_vga_file: | ||
1293 | if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) | ||
1294 | device_remove_file(&pdev->dev, &vga_attr); | ||
1295 | err_rom_file: | 1386 | err_rom_file: |
1296 | if (rom_size) { | 1387 | if (rom_size) { |
1297 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); | 1388 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); |
@@ -1377,3 +1468,62 @@ static int __init pci_sysfs_init(void) | |||
1377 | } | 1468 | } |
1378 | 1469 | ||
1379 | late_initcall(pci_sysfs_init); | 1470 | late_initcall(pci_sysfs_init); |
1471 | |||
1472 | static struct attribute *pci_dev_dev_attrs[] = { | ||
1473 | &vga_attr.attr, | ||
1474 | NULL, | ||
1475 | }; | ||
1476 | |||
1477 | static umode_t pci_dev_attrs_are_visible(struct kobject *kobj, | ||
1478 | struct attribute *a, int n) | ||
1479 | { | ||
1480 | struct device *dev = container_of(kobj, struct device, kobj); | ||
1481 | struct pci_dev *pdev = to_pci_dev(dev); | ||
1482 | |||
1483 | if (a == &vga_attr.attr) | ||
1484 | if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) | ||
1485 | return 0; | ||
1486 | |||
1487 | return a->mode; | ||
1488 | } | ||
1489 | |||
1490 | #ifdef CONFIG_PCI_IOV | ||
1491 | static struct attribute *sriov_dev_attrs[] = { | ||
1492 | &sriov_totalvfs_attr.attr, | ||
1493 | &sriov_numvfs_attr.attr, | ||
1494 | NULL, | ||
1495 | }; | ||
1496 | |||
1497 | static umode_t sriov_attrs_are_visible(struct kobject *kobj, | ||
1498 | struct attribute *a, int n) | ||
1499 | { | ||
1500 | struct device *dev = container_of(kobj, struct device, kobj); | ||
1501 | |||
1502 | if (!dev_is_pf(dev)) | ||
1503 | return 0; | ||
1504 | |||
1505 | return a->mode; | ||
1506 | } | ||
1507 | |||
1508 | static struct attribute_group sriov_dev_attr_group = { | ||
1509 | .attrs = sriov_dev_attrs, | ||
1510 | .is_visible = sriov_attrs_are_visible, | ||
1511 | }; | ||
1512 | #endif /* CONFIG_PCI_IOV */ | ||
1513 | |||
1514 | static struct attribute_group pci_dev_attr_group = { | ||
1515 | .attrs = pci_dev_dev_attrs, | ||
1516 | .is_visible = pci_dev_attrs_are_visible, | ||
1517 | }; | ||
1518 | |||
1519 | static const struct attribute_group *pci_dev_attr_groups[] = { | ||
1520 | &pci_dev_attr_group, | ||
1521 | #ifdef CONFIG_PCI_IOV | ||
1522 | &sriov_dev_attr_group, | ||
1523 | #endif | ||
1524 | NULL, | ||
1525 | }; | ||
1526 | |||
1527 | struct device_type pci_dev_type = { | ||
1528 | .groups = pci_dev_attr_groups, | ||
1529 | }; | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index aabf64798bda..adffc6f621e5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1578,15 +1578,25 @@ void pci_pme_active(struct pci_dev *dev, bool enable) | |||
1578 | 1578 | ||
1579 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); | 1579 | pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); |
1580 | 1580 | ||
1581 | /* PCI (as opposed to PCIe) PME requires that the device have | 1581 | /* |
1582 | its PME# line hooked up correctly. Not all hardware vendors | 1582 | * PCI (as opposed to PCIe) PME requires that the device have |
1583 | do this, so the PME never gets delivered and the device | 1583 | * its PME# line hooked up correctly. Not all hardware vendors |
1584 | remains asleep. The easiest way around this is to | 1584 | * do this, so the PME never gets delivered and the device |
1585 | periodically walk the list of suspended devices and check | 1585 | * remains asleep. The easiest way around this is to |
1586 | whether any have their PME flag set. The assumption is that | 1586 | * periodically walk the list of suspended devices and check |
1587 | we'll wake up often enough anyway that this won't be a huge | 1587 | * whether any have their PME flag set. The assumption is that |
1588 | hit, and the power savings from the devices will still be a | 1588 | * we'll wake up often enough anyway that this won't be a huge |
1589 | win. */ | 1589 | * hit, and the power savings from the devices will still be a |
1590 | * win. | ||
1591 | * | ||
1592 | * Although PCIe uses in-band PME message instead of PME# line | ||
1593 | * to report PME, PME does not work for some PCIe devices in | ||
1594 | * reality. For example, there are devices that set their PME | ||
1595 | * status bits, but don't really bother to send a PME message; | ||
1596 | * there are PCI Express Root Ports that don't bother to | ||
1597 | * trigger interrupts when they receive PME messages from the | ||
1598 | * devices below. So PME poll is used for PCIe devices too. | ||
1599 | */ | ||
1590 | 1600 | ||
1591 | if (dev->pme_poll) { | 1601 | if (dev->pme_poll) { |
1592 | struct pci_pme_device *pme_dev; | 1602 | struct pci_pme_device *pme_dev; |
@@ -3865,14 +3875,13 @@ static void __devinit pci_no_domains(void) | |||
3865 | } | 3875 | } |
3866 | 3876 | ||
3867 | /** | 3877 | /** |
3868 | * pci_ext_cfg_enabled - can we access extended PCI config space? | 3878 | * pci_ext_cfg_avail - can we access extended PCI config space? |
3869 | * @dev: The PCI device of the root bridge. | ||
3870 | * | 3879 | * |
3871 | * Returns 1 if we can access PCI extended config space (offsets | 3880 | * Returns 1 if we can access PCI extended config space (offsets |
3872 | * greater than 0xff). This is the default implementation. Architecture | 3881 | * greater than 0xff). This is the default implementation. Architecture |
3873 | * implementations can override this. | 3882 | * implementations can override this. |
3874 | */ | 3883 | */ |
3875 | int __weak pci_ext_cfg_avail(struct pci_dev *dev) | 3884 | int __weak pci_ext_cfg_avail(void) |
3876 | { | 3885 | { |
3877 | return 1; | 3886 | return 1; |
3878 | } | 3887 | } |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index fd92aab9904b..11a713bc7293 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -159,6 +159,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev) | |||
159 | } | 159 | } |
160 | extern struct device_attribute pci_dev_attrs[]; | 160 | extern struct device_attribute pci_dev_attrs[]; |
161 | extern struct device_attribute pcibus_dev_attrs[]; | 161 | extern struct device_attribute pcibus_dev_attrs[]; |
162 | extern struct device_type pci_dev_type; | ||
162 | #ifdef CONFIG_HOTPLUG | 163 | #ifdef CONFIG_HOTPLUG |
163 | extern struct bus_attribute pci_bus_attrs[]; | 164 | extern struct bus_attribute pci_bus_attrs[]; |
164 | #else | 165 | #else |
@@ -234,13 +235,14 @@ struct pci_sriov { | |||
234 | int nres; /* number of resources */ | 235 | int nres; /* number of resources */ |
235 | u32 cap; /* SR-IOV Capabilities */ | 236 | u32 cap; /* SR-IOV Capabilities */ |
236 | u16 ctrl; /* SR-IOV Control */ | 237 | u16 ctrl; /* SR-IOV Control */ |
237 | u16 total; /* total VFs associated with the PF */ | 238 | u16 total_VFs; /* total VFs associated with the PF */ |
238 | u16 initial; /* initial VFs associated with the PF */ | 239 | u16 initial_VFs; /* initial VFs associated with the PF */ |
239 | u16 nr_virtfn; /* number of VFs available */ | 240 | u16 num_VFs; /* number of VFs available */ |
240 | u16 offset; /* first VF Routing ID offset */ | 241 | u16 offset; /* first VF Routing ID offset */ |
241 | u16 stride; /* following VF stride */ | 242 | u16 stride; /* following VF stride */ |
242 | u32 pgsz; /* page size for BAR alignment */ | 243 | u32 pgsz; /* page size for BAR alignment */ |
243 | u8 link; /* Function Dependency Link */ | 244 | u8 link; /* Function Dependency Link */ |
245 | u16 driver_max_VFs; /* max num VFs driver supports */ | ||
244 | struct pci_dev *dev; /* lowest numbered PF */ | 246 | struct pci_dev *dev; /* lowest numbered PF */ |
245 | struct pci_dev *self; /* this PF */ | 247 | struct pci_dev *self; /* this PF */ |
246 | struct mutex lock; /* lock for VF bus */ | 248 | struct mutex lock; /* lock for VF bus */ |
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 213753b283a6..3da9ecc9ab84 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -242,8 +242,7 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link) | |||
242 | return; | 242 | return; |
243 | 243 | ||
244 | /* Training failed. Restore common clock configurations */ | 244 | /* Training failed. Restore common clock configurations */ |
245 | dev_printk(KERN_ERR, &parent->dev, | 245 | dev_err(&parent->dev, "ASPM: Could not configure common clock\n"); |
246 | "ASPM: Could not configure common clock\n"); | ||
247 | list_for_each_entry(child, &linkbus->devices, bus_list) | 246 | list_for_each_entry(child, &linkbus->devices, bus_list) |
248 | pcie_capability_write_word(child, PCI_EXP_LNKCTL, | 247 | pcie_capability_write_word(child, PCI_EXP_LNKCTL, |
249 | child_reg[PCI_FUNC(child->devfn)]); | 248 | child_reg[PCI_FUNC(child->devfn)]); |
@@ -507,9 +506,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) | |||
507 | */ | 506 | */ |
508 | pcie_capability_read_dword(child, PCI_EXP_DEVCAP, ®32); | 507 | pcie_capability_read_dword(child, PCI_EXP_DEVCAP, ®32); |
509 | if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) { | 508 | if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) { |
510 | dev_printk(KERN_INFO, &child->dev, "disabling ASPM" | 509 | dev_info(&child->dev, "disabling ASPM on pre-1.1 PCIe device. You can enable it with 'pcie_aspm=force'\n"); |
511 | " on pre-1.1 PCIe device. You can enable it" | ||
512 | " with 'pcie_aspm=force'\n"); | ||
513 | return -EINVAL; | 510 | return -EINVAL; |
514 | } | 511 | } |
515 | } | 512 | } |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ec909afa90b6..293af5a6f912 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -975,6 +975,7 @@ int pci_setup_device(struct pci_dev *dev) | |||
975 | dev->sysdata = dev->bus->sysdata; | 975 | dev->sysdata = dev->bus->sysdata; |
976 | dev->dev.parent = dev->bus->bridge; | 976 | dev->dev.parent = dev->bus->bridge; |
977 | dev->dev.bus = &pci_bus_type; | 977 | dev->dev.bus = &pci_bus_type; |
978 | dev->dev.type = &pci_dev_type; | ||
978 | dev->hdr_type = hdr_type & 0x7f; | 979 | dev->hdr_type = hdr_type & 0x7f; |
979 | dev->multifunction = !!(hdr_type & 0x80); | 980 | dev->multifunction = !!(hdr_type & 0x80); |
980 | dev->error_state = pci_channel_io_normal; | 981 | dev->error_state = pci_channel_io_normal; |
@@ -1890,6 +1891,28 @@ unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge) | |||
1890 | return max; | 1891 | return max; |
1891 | } | 1892 | } |
1892 | 1893 | ||
1894 | /** | ||
1895 | * pci_rescan_bus - scan a PCI bus for devices. | ||
1896 | * @bus: PCI bus to scan | ||
1897 | * | ||
1898 | * Scan a PCI bus and child buses for new devices, adds them, | ||
1899 | * and enables them. | ||
1900 | * | ||
1901 | * Returns the max number of subordinate bus discovered. | ||
1902 | */ | ||
1903 | unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | ||
1904 | { | ||
1905 | unsigned int max; | ||
1906 | |||
1907 | max = pci_scan_child_bus(bus); | ||
1908 | pci_assign_unassigned_bus_resources(bus); | ||
1909 | pci_enable_bridges(bus); | ||
1910 | pci_bus_add_devices(bus); | ||
1911 | |||
1912 | return max; | ||
1913 | } | ||
1914 | EXPORT_SYMBOL_GPL(pci_rescan_bus); | ||
1915 | |||
1893 | EXPORT_SYMBOL(pci_add_new_bus); | 1916 | EXPORT_SYMBOL(pci_add_new_bus); |
1894 | EXPORT_SYMBOL(pci_scan_slot); | 1917 | EXPORT_SYMBOL(pci_scan_slot); |
1895 | EXPORT_SYMBOL(pci_scan_bridge); | 1918 | EXPORT_SYMBOL(pci_scan_bridge); |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 7a451ff56ecc..0c59f7aba12b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1790,6 +1790,45 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TOSHIBA_2, | |||
1790 | PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE, | 1790 | PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE, |
1791 | quirk_tc86c001_ide); | 1791 | quirk_tc86c001_ide); |
1792 | 1792 | ||
1793 | /* | ||
1794 | * PLX PCI 9050 PCI Target bridge controller has an errata that prevents the | ||
1795 | * local configuration registers accessible via BAR0 (memory) or BAR1 (i/o) | ||
1796 | * being read correctly if bit 7 of the base address is set. | ||
1797 | * The BAR0 or BAR1 region may be disabled (size 0) or enabled (size 128). | ||
1798 | * Re-allocate the regions to a 256-byte boundary if necessary. | ||
1799 | */ | ||
1800 | static void __devinit quirk_plx_pci9050(struct pci_dev *dev) | ||
1801 | { | ||
1802 | unsigned int bar; | ||
1803 | |||
1804 | /* Fixed in revision 2 (PCI 9052). */ | ||
1805 | if (dev->revision >= 2) | ||
1806 | return; | ||
1807 | for (bar = 0; bar <= 1; bar++) | ||
1808 | if (pci_resource_len(dev, bar) == 0x80 && | ||
1809 | (pci_resource_start(dev, bar) & 0x80)) { | ||
1810 | struct resource *r = &dev->resource[bar]; | ||
1811 | dev_info(&dev->dev, | ||
1812 | "Re-allocating PLX PCI 9050 BAR %u to length 256 to avoid bit 7 bug\n", | ||
1813 | bar); | ||
1814 | r->start = 0; | ||
1815 | r->end = 0xff; | ||
1816 | } | ||
1817 | } | ||
1818 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, | ||
1819 | quirk_plx_pci9050); | ||
1820 | /* | ||
1821 | * The following Meilhaus (vendor ID 0x1402) device IDs (amongst others) | ||
1822 | * may be using the PLX PCI 9050: 0x0630, 0x0940, 0x0950, 0x0960, 0x100b, | ||
1823 | * 0x1400, 0x140a, 0x140b, 0x14e0, 0x14ea, 0x14eb, 0x1604, 0x1608, 0x160c, | ||
1824 | * 0x168f, 0x2000, 0x2600, 0x3000, 0x810a, 0x810b. | ||
1825 | * | ||
1826 | * Currently, device IDs 0x2000 and 0x2600 are used by the Comedi "me_daq" | ||
1827 | * driver. | ||
1828 | */ | ||
1829 | DECLARE_PCI_FIXUP_HEADER(0x1402, 0x2000, quirk_plx_pci9050); | ||
1830 | DECLARE_PCI_FIXUP_HEADER(0x1402, 0x2600, quirk_plx_pci9050); | ||
1831 | |||
1793 | static void __devinit quirk_netmos(struct pci_dev *dev) | 1832 | static void __devinit quirk_netmos(struct pci_dev *dev) |
1794 | { | 1833 | { |
1795 | unsigned int num_parallel = (dev->subsystem_device & 0xf0) >> 4; | 1834 | unsigned int num_parallel = (dev->subsystem_device & 0xf0) >> 4; |
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 513972f3ed13..7c0fd9252e6f 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c | |||
@@ -111,3 +111,39 @@ void pci_stop_and_remove_bus_device(struct pci_dev *dev) | |||
111 | pci_remove_bus_device(dev); | 111 | pci_remove_bus_device(dev); |
112 | } | 112 | } |
113 | EXPORT_SYMBOL(pci_stop_and_remove_bus_device); | 113 | EXPORT_SYMBOL(pci_stop_and_remove_bus_device); |
114 | |||
115 | void pci_stop_root_bus(struct pci_bus *bus) | ||
116 | { | ||
117 | struct pci_dev *child, *tmp; | ||
118 | struct pci_host_bridge *host_bridge; | ||
119 | |||
120 | if (!pci_is_root_bus(bus)) | ||
121 | return; | ||
122 | |||
123 | host_bridge = to_pci_host_bridge(bus->bridge); | ||
124 | list_for_each_entry_safe_reverse(child, tmp, | ||
125 | &bus->devices, bus_list) | ||
126 | pci_stop_bus_device(child); | ||
127 | |||
128 | /* stop the host bridge */ | ||
129 | device_del(&host_bridge->dev); | ||
130 | } | ||
131 | |||
132 | void pci_remove_root_bus(struct pci_bus *bus) | ||
133 | { | ||
134 | struct pci_dev *child, *tmp; | ||
135 | struct pci_host_bridge *host_bridge; | ||
136 | |||
137 | if (!pci_is_root_bus(bus)) | ||
138 | return; | ||
139 | |||
140 | host_bridge = to_pci_host_bridge(bus->bridge); | ||
141 | list_for_each_entry_safe(child, tmp, | ||
142 | &bus->devices, bus_list) | ||
143 | pci_remove_bus_device(child); | ||
144 | pci_remove_bus(bus); | ||
145 | host_bridge->bus = NULL; | ||
146 | |||
147 | /* remove the host bridge */ | ||
148 | put_device(&host_bridge->dev); | ||
149 | } | ||
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 1e808ca338f8..6d3591d57ea0 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -1550,25 +1550,12 @@ enable_all: | |||
1550 | } | 1550 | } |
1551 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); | 1551 | EXPORT_SYMBOL_GPL(pci_assign_unassigned_bridge_resources); |
1552 | 1552 | ||
1553 | #ifdef CONFIG_HOTPLUG | 1553 | void pci_assign_unassigned_bus_resources(struct pci_bus *bus) |
1554 | /** | ||
1555 | * pci_rescan_bus - scan a PCI bus for devices. | ||
1556 | * @bus: PCI bus to scan | ||
1557 | * | ||
1558 | * Scan a PCI bus and child buses for new devices, adds them, | ||
1559 | * and enables them. | ||
1560 | * | ||
1561 | * Returns the max number of subordinate bus discovered. | ||
1562 | */ | ||
1563 | unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | ||
1564 | { | 1554 | { |
1565 | unsigned int max; | ||
1566 | struct pci_dev *dev; | 1555 | struct pci_dev *dev; |
1567 | LIST_HEAD(add_list); /* list of resources that | 1556 | LIST_HEAD(add_list); /* list of resources that |
1568 | want additional resources */ | 1557 | want additional resources */ |
1569 | 1558 | ||
1570 | max = pci_scan_child_bus(bus); | ||
1571 | |||
1572 | down_read(&pci_bus_sem); | 1559 | down_read(&pci_bus_sem); |
1573 | list_for_each_entry(dev, &bus->devices, bus_list) | 1560 | list_for_each_entry(dev, &bus->devices, bus_list) |
1574 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 1561 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
@@ -1579,11 +1566,4 @@ unsigned int __ref pci_rescan_bus(struct pci_bus *bus) | |||
1579 | up_read(&pci_bus_sem); | 1566 | up_read(&pci_bus_sem); |
1580 | __pci_bus_assign_resources(bus, &add_list, NULL); | 1567 | __pci_bus_assign_resources(bus, &add_list, NULL); |
1581 | BUG_ON(!list_empty(&add_list)); | 1568 | BUG_ON(!list_empty(&add_list)); |
1582 | |||
1583 | pci_enable_bridges(bus); | ||
1584 | pci_bus_add_devices(bus); | ||
1585 | |||
1586 | return max; | ||
1587 | } | 1569 | } |
1588 | EXPORT_SYMBOL_GPL(pci_rescan_bus); | ||
1589 | #endif | ||
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index bb145e4b935e..8b1d7a6a9695 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -92,8 +92,8 @@ int acpi_pci_link_free_irq(acpi_handle handle); | |||
92 | 92 | ||
93 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ | 93 | /* ACPI PCI Interrupt Routing (pci_irq.c) */ |
94 | 94 | ||
95 | int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus); | 95 | int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); |
96 | void acpi_pci_irq_del_prt(struct pci_bus *bus); | 96 | void acpi_pci_irq_del_prt(int segment, int bus); |
97 | 97 | ||
98 | /* ACPI PCI Device Binding (pci_bind.c) */ | 98 | /* ACPI PCI Device Binding (pci_bind.c) */ |
99 | 99 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index ee2179546c63..5b37d643b6b3 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -573,6 +573,7 @@ struct pci_driver { | |||
573 | int (*resume_early) (struct pci_dev *dev); | 573 | int (*resume_early) (struct pci_dev *dev); |
574 | int (*resume) (struct pci_dev *dev); /* Device woken up */ | 574 | int (*resume) (struct pci_dev *dev); /* Device woken up */ |
575 | void (*shutdown) (struct pci_dev *dev); | 575 | void (*shutdown) (struct pci_dev *dev); |
576 | int (*sriov_configure) (struct pci_dev *dev, int num_vfs); /* PF pdev */ | ||
576 | const struct pci_error_handlers *err_handler; | 577 | const struct pci_error_handlers *err_handler; |
577 | struct device_driver driver; | 578 | struct device_driver driver; |
578 | struct pci_dynids dynids; | 579 | struct pci_dynids dynids; |
@@ -712,6 +713,8 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | |||
712 | extern void pci_dev_put(struct pci_dev *dev); | 713 | extern void pci_dev_put(struct pci_dev *dev); |
713 | extern void pci_remove_bus(struct pci_bus *b); | 714 | extern void pci_remove_bus(struct pci_bus *b); |
714 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); | 715 | extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); |
716 | void pci_stop_root_bus(struct pci_bus *bus); | ||
717 | void pci_remove_root_bus(struct pci_bus *bus); | ||
715 | void pci_setup_cardbus(struct pci_bus *bus); | 718 | void pci_setup_cardbus(struct pci_bus *bus); |
716 | extern void pci_sort_breadthfirst(void); | 719 | extern void pci_sort_breadthfirst(void); |
717 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) | 720 | #define dev_is_pci(d) ((d)->bus == &pci_bus_type) |
@@ -958,6 +961,7 @@ void pci_bus_size_bridges(struct pci_bus *bus); | |||
958 | int pci_claim_resource(struct pci_dev *, int); | 961 | int pci_claim_resource(struct pci_dev *, int); |
959 | void pci_assign_unassigned_resources(void); | 962 | void pci_assign_unassigned_resources(void); |
960 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); | 963 | void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge); |
964 | void pci_assign_unassigned_bus_resources(struct pci_bus *bus); | ||
961 | void pdev_enable_device(struct pci_dev *); | 965 | void pdev_enable_device(struct pci_dev *); |
962 | int pci_enable_resources(struct pci_dev *, int mask); | 966 | int pci_enable_resources(struct pci_dev *, int mask); |
963 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 967 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
@@ -1601,7 +1605,7 @@ static inline void pci_mmcfg_early_init(void) { } | |||
1601 | static inline void pci_mmcfg_late_init(void) { } | 1605 | static inline void pci_mmcfg_late_init(void) { } |
1602 | #endif | 1606 | #endif |
1603 | 1607 | ||
1604 | int pci_ext_cfg_avail(struct pci_dev *dev); | 1608 | int pci_ext_cfg_avail(void); |
1605 | 1609 | ||
1606 | void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); | 1610 | void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); |
1607 | 1611 | ||
@@ -1610,6 +1614,8 @@ extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | |||
1610 | extern void pci_disable_sriov(struct pci_dev *dev); | 1614 | extern void pci_disable_sriov(struct pci_dev *dev); |
1611 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); | 1615 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); |
1612 | extern int pci_num_vf(struct pci_dev *dev); | 1616 | extern int pci_num_vf(struct pci_dev *dev); |
1617 | extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); | ||
1618 | extern int pci_sriov_get_totalvfs(struct pci_dev *dev); | ||
1613 | #else | 1619 | #else |
1614 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | 1620 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) |
1615 | { | 1621 | { |
@@ -1626,6 +1632,14 @@ static inline int pci_num_vf(struct pci_dev *dev) | |||
1626 | { | 1632 | { |
1627 | return 0; | 1633 | return 0; |
1628 | } | 1634 | } |
1635 | static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) | ||
1636 | { | ||
1637 | return 0; | ||
1638 | } | ||
1639 | static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) | ||
1640 | { | ||
1641 | return 0; | ||
1642 | } | ||
1629 | #endif | 1643 | #endif |
1630 | 1644 | ||
1631 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | 1645 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 20ae747ddf34..259763d2df71 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
@@ -544,9 +544,9 @@ | |||
544 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ | 544 | #define PCI_EXP_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */ |
545 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints end here */ | 545 | #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints end here */ |
546 | #define PCI_EXP_LNKCAP2 44 /* Link Capability 2 */ | 546 | #define PCI_EXP_LNKCAP2 44 /* Link Capability 2 */ |
547 | #define PCI_EXP_LNKCAP2_SLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */ | 547 | #define PCI_EXP_LNKCAP2_SLS_2_5GB 0x02 /* Supported Link Speed 2.5GT/s */ |
548 | #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */ | 548 | #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x04 /* Supported Link Speed 5.0GT/s */ |
549 | #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x04 /* Current Link Speed 8.0GT/s */ | 549 | #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x08 /* Supported Link Speed 8.0GT/s */ |
550 | #define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */ | 550 | #define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */ |
551 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ | 551 | #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ |
552 | #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ | 552 | #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ |