diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-12-03 19:42:21 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-12-03 19:42:21 +0000 |
commit | 345f3e3ae8ef7bd904bcb56dd86dabf28a39cd00 (patch) | |
tree | 3d424d4d9abf069a4e7884a7503e16a7ec806b29 | |
parent | 83e5cb6e1ff93a4b130345b1a965e8126604fab8 (diff) |
Enumerate all i2c devices on the bus. Mark their nodes as attached even
if we didn't attach a device driver to avoid enumerating them again in
the acpi device tree walk.
ok deraadt@
-rw-r--r-- | sys/dev/acpi/dwiic_acpi.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/acpi/dwiic_acpi.c b/sys/dev/acpi/dwiic_acpi.c index 2bab3596d18..c4e43a1026b 100644 --- a/sys/dev/acpi/dwiic_acpi.c +++ b/sys/dev/acpi/dwiic_acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwiic_acpi.c,v 1.1 2017/11/16 18:12:27 jcs Exp $ */ +/* $OpenBSD: dwiic_acpi.c,v 1.2 2017/12/03 19:42:20 kettenis Exp $ */ /* * Synopsys DesignWare I2C controller * @@ -359,6 +359,11 @@ dwiic_acpi_found_hid(struct aml_node *node, void *arg) struct aml_value res; int64_t sta; char cdev[16], dev[16]; + struct i2c_attach_args ia; + + /* Skip our own _HID. */ + if (node->parent == sc->sc_devnode) + return 0; if (acpi_parsehid(node, arg, cdev, dev, 16) != 0) return 0; @@ -395,6 +400,14 @@ dwiic_acpi_found_hid(struct aml_node *node, void *arg) else if (dwiic_matchhids(dev, iatp_hids)) return dwiic_acpi_found_iatp(sc, node, dev, crs); + memset(&ia, 0, sizeof(ia)); + ia.ia_tag = sc->sc_iba.iba_tag; + ia.ia_name = dev; + ia.ia_addr = crs.i2c_addr; + + config_found(sc->sc_iic, &ia, dwiic_i2c_print); + node->parent->attached = 1; + return 0; } |