summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Porotchkin <kostap@marvell.com>2017-02-22 18:13:00 +0200
committerKostya Porotchkin <kostap@marvell.com>2017-07-12 09:56:31 +0300
commite6e201b1417a13a62db40465b4882a0cdb24ccb5 (patch)
tree6269795b908e0509bb71b431aa023bf9f9ddd9b9
parentaa741212a1414bce695e5173b7bd1a5acf3019c5 (diff)
ble: prepare DRAM for running in warm boot mode
The DRAM is marked as non-executable memory segment in BootROM. In the Warm Boot mode the control should be passed from BLE to the ATF that already exists in the DRAM. This is needed for eliminating the unnecessary boot image reload from the boot device. This patch marks the DRAM as an executable memory. Change-Id: I29a9d4e6a47cd664ce7040c270537690f1f1254e Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Reviewed-on: http://vgitil04.il.marvell.com:8080/40474 Tested-by: iSoC Platform CI <ykjenk@marvell.com>
-rw-r--r--ble/ble.mk1
-rw-r--r--ble/ble_mem.S56
2 files changed, 57 insertions, 0 deletions
diff --git a/ble/ble.mk b/ble/ble.mk
index ba4e2310..5041bc09 100644
--- a/ble/ble.mk
+++ b/ble/ble.mk
@@ -35,6 +35,7 @@ BLE_LIBS = $(MV_DDR_LIB)
PLAT_MARVELL = plat/marvell
BLE_SOURCES += ble/ble_main.c \
+ ble/ble_mem.S \
drivers/delay_timer/delay_timer.c \
$(PLAT_MARVELL)/common/plat_delay_timer.c
diff --git a/ble/ble_mem.S b/ble/ble_mem.S
new file mode 100644
index 00000000..c7d329d0
--- /dev/null
+++ b/ble/ble_mem.S
@@ -0,0 +1,56 @@
+/*
+ * ***************************************************************************
+ * Copyright (C) 2017 Marvell International Ltd.
+ * ***************************************************************************
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 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.
+ *
+ * Neither the name of Marvell nor the names of its contributors may be used
+ * to endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+ *
+ * **************************************************************************
+ */
+#include <asm_macros.S>
+#include <arm_def.h>
+#include <platform_def.h>
+
+#define PTE_NON_EXEC_OFF 54 /* XN - eXecute Never bit offset - see VMSAv8-64 */
+
+ .globl ble_prepare_exit
+
+func ble_prepare_exit
+ /*
+ * Read the page table base and set the first page to be executable.
+ * This is required for jumping to DRAM for further execution.
+ */
+ mrs x0, ttbr0_el3
+ ldr x1, [x0]
+ mov x2, #1
+ bic x1, x1, x2, lsl #PTE_NON_EXEC_OFF
+ str x1, [x0]
+ tlbi alle3
+ dsb sy
+ isb
+ ret
+endfunc ble_prepare_exit