From nobody Mon Nov 23 23:50:48 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jYN484d6lz71srG for ; Mon, 23 Nov 2026 23:50:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jYN481x51z4Njn for ; Mon, 23 Nov 2026 23:50:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795477848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/V2zRE6vPxMmGm6VhpLmwc6PURjAJe1cXAvwPWwsEI=; b=SqgUukwCOGiR8WBJLL+YGOHNAcPV9+3h7Fnl6p/htxIJbD7HvrRcJTscX8XmIIrOcf5nBO owfWhGnqxPkh655spGRUTUDmOJ19ooYy6cqvtJZyoz5A3NvJZRZFEdRaBMN2cJzsyr68OE QBy386C4CPzF8MF/Zifjg1Mc1mnbyKNY2FA/7uSW+TmqPAMaKWhDQ7Aehd0yPOqZFVq0Ts jNOR9z7CDYi+gjsZoPbB/cxbyG1YWdli2UQdcp31KmYbAc1MdBAZ+nhcVF+oF2qrnj7tIP T53jJQD4SXIH3m/2hI1JczcVfVAvqrwGtMmV9om0NcLF2HBOuP1FBhm7gJkzBA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795477848; b=cUM9LWsSIoPj3mNL8DSdcsplYM0/4hH2csq7nhse3hEBRYmaXyRQPxf7tEkewwb0tyhePR A2NfAOGeJRtaqXWY0gha5Rr2H9SinT59zOjzo2+/nIXGF3yuHM7jr44qKChTdAgHpmeH3o du/DXwxAMJKLh0oBv0BxzSIU89VwfAP4VxuVaqyZFrcoJoO2waFCy52CJ/Myb4fOQMUP1V RvgTMAaadTRu9qz6/3a+m9Nvh56pcKo6LgWg1PolQoYEhEDstzSMNmUhVll6sj4XozME9X Ukti2n6i3Y1OQ944xA6HGDMvkudtEsdAU+MDyjBH+g750AsDASJn31urtHwrOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795477848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=C/V2zRE6vPxMmGm6VhpLmwc6PURjAJe1cXAvwPWwsEI=; b=A/hDsGGlgoMo3uJTKTEkmDfBqcTPTd4jcoq9+YgyiJDkO7Kts+TAHHBovssVph+2ui30ib /mim+5CKQ9henk1zUyKKDTBptNzhIaHvbjuFO317Zo7Yot8J2OdFkMciJjLthv88wBOL9v rR13+vbhov3iw50fTP+gWmnxqppUdcZGR+362iP8kPwcpR4XqwrsFlYK3lcg+5wkKRTUnI 2sJGnAv9ndZZieQwwsNbocRnPKOWQ/Uc8At8sthZSBFupcRdQBoxiguJ5TXcEB6pih8xa3 Xke27kEBHTHOHcqrkh+kvosizxdZP96UtaZvu3rCI9ShzXwjQk1ykHpubiJRCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jYN48147bz1CRn for ; Mon, 23 Nov 2026 23:50:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 9e07 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 23 Nov 2026 23:50:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Cochard Subject: git: 17ebd95594cd - main - acpi_iicbus: Return _DSD properties of the I2C children List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olivier X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17ebd95594cd106b73cc9422ba86245e0bf5ab99 Auto-Submitted: auto-generated Date: Mon, 23 Nov 2026 23:50:48 +0000 Message-Id: <6b04d158.9e07.e0d59e1@gitrepo.freebsd.org> The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/src/commit/?id=17ebd95594cd106b73cc9422ba86245e0bf5ab99 commit 17ebd95594cd106b73cc9422ba86245e0bf5ab99 Author: Olivier Cochard AuthorDate: 2026-11-21 17:29:07 +0000 Commit: Olivier Cochard CommitDate: 2026-11-23 23:45:39 +0000 acpi_iicbus: Return _DSD properties of the I2C children acpi_iicbus has no bus_get_property method, so device_get_property() on one of its children reaches acpi(4) through bus_generic_get_property(). acpi_bus_get_prop() then takes the child's acpi_iicbus ivars for a struct acpi_device and follows garbage pointers: on an HP ZBook Ultra G1a, a driver reading _DSD of its I2C device froze the machine. Answer for the I2C children from their own ACPI handle, with a _DSD cache in the ivars, through a helper split out of acpi_bus_get_prop(). Reviewed by: wulf, imp Approved by: wulf, imp MFC after: 1 week Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/117 --- sys/dev/acpica/acpi.c | 26 ++++++++++++++++++++++---- sys/dev/acpica/acpivar.h | 3 +++ sys/dev/iicbus/acpi_iicbus.c | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 993203c5caab..f63373ee06f9 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -168,6 +168,8 @@ static int acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count); static ACPI_STATUS acpi_device_scan_cb(ACPI_HANDLE h, UINT32 level, void *context, void **retval); static ACPI_STATUS acpi_find_dsd(struct acpi_device *ad); +static ACPI_STATUS acpi_ad_get_prop(struct acpi_device *ad, + const char *propname, const ACPI_OBJECT **value); static void acpi_platform_osc(device_t dev); static void acpi_probe_children(device_t bus); static void acpi_probe_order(ACPI_HANDLE handle, int *order); @@ -1999,14 +2001,18 @@ acpi_device_eval_obj(device_t bus, device_t dev, const char *pathname, static ACPI_STATUS acpi_device_get_prop(device_t bus, device_t dev, const char *propname, const ACPI_OBJECT **value) +{ + return (acpi_ad_get_prop(device_get_ivars(dev), propname, value)); +} + +static ACPI_STATUS +acpi_ad_get_prop(struct acpi_device *ad, const char *propname, + const ACPI_OBJECT **value) { const ACPI_OBJECT *pkg, *name, *val; - struct acpi_device *ad; ACPI_STATUS status; int i; - ad = device_get_ivars(dev); - if (ad == NULL || propname == NULL) return (AE_BAD_PARAMETER); if (ad->dsd_pkg == NULL) { @@ -2102,11 +2108,23 @@ err: static ssize_t acpi_bus_get_prop(device_t bus, device_t child, const char *propname, void *propvalue, size_t size, device_property_type_t type) +{ + return (acpi_ad_get_property(device_get_ivars(child), propname, + propvalue, size, type)); +} + +/* + * Return a _DSD property of the device described by ad, for buses whose + * children are ACPI devices but whose ivars are not a struct acpi_device. + */ +ssize_t +acpi_ad_get_property(struct acpi_device *ad, const char *propname, + void *propvalue, size_t size, device_property_type_t type) { ACPI_STATUS status; const ACPI_OBJECT *obj; - status = acpi_device_get_prop(bus, child, propname, &obj); + status = acpi_ad_get_prop(ad, propname, &obj); if (ACPI_FAILURE(status)) return (-1); diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 66050662853c..7dfdc2e600c5 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -508,6 +508,9 @@ acpi_d_state_to_str(int state) char *acpi_name(ACPI_HANDLE handle); int acpi_avoid(ACPI_HANDLE handle); int acpi_disabled(char *subsys); +ssize_t acpi_ad_get_property(struct acpi_device *ad, + const char *propname, void *propvalue, size_t size, + device_property_type_t type); int acpi_get_acpi_device_path(device_t bus, device_t child, const char *locator, struct sbuf *sb); int acpi_machdep_init(device_t dev); diff --git a/sys/dev/iicbus/acpi_iicbus.c b/sys/dev/iicbus/acpi_iicbus.c index ffad1bfb9be7..5bee1fccd56c 100644 --- a/sys/dev/iicbus/acpi_iicbus.c +++ b/sys/dev/iicbus/acpi_iicbus.c @@ -73,6 +73,7 @@ struct acpi_iicbus_softc { struct acpi_iicbus_ivars { struct iicbus_ivar super_ivar; ACPI_HANDLE handle; + struct acpi_device ad; /* _DSD cache */ }; static int install_space_handler = 1; @@ -674,9 +675,28 @@ acpi_iicbus_child_deleted(device_t bus, device_t child) return; if (acpi_get_device(devi->handle) == child) AcpiDetachData(devi->handle, acpi_fake_objhandler); + if (devi->ad.dsd.Pointer != NULL) + AcpiOsFree(devi->ad.dsd.Pointer); iicbus_child_deleted(bus, child); } +static ssize_t +acpi_iicbus_get_property(device_t bus, device_t child, const char *propname, + void *propvalue, size_t size, device_property_type_t type) +{ + struct acpi_iicbus_ivars *devi; + + /* Deeper devices do not carry our ivars. */ + if (device_get_parent(child) != bus) + return (-1); + devi = device_get_ivars(child); + if (devi->handle == NULL) + return (-1); + devi->ad.ad_handle = devi->handle; + return (acpi_ad_get_property(&devi->ad, propname, propvalue, size, + type)); +} + static int acpi_iicbus_read_ivar(device_t bus, device_t child, int which, uintptr_t *res) { @@ -768,6 +788,7 @@ static device_method_t acpi_iicbus_methods[] = { DEVMETHOD(bus_child_location, acpi_iicbus_child_location), DEVMETHOD(bus_child_pnpinfo, acpi_iicbus_child_pnpinfo), DEVMETHOD(bus_get_device_path, acpi_get_acpi_device_path), + DEVMETHOD(bus_get_property, acpi_iicbus_get_property), DEVMETHOD_END, };