From nobody Mon Feb 13 17:52:27 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 4PFsP83RCQz3rYR7; Mon, 13 Feb 2023 17:52:28 +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 4PFsP807kWz3srY; Mon, 13 Feb 2023 17:52:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676310748; 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=y7W5RiSsqc2VVLoZuTUL242bNFgQiCfdq9ZNWTK+g1E=; b=ewcMQYh+Zr+eVL3Np/9/vAs2jmAH0b3CdN8lnG59c+IWaMshvpd+vZtyRztmgNS/KOoCmd C23sFmpyZgT7eCFEsB714VFMjOht6PDTuKtZzTyB5a1rNqcmElleoHgiMXmwDfMI7XdX1o mnF7fiBQu/sAjE2vmw6xPdQtgbwyRw66BxUZP7lyyFpyV0pjka78Yu0+1KXIqkON9weqrP WytbhubbECDG/9yBTEb14zJ1m5MwcdVHEU2qLslydK2++E7+U/SgRdAjAH9JGCmYCrgWSs uUT3XZUiJQTxGyHjMM82gQOvqhL4w0WAh4DEC1AiUbEcrymBUlGsaSgf8oc3cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676310748; 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=y7W5RiSsqc2VVLoZuTUL242bNFgQiCfdq9ZNWTK+g1E=; b=Ta3WCfDhKYwQLpHSKC/KV6WF0xzX+JCghNosDzZjnWUn05hESMT2Atm1I1EJQbSkaQI0ND tSMSkHzOEtDUQTFqc7UwmCwKaTG1OxAWZnP5BTAE8L7nixH6LOr+h+2Qyu8HEkm/e7rbA2 xUj6NDiR7cI6/E+4auKeKpEMrINoqZ9Fin7Omsyzi+Z/tlEaa3gzUG+q39FQq94ab441a4 1IiyfUxwotKkJOOos5fNH9zugux9iJblci+33JL6n8RQI5ZSLZo8Zrw1cHz3t58cDFWZCo 6xeIJub2gTaYpIPy28SqRMSJOAyYTL3V9zp575QHaxOR2bHPxnog0ZWxj317Tg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676310748; a=rsa-sha256; cv=none; b=SvYqpeEry/eTQnDKY2YaTmVHx9Xc9GX4nYH65uXGDTBeFD8biGyEUzMZdBIsw4IMMY60hS A2Z46NCacpYTyKaDMzFkh2CS8utWj/qJB0wglJ+Py/pNx9KNxlT6sVF3JHufhIldNlUvRR +yDP3SGePbD/iw9xAw1KpTwG1A1CUxukxmHLTc8YALrUrNsxvQJrZP+iYPI3CQ9Aofr3Tm MIS08bYeZ5oKBlBVdywazeFSjfZPzRsPj03BRk56VjanTbBSF2tg0mgsdSnwX9+tTQAPr5 ya5NHllaaKaWNV1DAcOnYzlZYJfKG86VsOKTOiyfR0Ci1rQjsXP97wftaeM0JA== 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 4PFsP767KwzS9B; Mon, 13 Feb 2023 17:52:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31DHqRdA082145; Mon, 13 Feb 2023 17:52:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31DHqRAB082144; Mon, 13 Feb 2023 17:52:27 GMT (envelope-from git) Date: Mon, 13 Feb 2023 17:52:27 GMT Message-Id: <202302131752.31DHqRAB082144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: afca197f5240 - main - ofwbus: only allow unit number zero 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afca197f5240ce2c2c7abfe5c9fbc50ba55f178b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=afca197f5240ce2c2c7abfe5c9fbc50ba55f178b commit afca197f5240ce2c2c7abfe5c9fbc50ba55f178b Author: Mitchell Horne AuthorDate: 2023-02-13 17:44:03 +0000 Commit: Mitchell Horne CommitDate: 2023-02-13 17:45:01 +0000 ofwbus: only allow unit number zero ofwbus has always been the root of attachment for OFW/FDT platforms. It may have simplebus children, but we expect only one instance of the ofwbus driver, added directly by nexus. We may as well ensure this remains the case. Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D38493 --- sys/dev/ofw/ofwbus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/ofw/ofwbus.c b/sys/dev/ofw/ofwbus.c index cc8c66170cdb..80d013cd06ee 100644 --- a/sys/dev/ofw/ofwbus.c +++ b/sys/dev/ofw/ofwbus.c @@ -89,6 +89,11 @@ ofwbus_probe(device_t dev) if (OF_peer(0) == 0) return (ENXIO); + /* Only one instance of ofwbus. */ + if (device_get_unit(dev) != 0) + panic("ofwbus added with non-zero unit number: %d\n", + device_get_unit(dev)); + device_set_desc(dev, "Open Firmware Device Tree"); return (BUS_PROBE_NOWILDCARD); }