summaryrefslogtreecommitdiffstats
path: root/src/soc/amd/common/block/cpu/car/ap_exit_car.S
blob: 6a14ed8c035bdfe9113bd24e5fbe8dc00dbd22f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* SPDX-License-Identifier: GPL-2.0-only */

.code32

#include <cpu/x86/cr.h>

.globl ap_teardown_car
ap_teardown_car:
	pop	%esi		/* return address, don't care */
	pop	%esi		/* flags */

	/* chipset_teardown_car() is expected to disable cache-as-ram. */
	call	chipset_teardown_car

	/*
	 * Check flags requirements (0 = FALSE, 1 = TRUE) :
	 * bit 0 = ExecWbinvd
	 * bit 1 = CacheEn
	 */

	/*
	 * TODO: Either use or remove this code - we'll node if the code
	 * is needed when 3 conditions happens:
	 * 1) This code is in place
	 * 2) AGESA code that calls HALT_THIS_AP is in place
	 * 3) We boot to OS, go to S3 and resume.
	 * If S3 resume fails, this code might be needed, if S3 resume
	 * is successful then the code can be removed.
	 */

	/*
	 * Commented out until defined if needed or not.
	 * test	%esi, 1
	 * jz	1f
	 * wbinvd
	 * 1:
	 */

	test	%esi, 2
	jz	2f
	/* Enable cache */
	mov	%cr0, %eax
	and	$(~(CR0_CD | CR0_NW)), %eax
	mov	%eax, %cr0
2:
	cli
	hlt
	jmp	2b