Linux Audio

Check our new training course

Loading...
v4.17
 
 1/*
 2 * CPU reset routines
 3 *
 4 * Copyright (C) 2001 Deep Blue Solutions Ltd.
 5 * Copyright (C) 2012 ARM Ltd.
 6 * Copyright (C) 2015 Huawei Futurewei Technologies.
 7 *
 8 * This program is free software; you can redistribute it and/or modify
 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/linkage.h>
 
14#include <asm/assembler.h>
15#include <asm/sysreg.h>
16#include <asm/virt.h>
17
18.text
19.pushsection    .idmap.text, "awx"
20
21/*
22 * __cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2) - Helper for
23 * cpu_soft_restart.
24 *
25 * @el2_switch: Flag to indicate a swich to EL2 is needed.
26 * @entry: Location to jump to for soft reset.
27 * arg0: First argument passed to @entry.
28 * arg1: Second argument passed to @entry.
29 * arg2: Third argument passed to @entry.
30 *
31 * Put the CPU into the same state as it would be if it had been reset, and
32 * branch to what would be the reset vector. It must be executed with the
33 * flat identity mapping.
34 */
35ENTRY(__cpu_soft_restart)
36	/* Clear sctlr_el1 flags. */
37	mrs	x12, sctlr_el1
38	ldr	x13, =SCTLR_ELx_FLAGS
39	bic	x12, x12, x13
40	pre_disable_mmu_workaround
 
 
 
 
41	msr	sctlr_el1, x12
42	isb
43
44	cbz	x0, 1f				// el2_switch?
45	mov	x0, #HVC_SOFT_RESTART
46	hvc	#0				// no return
47
481:	mov	x18, x1				// entry
49	mov	x0, x2				// arg0
50	mov	x1, x3				// arg1
51	mov	x2, x4				// arg2
52	br	x18
53ENDPROC(__cpu_soft_restart)
54
55.popsection
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * CPU reset routines
 4 *
 5 * Copyright (C) 2001 Deep Blue Solutions Ltd.
 6 * Copyright (C) 2012 ARM Ltd.
 7 * Copyright (C) 2015 Huawei Futurewei Technologies.
 
 
 
 
 8 */
 9
10#include <linux/linkage.h>
11#include <linux/cfi_types.h>
12#include <asm/assembler.h>
13#include <asm/sysreg.h>
14#include <asm/virt.h>
15
16.text
17.pushsection    .idmap.text, "a"
18
19/*
20 * cpu_soft_restart(el2_switch, entry, arg0, arg1, arg2)
 
21 *
22 * @el2_switch: Flag to indicate a switch to EL2 is needed.
23 * @entry: Location to jump to for soft reset.
24 * arg0: First argument passed to @entry. (relocation list)
25 * arg1: Second argument passed to @entry.(physical kernel entry)
26 * arg2: Third argument passed to @entry. (physical dtb address)
27 *
28 * Put the CPU into the same state as it would be if it had been reset, and
29 * branch to what would be the reset vector. It must be executed with the
30 * flat identity mapping.
31 */
32SYM_TYPED_FUNC_START(cpu_soft_restart)
33	mov_q	x12, INIT_SCTLR_EL1_MMU_OFF
 
 
 
34	pre_disable_mmu_workaround
35	/*
36	 * either disable EL1&0 translation regime or disable EL2&0 translation
37	 * regime if HCR_EL2.E2H == 1
38	 */
39	msr	sctlr_el1, x12
40	isb
41
42	cbz	x0, 1f				// el2_switch?
43	mov	x0, #HVC_SOFT_RESTART
44	hvc	#0				// no return
45
461:	mov	x8, x1				// entry
47	mov	x0, x2				// arg0
48	mov	x1, x3				// arg1
49	mov	x2, x4				// arg2
50	br	x8
51SYM_FUNC_END(cpu_soft_restart)
52
53.popsection