Index: sys/arm64/arm64/gic_v3.c =================================================================== --- sys/arm64/arm64/gic_v3.c +++ sys/arm64/arm64/gic_v3.c @@ -183,36 +183,44 @@ gic_r_read_4(device_t dev, bus_size_t offset) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - return (bus_read_4(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset)); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + return (bus_read_4(rdist, offset)); } uint64_t gic_r_read_8(device_t dev, bus_size_t offset) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - return (bus_read_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset)); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + return (bus_read_8(rdist, offset)); } void gic_r_write_4(device_t dev, bus_size_t offset, uint32_t val) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - bus_write_4(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + bus_write_4(rdist, offset, val); } void gic_r_write_8(device_t dev, bus_size_t offset, uint64_t val) { struct gic_v3_softc *sc; + struct resource *rdist; sc = device_get_softc(dev); - bus_write_8(sc->gic_redists.pcpu[PCPU_GET(cpuid)], offset, val); + rdist = &sc->gic_redists.pcpu[PCPU_GET(cpuid)]->res; + bus_write_8(rdist, offset, val); } /* @@ -382,9 +390,8 @@ case GICV3_IVAR_NIRQS: *result = (NIRQ - sc->gic_nirqs) / sc->gic_nchildren; return (0); - case GICV3_IVAR_REDIST_VADDR: - *result = (uintptr_t)rman_get_virtual( - sc->gic_redists.pcpu[PCPU_GET(cpuid)]); + case GICV3_IVAR_REDIST: + *result = (uintptr_t)sc->gic_redists.pcpu[PCPU_GET(cpuid)]; return (0); case GIC_IVAR_HW_REV: KASSERT( @@ -979,7 +986,7 @@ res = sc->gic_dist; break; case REDIST: - res = sc->gic_redists.pcpu[cpuid]; + res = &sc->gic_redists.pcpu[cpuid]->res; break; default: KASSERT(0, ("%s: Attempt to wait for unknown RWP", __func__)); @@ -1173,7 +1180,7 @@ KASSERT(sc->gic_redists.pcpu[cpuid] != NULL, ("Invalid pointer to per-CPU redistributor")); /* Copy res contents to its final destination */ - *sc->gic_redists.pcpu[cpuid] = r_res; + sc->gic_redists.pcpu[cpuid]->res = r_res; if (bootverbose) { device_printf(sc->dev, "CPU%u Re-Distributor has been found\n", Index: sys/arm64/arm64/gic_v3_var.h =================================================================== --- sys/arm64/arm64/gic_v3_var.h +++ sys/arm64/arm64/gic_v3_var.h @@ -40,10 +40,9 @@ struct gic_v3_irqsrc; -struct redist_lpis { - vm_offset_t conf_base; - vm_offset_t pend_base[MAXCPU]; - uint64_t flags; +struct redist_pcpu { + struct resource res; + vm_offset_t pend_base; }; struct gic_redists { @@ -55,10 +54,8 @@ struct resource ** regions; /* Number of Re-Distributor regions */ u_int nregions; - /* Per-CPU Re-Distributor handler */ - struct resource * pcpu[MAXCPU]; - /* LPIs data */ - struct redist_lpis lpis; + /* per-cpu Data */ + struct redist_pcpu *pcpu[MAXCPU]; }; struct gic_v3_softc { @@ -96,10 +93,10 @@ /* ivars */ #define GICV3_IVAR_NIRQS 1000 -#define GICV3_IVAR_REDIST_VADDR 1001 +#define GICV3_IVAR_REDIST 1001 __BUS_ACCESSOR(gicv3, nirqs, GICV3, NIRQS, u_int); -__BUS_ACCESSOR(gicv3, redist_vaddr, GICV3, REDIST_VADDR, void *); +__BUS_ACCESSOR(gicv3, redist, GICV3, REDIST, void *); /* Device methods */ int gic_v3_attach(device_t dev); @@ -131,7 +128,7 @@ u_int cpu = PCPU_GET(cpuid); \ \ bus_read_##len( \ - sc->gic_redists.pcpu[cpu], \ + &sc->gic_redists.pcpu[cpu]->res, \ reg); \ }) @@ -140,7 +137,7 @@ u_int cpu = PCPU_GET(cpuid); \ \ bus_write_##len( \ - sc->gic_redists.pcpu[cpu], \ + &sc->gic_redists.pcpu[cpu]->res, \ reg, val); \ }) Index: sys/arm64/arm64/gicv3_its.c =================================================================== --- sys/arm64/arm64/gicv3_its.c +++ sys/arm64/arm64/gicv3_its.c @@ -575,6 +575,7 @@ static int its_init_cpu(device_t dev, struct gicv3_its_softc *sc) { + struct redist_pcpu *rpcpu; device_t gicv3; vm_paddr_t target; uint64_t xbaser, tmp; @@ -662,7 +663,8 @@ if ((gic_its_read_8(sc, GITS_TYPER) & GITS_TYPER_PTA) != 0) { /* This ITS wants the redistributor physical address */ - target = vtophys(gicv3_get_redist_vaddr(dev)); + rpcpu = gicv3_get_redist(dev); + target = vtophys(rman_get_virtual(&rpcpu->res)); } else { /* This ITS wants the unique processor number */ target = GICR_TYPER_CPUNUM(gic_r_read_8(gicv3, GICR_TYPER));