diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-03-04 19:37:10 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-03-04 19:37:10 -0500 |
| commit | 12f981f9028da2402c236544c78b8378a278f830 (patch) | |
| tree | 7983fdf95d77ad241e09db861bb90a629eee753f | |
| parent | 10955d2251387df3997d8b9b6c572dfad9f23dd0 (diff) | |
| parent | c1ef5cbd03921047c2eafb998132e562043678a7 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6:
pci: hotplug: pciehp: fix error code path in hpc_power_off_slot
PCI: Add DECLARE_PCI_DEVICE_TABLE macro
PCI: fix up error messages for pci_bus registering
PCI: fix section mismatch warning in pci_scan_child_bus
PCI: consolidate duplicated MSI enable functions
PCI: use dev_printk in quirk messages
| -rw-r--r-- | Documentation/pci.txt | 6 | ||||
| -rw-r--r-- | drivers/pci/bus.c | 10 | ||||
| -rw-r--r-- | drivers/pci/hotplug-pci.c | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/cpci_hotplug_pci.c | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 5 | ||||
| -rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 2 | ||||
| -rw-r--r-- | drivers/pci/hotplug/shpchp_pci.c | 2 | ||||
| -rw-r--r-- | drivers/pci/probe.c | 8 | ||||
| -rw-r--r-- | drivers/pci/quirks.c | 41 | ||||
| -rw-r--r-- | include/linux/pci.h | 10 |
11 files changed, 40 insertions, 50 deletions
diff --git a/Documentation/pci.txt b/Documentation/pci.txt index 72b20c639596..bb7bd27d4682 100644 --- a/Documentation/pci.txt +++ b/Documentation/pci.txt | |||
| @@ -123,7 +123,8 @@ initialization with a pointer to a structure describing the driver | |||
| 123 | 123 | ||
| 124 | 124 | ||
| 125 | The ID table is an array of struct pci_device_id entries ending with an | 125 | The ID table is an array of struct pci_device_id entries ending with an |
| 126 | all-zero entry. Each entry consists of: | 126 | all-zero entry; use of the macro DECLARE_PCI_DEVICE_TABLE is the preferred |
| 127 | method of declaring the table. Each entry consists of: | ||
| 127 | 128 | ||
| 128 | vendor,device Vendor and device ID to match (or PCI_ANY_ID) | 129 | vendor,device Vendor and device ID to match (or PCI_ANY_ID) |
| 129 | 130 | ||
| @@ -191,7 +192,8 @@ Tips on when/where to use the above attributes: | |||
| 191 | 192 | ||
| 192 | o Do not mark the struct pci_driver. | 193 | o Do not mark the struct pci_driver. |
| 193 | 194 | ||
| 194 | o The ID table array should be marked __devinitdata. | 195 | o The ID table array should be marked __devinitconst; this is done |
| 196 | automatically if the table is declared with DECLARE_PCI_DEVICE_TABLE(). | ||
| 195 | 197 | ||
| 196 | o The probe() and remove() functions should be marked __devinit | 198 | o The probe() and remove() functions should be marked __devinit |
| 197 | and __devexit respectively. All initialization functions | 199 | and __devexit respectively. All initialization functions |
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index ef5a6a245f5f..6a9403d79e0c 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
| @@ -145,13 +145,15 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
| 145 | child_bus = dev->subordinate; | 145 | child_bus = dev->subordinate; |
| 146 | child_bus->dev.parent = child_bus->bridge; | 146 | child_bus->dev.parent = child_bus->bridge; |
| 147 | retval = device_register(&child_bus->dev); | 147 | retval = device_register(&child_bus->dev); |
| 148 | if (!retval) | 148 | if (retval) |
| 149 | dev_err(&dev->dev, "Error registering pci_bus," | ||
| 150 | " continuing...\n"); | ||
| 151 | else | ||
| 149 | retval = device_create_file(&child_bus->dev, | 152 | retval = device_create_file(&child_bus->dev, |
| 150 | &dev_attr_cpuaffinity); | 153 | &dev_attr_cpuaffinity); |
| 151 | if (retval) | 154 | if (retval) |
| 152 | dev_err(&dev->dev, "Error registering pci_bus" | 155 | dev_err(&dev->dev, "Error creating cpuaffinity" |
| 153 | " device bridge symlink," | 156 | " file, continuing...\n"); |
| 154 | " continuing...\n"); | ||
| 155 | } | 157 | } |
| 156 | } | 158 | } |
| 157 | } | 159 | } |
diff --git a/drivers/pci/hotplug-pci.c b/drivers/pci/hotplug-pci.c index a590ef682153..4d4a64478404 100644 --- a/drivers/pci/hotplug-pci.c +++ b/drivers/pci/hotplug-pci.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "pci.h" | 4 | #include "pci.h" |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | unsigned int pci_do_scan_bus(struct pci_bus *bus) | 7 | unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus) |
| 8 | { | 8 | { |
| 9 | unsigned int max; | 9 | unsigned int max; |
| 10 | 10 | ||
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index cf22f9e01e00..5e50008d1181 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
| @@ -1085,7 +1085,7 @@ static int acpiphp_bus_trim(acpi_handle handle) | |||
| 1085 | * This function should be called per *physical slot*, | 1085 | * This function should be called per *physical slot*, |
| 1086 | * not per each slot object in ACPI namespace. | 1086 | * not per each slot object in ACPI namespace. |
| 1087 | */ | 1087 | */ |
| 1088 | static int enable_device(struct acpiphp_slot *slot) | 1088 | static int __ref enable_device(struct acpiphp_slot *slot) |
| 1089 | { | 1089 | { |
| 1090 | struct pci_dev *dev; | 1090 | struct pci_dev *dev; |
| 1091 | struct pci_bus *bus = slot->bridge->pci_bus; | 1091 | struct pci_bus *bus = slot->bridge->pci_bus; |
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index 5e9be44817cb..b3515fc4cd38 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c | |||
| @@ -250,7 +250,7 @@ int cpci_led_off(struct slot* slot) | |||
| 250 | * Device configuration functions | 250 | * Device configuration functions |
| 251 | */ | 251 | */ |
| 252 | 252 | ||
| 253 | int cpci_configure_slot(struct slot* slot) | 253 | int __ref cpci_configure_slot(struct slot *slot) |
| 254 | { | 254 | { |
| 255 | struct pci_bus *parent; | 255 | struct pci_bus *parent; |
| 256 | int fn; | 256 | int fn; |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 6eba9b2cfb90..698975a6a21c 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
| @@ -711,7 +711,8 @@ static int hpc_power_off_slot(struct slot * slot) | |||
| 711 | retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); | 711 | retval = pcie_write_cmd(slot, slot_cmd, cmd_mask); |
| 712 | if (retval) { | 712 | if (retval) { |
| 713 | err("%s: Write command failed!\n", __FUNCTION__); | 713 | err("%s: Write command failed!\n", __FUNCTION__); |
| 714 | return -1; | 714 | retval = -1; |
| 715 | goto out; | ||
| 715 | } | 716 | } |
| 716 | dbg("%s: SLOTCTRL %x write cmd %x\n", | 717 | dbg("%s: SLOTCTRL %x write cmd %x\n", |
| 717 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); | 718 | __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); |
| @@ -722,7 +723,7 @@ static int hpc_power_off_slot(struct slot * slot) | |||
| 722 | * removed from the slot/adapter. | 723 | * removed from the slot/adapter. |
| 723 | */ | 724 | */ |
| 724 | msleep(1000); | 725 | msleep(1000); |
| 725 | 726 | out: | |
| 726 | if (changed) | 727 | if (changed) |
| 727 | pcie_unmask_bad_dllp(ctrl); | 728 | pcie_unmask_bad_dllp(ctrl); |
| 728 | 729 | ||
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index dd50713966d1..9372a840b63d 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
| @@ -167,7 +167,7 @@ static void program_fw_provided_values(struct pci_dev *dev) | |||
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | static int pciehp_add_bridge(struct pci_dev *dev) | 170 | static int __ref pciehp_add_bridge(struct pci_dev *dev) |
| 171 | { | 171 | { |
| 172 | struct pci_bus *parent = dev->bus; | 172 | struct pci_bus *parent = dev->bus; |
| 173 | int pass, busnr, start = parent->secondary; | 173 | int pass, busnr, start = parent->secondary; |
diff --git a/drivers/pci/hotplug/shpchp_pci.c b/drivers/pci/hotplug/shpchp_pci.c index 0a6b25ef194c..a69a21520895 100644 --- a/drivers/pci/hotplug/shpchp_pci.c +++ b/drivers/pci/hotplug/shpchp_pci.c | |||
| @@ -96,7 +96,7 @@ static void program_fw_provided_values(struct pci_dev *dev) | |||
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | int shpchp_configure_device(struct slot *p_slot) | 99 | int __ref shpchp_configure_device(struct slot *p_slot) |
| 100 | { | 100 | { |
| 101 | struct pci_dev *dev; | 101 | struct pci_dev *dev; |
| 102 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; | 102 | struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4d23b9fb551b..2db2e4bb0d1e 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -286,7 +286,7 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) | |||
| 286 | } | 286 | } |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | void pci_read_bridge_bases(struct pci_bus *child) | 289 | void __devinit pci_read_bridge_bases(struct pci_bus *child) |
| 290 | { | 290 | { |
| 291 | struct pci_dev *dev = child->self; | 291 | struct pci_dev *dev = child->self; |
| 292 | u8 io_base_lo, io_limit_lo; | 292 | u8 io_base_lo, io_limit_lo; |
| @@ -472,7 +472,7 @@ static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) | |||
| 472 | * them, we proceed to assigning numbers to the remaining buses in | 472 | * them, we proceed to assigning numbers to the remaining buses in |
| 473 | * order to avoid overlaps between old and new bus numbers. | 473 | * order to avoid overlaps between old and new bus numbers. |
| 474 | */ | 474 | */ |
| 475 | int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) | 475 | int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) |
| 476 | { | 476 | { |
| 477 | struct pci_bus *child; | 477 | struct pci_bus *child; |
| 478 | int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); | 478 | int is_cardbus = (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS); |
| @@ -1008,7 +1008,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) | |||
| 1008 | return nr; | 1008 | return nr; |
| 1009 | } | 1009 | } |
| 1010 | 1010 | ||
| 1011 | unsigned int pci_scan_child_bus(struct pci_bus *bus) | 1011 | unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus) |
| 1012 | { | 1012 | { |
| 1013 | unsigned int devfn, pass, max = bus->secondary; | 1013 | unsigned int devfn, pass, max = bus->secondary; |
| 1014 | struct pci_dev *dev; | 1014 | struct pci_dev *dev; |
| @@ -1116,7 +1116,7 @@ err_out: | |||
| 1116 | return NULL; | 1116 | return NULL; |
| 1117 | } | 1117 | } |
| 1118 | 1118 | ||
| 1119 | struct pci_bus *pci_scan_bus_parented(struct device *parent, | 1119 | struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, |
| 1120 | int bus, struct pci_ops *ops, void *sysdata) | 1120 | int bus, struct pci_ops *ops, void *sysdata) |
| 1121 | { | 1121 | { |
| 1122 | struct pci_bus *b; | 1122 | struct pci_bus *b; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index bbad4a9f264f..e9a333d98552 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -1652,9 +1652,8 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev) | |||
| 1652 | pci_write_config_byte(dev, 0x75, 0x1); | 1652 | pci_write_config_byte(dev, 0x75, 0x1); |
| 1653 | pci_write_config_byte(dev, 0x77, 0x0); | 1653 | pci_write_config_byte(dev, 0x77, 0x0); |
| 1654 | 1654 | ||
| 1655 | printk(KERN_INFO | 1655 | dev_info(&dev->dev, |
| 1656 | "PCI: VIA CX700 PCI parking/caching fixup on %s\n", | 1656 | "Disabling VIA CX700 PCI parking/caching\n"); |
| 1657 | pci_name(dev)); | ||
| 1658 | } | 1657 | } |
| 1659 | } | 1658 | } |
| 1660 | } | 1659 | } |
| @@ -1726,32 +1725,6 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2 | |||
| 1726 | quirk_msi_ht_cap); | 1725 | quirk_msi_ht_cap); |
| 1727 | 1726 | ||
| 1728 | 1727 | ||
| 1729 | /* | ||
| 1730 | * Force enable MSI mapping capability on HT bridges | ||
| 1731 | */ | ||
| 1732 | static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev) | ||
| 1733 | { | ||
| 1734 | int pos, ttl = 48; | ||
| 1735 | |||
| 1736 | pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING); | ||
| 1737 | while (pos && ttl--) { | ||
| 1738 | u8 flags; | ||
| 1739 | |||
| 1740 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) { | ||
| 1741 | printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n", | ||
| 1742 | pci_name(dev)); | ||
| 1743 | |||
| 1744 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | ||
| 1745 | flags | HT_MSI_FLAGS_ENABLE); | ||
| 1746 | } | ||
| 1747 | pos = pci_find_next_ht_capability(dev, pos, | ||
| 1748 | HT_CAPTYPE_MSI_MAPPING); | ||
| 1749 | } | ||
| 1750 | } | ||
| 1751 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, | ||
| 1752 | PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, | ||
| 1753 | quirk_msi_ht_cap_enable); | ||
| 1754 | |||
| 1755 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. | 1728 | /* The nVidia CK804 chipset may have 2 HT MSI mappings. |
| 1756 | * MSI are supported if the MSI capability set in any of these mappings. | 1729 | * MSI are supported if the MSI capability set in any of these mappings. |
| 1757 | */ | 1730 | */ |
| @@ -1778,9 +1751,8 @@ static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev) | |||
| 1778 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, | 1751 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, |
| 1779 | quirk_nvidia_ck804_msi_ht_cap); | 1752 | quirk_nvidia_ck804_msi_ht_cap); |
| 1780 | 1753 | ||
| 1781 | /* | 1754 | /* Force enable MSI mapping capability on HT bridges */ |
| 1782 | * Force enable MSI mapping capability on HT bridges */ | 1755 | static void __devinit ht_enable_msi_mapping(struct pci_dev *dev) |
| 1783 | static inline void ht_enable_msi_mapping(struct pci_dev *dev) | ||
| 1784 | { | 1756 | { |
| 1785 | int pos, ttl = 48; | 1757 | int pos, ttl = 48; |
| 1786 | 1758 | ||
| @@ -1799,6 +1771,9 @@ static inline void ht_enable_msi_mapping(struct pci_dev *dev) | |||
| 1799 | HT_CAPTYPE_MSI_MAPPING); | 1771 | HT_CAPTYPE_MSI_MAPPING); |
| 1800 | } | 1772 | } |
| 1801 | } | 1773 | } |
| 1774 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, | ||
| 1775 | PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, | ||
| 1776 | ht_enable_msi_mapping); | ||
| 1802 | 1777 | ||
| 1803 | static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | 1778 | static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) |
| 1804 | { | 1779 | { |
| @@ -1830,7 +1805,7 @@ static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev) | |||
| 1830 | 1805 | ||
| 1831 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, | 1806 | if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, |
| 1832 | &flags) == 0) { | 1807 | &flags) == 0) { |
| 1833 | dev_info(&dev->dev, "Quirk disabling HT MSI mapping"); | 1808 | dev_info(&dev->dev, "Disabling HT MSI mapping"); |
| 1834 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, | 1809 | pci_write_config_byte(dev, pos + HT_MSI_FLAGS, |
| 1835 | flags & ~HT_MSI_FLAGS_ENABLE); | 1810 | flags & ~HT_MSI_FLAGS_ENABLE); |
| 1836 | } | 1811 | } |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 87195b62de52..f3165e7ac431 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -389,6 +389,16 @@ struct pci_driver { | |||
| 389 | #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) | 389 | #define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) |
| 390 | 390 | ||
| 391 | /** | 391 | /** |
| 392 | * DECLARE_PCI_DEVICE_TABLE - macro used to describe a pci device table | ||
| 393 | * @_table: device table name | ||
| 394 | * | ||
| 395 | * This macro is used to create a struct pci_device_id array (a device table) | ||
| 396 | * in a generic manner. | ||
| 397 | */ | ||
| 398 | #define DECLARE_PCI_DEVICE_TABLE(_table) \ | ||
| 399 | const struct pci_device_id _table[] __devinitconst | ||
| 400 | |||
| 401 | /** | ||
| 392 | * PCI_DEVICE - macro used to describe a specific pci device | 402 | * PCI_DEVICE - macro used to describe a specific pci device |
| 393 | * @vend: the 16 bit PCI Vendor ID | 403 | * @vend: the 16 bit PCI Vendor ID |
| 394 | * @dev: the 16 bit PCI Device ID | 404 | * @dev: the 16 bit PCI Device ID |
