From nobody Sat Jul 01 17:20:45 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 4Qtf8s4mYFz4l8Wr; Sat, 1 Jul 2023 17:20: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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qtf8s3R8fz3pL2; Sat, 1 Jul 2023 17:20:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688232045; 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=GuisOGvfDIqH5BdKHHquiCZDjtVCxROL8HGU98w/tvo=; b=sYQGlvxKccnQKfXr9yKkuU5D59zUCAtlULfH+xg2/jMh4AmGpMqehl0hbzvFIq+FCz+kos FxhAi/L+UfDQhaF3xIuz0L/tRMEulD3aAV8v+wc1qkry1KaUoGMfEbGYW0ygq0FNpm0YZw mNQhhqv2FF22TLfLXQ2Wo7ThBRgWtO3T5JThrxhCE5imMVxDTemu8HFzxgG5u+FiZLtOsZ x1EFZRtckjx2B5WuvH27QqqeJi/nBXfz8gekMze7OwB+/humGKCPs4jlAkEfQ2Ganksb70 5L3B7/V1oB7CB+wYEhN+OE90TEHTeJ2qjAv63xVFRh9YLbjjapBlzXOH9YGeBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688232045; 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=GuisOGvfDIqH5BdKHHquiCZDjtVCxROL8HGU98w/tvo=; b=m//IKUaG1d1yDcMQnd89oTIFDc1cl5vr+ja70jUgmrPVTTR9TTvXxw0DysfxxqY/++QJLX Re03q0gfGLXe/E1owCHrM7yyOUa7BWyIvuuHlLGbZebMpbcSywIZKMeZ1YBJmggLMwXFbk axiNyd7l+/bWWvPQ0r1b1NLxPXuMF2i2LawNRBTV1Ea6zM90Pm4zKtsCVtm4MgIckPRYvX cev0AqxEiJrSoumhYexmVL2pHFFZVTSWCsmzgUjHN+d6WNl570++3nKFH9FNjSBDU8YG05 zotqqWRP7tG+LIHdXIK8TR3r20e03K8v0S5BikZazafNVDVQcexghyvjAdRPdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688232045; a=rsa-sha256; cv=none; b=BwLTvXuYdq/gKTsd8hl1ImtutvhmmEm6bYL80EiLaNKlRXwOiNNNPLEDw8M4nl+GPeGasI 4WCHa+EvMQmImaDFMkzuDdkCFVbuB5OUqp+Bi+DSFZkCGfqFXk/eMKqsC9YUPTqItgkHnH COALjsEdBA6T2n0/yA5ZxIR1WzXq8Lxjpwi1WM2wsDp14rdTqAjAOMzCmHkXlx+9lYCtww lOGMkPRQJo4JplGGaCEeE7xRGNA/rbsMmha0MwEV/BDD6t4Q2+ohLilRqrhCnaPfT1wW5l ZtalPnZ3VLCBuol9mn4IBGg0evXwOlGb3GnrVMtikUQqOUG+n01E/3V/RQ7VMQ== 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 4Qtf8s2LyhzYwc; Sat, 1 Jul 2023 17:20:45 +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 361HKjnZ066332; Sat, 1 Jul 2023 17:20:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 361HKjra066331; Sat, 1 Jul 2023 17:20:45 GMT (envelope-from git) Date: Sat, 1 Jul 2023 17:20:45 GMT Message-Id: <202307011720.361HKjra066331@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: a0bcfa78313b - main - superio: Handle conflicting devid via prefer/extid 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: a0bcfa78313b429a958149e045f4069b2ed8c984 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a0bcfa78313b429a958149e045f4069b2ed8c984 commit a0bcfa78313b429a958149e045f4069b2ed8c984 Author: Stéphane Rochoy AuthorDate: 2023-07-01 17:19:44 +0000 Commit: Warner Losh CommitDate: 2023-07-01 17:19:51 +0000 superio: Handle conflicting devid via prefer/extid Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/719 --- sys/dev/superio/superio.c | 20 ++++++++++++++++++++ sys/dev/superio/superio.h | 1 + 2 files changed, 21 insertions(+) diff --git a/sys/dev/superio/superio.c b/sys/dev/superio/superio.c index 1e4782277c0e..6db2b0685c1c 100644 --- a/sys/dev/superio/superio.c +++ b/sys/dev/superio/superio.c @@ -93,6 +93,7 @@ struct siosc { superio_vendor_t vendor; uint16_t devid; uint8_t revid; + int extid; uint8_t current_ldn; uint8_t ldn_reg; uint8_t enable_reg; @@ -292,6 +293,7 @@ static const struct { superio_vendor_t vendor; uint16_t devid; uint16_t mask; + int extid; /* Extra ID: used to handle conflicting devid. */ const char *descr; const struct sio_device *devices; } superio_table[] = { @@ -483,6 +485,7 @@ superio_detect(device_t dev, bool claim, struct siosc *sc) int error; int rid; int i, m; + int prefer; error = bus_get_resource(dev, SYS_RES_IOPORT, 0, &port, &count); if (error != 0) @@ -507,6 +510,11 @@ superio_detect(device_t dev, bool claim, struct siosc *sc) return (ENXIO); } + prefer = 0; + resource_int_value(device_get_name(dev), device_get_unit(dev), "prefer", &prefer); + if (bootverbose && prefer > 0) + device_printf(dev, "prefer extid %d\n", prefer); + for (m = 0; methods_table[m] != NULL; m++) { methods_table[m]->enter(res, port); if (methods_table[m]->vendor == SUPERIO_VENDOR_ITE) { @@ -533,6 +541,8 @@ superio_detect(device_t dev, bool claim, struct siosc *sc) continue; if ((superio_table[i].devid & ~mask) != (devid & ~mask)) continue; + if (prefer > 0 && prefer != superio_table[i].extid) + continue; break; } @@ -558,6 +568,7 @@ superio_detect(device_t dev, bool claim, struct siosc *sc) sc->io_port = port; sc->devid = devid; sc->revid = revid; + sc->extid = superio_table[i].extid; KASSERT(sc->vendor == SUPERIO_VENDOR_ITE || sc->vendor == SUPERIO_VENDOR_NUVOTON || @@ -877,6 +888,15 @@ superio_revid(device_t dev) return (sc->revid); } +int +superio_extid(device_t dev) +{ + device_t sio_dev = device_get_parent(dev); + struct siosc *sc = device_get_softc(sio_dev); + + return (sc->extid); +} + uint8_t superio_ldn_read(device_t dev, uint8_t ldn, uint8_t reg) { diff --git a/sys/dev/superio/superio.h b/sys/dev/superio/superio.h index 997bcb2c6efd..b12df6ef8a82 100644 --- a/sys/dev/superio/superio.h +++ b/sys/dev/superio/superio.h @@ -49,6 +49,7 @@ typedef enum superio_dev_type { superio_vendor_t superio_vendor(device_t dev); uint16_t superio_devid(device_t dev); uint8_t superio_revid(device_t dev); +int superio_extid(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);