aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:12:20 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:12:20 -0400
commitb04c58b1ed26317bfb4b33d3a2d16377fc6acd0f (patch)
tree8b6f65582a8fb3b70a07c16321969af1d06f7afc /drivers/acpi/scan.c
parent864e055f44a5701cb033bf3afa2b6cc37ddba678 (diff)
parent48459340b92b00ae1a75179f168ef20d3e61f264 (diff)
Merge branch 'acpi-enumeration'
* acpi-enumeration: ACPI / scan: use platform bus type by default for _HID enumeration ACPI / scan: always register ACPI LPSS scan handler ACPI / scan: always register memory hotplug scan handler ACPI / scan: always register container scan handler ACPI / scan: Change the meaning of missing .attach() in scan handlers ACPI / scan: introduce platform_id device PNP type flag ACPI / scan: drop unsupported serial IDs from PNP ACPI scan handler ID list ACPI / scan: drop IDs that do not comply with the ACPI PNP ID rule ACPI / PNP: use device ID list for PNPACPI device enumeration ACPI / scan: .match() callback for ACPI scan handlers
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c56
1 files changed, 53 insertions, 3 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 31c99f7148d0..f775fa0d850f 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -84,7 +84,7 @@ EXPORT_SYMBOL_GPL(acpi_initialize_hp_context);
84 84
85int acpi_scan_add_handler(struct acpi_scan_handler *handler) 85int acpi_scan_add_handler(struct acpi_scan_handler *handler)
86{ 86{
87 if (!handler || !handler->attach) 87 if (!handler)
88 return -EINVAL; 88 return -EINVAL;
89 89
90 list_add_tail(&handler->list_node, &acpi_scan_handlers_list); 90 list_add_tail(&handler->list_node, &acpi_scan_handlers_list);
@@ -1797,8 +1797,10 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
1797 return; 1797 return;
1798 } 1798 }
1799 1799
1800 if (info->valid & ACPI_VALID_HID) 1800 if (info->valid & ACPI_VALID_HID) {
1801 acpi_add_id(pnp, info->hardware_id.string); 1801 acpi_add_id(pnp, info->hardware_id.string);
1802 pnp->type.platform_id = 1;
1803 }
1802 if (info->valid & ACPI_VALID_CID) { 1804 if (info->valid & ACPI_VALID_CID) {
1803 cid_list = &info->compatible_id_list; 1805 cid_list = &info->compatible_id_list;
1804 for (i = 0; i < cid_list->count; i++) 1806 for (i = 0; i < cid_list->count; i++)
@@ -1977,6 +1979,9 @@ static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
1977{ 1979{
1978 const struct acpi_device_id *devid; 1980 const struct acpi_device_id *devid;
1979 1981
1982 if (handler->match)
1983 return handler->match(idstr, matchid);
1984
1980 for (devid = handler->ids; devid->id[0]; devid++) 1985 for (devid = handler->ids; devid->id[0]; devid++)
1981 if (!strcmp((char *)devid->id, idstr)) { 1986 if (!strcmp((char *)devid->id, idstr)) {
1982 if (matchid) 1987 if (matchid)
@@ -2065,6 +2070,44 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
2065 return AE_OK; 2070 return AE_OK;
2066} 2071}
2067 2072
2073static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
2074{
2075 bool *is_spi_i2c_slave_p = data;
2076
2077 if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
2078 return 1;
2079
2080 /*
2081 * devices that are connected to UART still need to be enumerated to
2082 * platform bus
2083 */
2084 if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
2085 *is_spi_i2c_slave_p = true;
2086
2087 /* no need to do more checking */
2088 return -1;
2089}
2090
2091static void acpi_default_enumeration(struct acpi_device *device)
2092{
2093 struct list_head resource_list;
2094 bool is_spi_i2c_slave = false;
2095
2096 if (!device->pnp.type.platform_id || device->handler)
2097 return;
2098
2099 /*
2100 * Do not enemerate SPI/I2C slaves as they will be enuerated by their
2101 * respective parents.
2102 */
2103 INIT_LIST_HEAD(&resource_list);
2104 acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
2105 &is_spi_i2c_slave);
2106 acpi_dev_free_resource_list(&resource_list);
2107 if (!is_spi_i2c_slave)
2108 acpi_create_platform_device(device);
2109}
2110
2068static int acpi_scan_attach_handler(struct acpi_device *device) 2111static int acpi_scan_attach_handler(struct acpi_device *device)
2069{ 2112{
2070 struct acpi_hardware_id *hwid; 2113 struct acpi_hardware_id *hwid;
@@ -2076,6 +2119,10 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
2076 2119
2077 handler = acpi_scan_match_handler(hwid->id, &devid); 2120 handler = acpi_scan_match_handler(hwid->id, &devid);
2078 if (handler) { 2121 if (handler) {
2122 if (!handler->attach) {
2123 device->pnp.type.platform_id = 0;
2124 continue;
2125 }
2079 device->handler = handler; 2126 device->handler = handler;
2080 ret = handler->attach(device, devid); 2127 ret = handler->attach(device, devid);
2081 if (ret > 0) 2128 if (ret > 0)
@@ -2086,6 +2133,9 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
2086 break; 2133 break;
2087 } 2134 }
2088 } 2135 }
2136 if (!ret)
2137 acpi_default_enumeration(device);
2138
2089 return ret; 2139 return ret;
2090} 2140}
2091 2141
@@ -2245,11 +2295,11 @@ int __init acpi_scan_init(void)
2245 acpi_pci_root_init(); 2295 acpi_pci_root_init();
2246 acpi_pci_link_init(); 2296 acpi_pci_link_init();
2247 acpi_processor_init(); 2297 acpi_processor_init();
2248 acpi_platform_init();
2249 acpi_lpss_init(); 2298 acpi_lpss_init();
2250 acpi_cmos_rtc_init(); 2299 acpi_cmos_rtc_init();
2251 acpi_container_init(); 2300 acpi_container_init();
2252 acpi_memory_hotplug_init(); 2301 acpi_memory_hotplug_init();
2302 acpi_pnp_init();
2253 2303
2254 mutex_lock(&acpi_scan_lock); 2304 mutex_lock(&acpi_scan_lock);
2255 /* 2305 /*