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

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
x86/PCI: truncate _CRS windows with _LEN > _MAX - _MIN + 1
x86/PCI: for host bridge address space collisions, show conflicting resource
frv/PCI: remove redundant warnings
x86/PCI: remove redundant warnings
PCI: don't say we claimed a resource if we failed
PCI quirk: Disable MSI on VIA K8T890 systems
PCI quirk: RS780/RS880: work around missing MSI initialization
PCI quirk: only apply CX700 PCI bus parking quirk if external VT6212L is present
PCI: complain about devices that seem to be broken
PCI: print resources consistently with %pR
PCI: make disabled window printk style match the enabled ones
PCI: break out primary/secondary/subordinate for readability
PCI: for address space collisions, show conflicting resource
resources: add interfaces that return conflict information
PCI: cleanup error return for pcix get and set mmrbc functions
PCI: fix access of PCI_X_CMD by pcix get and set mmrbc functions
PCI: kill off pci_register_set_vga_state() symbol export.
PCI: fix return value from pcix_get_max_mmrbc()

+184 -97
+1 -3
arch/frv/mb93090-mb00/pci-frv.c
··· 94 r = &dev->resource[idx]; 95 if (!r->start) 96 continue; 97 - if (pci_claim_resource(dev, idx) < 0) 98 - printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); 99 } 100 } 101 pcibios_allocate_bus_resources(&bus->children); ··· 124 DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", 125 r->start, r->end, r->flags, disabled, pass); 126 if (pci_claim_resource(dev, idx) < 0) { 127 - printk(KERN_ERR "PCI: Cannot allocate resource region %d of device %s\n", idx, pci_name(dev)); 128 /* We'll assign a new address later */ 129 r->end -= r->start; 130 r->start = 0;
··· 94 r = &dev->resource[idx]; 95 if (!r->start) 96 continue; 97 + pci_claim_resource(dev, idx); 98 } 99 } 100 pcibios_allocate_bus_resources(&bus->children); ··· 125 DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", 126 r->start, r->end, r->flags, disabled, pass); 127 if (pci_claim_resource(dev, idx) < 0) { 128 /* We'll assign a new address later */ 129 r->end -= r->start; 130 r->start = 0;
+18 -4
arch/x86/pci/acpi.c
··· 122 struct acpi_resource_address64 addr; 123 acpi_status status; 124 unsigned long flags; 125 - struct resource *root; 126 - u64 start, end; 127 128 status = resource_to_addr(acpi_res, &addr); 129 if (!ACPI_SUCCESS(status)) ··· 139 flags = IORESOURCE_IO; 140 } else 141 return AE_OK; 142 143 start = addr.minimum + addr.translation_offset; 144 end = start + addr.address_length - 1; ··· 168 return AE_OK; 169 } 170 171 - if (insert_resource(root, res)) { 172 dev_err(&info->bridge->dev, 173 - "can't allocate host bridge window %pR\n", res); 174 } else { 175 pci_bus_add_resource(info->bus, res, 0); 176 info->res_num++;
··· 122 struct acpi_resource_address64 addr; 123 acpi_status status; 124 unsigned long flags; 125 + struct resource *root, *conflict; 126 + u64 start, end, max_len; 127 128 status = resource_to_addr(acpi_res, &addr); 129 if (!ACPI_SUCCESS(status)) ··· 139 flags = IORESOURCE_IO; 140 } else 141 return AE_OK; 142 + 143 + max_len = addr.maximum - addr.minimum + 1; 144 + if (addr.address_length > max_len) { 145 + dev_printk(KERN_DEBUG, &info->bridge->dev, 146 + "host bridge window length %#llx doesn't fit in " 147 + "%#llx-%#llx, trimming\n", 148 + (unsigned long long) addr.address_length, 149 + (unsigned long long) addr.minimum, 150 + (unsigned long long) addr.maximum); 151 + addr.address_length = max_len; 152 + } 153 154 start = addr.minimum + addr.translation_offset; 155 end = start + addr.address_length - 1; ··· 157 return AE_OK; 158 } 159 160 + conflict = insert_resource_conflict(root, res); 161 + if (conflict) { 162 dev_err(&info->bridge->dev, 163 + "address space collision: host bridge window %pR " 164 + "conflicts with %s %pR\n", 165 + res, conflict->name, conflict); 166 } else { 167 pci_bus_add_resource(info->bus, res, 0); 168 info->res_num++;
-5
arch/x86/pci/i386.c
··· 127 continue; 128 if (!r->start || 129 pci_claim_resource(dev, idx) < 0) { 130 - dev_info(&dev->dev, 131 - "can't reserve window %pR\n", 132 - r); 133 /* 134 * Something is wrong with the region. 135 * Invalidate the resource to prevent ··· 178 "BAR %d: reserving %pr (d=%d, p=%d)\n", 179 idx, r, disabled, pass); 180 if (pci_claim_resource(dev, idx) < 0) { 181 - dev_info(&dev->dev, 182 - "can't reserve %pR\n", r); 183 /* We'll assign a new address later */ 184 r->end -= r->start; 185 r->start = 0;
··· 127 continue; 128 if (!r->start || 129 pci_claim_resource(dev, idx) < 0) { 130 /* 131 * Something is wrong with the region. 132 * Invalidate the resource to prevent ··· 181 "BAR %d: reserving %pr (d=%d, p=%d)\n", 182 idx, r, disabled, pass); 183 if (pci_claim_resource(dev, idx) < 0) { 184 /* We'll assign a new address later */ 185 r->end -= r->start; 186 r->start = 0;
+1 -7
drivers/gpu/drm/radeon/radeon_irq_kms.c
··· 116 } 117 /* enable msi */ 118 rdev->msi_enabled = 0; 119 - /* MSIs don't seem to work on my rs780; 120 - * not sure about rs880 or other rs780s. 121 - * Needs more investigation. 122 - */ 123 - if ((rdev->family >= CHIP_RV380) && 124 - (rdev->family != CHIP_RS780) && 125 - (rdev->family != CHIP_RS880)) { 126 int ret = pci_enable_msi(rdev->pdev); 127 if (!ret) { 128 rdev->msi_enabled = 1;
··· 116 } 117 /* enable msi */ 118 rdev->msi_enabled = 0; 119 + if (rdev->family >= CHIP_RV380) { 120 int ret = pci_enable_msi(rdev->pdev); 121 if (!ret) { 122 rdev->msi_enabled = 1;
+2 -3
drivers/pci/hotplug/pciehp_hpc.c
··· 832 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 833 if (!pci_resource_len(pdev, i)) 834 continue; 835 - ctrl_info(ctrl, " PCI resource [%d] : 0x%llx@0x%llx\n", 836 - i, (unsigned long long)pci_resource_len(pdev, i), 837 - (unsigned long long)pci_resource_start(pdev, i)); 838 } 839 ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap); 840 ctrl_info(ctrl, " Physical Slot Number : %d\n", PSN(ctrl));
··· 832 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 833 if (!pci_resource_len(pdev, i)) 834 continue; 835 + ctrl_info(ctrl, " PCI resource [%d] : %pR\n", 836 + i, &pdev->resource[i]); 837 } 838 ctrl_info(ctrl, "Slot Capabilities : 0x%08x\n", ctrl->slot_cap); 839 ctrl_info(ctrl, " Physical Slot Number : %d\n", PSN(ctrl));
+4 -5
drivers/pci/ioapic.c
··· 31 acpi_status status; 32 unsigned long long gsb; 33 struct ioapic *ioapic; 34 - u64 addr; 35 int ret; 36 char *type; 37 38 handle = DEVICE_ACPI_HANDLE(&dev->dev); 39 if (!handle) ··· 69 if (pci_request_region(dev, 0, type)) 70 goto exit_disable; 71 72 - addr = pci_resource_start(dev, 0); 73 - if (acpi_register_ioapic(ioapic->handle, addr, ioapic->gsi_base)) 74 goto exit_release; 75 76 pci_set_drvdata(dev, ioapic); 77 - dev_info(&dev->dev, "%s at %#llx, GSI %u\n", type, addr, 78 - ioapic->gsi_base); 79 return 0; 80 81 exit_release:
··· 31 acpi_status status; 32 unsigned long long gsb; 33 struct ioapic *ioapic; 34 int ret; 35 char *type; 36 + struct resource *res; 37 38 handle = DEVICE_ACPI_HANDLE(&dev->dev); 39 if (!handle) ··· 69 if (pci_request_region(dev, 0, type)) 70 goto exit_disable; 71 72 + res = &dev->resource[0]; 73 + if (acpi_register_ioapic(ioapic->handle, res->start, ioapic->gsi_base)) 74 goto exit_release; 75 76 pci_set_drvdata(dev, ioapic); 77 + dev_info(&dev->dev, "%s at %pR, GSI %u\n", type, res, ioapic->gsi_base); 78 return 0; 79 80 exit_release:
+20 -24
drivers/pci/pci.c
··· 2576 */ 2577 int pcix_get_max_mmrbc(struct pci_dev *dev) 2578 { 2579 - int err, cap; 2580 u32 stat; 2581 2582 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2583 if (!cap) 2584 return -EINVAL; 2585 2586 - err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat); 2587 - if (err) 2588 return -EINVAL; 2589 2590 - return (stat & PCI_X_STATUS_MAX_READ) >> 12; 2591 } 2592 EXPORT_SYMBOL(pcix_get_max_mmrbc); 2593 ··· 2599 */ 2600 int pcix_get_mmrbc(struct pci_dev *dev) 2601 { 2602 - int ret, cap; 2603 - u32 cmd; 2604 2605 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2606 if (!cap) 2607 return -EINVAL; 2608 2609 - ret = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); 2610 - if (!ret) 2611 - ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); 2612 2613 - return ret; 2614 } 2615 EXPORT_SYMBOL(pcix_get_mmrbc); 2616 ··· 2624 */ 2625 int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) 2626 { 2627 - int cap, err = -EINVAL; 2628 - u32 stat, cmd, v, o; 2629 2630 if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc)) 2631 - goto out; 2632 2633 v = ffs(mmrbc) - 10; 2634 2635 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2636 if (!cap) 2637 - goto out; 2638 2639 - err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat); 2640 - if (err) 2641 - goto out; 2642 2643 if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21) 2644 return -E2BIG; 2645 2646 - err = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); 2647 - if (err) 2648 - goto out; 2649 2650 o = (cmd & PCI_X_CMD_MAX_READ) >> 2; 2651 if (o != v) { ··· 2654 2655 cmd &= ~PCI_X_CMD_MAX_READ; 2656 cmd |= v << 2; 2657 - err = pci_write_config_dword(dev, cap + PCI_X_CMD, cmd); 2658 } 2659 - out: 2660 - return err; 2661 } 2662 EXPORT_SYMBOL(pcix_set_mmrbc); 2663 ··· 3020 EXPORT_SYMBOL(pci_disable_device); 3021 EXPORT_SYMBOL(pci_find_capability); 3022 EXPORT_SYMBOL(pci_bus_find_capability); 3023 - EXPORT_SYMBOL(pci_register_set_vga_state); 3024 EXPORT_SYMBOL(pci_release_regions); 3025 EXPORT_SYMBOL(pci_request_regions); 3026 EXPORT_SYMBOL(pci_request_regions_exclusive);
··· 2576 */ 2577 int pcix_get_max_mmrbc(struct pci_dev *dev) 2578 { 2579 + int cap; 2580 u32 stat; 2581 2582 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2583 if (!cap) 2584 return -EINVAL; 2585 2586 + if (pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat)) 2587 return -EINVAL; 2588 2589 + return 512 << ((stat & PCI_X_STATUS_MAX_READ) >> 21); 2590 } 2591 EXPORT_SYMBOL(pcix_get_max_mmrbc); 2592 ··· 2600 */ 2601 int pcix_get_mmrbc(struct pci_dev *dev) 2602 { 2603 + int cap; 2604 + u16 cmd; 2605 2606 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2607 if (!cap) 2608 return -EINVAL; 2609 2610 + if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) 2611 + return -EINVAL; 2612 2613 + return 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); 2614 } 2615 EXPORT_SYMBOL(pcix_get_mmrbc); 2616 ··· 2626 */ 2627 int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) 2628 { 2629 + int cap; 2630 + u32 stat, v, o; 2631 + u16 cmd; 2632 2633 if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc)) 2634 + return -EINVAL; 2635 2636 v = ffs(mmrbc) - 10; 2637 2638 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2639 if (!cap) 2640 + return -EINVAL; 2641 2642 + if (pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat)) 2643 + return -EINVAL; 2644 2645 if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21) 2646 return -E2BIG; 2647 2648 + if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) 2649 + return -EINVAL; 2650 2651 o = (cmd & PCI_X_CMD_MAX_READ) >> 2; 2652 if (o != v) { ··· 2657 2658 cmd &= ~PCI_X_CMD_MAX_READ; 2659 cmd |= v << 2; 2660 + if (pci_write_config_word(dev, cap + PCI_X_CMD, cmd)) 2661 + return -EIO; 2662 } 2663 + return 0; 2664 } 2665 EXPORT_SYMBOL(pcix_set_mmrbc); 2666 ··· 3023 EXPORT_SYMBOL(pci_disable_device); 3024 EXPORT_SYMBOL(pci_find_capability); 3025 EXPORT_SYMBOL(pci_bus_find_capability); 3026 EXPORT_SYMBOL(pci_release_regions); 3027 EXPORT_SYMBOL(pci_request_regions); 3028 EXPORT_SYMBOL(pci_request_regions_exclusive);
+33 -20
drivers/pci/probe.c
··· 174 pci_read_config_dword(dev, pos, &sz); 175 pci_write_config_dword(dev, pos, l); 176 177 /* 178 * All bits set in sz means the device isn't working properly. 179 - * If the BAR isn't implemented, all bits must be 0. If it's a 180 - * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit 181 - * 1 must be clear. 182 */ 183 - if (!sz || sz == 0xffffffff) 184 goto fail; 185 186 /* 187 * I don't know how l can have all bits set. Copied from old code. ··· 249 pos, res); 250 } 251 } else { 252 - sz = pci_size(l, sz, mask); 253 254 - if (!sz) 255 goto fail; 256 257 res->start = l; 258 - res->end = l + sz; 259 260 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); 261 } ··· 321 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 322 } else { 323 dev_printk(KERN_DEBUG, &dev->dev, 324 - " bridge window [io %04lx - %04lx] reg reading\n", 325 base, limit); 326 } 327 } ··· 345 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 346 } else { 347 dev_printk(KERN_DEBUG, &dev->dev, 348 - " bridge window [mem 0x%08lx - 0x%08lx] reg reading\n", 349 base, limit + 0xfffff); 350 } 351 } ··· 396 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 397 } else { 398 dev_printk(KERN_DEBUG, &dev->dev, 399 - " bridge window [mem 0x%08lx - %08lx pref] reg reading\n", 400 base, limit + 0xfffff); 401 } 402 } ··· 682 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); 683 u32 buses, i, j = 0; 684 u16 bctl; 685 int broken = 0; 686 687 pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); 688 689 - dev_dbg(&dev->dev, "scanning behind bridge, config %06x, pass %d\n", 690 - buses & 0xffffff, pass); 691 692 /* Check if setup is sensible at all */ 693 if (!pass && 694 - ((buses & 0xff) != bus->number || ((buses >> 8) & 0xff) <= bus->number)) { 695 dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n"); 696 broken = 1; 697 } ··· 706 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, 707 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); 708 709 - if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus && !broken) { 710 - unsigned int cmax, busnr; 711 /* 712 * Bus already configured by firmware, process it in the first 713 * pass and just note the configuration. 714 */ 715 if (pass) 716 goto out; 717 - busnr = (buses >> 8) & 0xFF; 718 719 /* 720 * If we already got to this bus through a different bridge, ··· 723 * However, we continue to descend down the hierarchy and 724 * scan remaining child buses. 725 */ 726 - child = pci_find_bus(pci_domain_nr(bus), busnr); 727 if (!child) { 728 - child = pci_add_new_bus(bus, dev, busnr); 729 if (!child) 730 goto out; 731 - child->primary = buses & 0xFF; 732 - child->subordinate = (buses >> 16) & 0xFF; 733 child->bridge_ctl = bctl; 734 } 735
··· 174 pci_read_config_dword(dev, pos, &sz); 175 pci_write_config_dword(dev, pos, l); 176 177 + if (!sz) 178 + goto fail; /* BAR not implemented */ 179 + 180 /* 181 * All bits set in sz means the device isn't working properly. 182 + * If it's a memory BAR or a ROM, bit 0 must be clear; if it's 183 + * an io BAR, bit 1 must be clear. 184 */ 185 + if (sz == 0xffffffff) { 186 + dev_err(&dev->dev, "reg %x: invalid size %#x; broken device?\n", 187 + pos, sz); 188 goto fail; 189 + } 190 191 /* 192 * I don't know how l can have all bits set. Copied from old code. ··· 244 pos, res); 245 } 246 } else { 247 + u32 size = pci_size(l, sz, mask); 248 249 + if (!size) { 250 + dev_err(&dev->dev, "reg %x: invalid size " 251 + "(l %#x sz %#x mask %#x); broken device?", 252 + pos, l, sz, mask); 253 goto fail; 254 + } 255 256 res->start = l; 257 + res->end = l + size; 258 259 dev_printk(KERN_DEBUG, &dev->dev, "reg %x: %pR\n", pos, res); 260 } ··· 312 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 313 } else { 314 dev_printk(KERN_DEBUG, &dev->dev, 315 + " bridge window [io %#06lx-%#06lx] (disabled)\n", 316 base, limit); 317 } 318 } ··· 336 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 337 } else { 338 dev_printk(KERN_DEBUG, &dev->dev, 339 + " bridge window [mem %#010lx-%#010lx] (disabled)\n", 340 base, limit + 0xfffff); 341 } 342 } ··· 387 dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); 388 } else { 389 dev_printk(KERN_DEBUG, &dev->dev, 390 + " bridge window [mem %#010lx-%#010lx pref] (disabled)\n", 391 base, limit + 0xfffff); 392 } 393 } ··· 673 int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); 674 u32 buses, i, j = 0; 675 u16 bctl; 676 + u8 primary, secondary, subordinate; 677 int broken = 0; 678 679 pci_read_config_dword(dev, PCI_PRIMARY_BUS, &buses); 680 + primary = buses & 0xFF; 681 + secondary = (buses >> 8) & 0xFF; 682 + subordinate = (buses >> 16) & 0xFF; 683 684 + dev_dbg(&dev->dev, "scanning [bus %02x-%02x] behind bridge, pass %d\n", 685 + secondary, subordinate, pass); 686 687 /* Check if setup is sensible at all */ 688 if (!pass && 689 + (primary != bus->number || secondary <= bus->number)) { 690 dev_dbg(&dev->dev, "bus configuration invalid, reconfiguring\n"); 691 broken = 1; 692 } ··· 693 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, 694 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); 695 696 + if ((secondary || subordinate) && !pcibios_assign_all_busses() && 697 + !is_cardbus && !broken) { 698 + unsigned int cmax; 699 /* 700 * Bus already configured by firmware, process it in the first 701 * pass and just note the configuration. 702 */ 703 if (pass) 704 goto out; 705 706 /* 707 * If we already got to this bus through a different bridge, ··· 710 * However, we continue to descend down the hierarchy and 711 * scan remaining child buses. 712 */ 713 + child = pci_find_bus(pci_domain_nr(bus), secondary); 714 if (!child) { 715 + child = pci_add_new_bus(bus, dev, secondary); 716 if (!child) 717 goto out; 718 + child->primary = primary; 719 + child->subordinate = subordinate; 720 child->bridge_ctl = bctl; 721 } 722
+54 -5
drivers/pci/quirks.c
··· 368 bus_region.end = res->end; 369 pcibios_bus_to_resource(dev, res, &bus_region); 370 371 - pci_claim_resource(dev, nr); 372 - dev_info(&dev->dev, "quirk: %pR claimed by %s\n", res, name); 373 } 374 } 375 ··· 1978 /* 1979 * Disable PCI Bus Parking and PCI Master read caching on CX700 1980 * which causes unspecified timing errors with a VT6212L on the PCI 1981 - * bus leading to USB2.0 packet loss. The defaults are that these 1982 - * features are turned off but some BIOSes turn them on. 1983 */ 1984 1985 uint8_t b; 1986 if (pci_read_config_byte(dev, 0x76, &b) == 0) { 1987 if (b & 0x40) { 1988 /* Turn off PCI Bus Parking */ ··· 2023 } 2024 } 2025 } 2026 - DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); 2027 2028 /* 2029 * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the ··· 2123 } 2124 } 2125 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 2126 2127 /* Go through the list of Hypertransport capabilities and 2128 * return 1 if a HT MSI capability is found and enabled */ ··· 2494 quirk_msi_intx_disable_bug); 2495 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375, 2496 quirk_msi_intx_disable_bug); 2497 2498 #endif /* CONFIG_PCI_MSI */ 2499
··· 368 bus_region.end = res->end; 369 pcibios_bus_to_resource(dev, res, &bus_region); 370 371 + if (pci_claim_resource(dev, nr) == 0) 372 + dev_info(&dev->dev, "quirk: %pR claimed by %s\n", 373 + res, name); 374 } 375 } 376 ··· 1977 /* 1978 * Disable PCI Bus Parking and PCI Master read caching on CX700 1979 * which causes unspecified timing errors with a VT6212L on the PCI 1980 + * bus leading to USB2.0 packet loss. 1981 + * 1982 + * This quirk is only enabled if a second (on the external PCI bus) 1983 + * VT6212L is found -- the CX700 core itself also contains a USB 1984 + * host controller with the same PCI ID as the VT6212L. 1985 */ 1986 1987 + /* Count VT6212L instances */ 1988 + struct pci_dev *p = pci_get_device(PCI_VENDOR_ID_VIA, 1989 + PCI_DEVICE_ID_VIA_8235_USB_2, NULL); 1990 uint8_t b; 1991 + 1992 + /* p should contain the first (internal) VT6212L -- see if we have 1993 + an external one by searching again */ 1994 + p = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235_USB_2, p); 1995 + if (!p) 1996 + return; 1997 + pci_dev_put(p); 1998 + 1999 if (pci_read_config_byte(dev, 0x76, &b) == 0) { 2000 if (b & 0x40) { 2001 /* Turn off PCI Bus Parking */ ··· 2008 } 2009 } 2010 } 2011 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0x324e, quirk_via_cx700_pci_parking_caching); 2012 2013 /* 2014 * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the ··· 2108 } 2109 } 2110 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 2111 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, 0xa238, quirk_disable_msi); 2112 2113 /* Go through the list of Hypertransport capabilities and 2114 * return 1 if a HT MSI capability is found and enabled */ ··· 2478 quirk_msi_intx_disable_bug); 2479 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x4375, 2480 quirk_msi_intx_disable_bug); 2481 + 2482 + /* 2483 + * MSI does not work with the AMD RS780/RS880 internal graphics and HDMI audio 2484 + * devices unless the BIOS has initialized the nb_cntl.strap_msi_enable bit. 2485 + */ 2486 + static void __init rs780_int_gfx_disable_msi(struct pci_dev *int_gfx_bridge) 2487 + { 2488 + u32 nb_cntl; 2489 + 2490 + if (!int_gfx_bridge->subordinate) 2491 + return; 2492 + 2493 + pci_bus_write_config_dword(int_gfx_bridge->bus, PCI_DEVFN(0, 0), 2494 + 0x60, 0); 2495 + pci_bus_read_config_dword(int_gfx_bridge->bus, PCI_DEVFN(0, 0), 2496 + 0x64, &nb_cntl); 2497 + 2498 + if (!(nb_cntl & BIT(10))) { 2499 + dev_warn(&int_gfx_bridge->dev, 2500 + FW_WARN "RS780: MSI for internal graphics disabled\n"); 2501 + int_gfx_bridge->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI; 2502 + } 2503 + } 2504 + 2505 + #define PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX 0x9602 2506 + 2507 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 2508 + PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX, 2509 + rs780_int_gfx_disable_msi); 2510 + /* wrong vendor ID on M4A785TD motherboard: */ 2511 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASUSTEK, 2512 + PCI_DEVICE_ID_AMD_RS780_P2P_INT_GFX, 2513 + rs780_int_gfx_disable_msi); 2514 2515 #endif /* CONFIG_PCI_MSI */ 2516
+8 -6
drivers/pci/setup-res.c
··· 93 int pci_claim_resource(struct pci_dev *dev, int resource) 94 { 95 struct resource *res = &dev->resource[resource]; 96 - struct resource *root; 97 - int err; 98 99 root = pci_find_parent_resource(dev, res); 100 if (!root) { ··· 102 return -EINVAL; 103 } 104 105 - err = request_resource(root, res); 106 - if (err) 107 dev_err(&dev->dev, 108 - "address space collision: %pR already in use\n", res); 109 110 - return err; 111 } 112 EXPORT_SYMBOL(pci_claim_resource); 113
··· 93 int pci_claim_resource(struct pci_dev *dev, int resource) 94 { 95 struct resource *res = &dev->resource[resource]; 96 + struct resource *root, *conflict; 97 98 root = pci_find_parent_resource(dev, res); 99 if (!root) { ··· 103 return -EINVAL; 104 } 105 106 + conflict = request_resource_conflict(root, res); 107 + if (conflict) { 108 dev_err(&dev->dev, 109 + "address space collision: %pR conflicts with %s %pR\n", 110 + res, conflict->name, conflict); 111 + return -EBUSY; 112 + } 113 114 + return 0; 115 } 116 EXPORT_SYMBOL(pci_claim_resource); 117
+4 -8
drivers/pcmcia/rsrc_nonstatic.c
··· 874 if (res == &ioport_resource) 875 continue; 876 dev_printk(KERN_INFO, &s->cb_dev->dev, 877 - "pcmcia: parent PCI bridge I/O " 878 - "window: 0x%llx - 0x%llx\n", 879 - (unsigned long long)res->start, 880 - (unsigned long long)res->end); 881 if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 882 done |= IORESOURCE_IO; 883 ··· 885 if (res == &iomem_resource) 886 continue; 887 dev_printk(KERN_INFO, &s->cb_dev->dev, 888 - "pcmcia: parent PCI bridge Memory " 889 - "window: 0x%llx - 0x%llx\n", 890 - (unsigned long long)res->start, 891 - (unsigned long long)res->end); 892 if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 893 done |= IORESOURCE_MEM; 894 }
··· 874 if (res == &ioport_resource) 875 continue; 876 dev_printk(KERN_INFO, &s->cb_dev->dev, 877 + "pcmcia: parent PCI bridge window: %pR\n", 878 + res); 879 if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 880 done |= IORESOURCE_IO; 881 ··· 887 if (res == &iomem_resource) 888 continue; 889 dev_printk(KERN_INFO, &s->cb_dev->dev, 890 + "pcmcia: parent PCI bridge window: %pR\n", 891 + res); 892 if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 893 done |= IORESOURCE_MEM; 894 }
+2
include/linux/ioport.h
··· 112 extern struct resource ioport_resource; 113 extern struct resource iomem_resource; 114 115 extern int request_resource(struct resource *root, struct resource *new); 116 extern int release_resource(struct resource *new); 117 void release_child_resources(struct resource *new); 118 extern void reserve_region_with_split(struct resource *root, 119 resource_size_t start, resource_size_t end, 120 const char *name); 121 extern int insert_resource(struct resource *parent, struct resource *new); 122 extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 123 extern int allocate_resource(struct resource *root, struct resource *new,
··· 112 extern struct resource ioport_resource; 113 extern struct resource iomem_resource; 114 115 + extern struct resource *request_resource_conflict(struct resource *root, struct resource *new); 116 extern int request_resource(struct resource *root, struct resource *new); 117 extern int release_resource(struct resource *new); 118 void release_child_resources(struct resource *new); 119 extern void reserve_region_with_split(struct resource *root, 120 resource_size_t start, resource_size_t end, 121 const char *name); 122 + extern struct resource *insert_resource_conflict(struct resource *parent, struct resource *new); 123 extern int insert_resource(struct resource *parent, struct resource *new); 124 extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new); 125 extern int allocate_resource(struct resource *root, struct resource *new,
+37 -7
kernel/resource.c
··· 219 } 220 221 /** 222 * request_resource - request and reserve an I/O or memory resource 223 * @root: root resource descriptor 224 * @new: resource descriptor desired by caller ··· 246 { 247 struct resource *conflict; 248 249 - write_lock(&resource_lock); 250 - conflict = __request_resource(root, new); 251 - write_unlock(&resource_lock); 252 return conflict ? -EBUSY : 0; 253 } 254 ··· 489 } 490 491 /** 492 - * insert_resource - Inserts a resource in the resource tree 493 * @parent: parent of the new resource 494 * @new: new resource to insert 495 * 496 - * Returns 0 on success, -EBUSY if the resource can't be inserted. 497 * 498 - * This function is equivalent to request_resource when no conflict 499 * happens. If a conflict happens, and the conflicting resources 500 * entirely fit within the range of the new resource, then the new 501 * resource is inserted and the conflicting resources become children of 502 * the new resource. 503 */ 504 - int insert_resource(struct resource *parent, struct resource *new) 505 { 506 struct resource *conflict; 507 508 write_lock(&resource_lock); 509 conflict = __insert_resource(parent, new); 510 write_unlock(&resource_lock); 511 return conflict ? -EBUSY : 0; 512 } 513
··· 219 } 220 221 /** 222 + * request_resource_conflict - request and reserve an I/O or memory resource 223 + * @root: root resource descriptor 224 + * @new: resource descriptor desired by caller 225 + * 226 + * Returns 0 for success, conflict resource on error. 227 + */ 228 + struct resource *request_resource_conflict(struct resource *root, struct resource *new) 229 + { 230 + struct resource *conflict; 231 + 232 + write_lock(&resource_lock); 233 + conflict = __request_resource(root, new); 234 + write_unlock(&resource_lock); 235 + return conflict; 236 + } 237 + 238 + /** 239 * request_resource - request and reserve an I/O or memory resource 240 * @root: root resource descriptor 241 * @new: resource descriptor desired by caller ··· 229 { 230 struct resource *conflict; 231 232 + conflict = request_resource_conflict(root, new); 233 return conflict ? -EBUSY : 0; 234 } 235 ··· 474 } 475 476 /** 477 + * insert_resource_conflict - Inserts resource in the resource tree 478 * @parent: parent of the new resource 479 * @new: new resource to insert 480 * 481 + * Returns 0 on success, conflict resource if the resource can't be inserted. 482 * 483 + * This function is equivalent to request_resource_conflict when no conflict 484 * happens. If a conflict happens, and the conflicting resources 485 * entirely fit within the range of the new resource, then the new 486 * resource is inserted and the conflicting resources become children of 487 * the new resource. 488 */ 489 + struct resource *insert_resource_conflict(struct resource *parent, struct resource *new) 490 { 491 struct resource *conflict; 492 493 write_lock(&resource_lock); 494 conflict = __insert_resource(parent, new); 495 write_unlock(&resource_lock); 496 + return conflict; 497 + } 498 + 499 + /** 500 + * insert_resource - Inserts a resource in the resource tree 501 + * @parent: parent of the new resource 502 + * @new: new resource to insert 503 + * 504 + * Returns 0 on success, -EBUSY if the resource can't be inserted. 505 + */ 506 + int insert_resource(struct resource *parent, struct resource *new) 507 + { 508 + struct resource *conflict; 509 + 510 + conflict = insert_resource_conflict(parent, new); 511 return conflict ? -EBUSY : 0; 512 } 513