Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI/PM: Report wakeup events before resuming devices
PCI/PM: Use pm_wakeup_event() directly for reporting wakeup events
PCI: sysfs: Update ROM to include default owner write access
x86/PCI: make Broadcom CNB20LE driver EMBEDDED and EXPERIMENTAL
x86/PCI: don't use native Broadcom CNB20LE driver when ACPI is available
PCI/ACPI: Request _OSC control once for each root bridge (v3)
PCI: enable pci=bfsort by default on future Dell systems
PCI/PCIe: Clear Root PME Status bits early during system resume
PCI: pci-stub: ignore zero-length id parameters
x86/PCI: irq and pci_ids patch for Intel Patsburg
PCI: Skip id checking if no id is passed
PCI: fix __pci_device_probe kernel-doc warning
PCI: make pci_restore_state return void
PCI: Disable ASPM if BIOS asks us to
PCI: Add mask bit definition for MSI-X table
PCI: MSI: Move MSI-X entry definition to pci_regs.h

Fix up trivial conflicts in drivers/net/{skge.c,sky2.c} that had in the
meantime been converted to not use legacy PCI power management, and thus
no longer use pci_restore_state() at all (and that caused trivial
conflicts with the "make pci_restore_state return void" patch)

+259 -187
+8 -2
arch/x86/Kconfig
··· 1934 1934 depends on X86_64 && PCI && ACPI 1935 1935 1936 1936 config PCI_CNB20LE_QUIRK 1937 - bool "Read CNB20LE Host Bridge Windows" 1938 - depends on PCI 1937 + bool "Read CNB20LE Host Bridge Windows" if EMBEDDED 1938 + default n 1939 + depends on PCI && EXPERIMENTAL 1939 1940 help 1940 1941 Read the PCI windows out of the CNB20LE host bridge. This allows 1941 1942 PCI hotplug to work on systems with the CNB20LE chipset which do 1942 1943 not have ACPI. 1944 + 1945 + There's no public spec for this chipset, and this functionality 1946 + is known to be incomplete. 1947 + 1948 + You should say N unless you know you need this. 1943 1949 1944 1950 config DMAR 1945 1951 bool "Support for DMA Remapping Devices (EXPERIMENTAL)"
+7 -4
arch/x86/pci/broadcom_bus.c
··· 9 9 * option) any later version. 10 10 */ 11 11 12 + #include <linux/acpi.h> 12 13 #include <linux/delay.h> 13 14 #include <linux/dmi.h> 14 15 #include <linux/pci.h> ··· 26 25 u8 fbus, lbus; 27 26 int i; 28 27 28 + #ifdef CONFIG_ACPI 29 29 /* 30 - * The x86_pci_root_bus_res_quirks() function already refuses to use 31 - * this information if ACPI _CRS was used. Therefore, we don't bother 32 - * checking if ACPI is enabled, and just generate the information 33 - * for both the ACPI _CRS and no ACPI cases. 30 + * We should get host bridge information from ACPI unless the BIOS 31 + * doesn't support it. 34 32 */ 33 + if (acpi_os_get_root_pointer()) 34 + return; 35 + #endif 35 36 36 37 info = &pci_root_info[pci_root_num]; 37 38 pci_root_num++;
+41
arch/x86/pci/common.c
··· 22 22 23 23 unsigned int pci_early_dump_regs; 24 24 static int pci_bf_sort; 25 + static int smbios_type_b1_flag; 25 26 int pci_routeirq; 26 27 int noioapicquirk; 27 28 #ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS ··· 186 185 return 0; 187 186 } 188 187 188 + static void __devinit read_dmi_type_b1(const struct dmi_header *dm, 189 + void *private_data) 190 + { 191 + u8 *d = (u8 *)dm + 4; 192 + 193 + if (dm->type != 0xB1) 194 + return; 195 + switch (((*(u32 *)d) >> 9) & 0x03) { 196 + case 0x00: 197 + printk(KERN_INFO "dmi type 0xB1 record - unknown flag\n"); 198 + break; 199 + case 0x01: /* set pci=bfsort */ 200 + smbios_type_b1_flag = 1; 201 + break; 202 + case 0x02: /* do not set pci=bfsort */ 203 + smbios_type_b1_flag = 2; 204 + break; 205 + default: 206 + break; 207 + } 208 + } 209 + 210 + static int __devinit find_sort_method(const struct dmi_system_id *d) 211 + { 212 + dmi_walk(read_dmi_type_b1, NULL); 213 + 214 + if (smbios_type_b1_flag == 1) { 215 + set_bf_sort(d); 216 + return 0; 217 + } 218 + return -1; 219 + } 220 + 189 221 /* 190 222 * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus) 191 223 */ ··· 246 212 }, 247 213 }, 248 214 #endif /* __i386__ */ 215 + { 216 + .callback = find_sort_method, 217 + .ident = "Dell System", 218 + .matches = { 219 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), 220 + }, 221 + }, 249 222 { 250 223 .callback = set_bf_sort, 251 224 .ident = "Dell PowerEdge 1950",
+2 -1
arch/x86/pci/irq.c
··· 589 589 case PCI_DEVICE_ID_INTEL_ICH10_1: 590 590 case PCI_DEVICE_ID_INTEL_ICH10_2: 591 591 case PCI_DEVICE_ID_INTEL_ICH10_3: 592 - case PCI_DEVICE_ID_INTEL_PATSBURG_LPC: 592 + case PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0: 593 + case PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1: 593 594 r->name = "PIIX/ICH"; 594 595 r->get = pirq_piix_get; 595 596 r->set = pirq_piix_set;
+9 -13
drivers/acpi/apei/hest.c
··· 195 195 196 196 __setup("hest_disable", setup_hest_disable); 197 197 198 - static int __init hest_init(void) 198 + void __init acpi_hest_init(void) 199 199 { 200 200 acpi_status status; 201 201 int rc = -ENODEV; 202 202 unsigned int ghes_count = 0; 203 203 204 204 if (acpi_disabled) 205 - goto err; 205 + return; 206 206 207 207 if (hest_disable) { 208 - pr_info(HEST_PFX "HEST tabling parsing is disabled.\n"); 209 - goto err; 208 + pr_info(HEST_PFX "Table parsing disabled.\n"); 209 + return; 210 210 } 211 211 212 212 status = acpi_get_table(ACPI_SIG_HEST, 0, 213 213 (struct acpi_table_header **)&hest_tab); 214 214 if (status == AE_NOT_FOUND) { 215 - pr_info(HEST_PFX "Table is not found!\n"); 215 + pr_info(HEST_PFX "Table not found.\n"); 216 216 goto err; 217 217 } else if (ACPI_FAILURE(status)) { 218 218 const char *msg = acpi_format_exception(status); ··· 226 226 goto err; 227 227 228 228 rc = hest_ghes_dev_register(ghes_count); 229 - if (rc) 230 - goto err; 229 + if (!rc) { 230 + pr_info(HEST_PFX "Table parsing has been initialized.\n"); 231 + return; 232 + } 231 233 232 - pr_info(HEST_PFX "HEST table parsing is initialized.\n"); 233 - 234 - return 0; 235 234 err: 236 235 hest_disable = 1; 237 - return rc; 238 236 } 239 - 240 - subsys_initcall(hest_init);
+35
drivers/acpi/pci_root.c
··· 36 36 #include <linux/slab.h> 37 37 #include <acpi/acpi_bus.h> 38 38 #include <acpi/acpi_drivers.h> 39 + #include <acpi/apei.h> 39 40 40 41 #define PREFIX "ACPI: " 41 42 ··· 47 46 static int acpi_pci_root_add(struct acpi_device *device); 48 47 static int acpi_pci_root_remove(struct acpi_device *device, int type); 49 48 static int acpi_pci_root_start(struct acpi_device *device); 49 + 50 + #define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ 51 + | OSC_ACTIVE_STATE_PWR_SUPPORT \ 52 + | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \ 53 + | OSC_MSI_SUPPORT) 50 54 51 55 static const struct acpi_device_id root_device_ids[] = { 52 56 {"PNP0A03", 0}, ··· 572 566 if (flags != base_flags) 573 567 acpi_pci_osc_support(root, flags); 574 568 569 + if (!pcie_ports_disabled 570 + && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { 571 + flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 572 + | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 573 + | OSC_PCI_EXPRESS_PME_CONTROL; 574 + 575 + if (pci_aer_available()) { 576 + if (aer_acpi_firmware_first()) 577 + dev_dbg(root->bus->bridge, 578 + "PCIe errors handled by BIOS.\n"); 579 + else 580 + flags |= OSC_PCI_EXPRESS_AER_CONTROL; 581 + } 582 + 583 + dev_info(root->bus->bridge, 584 + "Requesting ACPI _OSC control (0x%02x)\n", flags); 585 + 586 + status = acpi_pci_osc_control_set(device->handle, &flags, 587 + OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); 588 + if (ACPI_SUCCESS(status)) 589 + dev_info(root->bus->bridge, 590 + "ACPI _OSC control (0x%02x) granted\n", flags); 591 + else 592 + dev_dbg(root->bus->bridge, 593 + "ACPI _OSC request failed (code %d)\n", status); 594 + } 595 + 575 596 pci_acpi_add_bus_pm_notifier(device, root->bus); 576 597 if (device->wakeup.flags.run_wake) 577 598 device_set_run_wake(root->bus->bridge, true); ··· 635 602 { 636 603 if (acpi_pci_disabled) 637 604 return 0; 605 + 606 + acpi_hest_init(); 638 607 639 608 pci_acpi_crs_quirks(); 640 609 if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0)
+1 -3
drivers/media/video/cafe_ccic.c
··· 2184 2184 struct cafe_camera *cam = to_cam(v4l2_dev); 2185 2185 int ret = 0; 2186 2186 2187 - ret = pci_restore_state(pdev); 2188 - if (ret) 2189 - return ret; 2187 + pci_restore_state(pdev); 2190 2188 ret = pci_enable_device(pdev); 2191 2189 2192 2190 if (ret) {
+1 -3
drivers/net/myri10ge/myri10ge.c
··· 3403 3403 return -EIO; 3404 3404 } 3405 3405 3406 - status = pci_restore_state(pdev); 3407 - if (status) 3408 - return status; 3406 + pci_restore_state(pdev); 3409 3407 3410 3408 status = pci_enable_device(pdev); 3411 3409 if (status) {
+5 -20
drivers/net/sfc/falcon.c
··· 1107 1107 1108 1108 /* Restore PCI configuration if needed */ 1109 1109 if (method == RESET_TYPE_WORLD) { 1110 - if (efx_nic_is_dual_func(efx)) { 1111 - rc = pci_restore_state(nic_data->pci_dev2); 1112 - if (rc) { 1113 - netif_err(efx, drv, efx->net_dev, 1114 - "failed to restore PCI config for " 1115 - "the secondary function\n"); 1116 - goto fail3; 1117 - } 1118 - } 1119 - rc = pci_restore_state(efx->pci_dev); 1120 - if (rc) { 1121 - netif_err(efx, drv, efx->net_dev, 1122 - "failed to restore PCI config for the " 1123 - "primary function\n"); 1124 - goto fail4; 1125 - } 1110 + if (efx_nic_is_dual_func(efx)) 1111 + pci_restore_state(nic_data->pci_dev2); 1112 + pci_restore_state(efx->pci_dev); 1126 1113 netif_dbg(efx, drv, efx->net_dev, 1127 1114 "successfully restored PCI config\n"); 1128 1115 } ··· 1120 1133 rc = -ETIMEDOUT; 1121 1134 netif_err(efx, hw, efx->net_dev, 1122 1135 "timed out waiting for hardware reset\n"); 1123 - goto fail5; 1136 + goto fail3; 1124 1137 } 1125 1138 netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n"); 1126 1139 ··· 1128 1141 1129 1142 /* pci_save_state() and pci_restore_state() MUST be called in pairs */ 1130 1143 fail2: 1131 - fail3: 1132 1144 pci_restore_state(efx->pci_dev); 1133 1145 fail1: 1134 - fail4: 1135 - fail5: 1146 + fail3: 1136 1147 return rc; 1137 1148 } 1138 1149
+2 -2
drivers/net/wireless/rt2x00/rt2x00pci.c
··· 363 363 struct rt2x00_dev *rt2x00dev = hw->priv; 364 364 365 365 if (pci_set_power_state(pci_dev, PCI_D0) || 366 - pci_enable_device(pci_dev) || 367 - pci_restore_state(pci_dev)) { 366 + pci_enable_device(pci_dev)) { 368 367 ERROR(rt2x00dev, "Failed to resume device.\n"); 369 368 return -EIO; 370 369 } 371 370 371 + pci_restore_state(pci_dev); 372 372 return rt2x00lib_resume(rt2x00dev); 373 373 } 374 374 EXPORT_SYMBOL_GPL(rt2x00pci_resume);
+3 -2
drivers/pci/msi.c
··· 168 168 u32 mask_bits = desc->masked; 169 169 unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + 170 170 PCI_MSIX_ENTRY_VECTOR_CTRL; 171 - mask_bits &= ~1; 172 - mask_bits |= flag; 171 + mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; 172 + if (flag) 173 + mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; 173 174 writel(mask_bits, desc->mask_base + offset); 174 175 175 176 return mask_bits;
-6
drivers/pci/msi.h
··· 6 6 #ifndef MSI_H 7 7 #define MSI_H 8 8 9 - #define PCI_MSIX_ENTRY_SIZE 16 10 - #define PCI_MSIX_ENTRY_LOWER_ADDR 0 11 - #define PCI_MSIX_ENTRY_UPPER_ADDR 4 12 - #define PCI_MSIX_ENTRY_DATA 8 13 - #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 14 - 15 9 #define msi_control_reg(base) (base + PCI_MSI_FLAGS) 16 10 #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) 17 11 #define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI)
+2 -1
drivers/pci/pci-acpi.c
··· 46 46 struct pci_dev *pci_dev = context; 47 47 48 48 if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_dev) { 49 + pci_wakeup_event(pci_dev); 49 50 pci_check_pme_status(pci_dev); 50 51 pm_runtime_resume(&pci_dev->dev); 51 - pci_wakeup_event(pci_dev); 52 52 if (pci_dev->subordinate) 53 53 pci_pme_wakeup_bus(pci_dev->subordinate); 54 54 } ··· 399 399 400 400 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { 401 401 printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n"); 402 + pcie_clear_aspm(); 402 403 pcie_no_aspm(); 403 404 } 404 405
+3 -2
drivers/pci/pci-driver.c
··· 338 338 } 339 339 340 340 /** 341 - * __pci_device_probe() 341 + * __pci_device_probe - check if a driver wants to claim a specific PCI device 342 342 * @drv: driver to call to check if it wants the PCI device 343 343 * @pci_dev: PCI device being probed 344 344 * ··· 449 449 return error; 450 450 } 451 451 452 - return pci_restore_state(pci_dev); 452 + pci_restore_state(pci_dev); 453 + return 0; 453 454 } 454 455 455 456 static void pci_pm_default_resume_early(struct pci_dev *pci_dev)
+7
drivers/pci/pci-stub.c
··· 47 47 if (rc) 48 48 return rc; 49 49 50 + /* no ids passed actually */ 51 + if (ids[0] == '\0') 52 + return 0; 53 + 50 54 /* add ids specified in the module parameter */ 51 55 p = ids; 52 56 while ((id = strsep(&p, ","))) { 53 57 unsigned int vendor, device, subvendor = PCI_ANY_ID, 54 58 subdevice = PCI_ANY_ID, class=0, class_mask=0; 55 59 int fields; 60 + 61 + if (!strlen(id)) 62 + continue; 56 63 57 64 fields = sscanf(id, "%x:%x:%x:%x:%x:%x", 58 65 &vendor, &device, &subvendor, &subdevice,
+1 -1
drivers/pci/pci-sysfs.c
··· 1149 1149 sysfs_bin_attr_init(attr); 1150 1150 attr->size = rom_size; 1151 1151 attr->attr.name = "rom"; 1152 - attr->attr.mode = S_IRUSR; 1152 + attr->attr.mode = S_IRUSR | S_IWUSR; 1153 1153 attr->read = pci_read_rom; 1154 1154 attr->write = pci_write_rom; 1155 1155 retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);
+3 -22
drivers/pci/pci.c
··· 937 937 * pci_restore_state - Restore the saved state of a PCI device 938 938 * @dev: - PCI device that we're dealing with 939 939 */ 940 - int 941 - pci_restore_state(struct pci_dev *dev) 940 + void pci_restore_state(struct pci_dev *dev) 942 941 { 943 942 int i; 944 943 u32 val; 945 944 946 945 if (!dev->state_saved) 947 - return 0; 946 + return; 948 947 949 948 /* PCI Express register must be restored first */ 950 949 pci_restore_pcie_state(dev); ··· 967 968 pci_restore_iov_state(dev); 968 969 969 970 dev->state_saved = false; 970 - 971 - return 0; 972 971 } 973 972 974 973 static int do_pci_enable_device(struct pci_dev *dev, int bars) ··· 1297 1300 return ret; 1298 1301 } 1299 1302 1300 - /* 1301 - * Time to wait before the system can be put into a sleep state after reporting 1302 - * a wakeup event signaled by a PCI device. 1303 - */ 1304 - #define PCI_WAKEUP_COOLDOWN 100 1305 - 1306 - /** 1307 - * pci_wakeup_event - Report a wakeup event related to a given PCI device. 1308 - * @dev: Device to report the wakeup event for. 1309 - */ 1310 - void pci_wakeup_event(struct pci_dev *dev) 1311 - { 1312 - if (device_may_wakeup(&dev->dev)) 1313 - pm_wakeup_event(&dev->dev, PCI_WAKEUP_COOLDOWN); 1314 - } 1315 - 1316 1303 /** 1317 1304 * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set. 1318 1305 * @dev: Device to handle. ··· 1308 1327 static int pci_pme_wakeup(struct pci_dev *dev, void *ign) 1309 1328 { 1310 1329 if (pci_check_pme_status(dev)) { 1311 - pm_request_resume(&dev->dev); 1312 1330 pci_wakeup_event(dev); 1331 + pm_request_resume(&dev->dev); 1313 1332 } 1314 1333 return 0; 1315 1334 }
+6 -8
drivers/pci/pci.h
··· 74 74 extern void platform_pci_wakeup_init(struct pci_dev *dev); 75 75 extern void pci_allocate_cap_save_buffers(struct pci_dev *dev); 76 76 77 + static inline void pci_wakeup_event(struct pci_dev *dev) 78 + { 79 + /* Wait 100 ms before the system can be put into a sleep state. */ 80 + pm_wakeup_event(&dev->dev, 100); 81 + } 82 + 77 83 static inline bool pci_is_bridge(struct pci_dev *pci_dev) 78 84 { 79 85 return !!(pci_dev->subordinate); ··· 144 138 #else 145 139 static inline void pci_no_msi(void) { } 146 140 static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } 147 - #endif 148 - 149 - #ifdef CONFIG_PCIEAER 150 - void pci_no_aer(void); 151 - bool pci_aer_available(void); 152 - #else 153 - static inline void pci_no_aer(void) { } 154 - static inline bool pci_aer_available(void) { return false; } 155 141 #endif 156 142 157 143 static inline int pci_no_d1d2(struct pci_dev *dev)
+1
drivers/pci/pcie/aer/aerdrv.c
··· 17 17 18 18 #include <linux/module.h> 19 19 #include <linux/pci.h> 20 + #include <linux/pci-acpi.h> 20 21 #include <linux/sched.h> 21 22 #include <linux/kernel.h> 22 23 #include <linux/errno.h>
-3
drivers/pci/pcie/aer/aerdrv.h
··· 132 132 133 133 #ifdef CONFIG_ACPI_APEI 134 134 extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev); 135 - extern bool aer_acpi_firmware_first(void); 136 135 #else 137 136 static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) 138 137 { ··· 139 140 return pci_dev->__aer_firmware_first; 140 141 return 0; 141 142 } 142 - 143 - static inline bool aer_acpi_firmware_first(void) { return false; } 144 143 #endif 145 144 146 145 static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev,
+17 -4
drivers/pci/pcie/aspm.c
··· 68 68 struct aspm_latency acceptable[8]; 69 69 }; 70 70 71 - static int aspm_disabled, aspm_force; 71 + static int aspm_disabled, aspm_force, aspm_clear_state; 72 72 static DEFINE_MUTEX(aspm_lock); 73 73 static LIST_HEAD(link_list); 74 74 ··· 139 139 { 140 140 /* Don't enable Clock PM if the link is not Clock PM capable */ 141 141 if (!link->clkpm_capable && enable) 142 - return; 142 + enable = 0; 143 143 /* Need nothing if the specified equals to current state */ 144 144 if (link->clkpm_enabled == enable) 145 145 return; ··· 498 498 struct pci_dev *child; 499 499 int pos; 500 500 u32 reg32; 501 + 502 + if (aspm_clear_state) 503 + return -EINVAL; 504 + 501 505 /* 502 506 * Some functions in a slot might not all be PCIe functions, 503 507 * very strange. Disable ASPM for the whole slot ··· 567 563 struct pcie_link_state *link; 568 564 int blacklist = !!pcie_aspm_sanity_check(pdev); 569 565 570 - if (aspm_disabled || !pci_is_pcie(pdev) || pdev->link_state) 566 + if (!pci_is_pcie(pdev) || pdev->link_state) 571 567 return; 572 568 if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && 573 569 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) 570 + return; 571 + 572 + if (aspm_disabled && !aspm_clear_state) 574 573 return; 575 574 576 575 /* VIA has a strange chipset, root port is under a bridge */ ··· 648 641 struct pci_dev *parent = pdev->bus->self; 649 642 struct pcie_link_state *link, *root, *parent_link; 650 643 651 - if (aspm_disabled || !pci_is_pcie(pdev) || 644 + if ((aspm_disabled && !aspm_clear_state) || !pci_is_pcie(pdev) || 652 645 !parent || !parent->link_state) 653 646 return; 654 647 if ((parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && ··· 905 898 } 906 899 907 900 __setup("pcie_aspm=", pcie_aspm_disable); 901 + 902 + void pcie_clear_aspm(void) 903 + { 904 + if (!aspm_force) 905 + aspm_clear_state = 1; 906 + } 908 907 909 908 void pcie_no_aspm(void) 910 909 {
+6 -25
drivers/pci/pcie/pme.c
··· 26 26 #include "../pci.h" 27 27 #include "portdrv.h" 28 28 29 - #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ 30 - #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ 31 - 32 29 /* 33 30 * If this switch is set, MSI will not be used for PCIe PME signaling. This 34 31 * causes the PCIe port driver to use INTx interrupts only, but it turns out ··· 71 74 } 72 75 73 76 /** 74 - * pcie_pme_clear_status - Clear root port PME interrupt status. 75 - * @dev: PCIe root port or event collector. 76 - */ 77 - static void pcie_pme_clear_status(struct pci_dev *dev) 78 - { 79 - int rtsta_pos; 80 - u32 rtsta; 81 - 82 - rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA; 83 - 84 - pci_read_config_dword(dev, rtsta_pos, &rtsta); 85 - rtsta |= PCI_EXP_RTSTA_PME; 86 - pci_write_config_dword(dev, rtsta_pos, rtsta); 87 - } 88 - 89 - /** 90 77 * pcie_pme_walk_bus - Scan a PCI bus for devices asserting PME#. 91 78 * @bus: PCI bus to scan. 92 79 * ··· 84 103 list_for_each_entry(dev, &bus->devices, bus_list) { 85 104 /* Skip PCIe devices in case we started from a root port. */ 86 105 if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) { 87 - pm_request_resume(&dev->dev); 88 106 pci_wakeup_event(dev); 107 + pm_request_resume(&dev->dev); 89 108 ret = true; 90 109 } 91 110 ··· 187 206 /* The device is there, but we have to check its PME status. */ 188 207 found = pci_check_pme_status(dev); 189 208 if (found) { 190 - pm_request_resume(&dev->dev); 191 209 pci_wakeup_event(dev); 210 + pm_request_resume(&dev->dev); 192 211 } 193 212 pci_dev_put(dev); 194 213 } else if (devfn) { ··· 234 253 * Clear PME status of the port. If there are other 235 254 * pending PMEs, the status will be set again. 236 255 */ 237 - pcie_pme_clear_status(port); 256 + pcie_clear_root_pme_status(port); 238 257 239 258 spin_unlock_irq(&data->lock); 240 259 pcie_pme_handle_request(port, rtsta & 0xffff); ··· 359 378 360 379 port = srv->port; 361 380 pcie_pme_interrupt_enable(port, false); 362 - pcie_pme_clear_status(port); 381 + pcie_clear_root_pme_status(port); 363 382 364 383 ret = request_irq(srv->irq, pcie_pme_irq, IRQF_SHARED, "PCIe PME", srv); 365 384 if (ret) { ··· 383 402 384 403 spin_lock_irq(&data->lock); 385 404 pcie_pme_interrupt_enable(port, false); 386 - pcie_pme_clear_status(port); 405 + pcie_clear_root_pme_status(port); 387 406 data->noirq = true; 388 407 spin_unlock_irq(&data->lock); 389 408 ··· 403 422 404 423 spin_lock_irq(&data->lock); 405 424 data->noirq = false; 406 - pcie_pme_clear_status(port); 425 + pcie_clear_root_pme_status(port); 407 426 pcie_pme_interrupt_enable(port, true); 408 427 spin_unlock_irq(&data->lock); 409 428
+2 -3
drivers/pci/pcie/portdrv.h
··· 20 20 21 21 #define get_descriptor_id(type, service) (((type - 4) << 4) | service) 22 22 23 - extern bool pcie_ports_disabled; 24 - extern bool pcie_ports_auto; 25 - 26 23 extern struct bus_type pcie_port_bus_type; 27 24 extern int pcie_port_device_register(struct pci_dev *dev); 28 25 #ifdef CONFIG_PM ··· 31 34 extern void pcie_port_bus_unregister(void); 32 35 33 36 struct pci_dev; 37 + 38 + extern void pcie_clear_root_pme_status(struct pci_dev *dev); 34 39 35 40 #ifdef CONFIG_PCIE_PME 36 41 extern bool pcie_pme_msi_disabled;
+4 -19
drivers/pci/pcie/portdrv_acpi.c
··· 33 33 */ 34 34 int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) 35 35 { 36 - acpi_status status; 36 + struct acpi_pci_root *root; 37 37 acpi_handle handle; 38 38 u32 flags; 39 39 ··· 44 44 if (!handle) 45 45 return -EINVAL; 46 46 47 - flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 48 - | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 49 - | OSC_PCI_EXPRESS_PME_CONTROL; 50 - 51 - if (pci_aer_available()) { 52 - if (aer_acpi_firmware_first()) 53 - dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n"); 54 - else 55 - flags |= OSC_PCI_EXPRESS_AER_CONTROL; 56 - } 57 - 58 - status = acpi_pci_osc_control_set(handle, &flags, 59 - OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); 60 - if (ACPI_FAILURE(status)) { 61 - dev_dbg(&port->dev, "ACPI _OSC request failed (code %d)\n", 62 - status); 47 + root = acpi_pci_find_root(handle); 48 + if (!root) 63 49 return -ENODEV; 64 - } 65 50 66 - dev_info(&port->dev, "ACPI _OSC control granted for 0x%02x\n", flags); 51 + flags = root->osc_control_set; 67 52 68 53 *srv_mask = PCIE_PORT_SERVICE_VC; 69 54 if (flags & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)
+14 -11
drivers/pci/pcie/portdrv_core.c
··· 241 241 int cap_mask; 242 242 int err; 243 243 244 + if (pcie_ports_disabled) 245 + return 0; 246 + 244 247 err = pcie_port_platform_notify(dev, &cap_mask); 245 - if (pcie_ports_auto) { 246 - if (err) { 247 - pcie_no_aspm(); 248 - return 0; 249 - } 250 - } else { 248 + if (!pcie_ports_auto) { 251 249 cap_mask = PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP 252 250 | PCIE_PORT_SERVICE_VC; 253 251 if (pci_aer_available()) 254 252 cap_mask |= PCIE_PORT_SERVICE_AER; 253 + } else if (err) { 254 + return 0; 255 255 } 256 256 257 257 pos = pci_pcie_cap(dev); ··· 349 349 int status, capabilities, i, nr_service; 350 350 int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; 351 351 352 - /* Get and check PCI Express port services */ 353 - capabilities = get_port_device_capability(dev); 354 - if (!capabilities) 355 - return -ENODEV; 356 - 357 352 /* Enable PCI Express port device */ 358 353 status = pci_enable_device(dev); 359 354 if (status) 360 355 return status; 356 + 357 + /* Get and check PCI Express port services */ 358 + capabilities = get_port_device_capability(dev); 359 + if (!capabilities) { 360 + pcie_no_aspm(); 361 + return 0; 362 + } 363 + 361 364 pci_set_master(dev); 362 365 /* 363 366 * Initialize service irqs. Don't use service devices that
+33 -4
drivers/pci/pcie/portdrv_pci.c
··· 57 57 58 58 /* global data */ 59 59 60 + /** 61 + * pcie_clear_root_pme_status - Clear root port PME interrupt status. 62 + * @dev: PCIe root port or event collector. 63 + */ 64 + void pcie_clear_root_pme_status(struct pci_dev *dev) 65 + { 66 + int rtsta_pos; 67 + u32 rtsta; 68 + 69 + rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA; 70 + 71 + pci_read_config_dword(dev, rtsta_pos, &rtsta); 72 + rtsta |= PCI_EXP_RTSTA_PME; 73 + pci_write_config_dword(dev, rtsta_pos, rtsta); 74 + } 75 + 60 76 static int pcie_portdrv_restore_config(struct pci_dev *dev) 61 77 { 62 78 int retval; ··· 85 69 } 86 70 87 71 #ifdef CONFIG_PM 72 + static int pcie_port_resume_noirq(struct device *dev) 73 + { 74 + struct pci_dev *pdev = to_pci_dev(dev); 75 + 76 + /* 77 + * Some BIOSes forget to clear Root PME Status bits after system wakeup 78 + * which breaks ACPI-based runtime wakeup on PCI Express, so clear those 79 + * bits now just in case (shouldn't hurt). 80 + */ 81 + if(pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) 82 + pcie_clear_root_pme_status(pdev); 83 + return 0; 84 + } 85 + 88 86 static const struct dev_pm_ops pcie_portdrv_pm_ops = { 89 87 .suspend = pcie_port_device_suspend, 90 88 .resume = pcie_port_device_resume, ··· 106 76 .thaw = pcie_port_device_resume, 107 77 .poweroff = pcie_port_device_suspend, 108 78 .restore = pcie_port_device_resume, 79 + .resume_noirq = pcie_port_resume_noirq, 109 80 }; 110 81 111 82 #define PCIE_PORTDRV_PM_OPS (&pcie_portdrv_pm_ops) ··· 358 327 { 359 328 int retval; 360 329 361 - if (pcie_ports_disabled) { 362 - pcie_no_aspm(); 363 - return -EACCES; 364 - } 330 + if (pcie_ports_disabled) 331 + return pci_register_driver(&pcie_portdriver); 365 332 366 333 dmi_check_system(pcie_portdrv_dmi_table); 367 334
+1 -7
drivers/scsi/ipr.c
··· 7515 7515 { 7516 7516 struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; 7517 7517 volatile u32 int_reg; 7518 - int rc; 7519 7518 7520 7519 ENTER; 7521 7520 ioa_cfg->pdev->state_saved = true; 7522 - rc = pci_restore_state(ioa_cfg->pdev); 7523 - 7524 - if (rc != PCIBIOS_SUCCESSFUL) { 7525 - ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); 7526 - return IPR_RC_JOB_CONTINUE; 7527 - } 7521 + pci_restore_state(ioa_cfg->pdev); 7528 7522 7529 7523 if (ipr_set_pcix_cmd_reg(ioa_cfg)) { 7530 7524 ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR);
+1 -6
drivers/scsi/pmcraid.c
··· 2228 2228 /* Once either bist or pci reset is done, restore PCI config 2229 2229 * space. If this fails, proceed with hard reset again 2230 2230 */ 2231 - if (pci_restore_state(pinstance->pdev)) { 2232 - pmcraid_info("config-space error resetting again\n"); 2233 - pinstance->ioa_state = IOA_STATE_IN_RESET_ALERT; 2234 - pmcraid_reset_alert(cmd); 2235 - break; 2236 - } 2231 + pci_restore_state(pinstance->pdev); 2237 2232 2238 2233 /* fail all pending commands */ 2239 2234 pmcraid_fail_outstanding_cmds(pinstance);
+1 -1
drivers/staging/sm7xx/smtcfb.c
··· 1071 1071 /* when resuming, restore pci data and fb cursor */ 1072 1072 if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { 1073 1073 retv = pci_set_power_state(pdev, PCI_D0); 1074 - retv = pci_restore_state(pdev); 1074 + pci_restore_state(pdev); 1075 1075 if (pci_enable_device(pdev)) 1076 1076 return -1; 1077 1077 pci_set_master(pdev);
+6
include/acpi/apei.h
··· 19 19 extern int hest_disable; 20 20 extern int erst_disable; 21 21 22 + #ifdef CONFIG_ACPI_APEI 23 + void __init acpi_hest_init(void); 24 + #else 25 + static inline void acpi_hest_init(void) { return; } 26 + #endif 27 + 22 28 typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); 23 29 int apei_hest_parse(apei_hest_func_t func, void *data); 24 30
+6
include/linux/pci-acpi.h
··· 40 40 { return NULL; } 41 41 #endif 42 42 43 + #ifdef CONFIG_ACPI_APEI 44 + extern bool aer_acpi_firmware_first(void); 45 + #else 46 + static inline bool aer_acpi_firmware_first(void) { return false; } 47 + #endif 48 + 43 49 #endif /* _PCI_ACPI_H_ */
+4 -1
include/linux/pci-aspm.h
··· 27 27 extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 28 28 extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 29 29 extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30 + extern void pcie_clear_aspm(void); 30 31 extern void pcie_no_aspm(void); 31 32 #else 32 33 static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) ··· 42 41 static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 43 42 { 44 43 } 45 - 44 + static inline void pcie_clear_aspm(void) 45 + { 46 + } 46 47 static inline void pcie_no_aspm(void) 47 48 { 48 49 }
+14 -6
include/linux/pci.h
··· 806 806 807 807 /* Power management related routines */ 808 808 int pci_save_state(struct pci_dev *dev); 809 - int pci_restore_state(struct pci_dev *dev); 809 + void pci_restore_state(struct pci_dev *dev); 810 810 int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); 811 811 int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 812 812 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); ··· 820 820 int pci_back_from_sleep(struct pci_dev *dev); 821 821 bool pci_dev_run_wake(struct pci_dev *dev); 822 822 bool pci_check_pme_status(struct pci_dev *dev); 823 - void pci_wakeup_event(struct pci_dev *dev); 824 823 void pci_pme_wakeup_bus(struct pci_bus *bus); 825 824 826 825 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, ··· 993 994 extern int pci_msi_enabled(void); 994 995 #endif 995 996 997 + extern bool pcie_ports_disabled; 998 + extern bool pcie_ports_auto; 999 + 996 1000 #ifndef CONFIG_PCIEASPM 997 1001 static inline int pcie_aspm_enabled(void) 998 1002 { ··· 1003 1001 } 1004 1002 #else 1005 1003 extern int pcie_aspm_enabled(void); 1004 + #endif 1005 + 1006 + #ifdef CONFIG_PCIEAER 1007 + void pci_no_aer(void); 1008 + bool pci_aer_available(void); 1009 + #else 1010 + static inline void pci_no_aer(void) { } 1011 + static inline bool pci_aer_available(void) { return false; } 1006 1012 #endif 1007 1013 1008 1014 #ifndef CONFIG_PCIE_ECRC ··· 1178 1168 return 0; 1179 1169 } 1180 1170 1181 - static inline int pci_restore_state(struct pci_dev *dev) 1182 - { 1183 - return 0; 1184 - } 1171 + static inline void pci_restore_state(struct pci_dev *dev) 1172 + { } 1185 1173 1186 1174 static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) 1187 1175 {
+2 -1
include/linux/pci_ids.h
··· 2478 2478 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41 2479 2479 #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f 2480 2480 #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 2481 - #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC 0x1d40 2481 + #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40 2482 + #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41 2482 2483 #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2483 2484 #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2484 2485 #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
+10
include/linux/pci_regs.h
··· 309 309 #define PCI_MSIX_PBA 8 310 310 #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 311 311 312 + /* MSI-X entry's format */ 313 + #define PCI_MSIX_ENTRY_SIZE 16 314 + #define PCI_MSIX_ENTRY_LOWER_ADDR 0 315 + #define PCI_MSIX_ENTRY_UPPER_ADDR 4 316 + #define PCI_MSIX_ENTRY_DATA 8 317 + #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 318 + #define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 319 + 312 320 /* CompactPCI Hotswap Register */ 313 321 314 322 #define PCI_CHSWP_CSR 2 /* Control and Status Register */ ··· 504 496 #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ 505 497 #define PCI_EXP_RTCAP 30 /* Root Capabilities */ 506 498 #define PCI_EXP_RTSTA 32 /* Root Status */ 499 + #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ 500 + #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ 507 501 #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ 508 502 #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ 509 503 #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
+1 -6
sound/pci/cs5535audio/cs5535audio_pm.c
··· 90 90 int i; 91 91 92 92 pci_set_power_state(pci, PCI_D0); 93 - if (pci_restore_state(pci) < 0) { 94 - printk(KERN_ERR "cs5535audio: pci_restore_state failed, " 95 - "disabling device\n"); 96 - snd_card_disconnect(card); 97 - return -EIO; 98 - } 93 + pci_restore_state(pci); 99 94 if (pci_enable_device(pci) < 0) { 100 95 printk(KERN_ERR "cs5535audio: pci_enable_device failed, " 101 96 "disabling device\n");