Date: Wed, 27 Jan 2021 19:09:53 GMT From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: dd6c1c2a6c0d - main - Remove redundantcy from the arm GIC softc Message-ID: <202101271909.10RJ9rVj097419@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dd6c1c2a6c0d3ac239b55105b6726a594ba79c60 commit dd6c1c2a6c0d3ac239b55105b6726a594ba79c60 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2021-01-25 20:03:47 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2021-01-27 19:03:39 +0000 Remove redundantcy from the arm GIC softc A struct recource already contains the bus_space_tag_t and bus_space_handle_t. There is no neec to read them and store them again in the drivers softc. Remove them and use the struct resource directly with bus_read_* and bus_write_*. Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D28339 --- sys/arm/arm/gic.c | 20 +++++++------------- sys/arm/arm/gic.h | 6 ++---- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index 8fcf511fda08..1851e69644ed 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -143,16 +143,18 @@ static u_int arm_gic_map[MAXCPU]; static struct arm_gic_softc *gic_sc = NULL; +/* CPU Interface */ #define gic_c_read_4(_sc, _reg) \ - bus_space_read_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg)) + bus_read_4((_sc)->gic_res[GIC_RES_CPU], (_reg)) #define gic_c_write_4(_sc, _reg, _val) \ - bus_space_write_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg), (_val)) + bus_write_4((_sc)->gic_res[GIC_RES_CPU], (_reg), (_val)) +/* Distributor Interface */ #define gic_d_read_4(_sc, _reg) \ - bus_space_read_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg)) + bus_read_4((_sc)->gic_res[GIC_RES_DIST], (_reg)) #define gic_d_write_1(_sc, _reg, _val) \ - bus_space_write_1((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val)) + bus_write_1((_sc)->gic_res[GIC_RES_DIST], (_reg), (_val)) #define gic_d_write_4(_sc, _reg, _val) \ - bus_space_write_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val)) + bus_write_4((_sc)->gic_res[GIC_RES_DIST], (_reg), (_val)) static inline void gic_irq_unmask(struct arm_gic_softc *sc, u_int irq) @@ -321,14 +323,6 @@ arm_gic_attach(device_t dev) /* Initialize mutex */ mtx_init(&sc->mutex, "GIC lock", NULL, MTX_SPIN); - /* Distributor Interface */ - sc->gic_d_bst = rman_get_bustag(sc->gic_res[0]); - sc->gic_d_bsh = rman_get_bushandle(sc->gic_res[0]); - - /* CPU Interface */ - sc->gic_c_bst = rman_get_bustag(sc->gic_res[1]); - sc->gic_c_bsh = rman_get_bushandle(sc->gic_res[1]); - /* Disable interrupt forwarding to the CPU interface */ gic_d_write_4(sc, GICD_CTLR, 0x00); diff --git a/sys/arm/arm/gic.h b/sys/arm/arm/gic.h index 3df226c2819a..74cfbbee9d5a 100644 --- a/sys/arm/arm/gic.h +++ b/sys/arm/arm/gic.h @@ -49,11 +49,9 @@ struct arm_gic_softc { device_t gic_dev; void * gic_intrhand; struct gic_irqsrc * gic_irqs; +#define GIC_RES_DIST 0 +#define GIC_RES_CPU 1 struct resource * gic_res[3]; - bus_space_tag_t gic_c_bst; - bus_space_tag_t gic_d_bst; - bus_space_handle_t gic_c_bsh; - bus_space_handle_t gic_d_bsh; uint8_t ver; struct mtx mutex; uint32_t nirqs;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101271909.10RJ9rVj097419>