cpu/intel: Fix clearing MTRR for clang 64bit

Clang generates R_X86_64_32S symbols that get truncated.

TESTED:
- prodrive/hermes boots with GCC and clang
- MTRR are properly cleared (tested by filling in both
MTRR_FIX_64K_00000 and MTRR_FIX_4K_F8000 before clearing)

Change-Id: I6a5139f7029b6f35b44377f105dded06f6d9cbf9
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69388
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Arthur Heymans 2022-11-08 15:06:42 +01:00 committed by Felix Held
parent 1c9a8d8083
commit 2834d98f52
4 changed files with 24 additions and 20 deletions

View File

@ -32,15 +32,16 @@ wait_for_sipi:
post_code(POST_SOC_CLEAR_FIXED_MTRRS)
/* Clear/disable fixed MTRRs */
mov $fixed_mtrr_list_size, %ebx
mov $fixed_mtrr_list, %ebx
xor %eax, %eax
xor %edx, %edx
clear_fixed_mtrr:
add $-2, %ebx
movzwl fixed_mtrr_list(%ebx), %ecx
movzwl (%ebx), %ecx
wrmsr
jnz clear_fixed_mtrr
add $2, %ebx
cmp $fixed_mtrr_list_end, %ebx
jl clear_fixed_mtrr
/* Figure out how many MTRRs we have, and clear them out */
mov $MTRR_CAP_MSR, %ecx
@ -202,6 +203,6 @@ fixed_mtrr_list:
.word MTRR_FIX_4K_E8000
.word MTRR_FIX_4K_F0000
.word MTRR_FIX_4K_F8000
fixed_mtrr_list_size = . - fixed_mtrr_list
fixed_mtrr_list_end:
_cache_as_ram_setup_end:

View File

@ -43,15 +43,16 @@ wait_for_sipi:
post_code(POST_SOC_CLEAR_FIXED_MTRRS)
/* Clear/disable fixed MTRRs */
mov $fixed_mtrr_list_size, %ebx
mov $fixed_mtrr_list, %ebx
xor %eax, %eax
xor %edx, %edx
clear_fixed_mtrr:
add $-2, %ebx
movzwl fixed_mtrr_list(%ebx), %ecx
movzwl (%ebx), %ecx
wrmsr
jnz clear_fixed_mtrr
add $2, %ebx
cmp $fixed_mtrr_list_end, %ebx
jl clear_fixed_mtrr
/* Zero out all variable range MTRRs. */
movl $MTRR_CAP_MSR, %ecx
@ -256,6 +257,6 @@ fixed_mtrr_list:
.word MTRR_FIX_4K_E8000
.word MTRR_FIX_4K_F0000
.word MTRR_FIX_4K_F8000
fixed_mtrr_list_size = . - fixed_mtrr_list
fixed_mtrr_list_end:
_cache_as_ram_setup_end:

View File

@ -28,15 +28,16 @@ cache_as_ram:
jz ap_init
/* Clear/disable fixed MTRRs */
mov $fixed_mtrr_list_size, %ebx
mov $fixed_mtrr_list, %ebx
xor %eax, %eax
xor %edx, %edx
clear_fixed_mtrr:
add $-2, %ebx
movzwl fixed_mtrr_list(%ebx), %ecx
movzwl (%ebx), %ecx
wrmsr
jnz clear_fixed_mtrr
add $2, %ebx
cmp $fixed_mtrr_list_end, %ebx
jl clear_fixed_mtrr
/* Figure out how many MTRRs we have, and clear them out */
mov $MTRR_CAP_MSR, %ecx
@ -402,6 +403,6 @@ fixed_mtrr_list:
.word MTRR_FIX_4K_E8000
.word MTRR_FIX_4K_F0000
.word MTRR_FIX_4K_F8000
fixed_mtrr_list_size = . - fixed_mtrr_list
fixed_mtrr_list_end:
_cache_as_ram_setup_end:

View File

@ -101,15 +101,16 @@ no_reset:
post_code(POST_SOC_NO_RESET)
/* Clear/disable fixed MTRRs */
mov $fixed_mtrr_list_size, %ebx
mov $fixed_mtrr_list, %ebx
xor %eax, %eax
xor %edx, %edx
clear_fixed_mtrr:
add $-2, %ebx
movzwl fixed_mtrr_list(%ebx), %ecx
movzwl (%ebx), %ecx
wrmsr
jnz clear_fixed_mtrr
add $2, %ebx
cmp $fixed_mtrr_list_end, %ebx
jl clear_fixed_mtrr
post_code(POST_SOC_CLEAR_FIXED_MTRRS)
@ -317,7 +318,7 @@ fixed_mtrr_list:
.word MTRR_FIX_4K_E8000
.word MTRR_FIX_4K_F0000
.word MTRR_FIX_4K_F8000
fixed_mtrr_list_size = . - fixed_mtrr_list
fixed_mtrr_list_end:
#if CONFIG(INTEL_CAR_NEM)
.global car_nem