diff options
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r-- | drivers/acpi/pci_root.c | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 4c313eab6313..0984a1ee24ed 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -58,7 +58,7 @@ static struct acpi_driver acpi_pci_root_driver = { | |||
58 | 58 | ||
59 | struct acpi_pci_root { | 59 | struct acpi_pci_root { |
60 | struct list_head node; | 60 | struct list_head node; |
61 | acpi_handle handle; | 61 | struct acpi_device * device; |
62 | struct acpi_pci_id id; | 62 | struct acpi_pci_id id; |
63 | struct pci_bus *bus; | 63 | struct pci_bus *bus; |
64 | }; | 64 | }; |
@@ -83,7 +83,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver) | |||
83 | list_for_each(entry, &acpi_pci_roots) { | 83 | list_for_each(entry, &acpi_pci_roots) { |
84 | struct acpi_pci_root *root; | 84 | struct acpi_pci_root *root; |
85 | root = list_entry(entry, struct acpi_pci_root, node); | 85 | root = list_entry(entry, struct acpi_pci_root, node); |
86 | driver->add(root->handle); | 86 | driver->add(root->device->handle); |
87 | n++; | 87 | n++; |
88 | } | 88 | } |
89 | 89 | ||
@@ -110,7 +110,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) | |||
110 | list_for_each(entry, &acpi_pci_roots) { | 110 | list_for_each(entry, &acpi_pci_roots) { |
111 | struct acpi_pci_root *root; | 111 | struct acpi_pci_root *root; |
112 | root = list_entry(entry, struct acpi_pci_root, node); | 112 | root = list_entry(entry, struct acpi_pci_root, node); |
113 | driver->remove(root->handle); | 113 | driver->remove(root->device->handle); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
@@ -160,18 +160,17 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
160 | unsigned long value = 0; | 160 | unsigned long value = 0; |
161 | acpi_handle handle = NULL; | 161 | acpi_handle handle = NULL; |
162 | 162 | ||
163 | ACPI_FUNCTION_TRACE("acpi_pci_root_add"); | ||
164 | 163 | ||
165 | if (!device) | 164 | if (!device) |
166 | return_VALUE(-EINVAL); | 165 | return -EINVAL; |
167 | 166 | ||
168 | root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); | 167 | root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); |
169 | if (!root) | 168 | if (!root) |
170 | return_VALUE(-ENOMEM); | 169 | return -ENOMEM; |
171 | memset(root, 0, sizeof(struct acpi_pci_root)); | 170 | memset(root, 0, sizeof(struct acpi_pci_root)); |
172 | INIT_LIST_HEAD(&root->node); | 171 | INIT_LIST_HEAD(&root->node); |
173 | 172 | ||
174 | root->handle = device->handle; | 173 | root->device = device; |
175 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); | 174 | strcpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME); |
176 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); | 175 | strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); |
177 | acpi_driver_data(device) = root; | 176 | acpi_driver_data(device) = root; |
@@ -186,7 +185,7 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
186 | * ------- | 185 | * ------- |
187 | * Obtained via _SEG, if exists, otherwise assumed to be zero (0). | 186 | * Obtained via _SEG, if exists, otherwise assumed to be zero (0). |
188 | */ | 187 | */ |
189 | status = acpi_evaluate_integer(root->handle, METHOD_NAME__SEG, NULL, | 188 | status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL, |
190 | &value); | 189 | &value); |
191 | switch (status) { | 190 | switch (status) { |
192 | case AE_OK: | 191 | case AE_OK: |
@@ -198,7 +197,7 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
198 | root->id.segment = 0; | 197 | root->id.segment = 0; |
199 | break; | 198 | break; |
200 | default: | 199 | default: |
201 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SEG\n")); | 200 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _SEG")); |
202 | result = -ENODEV; | 201 | result = -ENODEV; |
203 | goto end; | 202 | goto end; |
204 | } | 203 | } |
@@ -208,7 +207,7 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
208 | * --- | 207 | * --- |
209 | * Obtained via _BBN, if exists, otherwise assumed to be zero (0). | 208 | * Obtained via _BBN, if exists, otherwise assumed to be zero (0). |
210 | */ | 209 | */ |
211 | status = acpi_evaluate_integer(root->handle, METHOD_NAME__BBN, NULL, | 210 | status = acpi_evaluate_integer(device->handle, METHOD_NAME__BBN, NULL, |
212 | &value); | 211 | &value); |
213 | switch (status) { | 212 | switch (status) { |
214 | case AE_OK: | 213 | case AE_OK: |
@@ -219,7 +218,7 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
219 | root->id.bus = 0; | 218 | root->id.bus = 0; |
220 | break; | 219 | break; |
221 | default: | 220 | default: |
222 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _BBN\n")); | 221 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BBN")); |
223 | result = -ENODEV; | 222 | result = -ENODEV; |
224 | goto end; | 223 | goto end; |
225 | } | 224 | } |
@@ -231,10 +230,11 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
231 | int bus = 0; | 230 | int bus = 0; |
232 | acpi_status status; | 231 | acpi_status status; |
233 | 232 | ||
234 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 233 | printk(KERN_ERR PREFIX |
235 | "Wrong _BBN value, please reboot and using option 'pci=noacpi'\n")); | 234 | "Wrong _BBN value, reboot" |
235 | " and use option 'pci=noacpi'\n"); | ||
236 | 236 | ||
237 | status = try_get_root_bridge_busnr(root->handle, &bus); | 237 | status = try_get_root_bridge_busnr(device->handle, &bus); |
238 | if (ACPI_FAILURE(status)) | 238 | if (ACPI_FAILURE(status)) |
239 | break; | 239 | break; |
240 | if (bus != root->id.bus) { | 240 | if (bus != root->id.bus) { |
@@ -273,9 +273,9 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
273 | */ | 273 | */ |
274 | root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); | 274 | root->bus = pci_acpi_scan_root(device, root->id.segment, root->id.bus); |
275 | if (!root->bus) { | 275 | if (!root->bus) { |
276 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 276 | printk(KERN_ERR PREFIX |
277 | "Bus %04x:%02x not present in PCI namespace\n", | 277 | "Bus %04x:%02x not present in PCI namespace\n", |
278 | root->id.segment, root->id.bus)); | 278 | root->id.segment, root->id.bus); |
279 | result = -ENODEV; | 279 | result = -ENODEV; |
280 | goto end; | 280 | goto end; |
281 | } | 281 | } |
@@ -294,9 +294,9 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
294 | * ----------------- | 294 | * ----------------- |
295 | * Evaluate and parse _PRT, if exists. | 295 | * Evaluate and parse _PRT, if exists. |
296 | */ | 296 | */ |
297 | status = acpi_get_handle(root->handle, METHOD_NAME__PRT, &handle); | 297 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); |
298 | if (ACPI_SUCCESS(status)) | 298 | if (ACPI_SUCCESS(status)) |
299 | result = acpi_pci_irq_add_prt(root->handle, root->id.segment, | 299 | result = acpi_pci_irq_add_prt(device->handle, root->id.segment, |
300 | root->id.bus); | 300 | root->id.bus); |
301 | 301 | ||
302 | end: | 302 | end: |
@@ -306,46 +306,43 @@ static int acpi_pci_root_add(struct acpi_device *device) | |||
306 | kfree(root); | 306 | kfree(root); |
307 | } | 307 | } |
308 | 308 | ||
309 | return_VALUE(result); | 309 | return result; |
310 | } | 310 | } |
311 | 311 | ||
312 | static int acpi_pci_root_start(struct acpi_device *device) | 312 | static int acpi_pci_root_start(struct acpi_device *device) |
313 | { | 313 | { |
314 | struct acpi_pci_root *root; | 314 | struct acpi_pci_root *root; |
315 | 315 | ||
316 | ACPI_FUNCTION_TRACE("acpi_pci_root_start"); | ||
317 | 316 | ||
318 | list_for_each_entry(root, &acpi_pci_roots, node) { | 317 | list_for_each_entry(root, &acpi_pci_roots, node) { |
319 | if (root->handle == device->handle) { | 318 | if (root->device == device) { |
320 | pci_bus_add_devices(root->bus); | 319 | pci_bus_add_devices(root->bus); |
321 | return_VALUE(0); | 320 | return 0; |
322 | } | 321 | } |
323 | } | 322 | } |
324 | return_VALUE(-ENODEV); | 323 | return -ENODEV; |
325 | } | 324 | } |
326 | 325 | ||
327 | static int acpi_pci_root_remove(struct acpi_device *device, int type) | 326 | static int acpi_pci_root_remove(struct acpi_device *device, int type) |
328 | { | 327 | { |
329 | struct acpi_pci_root *root = NULL; | 328 | struct acpi_pci_root *root = NULL; |
330 | 329 | ||
331 | ACPI_FUNCTION_TRACE("acpi_pci_root_remove"); | ||
332 | 330 | ||
333 | if (!device || !acpi_driver_data(device)) | 331 | if (!device || !acpi_driver_data(device)) |
334 | return_VALUE(-EINVAL); | 332 | return -EINVAL; |
335 | 333 | ||
336 | root = (struct acpi_pci_root *)acpi_driver_data(device); | 334 | root = (struct acpi_pci_root *)acpi_driver_data(device); |
337 | 335 | ||
338 | kfree(root); | 336 | kfree(root); |
339 | 337 | ||
340 | return_VALUE(0); | 338 | return 0; |
341 | } | 339 | } |
342 | 340 | ||
343 | static int __init acpi_pci_root_init(void) | 341 | static int __init acpi_pci_root_init(void) |
344 | { | 342 | { |
345 | ACPI_FUNCTION_TRACE("acpi_pci_root_init"); | ||
346 | 343 | ||
347 | if (acpi_pci_disabled) | 344 | if (acpi_pci_disabled) |
348 | return_VALUE(0); | 345 | return 0; |
349 | 346 | ||
350 | /* DEBUG: | 347 | /* DEBUG: |
351 | acpi_dbg_layer = ACPI_PCI_COMPONENT; | 348 | acpi_dbg_layer = ACPI_PCI_COMPONENT; |
@@ -353,9 +350,9 @@ static int __init acpi_pci_root_init(void) | |||
353 | */ | 350 | */ |
354 | 351 | ||
355 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | 352 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) |
356 | return_VALUE(-ENODEV); | 353 | return -ENODEV; |
357 | 354 | ||
358 | return_VALUE(0); | 355 | return 0; |
359 | } | 356 | } |
360 | 357 | ||
361 | subsys_initcall(acpi_pci_root_init); | 358 | subsys_initcall(acpi_pci_root_init); |