xref: /aosp_15_r20/external/coreboot/src/soc/amd/common/block/cpu/car/ap_exit_car.S (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3.code32
4
5#include <cpu/x86/cr.h>
6
7.globl ap_teardown_car
8ap_teardown_car:
9	pop	%esi		/* return address, don't care */
10	pop	%esi		/* flags */
11
12	/* chipset_teardown_car() is expected to disable cache-as-ram. */
13	call	chipset_teardown_car
14
15	/*
16	 * Check flags requirements (0 = FALSE, 1 = TRUE) :
17	 * bit 0 = ExecWbinvd
18	 * bit 1 = CacheEn
19	 */
20
21	/*
22	 * TODO: Either use or remove this code - we'll node if the code
23	 * is needed when 3 conditions happens:
24	 * 1) This code is in place
25	 * 2) AGESA code that calls HALT_THIS_AP is in place
26	 * 3) We boot to OS, go to S3 and resume.
27	 * If S3 resume fails, this code might be needed, if S3 resume
28	 * is successful then the code can be removed.
29	 */
30
31	/*
32	 * Commented out until defined if needed or not.
33	 * test	%esi, 1
34	 * jz	1f
35	 * wbinvd
36	 * 1:
37	 */
38
39	test	%esi, 2
40	jz	2f
41	/* Enable cache */
42	mov	%cr0, %eax
43	and	$(~(CR0_CD | CR0_NW)), %eax
44	mov	%eax, %cr0
452:
46	cli
47	hlt
48	jmp	2b
49