blob: fb03cf15b849c01126bdc34a3982ca4ac6bc90b9 [file] [log] [blame]
Leif Lindholm9a7bf652021-03-10 13:23:24 +00001/*
Ryan Everett3f588c42024-05-14 14:47:09 +01002 * Copyright (c) 2014-2024, Arm Limited and Contributors. All rights reserved.
Leif Lindholm9a7bf652021-03-10 13:23:24 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#include <arch.h>
7#include <asm_macros.S>
8#include <cpu_macros.S>
9#include <qemu_max.h>
10
11func qemu_max_core_pwr_dwn
12 /* ---------------------------------------------
13 * Disable the Data Cache.
14 * ---------------------------------------------
15 */
16 mrs x1, sctlr_el3
17 bic x1, x1, #SCTLR_C_BIT
18 msr sctlr_el3, x1
19 isb
20
21 /* ---------------------------------------------
22 * Flush L1 cache to L2.
23 * ---------------------------------------------
24 */
25 mov x18, lr
26 mov x0, #DCCISW
27 bl dcsw_op_level1
28 mov lr, x18
29 ret
30endfunc qemu_max_core_pwr_dwn
31
32func qemu_max_cluster_pwr_dwn
33 /* ---------------------------------------------
34 * Disable the Data Cache.
35 * ---------------------------------------------
36 */
37 mrs x1, sctlr_el3
38 bic x1, x1, #SCTLR_C_BIT
39 msr sctlr_el3, x1
40 isb
41
42 /* ---------------------------------------------
43 * Flush all caches to PoC.
44 * ---------------------------------------------
45 */
46 mov x0, #DCCISW
47 b dcsw_op_all
48endfunc qemu_max_cluster_pwr_dwn
49
Leif Lindholm9a7bf652021-03-10 13:23:24 +000050 /* ---------------------------------------------
51 * This function provides cpu specific
52 * register information for crash reporting.
53 * It needs to return with x6 pointing to
54 * a list of register names in ascii and
55 * x8 - x15 having values of registers to be
56 * reported.
57 * ---------------------------------------------
58 */
59.section .rodata.qemu_max_regs, "aS"
60qemu_max_regs: /* The ascii list of register names to be reported */
61 .asciz "" /* no registers to report */
62
63func qemu_max_cpu_reg_dump
64 adr x6, qemu_max_regs
65 ret
66endfunc qemu_max_cpu_reg_dump
67
68
69/* cpu_ops for QEMU MAX */
70declare_cpu_ops qemu_max, QEMU_MAX_MIDR, CPU_NO_RESET_FUNC, \
71 qemu_max_core_pwr_dwn, \
72 qemu_max_cluster_pwr_dwn