Set the TLB caching properties for portals at attach time.
This was found while reworking the device tree nodes for dtsec to match the Linux device tree. Instead of waiting and expecting later code to call dpaa_portal_map_registers(), do the equivalent immediately upon mapping. Otherwise, it's possible to access the pages before that function is called, and hang the CPU.
This commit is contained in:
parent
5fb70b0cae
commit
0e9f21dc24
@ -76,9 +76,12 @@ dpaa_portal_alloc_res(device_t dev, struct dpaa_portals_devinfo *di, int cpu)
|
||||
SYS_RES_MEMORY, &sc->sc_rrid[0], rle->start + sc->sc_dp_pa,
|
||||
rle->end + sc->sc_dp_pa, rle->count, RF_ACTIVE);
|
||||
if (sc->sc_rres[0] == NULL) {
|
||||
device_printf(dev, "Could not allocate memory.\n");
|
||||
device_printf(dev,
|
||||
"Could not allocate cache enabled memory.\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
tlb1_set_entry(rman_get_bushandle(sc->sc_rres[0]),
|
||||
rle->start + sc->sc_dp_pa, rle->count, _TLB_ENTRY_MEM);
|
||||
/* Cache inhibited area */
|
||||
rle = resource_list_find(res, SYS_RES_MEMORY, 1);
|
||||
sc->sc_rrid[1] = 1;
|
||||
@ -86,11 +89,15 @@ dpaa_portal_alloc_res(device_t dev, struct dpaa_portals_devinfo *di, int cpu)
|
||||
SYS_RES_MEMORY, &sc->sc_rrid[1], rle->start + sc->sc_dp_pa,
|
||||
rle->end + sc->sc_dp_pa, rle->count, RF_ACTIVE);
|
||||
if (sc->sc_rres[1] == NULL) {
|
||||
device_printf(dev, "Could not allocate memory.\n");
|
||||
device_printf(dev,
|
||||
"Could not allocate cache inhibited memory.\n");
|
||||
bus_release_resource(dev, SYS_RES_MEMORY,
|
||||
sc->sc_rrid[0], sc->sc_rres[0]);
|
||||
return (ENXIO);
|
||||
}
|
||||
tlb1_set_entry(rman_get_bushandle(sc->sc_rres[1]),
|
||||
rle->start + sc->sc_dp_pa, rle->count, _TLB_ENTRY_IO);
|
||||
sc->sc_dp[cpu].dp_regs_mapped = 1;
|
||||
}
|
||||
/* Acquire portal's CE_PA and CI_PA */
|
||||
rle = resource_list_find(res, SYS_RES_MEMORY, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user