aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug.c53
-rw-r--r--drivers/pci/hotplug/pciehprm_acpi.c8
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c20
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c8
-rw-r--r--drivers/pci/pci-sysfs.c10
-rw-r--r--drivers/pci/pci.c2
-rw-r--r--drivers/pci/pci.h1
-rw-r--r--drivers/pci/probe.c56
-rw-r--r--drivers/pci/quirks.c6
-rw-r--r--drivers/pci/setup-bus.c4
10 files changed, 95 insertions, 73 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/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 4ada15111af0..ad1017da8656 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -134,7 +134,8 @@ static void rpadlpar_claim_one_bus(struct pci_bus *b)
134static int pci_add_secondary_bus(struct device_node *dn, 134static int pci_add_secondary_bus(struct device_node *dn,
135 struct pci_dev *bridge_dev) 135 struct pci_dev *bridge_dev)
136{ 136{
137 struct pci_controller *hose = dn->phb; 137 struct pci_dn *pdn = dn->data;
138 struct pci_controller *hose = pdn->phb;
138 struct pci_bus *child; 139 struct pci_bus *child;
139 u8 sec_busno; 140 u8 sec_busno;
140 141
@@ -159,7 +160,7 @@ static int pci_add_secondary_bus(struct device_node *dn,
159 if (hose->last_busno < child->number) 160 if (hose->last_busno < child->number)
160 hose->last_busno = child->number; 161 hose->last_busno = child->number;
161 162
162 dn->bussubno = child->number; 163 pdn->bussubno = child->number;
163 164
164 /* ioremap() for child bus, which may or may not succeed */ 165 /* ioremap() for child bus, which may or may not succeed */
165 remap_bus_range(child); 166 remap_bus_range(child);
@@ -183,11 +184,12 @@ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
183 184
184static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) 185static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
185{ 186{
186 struct pci_controller *hose = dn->phb; 187 struct pci_dn *pdn = dn->data;
188 struct pci_controller *hose = pdn->phb;
187 struct pci_dev *dev = NULL; 189 struct pci_dev *dev = NULL;
188 190
189 /* Scan phb bus for EADS device, adding new one to bus->devices */ 191 /* Scan phb bus for EADS device, adding new one to bus->devices */
190 if (!pci_scan_single_device(hose->bus, dn->devfn)) { 192 if (!pci_scan_single_device(hose->bus, pdn->devfn)) {
191 printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__); 193 printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__);
192 return NULL; 194 return NULL;
193 } 195 }
@@ -269,6 +271,7 @@ static int dlpar_remove_root_bus(struct pci_controller *phb)
269static int dlpar_remove_phb(char *drc_name, struct device_node *dn) 271static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
270{ 272{
271 struct slot *slot; 273 struct slot *slot;
274 struct pci_dn *pdn;
272 int rc = 0; 275 int rc = 0;
273 276
274 if (!rpaphp_find_pci_bus(dn)) 277 if (!rpaphp_find_pci_bus(dn))
@@ -285,12 +288,13 @@ static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
285 } 288 }
286 } 289 }
287 290
288 BUG_ON(!dn->phb); 291 pdn = dn->data;
289 rc = dlpar_remove_root_bus(dn->phb); 292 BUG_ON(!pdn || !pdn->phb);
293 rc = dlpar_remove_root_bus(pdn->phb);
290 if (rc < 0) 294 if (rc < 0)
291 return rc; 295 return rc;
292 296
293 dn->phb = NULL; 297 pdn->phb = NULL;
294 298
295 return 0; 299 return 0;
296} 300}
@@ -299,7 +303,7 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn)
299{ 303{
300 struct pci_controller *phb; 304 struct pci_controller *phb;
301 305
302 if (dn->phb) { 306 if (PCI_DN(dn)->phb) {
303 /* PHB already exists */ 307 /* PHB already exists */
304 return -EINVAL; 308 return -EINVAL;
305 } 309 }
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 17a0279ebcb9..49e4d10a6488 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -51,10 +51,12 @@ static struct pci_bus *find_bus_among_children(struct pci_bus *bus,
51 51
52struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn) 52struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn)
53{ 53{
54 if (!dn->phb || !dn->phb->bus) 54 struct pci_dn *pdn = dn->data;
55
56 if (!pdn || !pdn->phb || !pdn->phb->bus)
55 return NULL; 57 return NULL;
56 58
57 return find_bus_among_children(dn->phb->bus, dn); 59 return find_bus_among_children(pdn->phb->bus, dn);
58} 60}
59EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); 61EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus);
60 62
@@ -229,7 +231,7 @@ rpaphp_pci_config_slot(struct pci_bus *bus)
229 if (!dn || !dn->child) 231 if (!dn || !dn->child)
230 return NULL; 232 return NULL;
231 233
232 slotno = PCI_SLOT(dn->child->devfn); 234 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
233 235
234 /* pci_scan_slot should find all children */ 236 /* pci_scan_slot should find all children */
235 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 237 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index cc9d65388e62..56a3b397efee 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -44,10 +44,14 @@ pci_config_attr(subsystem_device, "0x%04x\n");
44pci_config_attr(class, "0x%06x\n"); 44pci_config_attr(class, "0x%06x\n");
45pci_config_attr(irq, "%u\n"); 45pci_config_attr(irq, "%u\n");
46 46
47static ssize_t local_cpus_show(struct device *dev, struct device_attribute *attr, char *buf) 47static ssize_t local_cpus_show(struct device *dev,
48 struct device_attribute *attr, char *buf)
48{ 49{
49 cpumask_t mask = pcibus_to_cpumask(to_pci_dev(dev)->bus); 50 cpumask_t mask;
50 int len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask); 51 int len;
52
53 mask = pcibus_to_cpumask(to_pci_dev(dev)->bus);
54 len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
51 strcat(buf,"\n"); 55 strcat(buf,"\n");
52 return 1+len; 56 return 1+len;
53} 57}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ccff633a3948..992db89adce7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -819,7 +819,7 @@ pci_intx(struct pci_dev *pdev, int enable)
819 } 819 }
820 820
821 if (new != pci_command) { 821 if (new != pci_command) {
822 pci_write_config_word(pdev, PCI_COMMAND, pci_command); 822 pci_write_config_word(pdev, PCI_COMMAND, new);
823 } 823 }
824} 824}
825 825
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..26a55d08b506 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -72,11 +72,13 @@ void pci_remove_legacy_files(struct pci_bus *bus) { return; }
72/* 72/*
73 * PCI Bus Class Devices 73 * PCI Bus Class Devices
74 */ 74 */
75static ssize_t pci_bus_show_cpuaffinity(struct class_device *class_dev, char *buf) 75static ssize_t pci_bus_show_cpuaffinity(struct class_device *class_dev,
76 char *buf)
76{ 77{
77 cpumask_t cpumask = pcibus_to_cpumask(to_pci_bus(class_dev));
78 int ret; 78 int ret;
79 cpumask_t cpumask;
79 80
81 cpumask = pcibus_to_cpumask(to_pci_bus(class_dev));
80 ret = cpumask_scnprintf(buf, PAGE_SIZE, cpumask); 82 ret = cpumask_scnprintf(buf, PAGE_SIZE, cpumask);
81 if (ret < PAGE_SIZE) 83 if (ret < PAGE_SIZE)
82 buf[ret++] = '\n'; 84 buf[ret++] = '\n';
@@ -753,27 +755,19 @@ pci_scan_device(struct pci_bus *bus, int devfn)
753 kfree(dev); 755 kfree(dev);
754 return NULL; 756 return NULL;
755 } 757 }
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 758
763 return dev; 759 return dev;
764} 760}
765 761
766struct pci_dev * __devinit 762void __devinit pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
767pci_scan_single_device(struct pci_bus *bus, int devfn)
768{ 763{
769 struct pci_dev *dev; 764 device_initialize(&dev->dev);
765 dev->dev.release = pci_release_dev;
766 pci_dev_get(dev);
770 767
771 dev = pci_scan_device(bus, devfn); 768 dev->dev.dma_mask = &dev->dma_mask;
772 pci_scan_msi_device(dev); 769 dev->dev.coherent_dma_mask = 0xffffffffull;
773 770
774 if (!dev)
775 return NULL;
776
777 /* Fix up broken headers */ 771 /* Fix up broken headers */
778 pci_fixup_device(pci_fixup_header, dev); 772 pci_fixup_device(pci_fixup_header, dev);
779 773
@@ -785,6 +779,19 @@ pci_scan_single_device(struct pci_bus *bus, int devfn)
785 spin_lock(&pci_bus_lock); 779 spin_lock(&pci_bus_lock);
786 list_add_tail(&dev->bus_list, &bus->devices); 780 list_add_tail(&dev->bus_list, &bus->devices);
787 spin_unlock(&pci_bus_lock); 781 spin_unlock(&pci_bus_lock);
782}
783
784struct pci_dev * __devinit
785pci_scan_single_device(struct pci_bus *bus, int devfn)
786{
787 struct pci_dev *dev;
788
789 dev = pci_scan_device(bus, devfn);
790 if (!dev)
791 return NULL;
792
793 pci_device_add(dev, bus);
794 pci_scan_msi_device(dev);
788 795
789 return dev; 796 return dev;
790} 797}
@@ -881,7 +888,8 @@ unsigned int __devinit pci_do_scan_bus(struct pci_bus *bus)
881 return max; 888 return max;
882} 889}
883 890
884struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata) 891struct pci_bus * __devinit pci_create_bus(struct device *parent,
892 int bus, struct pci_ops *ops, void *sysdata)
885{ 893{
886 int error; 894 int error;
887 struct pci_bus *b; 895 struct pci_bus *b;
@@ -938,8 +946,6 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
938 b->resource[0] = &ioport_resource; 946 b->resource[0] = &ioport_resource;
939 b->resource[1] = &iomem_resource; 947 b->resource[1] = &iomem_resource;
940 948
941 b->subordinate = pci_scan_child_bus(b);
942
943 return b; 949 return b;
944 950
945sys_create_link_err: 951sys_create_link_err:
@@ -957,6 +963,18 @@ err_out:
957 kfree(b); 963 kfree(b);
958 return NULL; 964 return NULL;
959} 965}
966EXPORT_SYMBOL_GPL(pci_create_bus);
967
968struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent,
969 int bus, struct pci_ops *ops, void *sysdata)
970{
971 struct pci_bus *b;
972
973 b = pci_create_bus(parent, bus, ops, sysdata);
974 if (b)
975 b->subordinate = pci_scan_child_bus(b);
976 return b;
977}
960EXPORT_SYMBOL(pci_scan_bus_parented); 978EXPORT_SYMBOL(pci_scan_bus_parented);
961 979
962#ifdef CONFIG_HOTPLUG 980#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/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 6b0e6464eb39..657be948baf7 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -77,8 +77,7 @@ pbus_assign_resources_sorted(struct pci_bus *bus)
77 } 77 }
78} 78}
79 79
80static void __devinit 80void pci_setup_cardbus(struct pci_bus *bus)
81pci_setup_cardbus(struct pci_bus *bus)
82{ 81{
83 struct pci_dev *bridge = bus->self; 82 struct pci_dev *bridge = bus->self;
84 struct pci_bus_region region; 83 struct pci_bus_region region;
@@ -130,6 +129,7 @@ pci_setup_cardbus(struct pci_bus *bus)
130 region.end); 129 region.end);
131 } 130 }
132} 131}
132EXPORT_SYMBOL(pci_setup_cardbus);
133 133
134/* Initialize bridges with base/limit values we have collected. 134/* Initialize bridges with base/limit values we have collected.
135 PCI-to-PCI Bridge Architecture Specification rev. 1.1 (1998) 135 PCI-to-PCI Bridge Architecture Specification rev. 1.1 (1998)