omap4_l2cache.c (239281) | omap4_l2cache.c (244914) |
---|---|
1/*- 2 * Copyright (c) 2012 Olivier Houchard. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 */ 24 25#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2012 Olivier Houchard. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 9 unchanged lines hidden (view full) --- 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 */ 24 25#include <sys/cdefs.h> |
26__FBSDID("$FreeBSD: head/sys/arm/ti/omap4/omap4_l2cache.c 239281 2012-08-15 06:31:32Z gonzo $"); | 26__FBSDID("$FreeBSD: head/sys/arm/ti/omap4/omap4_l2cache.c 244914 2012-12-31 21:19:44Z gonzo $"); |
27#include <sys/types.h> 28#include <sys/param.h> 29#include <sys/systm.h> | 27#include <sys/types.h> 28#include <sys/param.h> 29#include <sys/systm.h> |
30#include <sys/bus.h> 31#include <sys/rman.h> 32#include <sys/lock.h> 33#include <sys/mutex.h> 34 |
|
30#include <arm/ti/ti_smc.h> 31#include <arm/ti/omap4/omap4_smc.h> | 35#include <arm/ti/ti_smc.h> 36#include <arm/ti/omap4/omap4_smc.h> |
37#include <machine/bus.h> |
|
32#include <machine/pl310.h> 33 34void | 38#include <machine/pl310.h> 39 40void |
35platform_init_pl310(struct pl310_softc *softc) | 41platform_pl310_init(struct pl310_softc *sc) |
36{ | 42{ |
37 ti_smc0(1, 0, L2CACHE_ENABLE_L2); | 43 uint32_t aux, prefetch; 44 45 aux = pl310_read4(sc, PL310_AUX_CTRL); 46 prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL); 47 48 if (bootverbose) { 49 device_printf(sc->sc_dev, "Early BRESP response: %s\n", 50 (aux & AUX_CTRL_EARLY_BRESP) ? "enabled" : "disabled"); 51 device_printf(sc->sc_dev, "Instruction prefetch: %s\n", 52 (aux & AUX_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled"); 53 device_printf(sc->sc_dev, "Data prefetch: %s\n", 54 (aux & AUX_CTRL_DATA_PREFETCH) ? "enabled" : "disabled"); 55 device_printf(sc->sc_dev, "Non-secure interrupt control: %s\n", 56 (aux & AUX_CTRL_NS_INT_CTRL) ? "enabled" : "disabled"); 57 device_printf(sc->sc_dev, "Non-secure lockdown: %s\n", 58 (aux & AUX_CTRL_NS_LOCKDOWN) ? "enabled" : "disabled"); 59 device_printf(sc->sc_dev, "Share override: %s\n", 60 (aux & AUX_CTRL_SHARE_OVERRIDE) ? "enabled" : "disabled"); 61 62 device_printf(sc->sc_dev, "Double linefil: %s\n", 63 (prefetch & PREFETCH_CTRL_DL) ? "enabled" : "disabled"); 64 device_printf(sc->sc_dev, "Instruction prefetch: %s\n", 65 (prefetch & PREFETCH_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled"); 66 device_printf(sc->sc_dev, "Data prefetch: %s\n", 67 (prefetch & PREFETCH_CTRL_DATA_PREFETCH) ? "enabled" : "disabled"); 68 device_printf(sc->sc_dev, "Double linefill on WRAP request: %s\n", 69 (prefetch & PREFETCH_CTRL_DL_ON_WRAP) ? "enabled" : "disabled"); 70 device_printf(sc->sc_dev, "Prefetch drop: %s\n", 71 (prefetch & PREFETCH_CTRL_PREFETCH_DROP) ? "enabled" : "disabled"); 72 device_printf(sc->sc_dev, "Incr double Linefill: %s\n", 73 (prefetch & PREFETCH_CTRL_INCR_DL) ? "enabled" : "disabled"); 74 device_printf(sc->sc_dev, "Not same ID on exclusive sequence: %s\n", 75 (prefetch & PREFETCH_CTRL_NOTSAMEID) ? "enabled" : "disabled"); 76 device_printf(sc->sc_dev, "Prefetch offset: %d\n", 77 (prefetch & PREFETCH_CTRL_OFFSET_MASK)); 78 } 79 80 /* 81 * Disable instruction prefetch 82 */ 83 prefetch &= ~PREFETCH_CTRL_INSTR_PREFETCH; 84 aux &= ~AUX_CTRL_INSTR_PREFETCH; 85 86 // prefetch &= ~PREFETCH_CTRL_DATA_PREFETCH; 87 // aux &= ~AUX_CTRL_DATA_PREFETCH; 88 89 /* 90 * Make sure data prefetch is on 91 */ 92 prefetch |= PREFETCH_CTRL_DATA_PREFETCH; 93 aux |= AUX_CTRL_DATA_PREFETCH; 94 95 /* 96 * TODO: add tunable for prefetch offset 97 * and experiment with performance 98 */ 99 100 ti_smc0(aux, 0, WRITE_AUXCTRL_REG); 101 ti_smc0(prefetch, 0, WRITE_PREFETCH_CTRL_REG); |
38} 39 | 102} 103 |
104void 105platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) 106{ 107 ti_smc0(val, 0, L2CACHE_WRITE_CTRL_REG); 108} 109 110void 111platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) 112{ 113 ti_smc0(val, 0, L2CACHE_WRITE_DEBUG_REG); 114} |
|