From cd96fed5dc3a203b076cbc74b337e59020d924ae Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Wed, 23 Jun 2021 10:48:28 +0200 Subject: soc/intel/cache_as_ram.S: Add macro to detect bootguard nem Change-Id: I3867fce29d23b647fad9845b9a5c08bb949fa354 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/55783 Reviewed-by: Angel Pons Reviewed-by: Patrick Georgi Tested-by: build bot (Jenkins) --- src/soc/intel/common/block/cpu/car/cache_as_ram.S | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/soc/intel/common/block') diff --git a/src/soc/intel/common/block/cpu/car/cache_as_ram.S b/src/soc/intel/common/block/cpu/car/cache_as_ram.S index 60ec6c5919..d880c2588d 100644 --- a/src/soc/intel/common/block/cpu/car/cache_as_ram.S +++ b/src/soc/intel/common/block/cpu/car/cache_as_ram.S @@ -59,6 +59,18 @@ rep stosl .endm +/* + * macro: is_bootguard_nem + * Checks if the Bootguard ACM has enabled non eviction mode + * Clobbers %eax, %ecx, %edx + * Returns %eax and sets/unsets zero flag + */ +.macro is_bootguard_nem + movl $MSR_BOOT_GUARD_SACM_INFO, %ecx + rdmsr + andl $B_BOOT_GUARD_SACM_INFO_NEM_ENABLED, %eax +.endm + .global bootblock_pre_c_entry bootblock_pre_c_entry: @@ -66,9 +78,7 @@ bootblock_pre_c_entry: /* Bootguard sets up its own CAR and needs separate handling */ check_boot_guard: - movl $MSR_BOOT_GUARD_SACM_INFO, %ecx - rdmsr - andl $B_BOOT_GUARD_SACM_INFO_NEM_ENABLED, %eax + is_bootguard_nem jz no_bootguard /* Disable PBE timer */ @@ -204,9 +214,7 @@ setup_car_mtrr: #endif post_code(0x25) - movl $MSR_BOOT_GUARD_SACM_INFO, %ecx - rdmsr - andl $B_BOOT_GUARD_SACM_INFO_NEM_ENABLED, %eax + is_bootguard_nem jz no_bootguard_car_continue clear_car -- cgit v1.2.3