From nobody Tue Jan 23 17:46:06 2024 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 4TKDz25FQFz57mrc; Tue, 23 Jan 2024 17:46:06 +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 4TKDz23hnMz47W6; Tue, 23 Jan 2024 17:46:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706031966; 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=kh0nIWwLaWLdlU0CmJi9NHDz5oSnyHiF1Pk6JGDHHPk=; b=D+wCXWWYZCodAvcENQM7tcGg0fowX6sS/sSQqIJRSRO7pjDPdThrL5Bak5A6ZE4K0j++CZ RuKWCQp/5PlsUxFVbcQXt07Q81+dS7tfbQz28r3K/dzqKDjnI6ESZTnH3Bqc5vo9nTfQPf mKFW26TdS/PgQgN99NGiB0B3u6GLRsF5MYt/1oYznVU0tXLpqqCBL1+mThkyQ7B8KQ3tr2 tk/gQnFe+btvFs+a1hW5OC8xO8ou4NeDEOJjrDQka8fqVPESCfr3707NswmI2wNcHKTQDu Qx6NoXUDxQK7EWSzTzHDMIRal8MThoE/i2Z1eeB/dfo5o5S4i9mabS3r4I8EbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706031966; 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=kh0nIWwLaWLdlU0CmJi9NHDz5oSnyHiF1Pk6JGDHHPk=; b=kVwsqnifITHjasZN0NvPryeXmf0OuCbUyQ41Nmb8zslA16ky2ZjyAqYcvbXXWJb4YbqPUW JvgOHrtVSIBKs2zSQQnnT3J2DkfVprTMSQWSA/fgc33fX5RWcYlJVpeCb0ufKjDVFJtUrf TJOencEn9qSdNQRD2oCRyjoYf+Da7ne+bKdn3Wi4PWueKv8kO9xqs8SwKrtic/W7wZymEy 0SvpHIYFi/6nDc9HjoBPICTGY2SfIf9KLocxa0WZQH9Wj+lB/ci20fjkrbec7Ms+bi7GU0 v83dDAe2EjVKlqpmrwbTlJDScxJ3AR5Ks267EBdubg5cZnS/yzYEg0gPVEmTfQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706031966; a=rsa-sha256; cv=none; b=bjFljY0tOQN0MbQly84N9ZHbuWXPQak5Tr1YPP1u1O5H1b1ERX7l/U4XS8C4A/cDewxWHn jSWnD7RJLM1FpIhpkri9aZso19wjcvNgjUNhMc2M8QZqFz/ftAItlh6u6ZSOMiKVsflxs0 ibmmsJw4QFSsL042tsrrGnJcrcNO4zkv9sZwm8kMq+jM9aEsTaMDicO46Oj3Fq+iaPSDdc 6TGKbKaGl6m7jnBpCp5oMLiq5C4vpot6f6DDGGL2eP4U2TaJOY2ynB9PHuzBRnCfeCaKnl btLd60vAYW/iaYfXkLA2ltjg+ErTBSkAYASoaDjLj1QG68rXpSBgdmPWpwgZfg== 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 4TKDz22pyGzgcP; Tue, 23 Jan 2024 17:46:06 +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 40NHk613076226; Tue, 23 Jan 2024 17:46:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40NHk6F6076223; Tue, 23 Jan 2024 17:46:06 GMT (envelope-from git) Date: Tue, 23 Jan 2024 17:46:06 GMT Message-Id: <202401231746.40NHk6F6076223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a82470212b76 - main - powerpc: Add RF_LITTLEENDIAN resource flag 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a82470212b7659afb7d3287e2ccae72d5e496b71 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a82470212b7659afb7d3287e2ccae72d5e496b71 commit a82470212b7659afb7d3287e2ccae72d5e496b71 Author: John Baldwin AuthorDate: 2024-01-23 17:38:36 +0000 Commit: John Baldwin CommitDate: 2024-01-23 17:38:36 +0000 powerpc: Add RF_LITTLEENDIAN resource flag If this powerpc-specific flag is set on a resource, then the little-endian bus tag is always used when mapping that resource. Make use of this flag in the mpc85xx/fsl_sata driver to avoid setting the SATA BAR's bus tag after bus_alloc_resource. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D43553 --- sys/powerpc/include/resource.h | 7 +++++++ sys/powerpc/mpc85xx/fsl_sata.c | 3 +-- sys/powerpc/powerpc/nexus.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sys/powerpc/include/resource.h b/sys/powerpc/include/resource.h index 9477572176e0..e7e9493569cc 100644 --- a/sys/powerpc/include/resource.h +++ b/sys/powerpc/include/resource.h @@ -41,4 +41,11 @@ #define SYS_RES_IOPORT 4 /* i/o ports */ #define PCI_RES_BUS 5 /* PCI bus numbers */ +/* + * A powerpc-specific resource flag to request little-endian bus tags + * for a resource. + */ + +#define RF_LITTLEENDIAN RF_SPARE1 + #endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/powerpc/mpc85xx/fsl_sata.c b/sys/powerpc/mpc85xx/fsl_sata.c index 861aaba530e3..74fc40053fdc 100644 --- a/sys/powerpc/mpc85xx/fsl_sata.c +++ b/sys/powerpc/mpc85xx/fsl_sata.c @@ -352,9 +352,8 @@ fsl_sata_attach(device_t dev) } ch->r_mid = 0; if (!(ch->r_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &ch->r_mid, RF_ACTIVE))) + &ch->r_mid, RF_ACTIVE | RF_LITTLEENDIAN))) return (ENXIO); - rman_set_bustag(ch->r_mem, &bs_le_tag); fsl_sata_dmainit(dev); fsl_sata_slotsalloc(dev); fsl_sata_init(dev); diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index 3c71e1e79e3b..55afadcb4e20 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -275,14 +275,20 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, panic("%s:%d SYS_RES_IOPORT handling not implemented", __func__, __LINE__); /* XXX: untested map->r_bushandle = start; - map->r_bustag = nexus_get_bus_tag(NULL, NULL); + if ((rman_get_flags(r) & RF_LITTLEENDIAN) != 0) + map->r_bustag = &bs_le_tag; + else + map->r_bustag = nexus_get_bus_tag(NULL, NULL); map->r_size = length; map->r_vaddr = NULL; */ break; case SYS_RES_MEMORY: map->r_vaddr = pmap_mapdev_attr(start, length, args.memattr); - map->r_bustag = nexus_get_bus_tag(NULL, NULL); + if ((rman_get_flags(r) & RF_LITTLEENDIAN) != 0) + map->r_bustag = &bs_le_tag; + else + map->r_bustag = nexus_get_bus_tag(NULL, NULL); map->r_size = length; map->r_bushandle = (bus_space_handle_t)map->r_vaddr; break;