From nobody Mon Feb 13 17:52:26 2023 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 4PFsP71Rnbz3rYL0; Mon, 13 Feb 2023 17:52:27 +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 4PFsP66fZBz3srG; Mon, 13 Feb 2023 17:52:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676310746; 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=zu827UAFCDJZ2QyysD17yyQmu723E55EWGkIYoQcOzM=; b=b2bCMO1nabyiyL0qTsr6NSPhRtq6xRL/sdi2Am+VQIwxt7TZ6SmmHAAbARzVUOnp9B2p4N bSMZY7iIXUt3dL2n8mjq9g/Kie9/xhXsuYY20b7Lbe1zni8JVhw3MXF1o3gdzSb2GqtoRy 85/ogZeS7ERNw0WZgdUDgBlnDS1aiZlNxn5qZCiBlVnRsDLL/nu5i6qZl61AQ6CVFVuTlV 4oBAEB3enkxOa4+RZTpHsUZar1JZ1ELPcbMxavQmfgLwzska5CflqIjK52hsJi01bFBThT kW+aIhFl+e7d5/65weJV32XoCTGfzz2mRlLRinJV/7pdwGCmrVIVDq6eIk75KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676310746; 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=zu827UAFCDJZ2QyysD17yyQmu723E55EWGkIYoQcOzM=; b=fDX9XxuVocMAJxibSGKUprVLz0uJ7WtYlOrC5hw1v0/4s2dCrjXu6zL94vcLf/D6ng3F41 LPJ+Ht31h+8ygKXerCVSyd16S3GxwztlBmXEi06FkR6pFNrG/vAOpqcAb1Znb96A2g/ToG R6tRwHckKd1bfayY1jU1hWFJktmQmlOxX9q6frveWB9ovAD+D1YfIZ1hxdTP8NL2gS9p4Y x3Mkr824/6vMWu4n5HKSBgTtSa2i6KhnYDAe9f/CGy1IXd6kP9c28SNyfImhLEJ10Wh9MJ LXEPMyka5AwusDN7p41X//o1yHGbaT9I/CTcVhR6mInO7zd3PI7flB6X9TX3Uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676310746; a=rsa-sha256; cv=none; b=hdI89sKmw4r0W6zLt4NzZpokd/G9e8TLfkhUg8PPbWFNB8fGrWGSjPI+Iblkoof6ap12Sx VZx4mmfwZyc+kLJlXDKCEbETdfJaGQSDovcMV6ffkkol7shdRm4bxEwkPQ9hSK0h/ADM8h LyZ6hz3gQth/+rfoCrFUaI4zxBihBR9ao2XER9HVW4egHk11rOcuy/G/70yWT9PhaxyaRi cKRi7FDs58VZxejBtqvlrIjvI2oRRc3gyKr7TCSWVRx6A4uhJJ0ErKhqevY8WGkU/V/xNB bKhjkmZZ/IeOAcO6stIT48LeYWVJl7YEUEwdOerEmPZOiW2wqNurxCjBPfpEGw== 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 4PFsP65BgGzS99; Mon, 13 Feb 2023 17:52:26 +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 31DHqQQZ082112; Mon, 13 Feb 2023 17:52:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31DHqQrC082111; Mon, 13 Feb 2023 17:52:26 GMT (envelope-from git) Date: Mon, 13 Feb 2023 17:52:26 GMT Message-Id: <202302131752.31DHqQrC082111@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: 53d5e65eead0 - main - ofwbus: remove arm64 ifdefs 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 53d5e65eead0f713c5e256018d46edbec0a96c11 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=53d5e65eead0f713c5e256018d46edbec0a96c11 commit 53d5e65eead0f713c5e256018d46edbec0a96c11 Author: Mitchell Horne AuthorDate: 2023-02-13 17:43:25 +0000 Commit: Mitchell Horne CommitDate: 2023-02-13 17:45:01 +0000 ofwbus: remove arm64 ifdefs Rather than using the DEVICE_IDENTIFY method, let's have other ofwbus-using platforms add ofwbus0 explicitly in nexus, like arm64. This gives them the same flexibility, e.g. if riscv starts supporting ACPI, and cleans up the #ifdefs. We were doing this already on riscv, but adjust the 'order' parameters. Reviewed by: andrew, jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D38492 --- sys/arm/arm/nexus.c | 5 ++++- sys/dev/ofw/ofwbus.c | 25 ++----------------------- sys/powerpc/powerpc/nexus.c | 4 ++++ sys/riscv/riscv/nexus.c | 10 +++++++--- 4 files changed, 17 insertions(+), 27 deletions(-) diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c index a2e043ff7c31..0cd960ec3682 100644 --- a/sys/arm/arm/nexus.c +++ b/sys/arm/arm/nexus.c @@ -182,8 +182,11 @@ nexus_attach(device_t dev) if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) panic("nexus_attach irq_rman"); + /* First, add ofwbus0. */ + device_add_child(dev, "ofwbus", 0); + /* - * First, deal with the children we know about already + * Next, deal with the children we know about already. */ bus_generic_probe(dev); bus_generic_attach(dev); diff --git a/sys/dev/ofw/ofwbus.c b/sys/dev/ofw/ofwbus.c index a466da546579..cc8c66170cdb 100644 --- a/sys/dev/ofw/ofwbus.c +++ b/sys/dev/ofw/ofwbus.c @@ -54,12 +54,10 @@ __FBSDID("$FreeBSD$"); * The ofwbus (which is a pseudo-bus actually) iterates over the nodes that * hang from the Open Firmware root node and adds them as devices to this bus * (except some special nodes which are excluded) so that drivers can be - * attached to them. + * attached to them. There should be only one ofwbus in the system, added + * directly as a child of nexus0. */ -#ifndef __aarch64__ -static device_identify_t ofwbus_identify; -#endif static device_probe_t ofwbus_probe; static device_attach_t ofwbus_attach; static bus_alloc_resource_t ofwbus_alloc_resource; @@ -67,9 +65,6 @@ static bus_release_resource_t ofwbus_release_resource; static device_method_t ofwbus_methods[] = { /* Device interface */ -#ifndef __aarch64__ - DEVMETHOD(device_identify, ofwbus_identify), -#endif DEVMETHOD(device_probe, ofwbus_probe), DEVMETHOD(device_attach, ofwbus_attach), @@ -87,28 +82,12 @@ EARLY_DRIVER_MODULE(ofwbus, nexus, ofwbus_driver, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(ofwbus, 1); -#ifndef __aarch64__ -static void -ofwbus_identify(driver_t *driver, device_t parent) -{ - - /* Check if Open Firmware has been instantiated */ - if (OF_peer(0) == 0) - return; - - if (device_find_child(parent, "ofwbus", -1) == NULL) - BUS_ADD_CHILD(parent, 0, "ofwbus", -1); -} -#endif - static int ofwbus_probe(device_t dev) { -#ifdef __aarch64__ if (OF_peer(0) == 0) return (ENXIO); -#endif device_set_desc(dev, "Open Firmware Device Tree"); return (BUS_PROBE_NOWILDCARD); diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index 2e756782d47d..c0d4f8396cfa 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -146,6 +146,10 @@ nexus_attach(device_t dev) rman_manage_region(&mem_rman, 0, BUS_SPACE_MAXADDR) != 0) panic("%s: failed to set up rmans.", __func__); + /* Add ofwbus0. */ + device_add_child(dev, "ofwbus", 0); + + /* Now, probe children. */ bus_generic_probe(dev); bus_generic_attach(dev); diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index ae0bfe388484..33720475844f 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -165,9 +165,13 @@ nexus_attach(device_t dev) if (rman_init(&irq_rman) || rman_manage_region(&irq_rman, 0, ~0)) panic("nexus_attach irq_rman"); - nexus_add_child(dev, 8, "timer", 0); - nexus_add_child(dev, 9, "rcons", 0); - nexus_add_child(dev, 10, "ofwbus", 0); + /* + * Add direct children of nexus. Devices will be probed and attached + * through ofwbus0. + */ + nexus_add_child(dev, 0, "timer", 0); + nexus_add_child(dev, 1, "rcons", 0); + nexus_add_child(dev, 2, "ofwbus", 0); bus_generic_probe(dev); bus_generic_attach(dev);