summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-17 23:07:26 +0000
committerian <ian@FreeBSD.org>2014-05-17 23:07:26 +0000
commit306b3492c9bb0631286f0c5fd87efb1d78f3cfd0 (patch)
tree789376822ee7d78282f375c3fa8717907599fcaf
parent90cd423e938c65630b6717c28e54771110171433 (diff)
downloadFreeBSD-src-306b3492c9bb0631286f0c5fd87efb1d78f3cfd0.zip
FreeBSD-src-306b3492c9bb0631286f0c5fd87efb1d78f3cfd0.tar.gz
MFC 265035: Move duplicated code to print l2 config into the common code.
-rw-r--r--sys/arm/arm/pl310.c43
-rw-r--r--sys/arm/freescale/imx/imx6_pl310.c36
-rw-r--r--sys/arm/include/pl310.h2
-rw-r--r--sys/arm/ti/omap4/omap4_l2cache.c32
4 files changed, 45 insertions, 68 deletions
diff --git a/sys/arm/arm/pl310.c b/sys/arm/arm/pl310.c
index 64e98b6..b087365 100644
--- a/sys/arm/arm/pl310.c
+++ b/sys/arm/arm/pl310.c
@@ -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)) {
diff --git a/sys/arm/freescale/imx/imx6_pl310.c b/sys/arm/freescale/imx/imx6_pl310.c
index f2d1c27..a4e383e 100644
--- a/sys/arm/freescale/imx/imx6_pl310.c
+++ b/sys/arm/freescale/imx/imx6_pl310.c
@@ -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
diff --git a/sys/arm/include/pl310.h b/sys/arm/include/pl310.h
index a3c42d8..b4200a8 100644
--- a/sys/arm/include/pl310.h
+++ b/sys/arm/include/pl310.h
@@ -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);
diff --git a/sys/arm/ti/omap4/omap4_l2cache.c b/sys/arm/ti/omap4/omap4_l2cache.c
index 67678bf..8fddc6f 100644
--- a/sys/arm/ti/omap4/omap4_l2cache.c
+++ b/sys/arm/ti/omap4/omap4_l2cache.c
@@ -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
*/
OpenPOWER on IntegriCloud