From nobody Sat Nov 02 18:25:14 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 4XgmP63Mthz5cThw; Sat, 02 Nov 2024 18:25:14 +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 4XgmP62ngSz4lfN; Sat, 2 Nov 2024 18:25:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730571914; 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=2ESdlHL4M6v5Ya2PrQN3gwQ9VHS1O7zKUbQkZ8qoYyM=; b=ucvYVRpN2x6s5opKmmz6Z16EknVuidpnFsVQj68oXKIS+nRQK4OdEyf8Ss1ISaLwMdts+w ma+oYYoBHQ/3igOMNp9oyrkdr62ta9hp1gTXowuBx/27jMqYDs1iRSTaEjpDf3Y1t/tOg+ 5BLSORFRG/4cjDXhIOx2FTkrhqZI/+QUAG9GyTsdhgr1I2E8BE/V3wd4fu8WCff1QF6N9y YCR9+uBBAbT8VL3T4INumTKat1tCJabp1HLmLqoAZP6ZRO+OORujIrP7aZPq8I+YyVtpW0 7sloUkDF/WzU4IRIbmCSjVlPImns8p01fE47E50qe1awtVXXuJ0PZKWYLOSSfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730571914; 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=2ESdlHL4M6v5Ya2PrQN3gwQ9VHS1O7zKUbQkZ8qoYyM=; b=Rf1kNO5mPvOcbbcAY15DWpj/0r224DFqmDFulh5x97YSMyZ2DziDkciPbzhoj6aqxI4015 lbRmORs6s3earieg1GMhpZcjL5pTYxuhGIN7RhFE2BTct7iqPH9kNXLxAp80b6I+sL17dP QnpJukD7O8pARDfsVqogf734gaEWLrIV2c9XSPQF036cV8yapT/SfdqrT/nKP3SY/xfyme nFlhUPH3+1y8if7HubN+CZJi5R/OfzAu+cYwco8CT295f06XufuHm3xNnOEJNAC47sM3sI 7eh8/HLCBhAl+CulDe16ld176svtNywuChf6n2OSfo7Ca3AoouX2m1b+tdXQRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730571914; a=rsa-sha256; cv=none; b=lOFF6aY/FVwOCXKnLXW6tgcN74XqVtAirfId9nsryvt8tm23xN+hT1hQ9heJebc4slV8Up NGXcSY+9d2X4nxPNY0RkLSNIj1vLVQUi1+7kO1l3HH9QolAyR+xzdZcMTEhPZVRPORLyt1 HO126FdjbuhtTqXCzZqQKGCMdHdZ49ctcvp5nAoM4aDfUl+9LNzYFlVN2l/ZAF+Y+WLyt/ YkZ2FrZW4b9qtGv0heba8WcZxpuhl54hmubyVNlKXsDIG8rf/hHF2aMumAESQSTLS1Iidy O4V/Q+X+y9vpU9zTs+Y8KUf2x+j67NhocheMONQVRtNJBNtzMlGPTTdZGjetJw== 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 4XgmP62KSVzG88; Sat, 2 Nov 2024 18:25:14 +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 4A2IPEed003264; Sat, 2 Nov 2024 18:25:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A2IPEKB003261; Sat, 2 Nov 2024 18:25:14 GMT (envelope-from git) Date: Sat, 2 Nov 2024 18:25:14 GMT Message-Id: <202411021825.4A2IPEKB003261@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: 3514f98940a0 - main - newbus: Introduce bus_get_pass() and hide bus_current_pass 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/main X-Git-Reftype: branch X-Git-Commit: 3514f98940a0d43264ef9e13990c8c70a4252e04 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3514f98940a0d43264ef9e13990c8c70a4252e04 commit 3514f98940a0d43264ef9e13990c8c70a4252e04 Author: Elliott Mitchell AuthorDate: 2024-10-06 00:19:04 +0000 Commit: Warner Losh CommitDate: 2024-11-02 18:25:34 +0000 newbus: Introduce bus_get_pass() and hide bus_current_pass There's no reason to write to bus_current_pass outside of the controlled times subr_bus.c does it, so move to an accessor and make bus_current_pass private to newbus. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1457 --- sys/arm/freescale/imx/imx6_anatop.c | 2 +- sys/arm/nvidia/drm2/tegra_host1x.c | 2 +- sys/arm/ti/omap4/omap4_prcm_clks.c | 2 +- sys/kern/subr_bus.c | 18 ++++++++++++++++-- sys/sys/bus.h | 4 +--- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/sys/arm/freescale/imx/imx6_anatop.c b/sys/arm/freescale/imx/imx6_anatop.c index d0daa7c951de..740f185bfb8b 100644 --- a/sys/arm/freescale/imx/imx6_anatop.c +++ b/sys/arm/freescale/imx/imx6_anatop.c @@ -670,7 +670,7 @@ imx6_anatop_new_pass(device_t dev) * that attach on the CPU pass). */ sc = device_get_softc(dev); - if (!sc->cpu_init_done && bus_current_pass >= cpu_init_pass) { + if (!sc->cpu_init_done && bus_get_pass() >= cpu_init_pass) { sc->cpu_init_done = true; cpufreq_initialize(sc); initialize_tempmon(sc); diff --git a/sys/arm/nvidia/drm2/tegra_host1x.c b/sys/arm/nvidia/drm2/tegra_host1x.c index 4384ab0bc976..e04a50e4c003 100644 --- a/sys/arm/nvidia/drm2/tegra_host1x.c +++ b/sys/arm/nvidia/drm2/tegra_host1x.c @@ -448,7 +448,7 @@ host1x_new_pass(device_t dev) * but some of our FDT resources are not ready until BUS_PASS_DEFAULT */ sc = device_get_softc(dev); - if (sc->attach_done || bus_current_pass < BUS_PASS_DEFAULT) { + if (sc->attach_done || bus_get_pass() < BUS_PASS_DEFAULT) { bus_generic_new_pass(dev); return; } diff --git a/sys/arm/ti/omap4/omap4_prcm_clks.c b/sys/arm/ti/omap4/omap4_prcm_clks.c index 73ef67a19d47..63c679f178bc 100644 --- a/sys/arm/ti/omap4/omap4_prcm_clks.c +++ b/sys/arm/ti/omap4/omap4_prcm_clks.c @@ -1459,7 +1459,7 @@ omap4_prcm_new_pass(device_t dev) unsigned int freq; if (sc->attach_done || - bus_current_pass < (BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY)) { + bus_get_pass() < (BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY)) { bus_generic_new_pass(dev); return; } diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index c1f75dd30126..2dbe1072aa83 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -437,7 +437,7 @@ bus_topo_unlock(void) */ static driver_list_t passes = TAILQ_HEAD_INITIALIZER(passes); -int bus_current_pass = BUS_PASS_ROOT; +static int bus_current_pass = BUS_PASS_ROOT; /** * @internal @@ -474,6 +474,20 @@ driver_register_pass(struct driverlink *new) TAILQ_INSERT_TAIL(&passes, new, passlink); } +/** + * @brief Retrieve the current bus pass + * + * Retrieves the current bus pass level. Call the BUS_NEW_PASS() + * method on the root bus to kick off a new device tree scan for each + * new pass level that has at least one driver. + */ +int +bus_get_pass(void) +{ + + return (bus_current_pass); +} + /** * @brief Raise the current bus pass * @@ -481,7 +495,7 @@ driver_register_pass(struct driverlink *new) * method on the root bus to kick off a new device tree scan for each * new pass level that has at least one driver. */ -void +static void bus_set_pass(int pass) { struct driverlink *dl; diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 4f34990cd10f..1f5e074cfe5a 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -818,9 +818,7 @@ void bus_data_generation_update(void); #define BUS_LOCATOR_UEFI "UEFI" #define BUS_LOCATOR_OFW "OFW" -extern int bus_current_pass; - -void bus_set_pass(int pass); +int bus_get_pass(void); /** * Routines to lock / unlock the newbus lock.