From nobody Sat Jul 01 17:20:42 2023 X-Original-To: dev-commits-src-main@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 4Qtf8q2BQpz4l8ZR; Sat, 1 Jul 2023 17:20:43 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qtf8q1WBVz3pGj; Sat, 1 Jul 2023 17:20:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688232043; 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=uE1hYWo3BkGFsR6TrHWoGFAHQWOeaWqibzJOvQx/O/c=; b=AWGhFllmboANObVYsNSowf8rb2iNDB7g5AsXh4Z3a9hNoTA1XD+cvvTK1j7K3OUxOwpMGR qvCoFasos/le490ab1EgDaQtweIIIIGbU6GxOfRNz1dOcokBlESO8vjtmgCTI/WORYwTyF 3F05MvtVLsNWbwMK+locpO/QIXKbyvGtKVD9oYp2t+nR4wqzjMKOu+Y7tGzQ/rpFY+j3F8 IRRW4Oc5twdm9elVsTHpVqW89MoUlzBiZ+0IqTkC3ofveuxkuksgArLrj0+TTPrN4bSAdN 5XUw/5/7d2mZcsQNwH8UbMWdSpvnpcassxyWR3gsUW9faGcq8rUaRbpIuVtdvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688232043; 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=uE1hYWo3BkGFsR6TrHWoGFAHQWOeaWqibzJOvQx/O/c=; b=HXRnW1bgTcx6j5LP3/kB9X96t/P6nAnEinGr8lYLIEUAo1JQC1WFSw7cYQWx5Xi3ob908I 9f+YwkJa5y352CnsMXFKu1mHfrv3NWVtVIFDf8XiB+guJPhZGC2+8YeRv+UUOEfbVnXVer EPHRHvdNHJbHkdkzRcv5zOCPtR64cSS6OeOF2zvZJHwE2I8Tym6m3j9NFwWq7YViXm3JyW YdtTR8768UZMRmojW9mpDzhAH+SrjtC6lfRXnk406GLXGTPl48bvGCy/9d91gsbLNBh7+M YKq5OYLt1Mmq+jS0NfjiOvG1vtRMPRYhGDqCNvoKgCTiV2q7p4slIgev/9ohuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688232043; a=rsa-sha256; cv=none; b=C+ZeDc3r6dSQSZ4jnMPB+grEwZTE235Lcho+l/Zt6HA65SeOk1w8iLRgb+cSU3rpsprYJ4 Uk7oueTogltLIQkYiYhUyy1JDLfc27Fw0RmQLziH2eUF0j1i5gSfxF+ECSaN+zWYeYFE50 f7HPZhniDQacUWoNk6yR+ghlBEcQ2+74O3Ub7LTI15koodQsdEvyiI+e5V2NL6iJqf1O7f 1BFtuWQ0kZKnG9oABftDSoXbWwo+qAbBGJvgkUoJjG4TTFd1Q3iyonqaKP4r6lPQUOIznB aHDXpksUkqohBvyWZLmIhL0plCo5nowCl4DovfloF23lwZeg4eLnf9D5zAwcFA== 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 4Qtf8q0TNtzYsY; Sat, 1 Jul 2023 17:20:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 361HKh7o066290; Sat, 1 Jul 2023 17:20:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 361HKgt1066289; Sat, 1 Jul 2023 17:20:42 GMT (envelope-from git) Date: Sat, 1 Jul 2023 17:20:42 GMT Message-Id: <202307011720.361HKgt1066289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 26a0a4035e51 - main - superio: Add superio_ldn_read and superio_ldn_write List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 26a0a4035e517d633b96cbcfe6b75bddec553ec3 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=26a0a4035e517d633b96cbcfe6b75bddec553ec3 commit 26a0a4035e517d633b96cbcfe6b75bddec553ec3 Author: Stéphane Rochoy AuthorDate: 2023-07-01 17:19:44 +0000 Commit: Warner Losh CommitDate: 2023-07-01 17:19:49 +0000 superio: Add superio_ldn_read and superio_ldn_write Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/719 --- sys/dev/superio/superio.c | 38 ++++++++++++++++++++++++++------------ sys/dev/superio/superio.h | 2 ++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/sys/dev/superio/superio.c b/sys/dev/superio/superio.c index 6f2e44450681..1e4782277c0e 100644 --- a/sys/dev/superio/superio.c +++ b/sys/dev/superio/superio.c @@ -564,7 +564,7 @@ superio_detect(device_t dev, bool claim, struct siosc *sc) sc->vendor == SUPERIO_VENDOR_FINTEK, ("Only ITE, Nuvoton and Fintek SuperIO-s are supported")); sc->ldn_reg = 0x07; - sc->enable_reg = 0x30; + sc->enable_reg = 0x30; /* FIXME enable_reg not used by nctgpio(4). */ sc->current_ldn = 0xff; /* no device should have this */ if (superio_table[i].descr != NULL) { @@ -877,30 +877,44 @@ superio_revid(device_t dev) return (sc->revid); } +uint8_t +superio_ldn_read(device_t dev, uint8_t ldn, uint8_t reg) +{ + device_t sio_dev = device_get_parent(dev); + struct siosc *sc = device_get_softc(sio_dev); + uint8_t v; + + sio_conf_enter(sc); + v = sio_ldn_read(sc, ldn, reg); + sio_conf_exit(sc); + return (v); +} + uint8_t superio_read(device_t dev, uint8_t reg) { - device_t sio_dev = device_get_parent(dev); - struct siosc *sc = device_get_softc(sio_dev); struct superio_devinfo *dinfo = device_get_ivars(dev); - uint8_t v; + + return (superio_ldn_read(dev, dinfo->ldn, reg)); +} + +void +superio_ldn_write(device_t dev, uint8_t ldn, uint8_t reg, uint8_t val) +{ + device_t sio_dev = device_get_parent(dev); + struct siosc *sc = device_get_softc(sio_dev); sio_conf_enter(sc); - v = sio_ldn_read(sc, dinfo->ldn, reg); + sio_ldn_write(sc, ldn, reg, val); sio_conf_exit(sc); - return (v); } void superio_write(device_t dev, uint8_t reg, uint8_t val) { - device_t sio_dev = device_get_parent(dev); - struct siosc *sc = device_get_softc(sio_dev); struct superio_devinfo *dinfo = device_get_ivars(dev); - sio_conf_enter(sc); - sio_ldn_write(sc, dinfo->ldn, reg, val); - sio_conf_exit(sc); + return (superio_ldn_write(dev, dinfo->ldn, reg, val)); } bool @@ -915,7 +929,7 @@ superio_dev_enabled(device_t dev, uint8_t mask) if (sc->vendor == SUPERIO_VENDOR_ITE && dinfo->ldn == 7) return (true); - v = superio_read(dev, sc->enable_reg); + v = superio_read(dev, sc->enable_reg); /* FIXME enable_reg not used by nctgpio(4). */ return ((v & mask) != 0); } diff --git a/sys/dev/superio/superio.h b/sys/dev/superio/superio.h index 993f95fc9fbb..997bcb2c6efd 100644 --- a/sys/dev/superio/superio.h +++ b/sys/dev/superio/superio.h @@ -50,7 +50,9 @@ superio_vendor_t superio_vendor(device_t dev); uint16_t superio_devid(device_t dev); uint8_t superio_revid(device_t dev); uint8_t superio_read(device_t dev, uint8_t reg); +uint8_t superio_ldn_read(device_t dev, uint8_t ldn, uint8_t reg); void superio_write(device_t dev, uint8_t reg, uint8_t val); +void superio_ldn_write(device_t dev, uint8_t ldn, uint8_t reg, uint8_t val); bool superio_dev_enabled(device_t dev, uint8_t mask); void superio_dev_enable(device_t dev, uint8_t mask); void superio_dev_disable(device_t dev, uint8_t mask);