Icenowy Zheng | b198c2e | 2022-01-29 10:23:02 -0500 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Utility functions for FEL mode. |
| 4 | * |
| 5 | * Copyright (c) 2015 Google, Inc |
| 6 | */ |
| 7 | |
| 8 | #include <asm-offsets.h> |
| 9 | #include <config.h> |
| 10 | #include <asm/system.h> |
| 11 | #include <linux/linkage.h> |
| 12 | |
| 13 | ENTRY(save_boot_params) |
| 14 | ldr r0, =fel_stash |
| 15 | str sp, [r0, #0] |
| 16 | str lr, [r0, #4] |
| 17 | mrs lr, cpsr @ Read CPSR |
| 18 | str lr, [r0, #8] |
| 19 | mrc p15, 0, lr, c1, c0, 0 @ Read CP15 SCTLR Register |
| 20 | str lr, [r0, #12] |
| 21 | b save_boot_params_ret |
| 22 | ENDPROC(save_boot_params) |
| 23 | |
| 24 | ENTRY(return_to_fel) |
| 25 | mov sp, r0 |
| 26 | mov lr, r1 |
| 27 | ldr r0, =fel_stash |
Icenowy Zheng | b198c2e | 2022-01-29 10:23:02 -0500 | [diff] [blame] | 28 | ldr r1, [r0, #12] |
Andre Przywara | 0d0bec0 | 2022-03-01 12:21:58 +0000 | [diff] [blame^] | 29 | mcr p15, 0, r1, c1, c0, 0 @ Write CP15 SCTLR register |
| 30 | ldr r1, [r0, #8] |
Icenowy Zheng | b198c2e | 2022-01-29 10:23:02 -0500 | [diff] [blame] | 31 | msr cpsr, r1 @ Write CPSR |
| 32 | bx lr |
| 33 | ENDPROC(return_to_fel) |