aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/hotplug.c53
-rw-r--r--drivers/pci/hotplug/pciehprm_acpi.c8
-rw-r--r--drivers/pci/pci.h1
-rw-r--r--drivers/pci/probe.c50
-rw-r--r--drivers/pci/quirks.c6
-rw-r--r--include/linux/pci.h23
6 files changed, 77 insertions, 64 deletions
diff --git a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
index b844bc972324..10444988a10b 100644
--- a/drivers/pci/hotplug.c
+++ b/drivers/pci/hotplug.c
@@ -20,46 +20,35 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp,
20 20
21 scratch = buffer; 21 scratch = buffer;
22 22
23 /* stuff we want to pass to /sbin/hotplug */ 23
24 envp[i++] = scratch; 24 if (add_hotplug_env_var(envp, num_envp, &i,
25 length += scnprintf (scratch, buffer_size - length, "PCI_CLASS=%04X", 25 buffer, buffer_size, &length,
26 pdev->class); 26 "PCI_CLASS=%04X", pdev->class))
27 if ((buffer_size - length <= 0) || (i >= num_envp))
28 return -ENOMEM; 27 return -ENOMEM;
29 ++length;
30 scratch += length;
31 28
32 envp[i++] = scratch; 29 if (add_hotplug_env_var(envp, num_envp, &i,
33 length += scnprintf (scratch, buffer_size - length, "PCI_ID=%04X:%04X", 30 buffer, buffer_size, &length,
34 pdev->vendor, pdev->device); 31 "PCI_ID=%04X:%04X", pdev->vendor, pdev->device))
35 if ((buffer_size - length <= 0) || (i >= num_envp))
36 return -ENOMEM; 32 return -ENOMEM;
37 ++length;
38 scratch += length;
39 33
40 envp[i++] = scratch; 34 if (add_hotplug_env_var(envp, num_envp, &i,
41 length += scnprintf (scratch, buffer_size - length, 35 buffer, buffer_size, &length,
42 "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor, 36 "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor,
43 pdev->subsystem_device); 37 pdev->subsystem_device))
44 if ((buffer_size - length <= 0) || (i >= num_envp))
45 return -ENOMEM; 38 return -ENOMEM;
46 ++length;
47 scratch += length;
48 39
49 envp[i++] = scratch; 40 if (add_hotplug_env_var(envp, num_envp, &i,
50 length += scnprintf (scratch, buffer_size - length, "PCI_SLOT_NAME=%s", 41 buffer, buffer_size, &length,
51 pci_name(pdev)); 42 "PCI_SLOT_NAME=%s", pci_name(pdev)))
52 if ((buffer_size - length <= 0) || (i >= num_envp))
53 return -ENOMEM; 43 return -ENOMEM;
54 44
55 envp[i++] = scratch; 45 if (add_hotplug_env_var(envp, num_envp, &i,
56 length += scnprintf (scratch, buffer_size - length, 46 buffer, buffer_size, &length,
57 "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", 47 "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x",
58 pdev->vendor, pdev->device, 48 pdev->vendor, pdev->device,
59 pdev->subsystem_vendor, pdev->subsystem_device, 49 pdev->subsystem_vendor, pdev->subsystem_device,
60 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), 50 (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
61 (u8)(pdev->class)); 51 (u8)(pdev->class)))
62 if ((buffer_size - length <= 0) || (i >= num_envp))
63 return -ENOMEM; 52 return -ENOMEM;
64 53
65 envp[i] = NULL; 54 envp[i] = NULL;
diff --git a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c
index 305b47ec2f2c..1406db35b089 100644
--- a/drivers/pci/hotplug/pciehprm_acpi.c
+++ b/drivers/pci/hotplug/pciehprm_acpi.c
@@ -1696,15 +1696,15 @@ void pciehprm_enable_card(
1696 pci_bus->number = func->bus; 1696 pci_bus->number = func->bus;
1697 devfn = PCI_DEVFN(func->device, func->function); 1697 devfn = PCI_DEVFN(func->device, func->function);
1698 1698
1699 rc = pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &command); 1699 rc = pci_bus_read_config_word(pci_bus, devfn, PCI_COMMAND, &cmd);
1700 1700
1701 if (card_type == PCI_HEADER_TYPE_BRIDGE) { 1701 if (card_type == PCI_HEADER_TYPE_BRIDGE) {
1702 rc = pci_bus_read_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, &bcommand); 1702 rc = pci_bus_read_config_word(pci_bus, devfn, PCI_BRIDGE_CONTROL, &bcmd);
1703 } 1703 }
1704 1704
1705 cmd = command = command | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE 1705 command = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE
1706 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY; 1706 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
1707 bcmd = bcommand = bcommand | PCI_BRIDGE_CTL_NO_ISA; 1707 bcommand = bcmd | PCI_BRIDGE_CTL_NO_ISA;
1708 1708
1709 ab = find_acpi_bridge_by_bus(acpi_bridges_head, ctrl->seg, ctrl->bus); 1709 ab = find_acpi_bridge_by_bus(acpi_bridges_head, ctrl->seg, ctrl->bus);
1710 if (ab) { 1710 if (ab) {
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index d00168b1f662..d3f3dd42240d 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -29,7 +29,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }
29#endif 29#endif
30 30
31/* Functions for PCI Hotplug drivers to use */ 31/* Functions for PCI Hotplug drivers to use */
32extern struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
33extern unsigned int pci_do_scan_bus(struct pci_bus *bus); 32extern unsigned int pci_do_scan_bus(struct pci_bus *bus);
34extern int pci_remove_device_safe(struct pci_dev *dev); 33extern int pci_remove_device_safe(struct pci_dev *dev);
35extern unsigned char pci_max_busnr(void); 34extern unsigned char pci_max_busnr(void);
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b9c9b03919d4..35caec13023a 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -753,27 +753,19 @@ pci_scan_device(struct pci_bus *bus, int devfn)
753 kfree(dev); 753 kfree(dev);
754 return NULL; 754 return NULL;
755 } 755 }
756 device_initialize(&dev->dev);
757 dev->dev.release = pci_release_dev;
758 pci_dev_get(dev);
759
760 dev->dev.dma_mask = &dev->dma_mask;
761 dev->dev.coherent_dma_mask = 0xffffffffull;
762 756
763 return dev; 757 return dev;
764} 758}
765 759
766struct pci_dev * __devinit 760void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
767pci_scan_single_device(struct pci_bus *bus, int devfn)
768{ 761{
769 struct pci_dev *dev; 762 device_initialize(&dev->dev);
763 dev->dev.release = pci_release_dev;
764 pci_dev_get(dev);
770 765
771 dev = pci_scan_device(bus, devfn); 766 dev->dev.dma_mask = &dev->dma_mask;
772 pci_scan_msi_device(dev); 767 dev->dev.coherent_dma_mask = 0xffffffffull;
773 768
774 if (!dev)
775 return NULL;
776
777 /* Fix up broken headers */ 769 /* Fix up broken headers */
778 pci_fixup_device(pci_fixup_header, dev); 770 pci_fixup_device(pci_fixup_header, dev);
779 771
@@ -785,6 +777,19 @@ pci_scan_single_device(struct pci_bus *bus, int devfn)
785 spin_lock(&pci_bus_lock); 777 spin_lock(&pci_bus_lock);
786 list_add_tail(&dev->bus_list, &bus->devices); 778 list_add_tail(&dev->bus_list, &bus->devices);
787 spin_unlock(&pci_bus_lock); 779 spin_unlock(&pci_bus_lock);
780}
781
782struct pci_dev * __devinit
783pci_scan_single_device(struct pci_bus *bus, int devfn)
784{
785 struct pci_dev *dev;
786
787 dev = pci_scan_device(bus, devfn);
788 if (!dev)
789 return NULL;
790
791 pci_device_add(dev, bus);
792 pci_scan_msi_device(dev);
788 793
789 return dev; 794 return dev;
790} 795}
@@ -881,7 +886,8 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
881 return max; 886 return max;
882} 887}
883 888
884struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata) 889struct pci_bus * __devinit pci_create_bus(struct device *parent,
890 int bus, struct pci_ops *ops, void *sysdata)
885{ 891{
886 int error; 892 int error;
887 struct pci_bus *b; 893 struct pci_bus *b;
@@ -938,8 +944,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
938 b->resource[0] = &ioport_resource; 944 b->resource[0] = &ioport_resource;
939 b->resource[1] = &iomem_resource; 945 b->resource[1] = &iomem_resource;
940 946
941 b->subordinate = pci_scan_child_bus(b);
942
943 return b; 947 return b;
944 948
945sys_create_link_err: 949sys_create_link_err:
@@ -957,6 +961,18 @@ err_out:
957 kfree(b); 961 kfree(b);
958 return NULL; 962 return NULL;
959} 963}
964EXPORT_SYMBOL_GPL(pci_create_bus);
965
966struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
967 int bus, struct pci_ops *ops, void *sysdata)
968{
969 struct pci_bus *b;
970
971 b = pci_create_bus(parent, bus, ops, sysdata);
972 if (b)
973 b->subordinate = pci_scan_child_bus(b);
974 return b;
975}
960EXPORT_SYMBOL(pci_scan_bus_parented); 976EXPORT_SYMBOL(pci_scan_bus_parented);
961 977
962#ifdef CONFIG_HOTPLUG 978#ifdef CONFIG_HOTPLUG
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 4f0c1bd3674a..11ca44387cb0 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -876,6 +876,12 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
876 case 0xC00C: /* Samsung P35 notebook */ 876 case 0xC00C: /* Samsung P35 notebook */
877 asus_hides_smbus = 1; 877 asus_hides_smbus = 1;
878 } 878 }
879 } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ)) {
880 if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)
881 switch(dev->subsystem_device) {
882 case 0x0058: /* Compaq Evo N620c */
883 asus_hides_smbus = 1;
884 }
879 } 885 }
880} 886}
881DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845_HB, asus_hides_smbus_hostbridge ); 887DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82845_HB, asus_hides_smbus_hostbridge );
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c62e89270237..e5e24e13a114 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -315,8 +315,11 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
315 pci_bus_add_devices(root_bus); 315 pci_bus_add_devices(root_bus);
316 return root_bus; 316 return root_bus;
317} 317}
318struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata);
319struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
318int pci_scan_slot(struct pci_bus *bus, int devfn); 320int pci_scan_slot(struct pci_bus *bus, int devfn);
319struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 321struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
322void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
320unsigned int pci_scan_child_bus(struct pci_bus *bus); 323unsigned int pci_scan_child_bus(struct pci_bus *bus);
321void pci_bus_add_device(struct pci_dev *dev); 324void pci_bus_add_device(struct pci_dev *dev);
322void pci_read_bridge_bases(struct pci_bus *child); 325void pci_read_bridge_bases(struct pci_bus *child);
@@ -377,32 +380,32 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
377 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 380 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val);
378} 381}
379 382
380int pci_enable_device(struct pci_dev *dev); 383int __must_check pci_enable_device(struct pci_dev *dev);
381int pci_enable_device_bars(struct pci_dev *dev, int mask); 384int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
382void pci_disable_device(struct pci_dev *dev); 385void pci_disable_device(struct pci_dev *dev);
383void pci_set_master(struct pci_dev *dev); 386void pci_set_master(struct pci_dev *dev);
384#define HAVE_PCI_SET_MWI 387#define HAVE_PCI_SET_MWI
385int pci_set_mwi(struct pci_dev *dev); 388int __must_check pci_set_mwi(struct pci_dev *dev);
386void pci_clear_mwi(struct pci_dev *dev); 389void pci_clear_mwi(struct pci_dev *dev);
387void pci_intx(struct pci_dev *dev, int enable); 390void pci_intx(struct pci_dev *dev, int enable);
388int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 391int __must_check pci_set_dma_mask(struct pci_dev *dev, u64 mask);
389int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 392int __must_check pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
390void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 393void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
391int pci_assign_resource(struct pci_dev *dev, int i); 394int pci_assign_resource(struct pci_dev *dev, int i);
392void pci_restore_bars(struct pci_dev *dev); 395void pci_restore_bars(struct pci_dev *dev);
393 396
394/* ROM control related routines */ 397/* ROM control related routines */
395void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size); 398void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
396void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size); 399void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
397void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 400void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
398void pci_remove_rom(struct pci_dev *pdev); 401void pci_remove_rom(struct pci_dev *pdev);
399 402
400/* Power management related routines */ 403/* Power management related routines */
401int pci_save_state(struct pci_dev *dev); 404int pci_save_state(struct pci_dev *dev);
402int pci_restore_state(struct pci_dev *dev); 405int pci_restore_state(struct pci_dev *dev);
403int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 406int __must_check pci_set_power_state(struct pci_dev *dev, pci_power_t state);
404pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 407pci_power_t __must_check pci_choose_state(struct pci_dev *dev, pm_message_t state);
405int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 408int __must_check pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
406 409
407/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 410/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
408void pci_bus_assign_resources(struct pci_bus *bus); 411void pci_bus_assign_resources(struct pci_bus *bus);