aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2006-12-07 07:57:10 -0500
committerLen Brown <len.brown@intel.com>2006-12-15 23:38:35 -0500
commitae8433324be16673c75951986dcf85f29c090557 (patch)
treec762438e6d685f3f106a5c2bc9fc93246bfb47ff /drivers/acpi/scan.c
parentdb3e1cc3257758d8a694d0a6ab29f109fb019853 (diff)
ACPI: Set fake hid for non-PNPID ACPI devices
We do this mainly because: 1. hid is used to match ACPI devices and drivers. .match method which is incompatible to driver model can be deleted from acpi_driver.ops then. 2. As the .uevent method mark ACPI drivers by PNPID, fake hid is set to non-PNPID devices so that udev script can load the right ACPI driver by looking for "HWID = " or "COMPTID = ". Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c59
1 files changed, 57 insertions, 2 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c566c74e8a31..9efe3e9dbf21 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -166,8 +166,6 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv)
166 struct acpi_device *acpi_dev = to_acpi_device(dev); 166 struct acpi_device *acpi_dev = to_acpi_device(dev);
167 struct acpi_driver *acpi_drv = to_acpi_driver(drv); 167 struct acpi_driver *acpi_drv = to_acpi_driver(drv);
168 168
169 if (acpi_drv->ops.match)
170 return !acpi_drv->ops.match(acpi_dev, acpi_drv);
171 return !acpi_match_ids(acpi_dev, acpi_drv->ids); 169 return !acpi_match_ids(acpi_dev, acpi_drv->ids);
172} 170}
173 171
@@ -706,6 +704,53 @@ static void acpi_device_get_busid(struct acpi_device *device,
706 } 704 }
707} 705}
708 706
707static int
708acpi_video_bus_match(struct acpi_device *device)
709{
710 acpi_handle h_dummy1;
711 acpi_handle h_dummy2;
712 acpi_handle h_dummy3;
713
714
715 if (!device)
716 return -EINVAL;
717
718 /* Since there is no HID, CID for ACPI Video drivers, we have
719 * to check well known required nodes for each feature we support.
720 */
721
722 /* Does this device able to support video switching ? */
723 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
724 ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
725 return 0;
726
727 /* Does this device able to retrieve a video ROM ? */
728 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
729 return 0;
730
731 /* Does this device able to configure which video head to be POSTed ? */
732 if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
733 ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
734 ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
735 return 0;
736
737 return -ENODEV;
738}
739
740static int acpi_pci_bridge_match(struct acpi_device *device)
741{
742 acpi_status status;
743 acpi_handle handle;
744
745 /* pci bridge has _PRT but isn't PNP0A03 */
746 status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
747 if (ACPI_FAILURE(status))
748 return -ENODEV;
749 if (!acpi_match_ids(device, "PNP0A03"))
750 return -ENODEV;
751 return 0;
752}
753
709static void acpi_device_set_id(struct acpi_device *device, 754static void acpi_device_set_id(struct acpi_device *device,
710 struct acpi_device *parent, acpi_handle handle, 755 struct acpi_device *parent, acpi_handle handle,
711 int type) 756 int type)
@@ -736,6 +781,16 @@ static void acpi_device_set_id(struct acpi_device *device,
736 device->pnp.bus_address = info->address; 781 device->pnp.bus_address = info->address;
737 device->flags.bus_address = 1; 782 device->flags.bus_address = 1;
738 } 783 }
784
785 if(!(info->valid & (ACPI_VALID_HID | ACPI_VALID_CID))){
786 status = acpi_video_bus_match(device);
787 if(ACPI_SUCCESS(status))
788 hid = ACPI_VIDEO_HID;
789
790 status = acpi_pci_bridge_match(device);
791 if(ACPI_SUCCESS(status))
792 hid = ACPI_PCI_BRIDGE_HID;
793 }
739 break; 794 break;
740 case ACPI_BUS_TYPE_POWER: 795 case ACPI_BUS_TYPE_POWER:
741 hid = ACPI_POWER_HID; 796 hid = ACPI_POWER_HID;