summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Garrett <mjg59@srcf.ucam.org>2008-02-07 01:44:06 +0000
committerLen Brown <len.brown@intel.com>2008-02-07 03:22:57 -0500
commit3fa2cdcc45a0176de15cac9dbf4ed2834ebf8932 (patch)
treed5243b920481bd8345c759d3c432160ae76463b5
parent863c1490e512db40dab61e44b694a493a9e68b3f (diff)
ACPI: video: Ignore ACPI video devices that aren't present in hardware
Vendors often ship machines with a choice of integrated or discrete graphics, and use the same DSDT for both. As a result, the ACPI video module will locate devices that may not exist on this specific platform. Attempt to determine whether the device exists or not, and abort the device creation if it do not exist. Signed-off-by: Matthew Garrett <mjg59@srcf.ucam.org> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/video.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index b5e35cd559e..970c01a7f8f 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -730,11 +730,40 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
static int acpi_video_bus_check(struct acpi_video_bus *video)
{
acpi_status status = -ENOENT;
-
+ long device_id;
+ struct device *dev;
+ struct acpi_device *device;
if (!video)
return -EINVAL;
+ device = video->device;
+
+ status =
+ acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
+
+ if (!ACPI_SUCCESS(status))
+ return -ENODEV;
+
+ /* We need to attempt to determine whether the _ADR refers to a
+ PCI device or not. There's no terribly good way to do this,
+ so the best we can hope for is to assume that there'll never
+ be a video device in the host bridge */
+ if (device_id >= 0x10000) {
+ /* It looks like a PCI device. Does it exist? */
+ dev = acpi_get_physical_device(device->handle);
+ } else {
+ /* It doesn't look like a PCI device. Does its parent
+ exist? */
+ acpi_handle phandle;
+ if (acpi_get_parent(device->handle, &phandle))
+ return -ENODEV;
+ dev = acpi_get_physical_device(phandle);
+ }
+ if (!dev)
+ return -ENODEV;
+ put_device(dev);
+
/* Since there is no HID, CID and so on for VGA driver, we have
* to check well known required nodes.
*/