svn commit: r300637 - head/sys/dev/dpaa
Justin Hibbits
jhibbits at FreeBSD.org
Wed May 25 01:23:20 UTC 2016
Author: jhibbits
Date: Wed May 25 01:23:19 2016
New Revision: 300637
URL: https://svnweb.freebsd.org/changeset/base/300637
Log:
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.
Modified:
head/sys/dev/dpaa/portals_common.c
Modified: head/sys/dev/dpaa/portals_common.c
==============================================================================
--- head/sys/dev/dpaa/portals_common.c Wed May 25 00:25:38 2016 (r300636)
+++ head/sys/dev/dpaa/portals_common.c Wed May 25 01:23:19 2016 (r300637)
@@ -76,9 +76,12 @@ dpaa_portal_alloc_res(device_t dev, stru
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, stru
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);
More information about the svn-src-all
mailing list