aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/bus.c10
-rw-r--r--drivers/pci/dmar.c9
-rw-r--r--drivers/pci/hotplug-pci.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c6
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c2
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c33
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c2
-rw-r--r--drivers/pci/hotplug/ibmphp_ebda.c1
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c5
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c2
-rw-r--r--drivers/pci/hotplug/shpchp_pci.c2
-rw-r--r--drivers/pci/intel-iommu.c7
-rw-r--r--drivers/pci/intel-iommu.h5
-rw-r--r--drivers/pci/iova.c3
-rw-r--r--drivers/pci/iova.h3
-rw-r--r--drivers/pci/pci-acpi.c27
-rw-r--r--drivers/pci/pci.c1
-rw-r--r--drivers/pci/probe.c8
-rw-r--r--drivers/pci/proc.c2
-rw-r--r--drivers/pci/quirks.c110
-rw-r--r--drivers/pci/rom.c3
-rw-r--r--drivers/pci/setup-bus.c6
22 files changed, 155 insertions, 94 deletions
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/dmar.c b/drivers/pci/dmar.c
index 8ed26480371f..f941f609dbf3 100644
--- a/drivers/pci/dmar.c
+++ b/drivers/pci/dmar.c
@@ -14,11 +14,12 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Copyright (C) Ashok Raj <ashok.raj@intel.com> 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright (C) Shaohua Li <shaohua.li@intel.com> 18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 19 * Author: Shaohua Li <shaohua.li@intel.com>
20 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
20 * 21 *
21 * This file implements early detection/parsing of DMA Remapping Devices 22 * This file implements early detection/parsing of DMA Remapping Devices
22 * reported to OS through BIOS via DMA remapping reporting (DMAR) ACPI 23 * reported to OS through BIOS via DMA remapping reporting (DMAR) ACPI
23 * tables. 24 * tables.
24 */ 25 */
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
7unsigned int pci_do_scan_bus(struct pci_bus *bus) 7unsigned 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_core.c b/drivers/pci/hotplug/acpiphp_core.c
index c8c263875c21..9279d5ba62e6 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -392,6 +392,9 @@ static int __init acpiphp_init(void)
392{ 392{
393 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 393 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
394 394
395 if (acpi_pci_disabled)
396 return 0;
397
395 acpiphp_debug = debug; 398 acpiphp_debug = debug;
396 399
397 /* read all the ACPI info from the system */ 400 /* read all the ACPI info from the system */
@@ -401,6 +404,9 @@ static int __init acpiphp_init(void)
401 404
402static void __exit acpiphp_exit(void) 405static void __exit acpiphp_exit(void)
403{ 406{
407 if (acpi_pci_disabled)
408 return;
409
404 /* deallocate internal data structures etc. */ 410 /* deallocate internal data structures etc. */
405 acpiphp_glue_exit(); 411 acpiphp_glue_exit();
406} 412}
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 */
1088static int enable_device(struct acpiphp_slot *slot) 1088static 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/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 750ebd7a4c10..b0a22b92717e 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -395,33 +395,34 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
395{ 395{
396 acpi_handle *phandle = (acpi_handle *)context; 396 acpi_handle *phandle = (acpi_handle *)context;
397 acpi_status status; 397 acpi_status status;
398 struct acpi_device_info info; 398 struct acpi_device_info *info;
399 struct acpi_buffer info_buffer = { 399 struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
400 .length = sizeof(struct acpi_device_info), 400 int retval = 0;
401 .pointer = &info,
402 };
403 401
404 status = acpi_get_object_info(handle, &info_buffer); 402 status = acpi_get_object_info(handle, &info_buffer);
405 if (ACPI_FAILURE(status)) { 403 if (ACPI_FAILURE(status)) {
406 err("%s: Failed to get device information\n", __FUNCTION__); 404 err("%s: Failed to get device information status=0x%x\n",
407 return 0; 405 __FUNCTION__, status);
406 return retval;
408 } 407 }
409 info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; 408 info = info_buffer.pointer;
410 409 info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0';
411 if (info.current_status && (info.valid & ACPI_VALID_HID) && 410
412 (!strcmp(info.hardware_id.value, IBM_HARDWARE_ID1) || 411 if (info->current_status && (info->valid & ACPI_VALID_HID) &&
413 !strcmp(info.hardware_id.value, IBM_HARDWARE_ID2))) { 412 (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) ||
414 dbg("found hardware: %s, handle: %p\n", info.hardware_id.value, 413 !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) {
415 handle); 414 dbg("found hardware: %s, handle: %p\n",
415 info->hardware_id.value, handle);
416 *phandle = handle; 416 *phandle = handle;
417 /* returning non-zero causes the search to stop 417 /* returning non-zero causes the search to stop
418 * and returns this value to the caller of 418 * and returns this value to the caller of
419 * acpi_walk_namespace, but it also causes some warnings 419 * acpi_walk_namespace, but it also causes some warnings
420 * in the acpi debug code to print... 420 * in the acpi debug code to print...
421 */ 421 */
422 return FOUND_APCI; 422 retval = FOUND_APCI;
423 } 423 }
424 return 0; 424 kfree(info);
425 return retval;
425} 426}
426 427
427static int __init ibm_acpiphp_init(void) 428static int __init ibm_acpiphp_init(void)
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
253int cpci_configure_slot(struct slot* slot) 253int __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/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index 600ed7b67ae7..bbccde9f228f 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -963,6 +963,7 @@ static int __init ebda_rsrc_controller (void)
963 963
964 bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num); 964 bus_info_ptr1 = ibmphp_find_same_bus_num (hpc_ptr->slots[index].slot_bus_num);
965 if (!bus_info_ptr1) { 965 if (!bus_info_ptr1) {
966 kfree(tmp_slot);
966 rc = -ENODEV; 967 rc = -ENODEV;
967 goto error; 968 goto error;
968 } 969 }
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
170static int pciehp_add_bridge(struct pci_dev *dev) 170static 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
99int shpchp_configure_device(struct slot *p_slot) 99int __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/intel-iommu.c b/drivers/pci/intel-iommu.c
index a4c3089f892a..977d29b32295 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -14,9 +14,10 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Copyright (C) Ashok Raj <ashok.raj@intel.com> 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright (C) Shaohua Li <shaohua.li@intel.com> 18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 19 * Author: Shaohua Li <shaohua.li@intel.com>
20 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
20 */ 21 */
21 22
22#include <linux/init.h> 23#include <linux/init.h>
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h
index 07f5f6353bda..afc0ad96122e 100644
--- a/drivers/pci/intel-iommu.h
+++ b/drivers/pci/intel-iommu.h
@@ -14,8 +14,9 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Copyright (C) Ashok Raj <ashok.raj@intel.com> 17 * Copyright (C) 2006-2008 Intel Corporation
18 * Copyright (C) Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 18 * Author: Ashok Raj <ashok.raj@intel.com>
19 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
19 */ 20 */
20 21
21#ifndef _INTEL_IOMMU_H_ 22#ifndef _INTEL_IOMMU_H_
diff --git a/drivers/pci/iova.c b/drivers/pci/iova.c
index 8de7ab6c6d0c..dbcdd6bfa63a 100644
--- a/drivers/pci/iova.c
+++ b/drivers/pci/iova.c
@@ -3,7 +3,8 @@
3 * 3 *
4 * This file is released under the GPLv2. 4 * This file is released under the GPLv2.
5 * 5 *
6 * Copyright (C) 2006 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 6 * Copyright (C) 2006-2008 Intel Corporation
7 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
7 */ 8 */
8 9
9#include "iova.h" 10#include "iova.h"
diff --git a/drivers/pci/iova.h b/drivers/pci/iova.h
index d521b5b7319c..228f6c94b69c 100644
--- a/drivers/pci/iova.h
+++ b/drivers/pci/iova.h
@@ -3,7 +3,8 @@
3 * 3 *
4 * This file is released under the GPLv2. 4 * This file is released under the GPLv2.
5 * 5 *
6 * Copyright (C) 2006 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 6 * Copyright (C) 2006-2008 Intel Corporation
7 * Author: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
7 * 8 *
8 */ 9 */
9 10
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index e569645d59e2..72f7476930c8 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -158,6 +158,7 @@ run_osc_out:
158/** 158/**
159 * __pci_osc_support_set - register OS support to Firmware 159 * __pci_osc_support_set - register OS support to Firmware
160 * @flags: OS support bits 160 * @flags: OS support bits
161 * @hid: hardware ID
161 * 162 *
162 * Update OS support fields and doing a _OSC Query to obtain an update 163 * Update OS support fields and doing a _OSC Query to obtain an update
163 * from Firmware on supported control bits. 164 * from Firmware on supported control bits.
@@ -241,8 +242,6 @@ EXPORT_SYMBOL(pci_osc_control_set);
241 * choose from highest power _SxD to lowest power _SxW 242 * choose from highest power _SxD to lowest power _SxW
242 * else // no _PRW at S-state x 243 * else // no _PRW at S-state x
243 * choose highest power _SxD or any lower power 244 * choose highest power _SxD or any lower power
244 *
245 * currently we simply return _SxD, if present.
246 */ 245 */
247 246
248static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev, 247static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
@@ -273,21 +272,29 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
273{ 272{
274 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 273 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);
275 acpi_handle tmp; 274 acpi_handle tmp;
276 static int state_conv[] = { 275 static const u8 state_conv[] = {
277 [0] = 0, 276 [PCI_D0] = ACPI_STATE_D0,
278 [1] = 1, 277 [PCI_D1] = ACPI_STATE_D1,
279 [2] = 2, 278 [PCI_D2] = ACPI_STATE_D2,
280 [3] = 3, 279 [PCI_D3hot] = ACPI_STATE_D3,
281 [4] = 3 280 [PCI_D3cold] = ACPI_STATE_D3
282 }; 281 };
283 int acpi_state = state_conv[(int __force) state];
284 282
285 if (!handle) 283 if (!handle)
286 return -ENODEV; 284 return -ENODEV;
287 /* If the ACPI device has _EJ0, ignore the device */ 285 /* If the ACPI device has _EJ0, ignore the device */
288 if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) 286 if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp)))
289 return 0; 287 return 0;
290 return acpi_bus_set_power(handle, acpi_state); 288
289 switch (state) {
290 case PCI_D0:
291 case PCI_D1:
292 case PCI_D2:
293 case PCI_D3hot:
294 case PCI_D3cold:
295 return acpi_bus_set_power(handle, state_conv[state]);
296 }
297 return -EINVAL;
291} 298}
292 299
293 300
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ae3df46eaabf..183fddaa38b7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -554,6 +554,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
554 case PM_EVENT_PRETHAW: 554 case PM_EVENT_PRETHAW:
555 /* REVISIT both freeze and pre-thaw "should" use D0 */ 555 /* REVISIT both freeze and pre-thaw "should" use D0 */
556 case PM_EVENT_SUSPEND: 556 case PM_EVENT_SUSPEND:
557 case PM_EVENT_HIBERNATE:
557 return PCI_D3hot; 558 return PCI_D3hot;
558 default: 559 default:
559 printk("Unrecognized suspend event %d\n", state.event); 560 printk("Unrecognized suspend event %d\n", state.event);
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
289void pci_read_bridge_bases(struct pci_bus *child) 289void __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 */
475int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass) 475int __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
1011unsigned int pci_scan_child_bus(struct pci_bus *bus) 1011unsigned 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
1119struct pci_bus *pci_scan_bus_parented(struct device *parent, 1119struct 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/proc.c b/drivers/pci/proc.c
index 68aeeb7206de..ef18fcd641e2 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -422,7 +422,7 @@ int pci_proc_detach_device(struct pci_dev *dev)
422 struct proc_dir_entry *e; 422 struct proc_dir_entry *e;
423 423
424 if ((e = dev->procent)) { 424 if ((e = dev->procent)) {
425 if (atomic_read(&e->count)) 425 if (atomic_read(&e->count) > 1)
426 return -EBUSY; 426 return -EBUSY;
427 remove_proc_entry(e->name, dev->bus->procdir); 427 remove_proc_entry(e->name, dev->bus->procdir);
428 dev->procent = NULL; 428 dev->procent = NULL;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0a953d43b9a2..e9a333d98552 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -867,13 +867,13 @@ static void quirk_disable_pxb(struct pci_dev *pdev)
867DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); 867DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb);
868DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb); 868DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, quirk_disable_pxb);
869 869
870 870static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev)
871static void __devinit quirk_sb600_sata(struct pci_dev *pdev)
872{ 871{
873 /* set sb600 sata to ahci mode */ 872 /* set sb600/sb700/sb800 sata to ahci mode */
874 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { 873 u8 tmp;
875 u8 tmp;
876 874
875 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp);
876 if (tmp == 0x01) {
877 pci_read_config_byte(pdev, 0x40, &tmp); 877 pci_read_config_byte(pdev, 0x40, &tmp);
878 pci_write_config_byte(pdev, 0x40, tmp|1); 878 pci_write_config_byte(pdev, 0x40, tmp|1);
879 pci_write_config_byte(pdev, 0x9, 1); 879 pci_write_config_byte(pdev, 0x9, 1);
@@ -881,10 +881,13 @@ static void __devinit quirk_sb600_sata(struct pci_dev *pdev)
881 pci_write_config_byte(pdev, 0x40, tmp); 881 pci_write_config_byte(pdev, 0x40, tmp);
882 882
883 pdev->class = PCI_CLASS_STORAGE_SATA_AHCI; 883 pdev->class = PCI_CLASS_STORAGE_SATA_AHCI;
884 dev_info(&pdev->dev, "set SATA to AHCI mode\n");
884 } 885 }
885} 886}
886DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_sb600_sata); 887DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
887DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_sb600_sata); 888DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode);
889DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
890DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
888 891
889/* 892/*
890 * Serverworks CSB5 IDE does not fully support native mode 893 * Serverworks CSB5 IDE does not fully support native mode
@@ -1649,9 +1652,8 @@ static void __devinit quirk_via_cx700_pci_parking_caching(struct pci_dev *dev)
1649 pci_write_config_byte(dev, 0x75, 0x1); 1652 pci_write_config_byte(dev, 0x75, 0x1);
1650 pci_write_config_byte(dev, 0x77, 0x0); 1653 pci_write_config_byte(dev, 0x77, 0x0);
1651 1654
1652 printk(KERN_INFO 1655 dev_info(&dev->dev,
1653 "PCI: VIA CX700 PCI parking/caching fixup on %s\n", 1656 "Disabling VIA CX700 PCI parking/caching\n");
1654 pci_name(dev));
1655 } 1657 }
1656 } 1658 }
1657} 1659}
@@ -1723,10 +1725,34 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT2
1723 quirk_msi_ht_cap); 1725 quirk_msi_ht_cap);
1724 1726
1725 1727
1726/* 1728/* The nVidia CK804 chipset may have 2 HT MSI mappings.
1727 * Force enable MSI mapping capability on HT bridges 1729 * MSI are supported if the MSI capability set in any of these mappings.
1728 */ 1730 */
1729static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev) 1731static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1732{
1733 struct pci_dev *pdev;
1734
1735 if (!dev->subordinate)
1736 return;
1737
1738 /* check HT MSI cap on this chipset and the root one.
1739 * a single one having MSI is enough to be sure that MSI are supported.
1740 */
1741 pdev = pci_get_slot(dev->bus, 0);
1742 if (!pdev)
1743 return;
1744 if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
1745 dev_warn(&dev->dev, "MSI quirk detected; "
1746 "subordinate MSI disabled\n");
1747 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
1748 }
1749 pci_dev_put(pdev);
1750}
1751DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1752 quirk_nvidia_ck804_msi_ht_cap);
1753
1754/* Force enable MSI mapping capability on HT bridges */
1755static void __devinit ht_enable_msi_mapping(struct pci_dev *dev)
1730{ 1756{
1731 int pos, ttl = 48; 1757 int pos, ttl = 48;
1732 1758
@@ -1734,9 +1760,9 @@ static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev)
1734 while (pos && ttl--) { 1760 while (pos && ttl--) {
1735 u8 flags; 1761 u8 flags;
1736 1762
1737 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS, &flags) == 0) { 1763 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
1738 printk(KERN_INFO "PCI: Enabling HT MSI Mapping on %s\n", 1764 &flags) == 0) {
1739 pci_name(dev)); 1765 dev_info(&dev->dev, "Enabling HT MSI Mapping\n");
1740 1766
1741 pci_write_config_byte(dev, pos + HT_MSI_FLAGS, 1767 pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
1742 flags | HT_MSI_FLAGS_ENABLE); 1768 flags | HT_MSI_FLAGS_ENABLE);
@@ -1747,33 +1773,47 @@ static void __devinit quirk_msi_ht_cap_enable(struct pci_dev *dev)
1747} 1773}
1748DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 1774DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS,
1749 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB, 1775 PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB,
1750 quirk_msi_ht_cap_enable); 1776 ht_enable_msi_mapping);
1751 1777
1752/* The nVidia CK804 chipset may have 2 HT MSI mappings. 1778static void __devinit nv_msi_ht_cap_quirk(struct pci_dev *dev)
1753 * MSI are supported if the MSI capability set in any of these mappings.
1754 */
1755static void __devinit quirk_nvidia_ck804_msi_ht_cap(struct pci_dev *dev)
1756{ 1779{
1757 struct pci_dev *pdev; 1780 struct pci_dev *host_bridge;
1781 int pos, ttl = 48;
1758 1782
1759 if (!dev->subordinate) 1783 /*
1784 * HT MSI mapping should be disabled on devices that are below
1785 * a non-Hypertransport host bridge. Locate the host bridge...
1786 */
1787 host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
1788 if (host_bridge == NULL) {
1789 dev_warn(&dev->dev,
1790 "nv_msi_ht_cap_quirk didn't locate host bridge\n");
1760 return; 1791 return;
1792 }
1761 1793
1762 /* check HT MSI cap on this chipset and the root one. 1794 pos = pci_find_ht_capability(host_bridge, HT_CAPTYPE_SLAVE);
1763 * a single one having MSI is enough to be sure that MSI are supported. 1795 if (pos != 0) {
1764 */ 1796 /* Host bridge is to HT */
1765 pdev = pci_get_slot(dev->bus, 0); 1797 ht_enable_msi_mapping(dev);
1766 if (!pdev)
1767 return; 1798 return;
1768 if (!msi_ht_cap_enabled(dev) && !msi_ht_cap_enabled(pdev)) {
1769 dev_warn(&dev->dev, "MSI quirk detected; "
1770 "subordinate MSI disabled\n");
1771 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
1772 } 1799 }
1773 pci_dev_put(pdev); 1800
1801 /* Host bridge is not to HT, disable HT MSI mapping on this device */
1802 pos = pci_find_ht_capability(dev, HT_CAPTYPE_MSI_MAPPING);
1803 while (pos && ttl--) {
1804 u8 flags;
1805
1806 if (pci_read_config_byte(dev, pos + HT_MSI_FLAGS,
1807 &flags) == 0) {
1808 dev_info(&dev->dev, "Disabling HT MSI mapping");
1809 pci_write_config_byte(dev, pos + HT_MSI_FLAGS,
1810 flags & ~HT_MSI_FLAGS_ENABLE);
1811 }
1812 pos = pci_find_next_ht_capability(dev, pos,
1813 HT_CAPTYPE_MSI_MAPPING);
1814 }
1774} 1815}
1775DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE, 1816DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, nv_msi_ht_cap_quirk);
1776 quirk_nvidia_ck804_msi_ht_cap);
1777 1817
1778static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev) 1818static void __devinit quirk_msi_intx_disable_bug(struct pci_dev *dev)
1779{ 1819{
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
index a98b2470b9ea..bd5c0e031398 100644
--- a/drivers/pci/rom.c
+++ b/drivers/pci/rom.c
@@ -242,8 +242,7 @@ void pci_remove_rom(struct pci_dev *pdev)
242#endif /* 0 */ 242#endif /* 0 */
243 243
244/** 244/**
245 * pci_cleanup_rom - internal routine for freeing the ROM copy created 245 * pci_cleanup_rom - free the ROM copy created by pci_map_rom_copy
246 * by pci_map_rom_copy called from remove.c
247 * @pdev: pointer to pci device struct 246 * @pdev: pointer to pci device struct
248 * 247 *
249 * Free the copied ROM if we allocated one. 248 * Free the copied ROM if we allocated one.
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 262b0439abe9..125e7b7f34ff 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -206,10 +206,8 @@ pci_setup_bridge(struct pci_bus *bus)
206 if (bus->resource[2]->flags & IORESOURCE_PREFETCH) { 206 if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
207 l = (region.start >> 16) & 0xfff0; 207 l = (region.start >> 16) & 0xfff0;
208 l |= region.end & 0xfff00000; 208 l |= region.end & 0xfff00000;
209#ifdef CONFIG_RESOURCES_64BIT 209 bu = upper_32_bits(region.start);
210 bu = region.start >> 32; 210 lu = upper_32_bits(region.end);
211 lu = region.end >> 32;
212#endif
213 DBG(KERN_INFO " PREFETCH window: 0x%016llx-0x%016llx\n", 211 DBG(KERN_INFO " PREFETCH window: 0x%016llx-0x%016llx\n",
214 (unsigned long long)region.start, 212 (unsigned long long)region.start,
215 (unsigned long long)region.end); 213 (unsigned long long)region.end);