aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_bind.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_bind.c')
-rw-r--r--drivers/acpi/pci_bind.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
index 5d19b39e9e2b..5148f3c10b5c 100644
--- a/drivers/acpi/pci_bind.c
+++ b/drivers/acpi/pci_bind.c
@@ -61,15 +61,14 @@ acpi_pci_data_handler (
61 61
62 62
63/** 63/**
64 * acpi_os_get_pci_id 64 * acpi_get_pci_id
65 * ------------------ 65 * ------------------
66 * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem) 66 * This function is used by the ACPI Interpreter (a.k.a. Core Subsystem)
67 * to resolve PCI information for ACPI-PCI devices defined in the namespace. 67 * to resolve PCI information for ACPI-PCI devices defined in the namespace.
68 * This typically occurs when resolving PCI operation region information. 68 * This typically occurs when resolving PCI operation region information.
69 */ 69 */
70#ifdef ACPI_FUTURE_USAGE
71acpi_status 70acpi_status
72acpi_os_get_pci_id ( 71acpi_get_pci_id (
73 acpi_handle handle, 72 acpi_handle handle,
74 struct acpi_pci_id *id) 73 struct acpi_pci_id *id)
75{ 74{
@@ -78,7 +77,7 @@ acpi_os_get_pci_id (
78 struct acpi_device *device = NULL; 77 struct acpi_device *device = NULL;
79 struct acpi_pci_data *data = NULL; 78 struct acpi_pci_data *data = NULL;
80 79
81 ACPI_FUNCTION_TRACE("acpi_os_get_pci_id"); 80 ACPI_FUNCTION_TRACE("acpi_get_pci_id");
82 81
83 if (!id) 82 if (!id)
84 return_ACPI_STATUS(AE_BAD_PARAMETER); 83 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -92,7 +91,7 @@ acpi_os_get_pci_id (
92 } 91 }
93 92
94 status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data); 93 status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data);
95 if (ACPI_FAILURE(status) || !data || !data->dev) { 94 if (ACPI_FAILURE(status) || !data) {
96 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 95 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
97 "Invalid ACPI-PCI context for device %s\n", 96 "Invalid ACPI-PCI context for device %s\n",
98 acpi_device_bid(device))); 97 acpi_device_bid(device)));
@@ -115,7 +114,7 @@ acpi_os_get_pci_id (
115 114
116 return_ACPI_STATUS(AE_OK); 115 return_ACPI_STATUS(AE_OK);
117} 116}
118#endif /* ACPI_FUTURE_USAGE */ 117EXPORT_SYMBOL(acpi_get_pci_id);
119 118
120 119
121int 120int
@@ -129,6 +128,8 @@ acpi_pci_bind (
129 char *pathname = NULL; 128 char *pathname = NULL;
130 struct acpi_buffer buffer = {0, NULL}; 129 struct acpi_buffer buffer = {0, NULL};
131 acpi_handle handle = NULL; 130 acpi_handle handle = NULL;
131 struct pci_dev *dev;
132 struct pci_bus *bus;
132 133
133 ACPI_FUNCTION_TRACE("acpi_pci_bind"); 134 ACPI_FUNCTION_TRACE("acpi_pci_bind");
134 135
@@ -193,8 +194,20 @@ acpi_pci_bind (
193 * Locate matching device in PCI namespace. If it doesn't exist 194 * Locate matching device in PCI namespace. If it doesn't exist
194 * this typically means that the device isn't currently inserted 195 * this typically means that the device isn't currently inserted
195 * (e.g. docking station, port replicator, etc.). 196 * (e.g. docking station, port replicator, etc.).
197 * We cannot simply search the global pci device list, since
198 * PCI devices are added to the global pci list when the root
199 * bridge start ops are run, which may not have happened yet.
196 */ 200 */
197 data->dev = pci_find_slot(data->id.bus, PCI_DEVFN(data->id.device, data->id.function)); 201 bus = pci_find_bus(data->id.segment, data->id.bus);
202 if (bus) {
203 list_for_each_entry(dev, &bus->devices, bus_list) {
204 if (dev->devfn == PCI_DEVFN(data->id.device,
205 data->id.function)) {
206 data->dev = dev;
207 break;
208 }
209 }
210 }
198 if (!data->dev) { 211 if (!data->dev) {
199 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 212 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
200 "Device %02x:%02x:%02x.%02x not present in PCI namespace\n", 213 "Device %02x:%02x:%02x.%02x not present in PCI namespace\n",