Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178387444
D60064.1796643357.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D60064.1796643357.diff
View Options
Index: sys/dev/iicbus/acpi_iicbus.c
===================================================================
--- sys/dev/iicbus/acpi_iicbus.c
+++ sys/dev/iicbus/acpi_iicbus.c
@@ -322,13 +322,33 @@
return (s);
}
+/*
+ * The ACPI namespace scope a given iicbus(4) instance stands for.
+ *
+ * A plain controller drives one bus, and that bus is not a namespace object
+ * of its own: whatever sits on it is described in the controller's scope.
+ * A controller that fans out -- an i2c mux -- drives several buses that
+ * firmware does describe separately, one node per downstream channel. Such
+ * a parent answers ACPI_IVAR_HANDLE for each of its child buses, with the
+ * node for that channel, or with NULL for a channel firmware left
+ * undescribed.
+ */
+static ACPI_HANDLE
+acpi_iicbus_get_scope(device_t iicbus)
+{
+
+ if (acpi_has_handle(iicbus))
+ return (acpi_get_handle(iicbus));
+ return (acpi_get_handle(device_get_parent(iicbus)));
+}
+
static int
acpi_iicbus_install_address_space_handler(struct acpi_iicbus_softc *sc)
{
ACPI_HANDLE handle;
ACPI_STATUS s;
- handle = acpi_get_handle(device_get_parent(sc->super_sc.dev));
+ handle = acpi_iicbus_get_scope(sc->super_sc.dev);
s = AcpiInstallAddressSpaceHandler(handle, ACPI_ADR_SPACE_GSBUS,
&acpi_iicbus_space_handler, NULL, &sc->space_handler_info);
if (ACPI_FAILURE(s)) {
@@ -346,7 +366,7 @@
ACPI_HANDLE handle;
ACPI_STATUS s;
- handle = acpi_get_handle(device_get_parent(sc->super_sc.dev));
+ handle = acpi_iicbus_get_scope(sc->super_sc.dev);
s = AcpiRemoveAddressSpaceHandler(handle, ACPI_ADR_SPACE_GSBUS,
&acpi_iicbus_space_handler);
if (ACPI_FAILURE(s)) {
@@ -489,8 +509,7 @@
if (ACPI_FAILURE(acpi_iicbus_get_i2cres(handle, &sb)) ||
sb.SlaveAddress == 0)
return (AE_OK);
- if (sb.ResourceSource_Handle !=
- acpi_get_handle(device_get_parent(iicbus)))
+ if (sb.ResourceSource_Handle != acpi_iicbus_get_scope(iicbus))
return (AE_OK);
if (bootverbose)
acpi_iicbus_dump_res(iicbus, &sb);
@@ -577,7 +596,7 @@
if (controller == NULL)
return (ENXIO);
- handle = acpi_get_handle(controller);
+ handle = acpi_iicbus_get_scope(dev);
if (handle == NULL)
return (ENXIO);
Index: sys/dev/iicbus/mux/pca954x.c
===================================================================
--- sys/dev/iicbus/mux/pca954x.c
+++ sys/dev/iicbus/mux/pca954x.c
@@ -288,14 +288,18 @@
DRIVER_MODULE(pca954x, iicbus, pca954x_driver, 0, 0);
/*
- * Register both downstream bus drivers: they share the "iicbus" devclass and
- * ofw_iicbus_probe() declines (ENXIO) when the child bus has no OFW node, so
- * the right one attaches for the way the mux was described.
+ * Register every downstream bus driver: they share the "iicbus" devclass, and
+ * each of the firmware-aware ones declines (ENXIO) when the child bus has no
+ * node of its own, so the right one attaches for the way the mux -- and the
+ * individual channel -- was described.
*/
DRIVER_MODULE(iicbus, pca954x, iicbus_driver, 0, 0);
#ifdef FDT
DRIVER_MODULE(ofw_iicbus, pca954x, ofw_iicbus_driver, 0, 0);
#endif
+#ifdef DEV_ACPI
+DRIVER_MODULE(acpi_iicbus, pca954x, acpi_iicbus_driver, 0, 0);
+#endif
MODULE_DEPEND(pca954x, iicmux, 1, 1, 1);
#ifdef DEV_ACPI
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 7, 11:35 AM (19 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42258326
Default Alt Text
D60064.1796643357.diff (3 KB)
Attached To
Mode
D60064: acpi_iicbus, pca954x: attach acpi_iicbus to i2c mux channel scopes
Attached
Detach File
Event Timeline