diff options
author | Iru Cai <mytbk920423@gmail.com> | 2018-12-29 19:28:17 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 15:10:46 +0800 |
commit | 6ef7b8746f8886827f6cf6404c7706675e00e57b (patch) | |
tree | c4a18c8f8de86a6c3f5e0ef613067a3ec0599ffb | |
parent | 34d31e60d7adf2128a796b80f54864f92eb8c94f (diff) | |
download | coreboot-6ef7b8746f8886827f6cf6404c7706675e00e57b.tar.xz |
freq_sel frag
-rw-r--r-- | src/northbridge/intel/haswell/mrc.asm | 33 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc_frags.c | 20 |
2 files changed, 30 insertions, 23 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm index 406454f48d..e67145cf92 100644 --- a/src/northbridge/intel/haswell/mrc.asm +++ b/src/northbridge/intel/haswell/mrc.asm @@ -185,6 +185,7 @@ extern frag_fffa1e83 extern frag_fffa9029 extern frag_fffba1df extern frag_fffba341 +extern freq_sel ;; misc extern fcn_fffbd29a @@ -4435,7 +4436,6 @@ or eax, edx mov edx, dword [ebx + 0x103f] or eax, esi mov esi, dword [ebp - 0x78] -mov ecx, 0xa lea edx, [edi + edx + 0x40d0] mov byte [edx], al imul eax, dword [ebp - 0x6c], 0x1347 @@ -4445,29 +4445,16 @@ lea edi, [esi + eax + 0x16] mov eax, dword [ebx + 0x1749] mov dword [ebp - 0x7c], eax mov eax, dword [ebx + 0x16c6] -cmp eax, 0x320 -jbe short loc_fffa6e30 ; jbe 0xfffa6e30 -cmp eax, 0x42b -mov cl, 0xd -jbe short loc_fffa6e30 ; jbe 0xfffa6e30 -cmp eax, 0x535 -mov cl, 0x10 -jbe short loc_fffa6e30 ; jbe 0xfffa6e30 -cmp eax, 0x640 -mov cl, 0x14 -jbe short loc_fffa6e30 ; jbe 0xfffa6e30 -cmp eax, 0x74b -mov cl, 0x17 -jbe short loc_fffa6e30 ; jbe 0xfffa6e30 -cmp eax, 0x855 -mov cl, 0x1a -jbe short loc_fffa6e30 ; jbe 0xfffa6e30 -cmp eax, 0x961 -sbb ecx, ecx -and ecx, 0xfffffffd -add ecx, 0x20 -loc_fffa6e30: ; not directly referenced +push ebx +mov ebx, eax ; save eax first +push eax +call freq_sel +mov ecx, eax +add esp, 4 +mov eax, ebx +pop ebx + cmp ecx, 0x3f mov edx, 0x3f cmova ecx, edx diff --git a/src/northbridge/intel/haswell/mrc_frags.c b/src/northbridge/intel/haswell/mrc_frags.c index 6d1b5c00b6..4fab447b32 100644 --- a/src/northbridge/intel/haswell/mrc_frags.c +++ b/src/northbridge/intel/haswell/mrc_frags.c @@ -246,3 +246,23 @@ void frag_fffba341(void *rcba, u8 *data) write16(rcba + 0x31fe, tmp); } } + +int freq_sel(int freq); +int freq_sel(int freq) +{ + if (freq <= 800) + return 10; + if (freq <= 1067) + return 13; + if (freq <= 1333) + return 16; + if (freq <= 1600) + return 20; + if (freq <= 1867) + return 23; + if (freq <= 2133) + return 26; + if (freq < 2401) + return 29; + return 32; +} |