Date: Thu, 27 Feb 2025 14:16:46 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 57720609f705 - stable/14 - powerpc: Add RF_LITTLEENDIAN resource flag Message-ID: <202502271416.51REGkM7016124@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=57720609f705edaea4afc245d6f877530b741f69 commit 57720609f705edaea4afc245d6f877530b741f69 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-01-23 17:38:36 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2025-02-27 13:09:21 +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 (cherry picked from commit a82470212b7659afb7d3287e2ccae72d5e496b71) --- 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 9279a8d43810..5fdd05282676 100644 --- a/sys/powerpc/mpc85xx/fsl_sata.c +++ b/sys/powerpc/mpc85xx/fsl_sata.c @@ -353,9 +353,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 a2043c3cfdf9..826e75daa374 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -276,14 +276,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502271416.51REGkM7016124>