diff options
author | Zhang Rui <rui.zhang@intel.com> | 2006-12-07 07:57:10 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-12-15 23:38:35 -0500 |
commit | ae8433324be16673c75951986dcf85f29c090557 (patch) | |
tree | c762438e6d685f3f106a5c2bc9fc93246bfb47ff | |
parent | db3e1cc3257758d8a694d0a6ab29f109fb019853 (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>
-rw-r--r-- | drivers/acpi/pci_bind.c | 20 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 59 | ||||
-rw-r--r-- | drivers/acpi/video.c | 37 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 6 | ||||
-rw-r--r-- | include/acpi/acpi_drivers.h | 2 |
5 files changed, 63 insertions, 61 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c index d83327468358..aa05e92464e6 100644 --- a/drivers/acpi/pci_bind.c +++ b/drivers/acpi/pci_bind.c | |||
@@ -379,32 +379,16 @@ acpi_pci_bind_root(struct acpi_device *device, | |||
379 | 379 | ||
380 | static int acpi_pci_bridge_add(struct acpi_device *device); | 380 | static int acpi_pci_bridge_add(struct acpi_device *device); |
381 | static int acpi_pci_bridge_remove(struct acpi_device *device, int type); | 381 | static int acpi_pci_bridge_remove(struct acpi_device *device, int type); |
382 | static int acpi_pci_bridge_match(struct acpi_device *device, | 382 | |
383 | struct acpi_driver *driver); | ||
384 | static struct acpi_driver acpi_pci_bridge_driver = { | 383 | static struct acpi_driver acpi_pci_bridge_driver = { |
385 | .name = ACPI_PCI_BRIDGE_DRIVER_NAME, | 384 | .name = ACPI_PCI_BRIDGE_DRIVER_NAME, |
385 | .ids = ACPI_PCI_BRIDGE_HID, | ||
386 | .ops = { | 386 | .ops = { |
387 | .add = acpi_pci_bridge_add, | 387 | .add = acpi_pci_bridge_add, |
388 | .remove = acpi_pci_bridge_remove, | 388 | .remove = acpi_pci_bridge_remove, |
389 | .match = acpi_pci_bridge_match, | ||
390 | }, | 389 | }, |
391 | }; | 390 | }; |
392 | 391 | ||
393 | static int acpi_pci_bridge_match(struct acpi_device *device, | ||
394 | struct acpi_driver *driver) | ||
395 | { | ||
396 | acpi_status status; | ||
397 | acpi_handle handle; | ||
398 | |||
399 | /* pci bridge has _PRT but isn't PNP0A03 */ | ||
400 | status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); | ||
401 | if (ACPI_FAILURE(status)) | ||
402 | return -ENODEV; | ||
403 | if (!acpi_match_ids(device, "PNP0A03")) | ||
404 | return -ENODEV; | ||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | static int acpi_pci_bridge_add(struct acpi_device *device) | 392 | static int acpi_pci_bridge_add(struct acpi_device *device) |
409 | { | 393 | { |
410 | return acpi_pci_bind(device); | 394 | return acpi_pci_bind(device); |
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 | ||
707 | static int | ||
708 | acpi_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 | |||
740 | static 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 | |||
709 | static void acpi_device_set_id(struct acpi_device *device, | 754 | static 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; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 56666a982476..6e99eea689c8 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -65,16 +65,14 @@ MODULE_LICENSE("GPL"); | |||
65 | 65 | ||
66 | static int acpi_video_bus_add(struct acpi_device *device); | 66 | static int acpi_video_bus_add(struct acpi_device *device); |
67 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 67 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
68 | static int acpi_video_bus_match(struct acpi_device *device, | ||
69 | struct acpi_driver *driver); | ||
70 | 68 | ||
71 | static struct acpi_driver acpi_video_bus = { | 69 | static struct acpi_driver acpi_video_bus = { |
72 | .name = ACPI_VIDEO_DRIVER_NAME, | 70 | .name = ACPI_VIDEO_DRIVER_NAME, |
73 | .class = ACPI_VIDEO_CLASS, | 71 | .class = ACPI_VIDEO_CLASS, |
72 | .ids = ACPI_VIDEO_HID, | ||
74 | .ops = { | 73 | .ops = { |
75 | .add = acpi_video_bus_add, | 74 | .add = acpi_video_bus_add, |
76 | .remove = acpi_video_bus_remove, | 75 | .remove = acpi_video_bus_remove, |
77 | .match = acpi_video_bus_match, | ||
78 | }, | 76 | }, |
79 | }; | 77 | }; |
80 | 78 | ||
@@ -1774,39 +1772,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
1774 | return 0; | 1772 | return 0; |
1775 | } | 1773 | } |
1776 | 1774 | ||
1777 | static int | ||
1778 | acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver) | ||
1779 | { | ||
1780 | acpi_handle h_dummy1; | ||
1781 | acpi_handle h_dummy2; | ||
1782 | acpi_handle h_dummy3; | ||
1783 | |||
1784 | |||
1785 | if (!device || !driver) | ||
1786 | return -EINVAL; | ||
1787 | |||
1788 | /* Since there is no HID, CID for ACPI Video drivers, we have | ||
1789 | * to check well known required nodes for each feature we support. | ||
1790 | */ | ||
1791 | |||
1792 | /* Does this device able to support video switching ? */ | ||
1793 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && | ||
1794 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) | ||
1795 | return 0; | ||
1796 | |||
1797 | /* Does this device able to retrieve a video ROM ? */ | ||
1798 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) | ||
1799 | return 0; | ||
1800 | |||
1801 | /* Does this device able to configure which video head to be POSTed ? */ | ||
1802 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && | ||
1803 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && | ||
1804 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) | ||
1805 | return 0; | ||
1806 | |||
1807 | return -ENODEV; | ||
1808 | } | ||
1809 | |||
1810 | static int __init acpi_video_init(void) | 1775 | static int __init acpi_video_init(void) |
1811 | { | 1776 | { |
1812 | int result = 0; | 1777 | int result = 0; |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 58dc8f651861..a6b4037beeae 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -97,8 +97,6 @@ typedef int (*acpi_op_resume) (struct acpi_device * device); | |||
97 | typedef int (*acpi_op_scan) (struct acpi_device * device); | 97 | typedef int (*acpi_op_scan) (struct acpi_device * device); |
98 | typedef int (*acpi_op_bind) (struct acpi_device * device); | 98 | typedef int (*acpi_op_bind) (struct acpi_device * device); |
99 | typedef int (*acpi_op_unbind) (struct acpi_device * device); | 99 | typedef int (*acpi_op_unbind) (struct acpi_device * device); |
100 | typedef int (*acpi_op_match) (struct acpi_device * device, | ||
101 | struct acpi_driver * driver); | ||
102 | typedef int (*acpi_op_shutdown) (struct acpi_device * device); | 100 | typedef int (*acpi_op_shutdown) (struct acpi_device * device); |
103 | 101 | ||
104 | struct acpi_bus_ops { | 102 | struct acpi_bus_ops { |
@@ -112,9 +110,8 @@ struct acpi_bus_ops { | |||
112 | u32 acpi_op_scan:1; | 110 | u32 acpi_op_scan:1; |
113 | u32 acpi_op_bind:1; | 111 | u32 acpi_op_bind:1; |
114 | u32 acpi_op_unbind:1; | 112 | u32 acpi_op_unbind:1; |
115 | u32 acpi_op_match:1; | ||
116 | u32 acpi_op_shutdown:1; | 113 | u32 acpi_op_shutdown:1; |
117 | u32 reserved:20; | 114 | u32 reserved:21; |
118 | }; | 115 | }; |
119 | 116 | ||
120 | struct acpi_device_ops { | 117 | struct acpi_device_ops { |
@@ -128,7 +125,6 @@ struct acpi_device_ops { | |||
128 | acpi_op_scan scan; | 125 | acpi_op_scan scan; |
129 | acpi_op_bind bind; | 126 | acpi_op_bind bind; |
130 | acpi_op_unbind unbind; | 127 | acpi_op_unbind unbind; |
131 | acpi_op_match match; | ||
132 | acpi_op_shutdown shutdown; | 128 | acpi_op_shutdown shutdown; |
133 | }; | 129 | }; |
134 | 130 | ||
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 6a5bdcefec64..be67750ec88b 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h | |||
@@ -43,6 +43,8 @@ | |||
43 | #define ACPI_BUTTON_HID_POWERF "ACPI_FPB" | 43 | #define ACPI_BUTTON_HID_POWERF "ACPI_FPB" |
44 | #define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" | 44 | #define ACPI_BUTTON_HID_SLEEPF "ACPI_FSB" |
45 | 45 | ||
46 | #define ACPI_VIDEO_HID "ACPI_VID" | ||
47 | #define ACPI_PCI_BRIDGE_HID "ACPI_PCI" | ||
46 | /* -------------------------------------------------------------------------- | 48 | /* -------------------------------------------------------------------------- |
47 | PCI | 49 | PCI |
48 | -------------------------------------------------------------------------- */ | 50 | -------------------------------------------------------------------------- */ |