summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-11-16 21:06:54 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 15:10:47 +0800
commit2c91bbadec91182b01e08f145936c7a192472589 (patch)
treee67137180616104285f08c440e8f799a4f511170
parent79fccd9ba823849a797b998f57c0efe247583061 (diff)
downloadcoreboot-2c91bbadec91182b01e08f145936c7a192472589.tar.xz
frag_fffa58f7
-rw-r--r--src/northbridge/intel/haswell/mrc.asm48
-rw-r--r--src/northbridge/intel/haswell/mrc_frags.c30
2 files changed, 34 insertions, 44 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm
index b4087f6d7e..00a3a008e4 100644
--- a/src/northbridge/intel/haswell/mrc.asm
+++ b/src/northbridge/intel/haswell/mrc.asm
@@ -222,6 +222,7 @@ global fcn_fffb7acc
global fcn_fffb7866
extern frag_fffa5810
+extern frag_fffa58f7
;;
mrc_entry:
@@ -2376,50 +2377,9 @@ mov byte [ebx + 0x16d6], al
jmp near loc_fffa586c ; jmp 0xfffa586c
loc_fffa58f7: ; not directly referenced
-cmp dword [ebx + 0x16d7], 0
-jne short loc_fffa5979 ; jne 0xfffa5979
-cmp dword [ebx + 0x1021], 1
-jne short loc_fffa5915 ; jne 0xfffa5915
-mov al, byte [ebx + 0xff4]
-test al, al
-je short loc_fffa5915 ; je 0xfffa5915
-jmp short loc_fffa5973 ; jmp 0xfffa5973
-
-loc_fffa5915: ; not directly referenced
-mov eax, dword [ebx + 0xff9]
-mov ecx, dword [ebx + 0x16c6]
-test eax, eax
-mov edi, dword [ebx + 0x16d2]
-mov dword [ebp - 0x74], ecx
-mov esi, 0x3e8
-je short loc_fffa593e ; je 0xfffa593e
-mov ecx, 0x186a0
-xor edx, edx
-div ecx
-mov esi, eax
-
-loc_fffa593e: ; not directly referenced
-dec edi
-mov eax, 0x411ab
-mov ecx, 0x30d40
-cmovne ecx, eax
-mov eax, 0x3b9aca00
-imul ecx, esi
-mul dword [ebp - 0x74]
-xor edi, edi
-push edi
-push ecx
-push edx
-push eax
-call udiv64 ; call 0xfffc91d0
-add eax, 0x1f4
-mov ecx, 0x3e8
-xor edx, edx
-add esp, 0x10
-div ecx
-
-loc_fffa5973: ; not directly referenced
-mov byte [ebx + 0x16d6], al
+push ebx
+call frag_fffa58f7
+add esp, 4
loc_fffa5979: ; not directly referenced
mov al, byte [ebx + 0x16d6]
diff --git a/src/northbridge/intel/haswell/mrc_frags.c b/src/northbridge/intel/haswell/mrc_frags.c
index bd1e26ff33..3f058f1511 100644
--- a/src/northbridge/intel/haswell/mrc_frags.c
+++ b/src/northbridge/intel/haswell/mrc_frags.c
@@ -9,6 +9,7 @@
#include <cpu/intel/haswell/haswell.h>
#include "mrc_pch.h"
#include "pei_usb.h"
+#include "mrc_misc.h"
void frag_fffa0ff3(void);
void frag_fffa0ff3(void)
@@ -44,6 +45,35 @@ void frag_fffa5810(void *ramdata, int idx)
// goto loc_fffa57f9
}
+void frag_fffa58f7(void *ramdata);
+void frag_fffa58f7(void *ramdata)
+{
+ // ramdata in ebx
+ char cVar11;
+ if (*(int *)(ramdata + 0x16d7) == 0) {
+ if ((*(int *)(ramdata + 0x1021) != 1) ||
+ (cVar11 = *(char *)(ramdata + 0xff4),cVar11 == '\0')) {
+ uint32_t uVar28;
+ int iVar8;
+ if (*(uint32_t*)(ramdata + 0xff9) != 0) {
+ uVar28 = *(uint32_t*)(ramdata + 0xff9) / 100000;
+ } else {
+ uVar28 = 1000;
+ }
+ if (*(int *)(ramdata + 0x16d2) != 1) {
+ iVar8 = 266667;
+ } else {
+ iVar8 = 200000;
+ }
+ uint64_t uVar37 = udiv64(
+ (uint64_t)(*(uint32_t*)(ramdata + 0x16c6)) * 1000000000,
+ (uint64_t)(iVar8 * uVar28));
+ cVar11 = (char)(((int)uVar37 + 500U) / 1000);
+ }
+ *(char *)((int)ramdata + 0x16d6) = cVar11;
+ }
+}
+
void frag_fffa5d3c(void *bar, uint32_t offset);
void frag_fffa5d3c(void *bar, uint32_t offset)
{