Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69388 )
Change subject: cpu/intel: Fix clearing MTRR for clang 64bit ......................................................................
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 --- M src/cpu/intel/car/core2/cache_as_ram.S M src/cpu/intel/car/non-evict/cache_as_ram.S M src/cpu/intel/car/p4-netburst/cache_as_ram.S M src/soc/intel/common/block/cpu/car/cache_as_ram.S 4 files changed, 41 insertions(+), 20 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/69388/1
diff --git a/src/cpu/intel/car/core2/cache_as_ram.S b/src/cpu/intel/car/core2/cache_as_ram.S index f47ba5f..810475d 100644 --- a/src/cpu/intel/car/core2/cache_as_ram.S +++ b/src/cpu/intel/car/core2/cache_as_ram.S @@ -31,15 +31,16 @@ post_code(0x22)
/* 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 @@ -201,6 +202,6 @@ .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: diff --git a/src/cpu/intel/car/non-evict/cache_as_ram.S b/src/cpu/intel/car/non-evict/cache_as_ram.S index 0451bb4..0ab922e 100644 --- a/src/cpu/intel/car/non-evict/cache_as_ram.S +++ b/src/cpu/intel/car/non-evict/cache_as_ram.S @@ -42,15 +42,16 @@
post_code(0x22) /* 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 @@ -255,6 +256,6 @@ .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: diff --git a/src/cpu/intel/car/p4-netburst/cache_as_ram.S b/src/cpu/intel/car/p4-netburst/cache_as_ram.S index 9ac9e22..2df003c 100644 --- a/src/cpu/intel/car/p4-netburst/cache_as_ram.S +++ b/src/cpu/intel/car/p4-netburst/cache_as_ram.S @@ -27,15 +27,16 @@ 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 @@ -401,6 +402,6 @@ .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: 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 552ba15..580a10d 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 @@ -100,15 +100,16 @@ post_code(0x21)
/* 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(0x22)
@@ -316,7 +317,7 @@ .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