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
This commit is contained in:
Andrew Turner 2021-01-25 20:03:47 +00:00
parent 7012461c9b
commit dd6c1c2a6c
2 changed files with 9 additions and 17 deletions

View File

@ -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);

View File

@ -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;