summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2013-05-01 13:49:18 +0000
committerpatrick <patrick@openbsd.org>2013-05-01 13:49:18 +0000
commitb56a7e21199db63281ae60d759f83b623d5879da (patch)
tree0849a2c1da0c8b194faa359881d3a4cad6beab59 /sys
parentFix a case where we might be cache flushing unmapped pages. (diff)
downloadwireguard-openbsd-b56a7e21199db63281ae60d759f83b623d5879da.tar.xz
wireguard-openbsd-b56a7e21199db63281ae60d759f83b623d5879da.zip
Disable PandaBoard's L2 Cache early on bootup. We will re-enable it
later once we're ready. ok bmercer@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/beagle/beagle/beagle_machdep.c10
-rw-r--r--sys/arch/beagle/beagle/beagle_start.S69
2 files changed, 77 insertions, 2 deletions
diff --git a/sys/arch/beagle/beagle/beagle_machdep.c b/sys/arch/beagle/beagle/beagle_machdep.c
index bf6cc0ebc64..5b759dd2541 100644
--- a/sys/arch/beagle/beagle/beagle_machdep.c
+++ b/sys/arch/beagle/beagle/beagle_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: beagle_machdep.c,v 1.15 2012/08/30 15:51:13 deraadt Exp $ */
+/* $OpenBSD: beagle_machdep.c,v 1.16 2013/05/01 13:49:18 patrick Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
@@ -451,6 +451,7 @@ initarm(void *arg0, void *arg1, void *arg2)
pv_addr_t kernel_l1pt;
paddr_t memstart;
psize_t memsize;
+ extern void omap4_smc_call(uint32_t, uint32_t);
#if 0
int led_data = 0;
@@ -468,6 +469,13 @@ initarm(void *arg0, void *arg1, void *arg2)
if (set_cpufuncs())
panic("cpu not recognized!");
+ switch (board_id) {
+ case BOARD_ID_OMAP4_PANDA:
+ /* disable external L2 cache */
+ omap4_smc_call(0x102, 0);
+ break;
+ }
+
#if 0
/* Calibrate the delay loop. */
#endif
diff --git a/sys/arch/beagle/beagle/beagle_start.S b/sys/arch/beagle/beagle/beagle_start.S
index 6869526a7f7..dfd3668b3da 100644
--- a/sys/arch/beagle/beagle/beagle_start.S
+++ b/sys/arch/beagle/beagle/beagle_start.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: beagle_start.S,v 1.4 2013/04/30 13:23:52 patrick Exp $ */
+/* $OpenBSD: beagle_start.S,v 1.5 2013/05/01 13:49:18 patrick Exp $ */
/* $NetBSD: lubbock_start.S,v 1.1 2003/06/18 10:51:15 bsh Exp $ */
/*
@@ -185,3 +185,70 @@ mmu_init_table2:
MMU_INIT(0xc0000000, SDRAM_START, 64, L1_TYPE_S|L1_S_C|L1_S_V7_AP(AP_KRW))
.word 0 /* end of table */
+
+ .text
+
+/*-
+ * Copyright (c) 2011
+ * Ben Gray <ben.r.gray@gmail.com>.
+ * All rights reserved.
+ *
+ * Based heavily on the Linux OMAP secure API
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ * Written by Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * omap4_smc_call - issues a secure monitor API call
+ * @r0: contains the monitor API number
+ * @r1: contains the value to set
+ *
+ * This function will send a secure monitor call to the internal rom code in
+ * the trust mode. The rom code expects that r0 will contain the value and
+ * r12 will contain the API number, so internally the function swaps the
+ * register settings around. The trust mode code may also alter all the cpu
+ * registers so everything (including the lr register) is saved on the stack
+ * before the call.
+ *
+ * RETURNS:
+ * nothing
+ */
+ENTRY(omap4_smc_call)
+ stmfd sp!, {r2-r12, lr}
+ mov r12, r0
+ mov r0, r1
+#if 0
+ dsb
+#else
+ .word 0xf57ff040
+#endif
+#if 0
+ smc #0 /* XXX or #1 ??? */
+#else
+ .word 0xe1600070
+#endif
+ ldmfd sp!, {r2-r12, pc}
+