From nobody Sat Dec 07 00:01:45 2024 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 4Y4pFj4JM0z5g76j; Sat, 07 Dec 2024 00:01:45 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y4pFj1ZJvz4LPB; Sat, 7 Dec 2024 00:01:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733529705; 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=KSyOk8CBCcusxvAg3ThUCg8j2R7F0pjzZepcrT0Dzqs=; b=CQJh1/u2JMxNWN+wAM+1BbPlxjkm5TMKAtAg87Aja1XQveb+0w/G5PyDOtxetlBovqKCm0 tzlDgIY0Ma9xxYKOHd3m0cR1YOcuje9Lt17TjWrznVIFHpTcpYxgIbu8REyQP4Qq5IWogq PSDc+zuKOvQ2ABpuVV30s+8WB10veKNr66X+ghgGuHDR4f9SJm2WEnp6hmWEZkmdfQqNyu /JQxhlVVxlMcurmjt8yJizsK8GNd/+NgO80MJ7kY34h4HrvVG3If0mwIyFJdnjYX6SjmM2 wq1yd/EAbiWI3ecgD+TLUm0OkwlijfCamuwUOYyFg6JgrC51m9UE40wgGbc2xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733529705; 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=KSyOk8CBCcusxvAg3ThUCg8j2R7F0pjzZepcrT0Dzqs=; b=CcinIH1iu7wK4WrMwcSQiCPq15br2ARzyfrMPP/9QiG522HZUijzY3CO/9Vmga3ZOUnwHS MbeamuMXcjDfy2xL09u5NySe1uaMC8CjGE1miDAL3qEtxtwMqXVAL+Ah2lppIuLDqOqSKT 0vAb184snDkxMQHctLrx2n0w8dA7NCSODWXw0h0jqxiyE5/ubshJGBpQ94ONfBEin++ia4 XenMeKeWPMAuNlq5oHdjngTug0I3DXXboWjMC4clZTH/4V2mx4sCDJOyZEpfpGRGZYv6V9 HhyShVTEpg/MkoZy6ihOGqolXZDVYOaPc4/uk4Y+FsTiMKaUT9Nky+TEtV3aAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733529705; a=rsa-sha256; cv=none; b=ekQ2L3AQ+ufG9ZNwxMuN0ZTzxAJKZYONNXNR48w+GnM1zMMkq/lG5ra0EFoMALVdmJxiHF hRl7iT265hhHJ9A4JxCFbEfUqXW6jWRYlM7EDd1E2/H/p/K8AxKUUdbdOGcNoIgAQ05FP3 djamzhIQfZlqitYAi9KlzmxpMmKq0YPMGJzs3GvdOJB2X4HZRVih5sNrEI8BCxE/z6J6+y UjecMw5ykli/yy2831CnmcNuEI5J255WaAVzitgsHjBADDVPADDQVVHI30XfmuyByidnYU n72p4/LQ9kX+JKRY0gm4nJuDZRJJdaOmUDYOAgOEK7cchy0rEyrg/FSVUNYwAA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y4pFj18z3z10HG; Sat, 7 Dec 2024 00:01:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B701jOb055015; Sat, 7 Dec 2024 00:01:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B701jFe055012; Sat, 7 Dec 2024 00:01:45 GMT (envelope-from git) Date: Sat, 7 Dec 2024 00:01:45 GMT Message-Id: <202412070001.4B701jFe055012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4651f4be1ed3 - stable/13 - ACPI: Treat all 20-element _BIX entires as revision 0 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4651f4be1ed36d72f6d299a040f9a41eeb5c43c4 Auto-Submitted: auto-generated The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4651f4be1ed36d72f6d299a040f9a41eeb5c43c4 commit 4651f4be1ed36d72f6d299a040f9a41eeb5c43c4 Author: Bartosz Fabianowski AuthorDate: 2024-10-02 18:21:28 +0000 Commit: Warner Losh CommitDate: 2024-12-07 00:01:59 +0000 ACPI: Treat all 20-element _BIX entires as revision 0 Some Fujitsu Lifebooks return an invalid _BIX object. The first element of _BIX is a revision number, which indicates what elements will follow: * ACPI 4.0 defined _BIX revision 0 with 20 elements. * ACPI 6.0 introduced _BIX revision 1 with 21 elements. The problem is that the offending Lifebooks have the a non-zero _BIX revision, but provide 20 fields only. The ACPICA parser chokes on this [1], but that seems to be inconsequential. More importantly, our own battery info handling code also verifies that for revision > 0, there are at least 21 fields - and refuses to process the invalid _BIX. One workaround would be to introduce special case / quirk handling for Fujitsu Lifebooks. A better one is to relax the requirements check: If there are only 20 elements, treat the _BIX as revision 0, no matter what revision number was provided by the device. Linux doesn't run into this problem by the way because it only supports the 20 fields defined in the ACPI 4.0 spec [3]. It never looks at the revision number or the 21st field added in ACPI 6.0. [1] https://cgit.freebsd.org/src/tree/sys/contrib/dev/acpica/components/namespace/nsprepkg.c#n815 [2] https://cgit.freebsd.org/src/tree/sys/dev/acpica/acpi_cmbat.c#n371 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/acpi/battery.c#n418 PR: 252030 Reviewed by: imp MFC After: 2 weeks (cherry picked from commit cd8c3af747cc300c8257c315c7576644e2bb86ff) --- sys/dev/acpica/acpi_cmbat.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/dev/acpica/acpi_cmbat.c b/sys/dev/acpica/acpi_cmbat.c index 553cce3ab292..7b0d541d2441 100644 --- a/sys/dev/acpica/acpi_cmbat.c +++ b/sys/dev/acpica/acpi_cmbat.c @@ -399,8 +399,17 @@ acpi_cmbat_get_bix(void *arg) sc->bix.rev != ACPI_BIX_REV_1) ACPI_BIX_REV_MISMATCH_ERR(sc->bix.rev, ACPI_BIX_REV_1); } else if (ACPI_PKG_VALID_EQ(res, 20)) {/* ACPI 4.0 _BIX */ - if (sc->bix.rev != ACPI_BIX_REV_0) - ACPI_BIX_REV_MISMATCH_ERR(sc->bix.rev, ACPI_BIX_REV_0); + /* + * Some models claim to be rev.1, but have a _BIX with only 20 + * members. Be lenient and treat this as a valid rev.0 _BIX. + */ + if (sc->bix.rev != ACPI_BIX_REV_0) { + ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), + "_BIX containing too few objects for revision %u. " + "Treating as revision %u instead.\n", + sc->bix.rev, ACPI_BIX_REV_0); + sc->bix.rev = ACPI_BIX_REV_0; + } } else if (ACPI_PKG_VALID(res, 22)) { /* _BIX with 22 or more members. */ if (ACPI_BIX_REV_MIN_CHECK(sc->bix.rev, ACPI_BIX_REV_1 + 1)) {