blob: 9e37b4644c299e70e362a31ef580279be5fba02f [file] [log] [blame]
Angel Ponsf23ae0b2020-04-02 23:48:12 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Arthur Heymansdd4d8952018-06-03 12:04:26 +02002
Martin Rothc87ab012022-11-20 19:32:51 -07003#include <cpu/intel/post_codes.h>
Arthur Heymansdd4d8952018-06-03 12:04:26 +02004#include <cpu/x86/mtrr.h>
5#include <cpu/x86/cache.h>
6#include <cpu/x86/post_code.h>
7
8#define NoEvictMod_MSR 0x2e0
9
10.code32
11.global chipset_teardown_car
12
13chipset_teardown_car:
14 pop %esp
15
Yuchen He1e67adb2023-07-25 21:28:36 +020016 post_code(POSTCODE_POSTCAR_DISABLE_CACHE)
Arthur Heymansdd4d8952018-06-03 12:04:26 +020017
18 /* Disable cache. */
19 movl %cr0, %eax
20 orl $CR0_CacheDisable, %eax
21 movl %eax, %cr0
22
Yuchen He1e67adb2023-07-25 21:28:36 +020023 post_code(POSTCODE_POSTCAR_DISABLE_DEF_MTRR)
Arthur Heymansdd4d8952018-06-03 12:04:26 +020024
25 /* Disable MTRR. */
26 movl $MTRR_DEF_TYPE_MSR, %ecx
27 rdmsr
28 andl $(~MTRR_DEF_TYPE_EN), %eax
29 wrmsr
30
31 /* Disable the no eviction run state */
Elyes HAOUAS6d772bc2018-12-22 09:19:49 +010032 movl $NoEvictMod_MSR, %ecx
Arthur Heymansdd4d8952018-06-03 12:04:26 +020033 rdmsr
Elyes HAOUAS6d772bc2018-12-22 09:19:49 +010034 andl $~2, %eax
Arthur Heymansdd4d8952018-06-03 12:04:26 +020035 wrmsr
Elyes HAOUAS6d772bc2018-12-22 09:19:49 +010036 andl $~1, %eax
Arthur Heymansdd4d8952018-06-03 12:04:26 +020037 wrmsr
38
Yuchen He1e67adb2023-07-25 21:28:36 +020039 post_code(POSTCODE_POSTCAR_TEARDOWN_DONE)
Arthur Heymansdd4d8952018-06-03 12:04:26 +020040
41 /* Return to caller. */
42 jmp *%esp