1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

Move duplicated code to print l2 cache config into the common code.

This commit is contained in:
Ian Lepore 2014-04-27 23:47:38 +00:00
parent 17102f802f
commit 88b3694bd9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=265035
4 changed files with 45 additions and 68 deletions

View File

@ -84,6 +84,47 @@ static uint32_t g_ways_assoc;
static struct pl310_softc *pl310_softc;
void
pl310_print_config(struct pl310_softc *sc)
{
uint32_t aux, prefetch;
const char *dis = "disabled";
const char *ena = "enabled";
aux = pl310_read4(sc, PL310_AUX_CTRL);
prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL);
device_printf(sc->sc_dev, "Early BRESP response: %s\n",
(aux & AUX_CTRL_EARLY_BRESP) ? ena : dis);
device_printf(sc->sc_dev, "Instruction prefetch: %s\n",
(aux & AUX_CTRL_INSTR_PREFETCH) ? ena : dis);
device_printf(sc->sc_dev, "Data prefetch: %s\n",
(aux & AUX_CTRL_DATA_PREFETCH) ? ena : dis);
device_printf(sc->sc_dev, "Non-secure interrupt control: %s\n",
(aux & AUX_CTRL_NS_INT_CTRL) ? ena : dis);
device_printf(sc->sc_dev, "Non-secure lockdown: %s\n",
(aux & AUX_CTRL_NS_LOCKDOWN) ? ena : dis);
device_printf(sc->sc_dev, "Share override: %s\n",
(aux & AUX_CTRL_SHARE_OVERRIDE) ? ena : dis);
device_printf(sc->sc_dev, "Double linefill: %s\n",
(prefetch & PREFETCH_CTRL_DL) ? ena : dis);
device_printf(sc->sc_dev, "Instruction prefetch: %s\n",
(prefetch & PREFETCH_CTRL_INSTR_PREFETCH) ? ena : dis);
device_printf(sc->sc_dev, "Data prefetch: %s\n",
(prefetch & PREFETCH_CTRL_DATA_PREFETCH) ? ena : dis);
device_printf(sc->sc_dev, "Double linefill on WRAP request: %s\n",
(prefetch & PREFETCH_CTRL_DL_ON_WRAP) ? ena : dis);
device_printf(sc->sc_dev, "Prefetch drop: %s\n",
(prefetch & PREFETCH_CTRL_PREFETCH_DROP) ? ena : dis);
device_printf(sc->sc_dev, "Incr double Linefill: %s\n",
(prefetch & PREFETCH_CTRL_INCR_DL) ? ena : dis);
device_printf(sc->sc_dev, "Not same ID on exclusive sequence: %s\n",
(prefetch & PREFETCH_CTRL_NOTSAMEID) ? ena : dis);
device_printf(sc->sc_dev, "Prefetch offset: %d\n",
(prefetch & PREFETCH_CTRL_OFFSET_MASK));
}
static int
pl310_filter(void *arg)
{
@ -351,6 +392,8 @@ pl310_attach(device_t dev)
/* Enable the L2 cache if disabled */
platform_pl310_write_ctrl(sc, CTRL_ENABLED);
device_printf(dev, "L2 Cache enabled\n");
if (bootverbose)
pl310_print_config(sc);
}
if (!sc->sc_enabled && (ctrl_value & CTRL_ENABLED)) {

View File

@ -44,42 +44,6 @@ __FBSDID("$FreeBSD$");
void
platform_pl310_init(struct pl310_softc *sc)
{
uint32_t aux, prefetch;
aux = pl310_read4(sc, PL310_AUX_CTRL);
prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL);
if (bootverbose) {
device_printf(sc->sc_dev, "Early BRESP response: %s\n",
(aux & AUX_CTRL_EARLY_BRESP) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Instruction prefetch: %s\n",
(aux & AUX_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Data prefetch: %s\n",
(aux & AUX_CTRL_DATA_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Non-secure interrupt control: %s\n",
(aux & AUX_CTRL_NS_INT_CTRL) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Non-secure lockdown: %s\n",
(aux & AUX_CTRL_NS_LOCKDOWN) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Share override: %s\n",
(aux & AUX_CTRL_SHARE_OVERRIDE) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Double linefil: %s\n",
(prefetch & PREFETCH_CTRL_DL) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Instruction prefetch: %s\n",
(prefetch & PREFETCH_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Data prefetch: %s\n",
(prefetch & PREFETCH_CTRL_DATA_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Double linefill on WRAP request: %s\n",
(prefetch & PREFETCH_CTRL_DL_ON_WRAP) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Prefetch drop: %s\n",
(prefetch & PREFETCH_CTRL_PREFETCH_DROP) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Incr double Linefill: %s\n",
(prefetch & PREFETCH_CTRL_INCR_DL) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Not same ID on exclusive sequence: %s\n",
(prefetch & PREFETCH_CTRL_NOTSAMEID) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Prefetch offset: %d\n",
(prefetch & PREFETCH_CTRL_OFFSET_MASK));
}
}
void

View File

@ -161,6 +161,8 @@ pl310_write4(struct pl310_softc *sc, bus_size_t off, uint32_t val)
bus_write_4(sc->sc_mem_res, off, val);
}
void pl310_print_config(struct pl310_softc *sc);
void platform_pl310_init(struct pl310_softc *);
void platform_pl310_write_ctrl(struct pl310_softc *, uint32_t);
void platform_pl310_write_debug(struct pl310_softc *, uint32_t);

View File

@ -45,38 +45,6 @@ platform_pl310_init(struct pl310_softc *sc)
aux = pl310_read4(sc, PL310_AUX_CTRL);
prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL);
if (bootverbose) {
device_printf(sc->sc_dev, "Early BRESP response: %s\n",
(aux & AUX_CTRL_EARLY_BRESP) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Instruction prefetch: %s\n",
(aux & AUX_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Data prefetch: %s\n",
(aux & AUX_CTRL_DATA_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Non-secure interrupt control: %s\n",
(aux & AUX_CTRL_NS_INT_CTRL) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Non-secure lockdown: %s\n",
(aux & AUX_CTRL_NS_LOCKDOWN) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Share override: %s\n",
(aux & AUX_CTRL_SHARE_OVERRIDE) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Double linefil: %s\n",
(prefetch & PREFETCH_CTRL_DL) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Instruction prefetch: %s\n",
(prefetch & PREFETCH_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Data prefetch: %s\n",
(prefetch & PREFETCH_CTRL_DATA_PREFETCH) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Double linefill on WRAP request: %s\n",
(prefetch & PREFETCH_CTRL_DL_ON_WRAP) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Prefetch drop: %s\n",
(prefetch & PREFETCH_CTRL_PREFETCH_DROP) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Incr double Linefill: %s\n",
(prefetch & PREFETCH_CTRL_INCR_DL) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Not same ID on exclusive sequence: %s\n",
(prefetch & PREFETCH_CTRL_NOTSAMEID) ? "enabled" : "disabled");
device_printf(sc->sc_dev, "Prefetch offset: %d\n",
(prefetch & PREFETCH_CTRL_OFFSET_MASK));
}
/*
* Disable instruction prefetch
*/