summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-11-17 22:32:32 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 22:37:26 +0800
commit38492900e1b7059b00229e959dc7e5c9367dccd5 (patch)
tree915685c8c3882cc91c581f6210133b5ed8b9073b
parent42132fb09996afcf305cb75de1cc30f64a8c95c7 (diff)
downloadcoreboot-38492900e1b7059b00229e959dc7e5c9367dccd5.tar.xz
fcn_fffb8fda from ghidra
-rw-r--r--src/northbridge/intel/haswell/mrc.asm102
-rw-r--r--src/northbridge/intel/haswell/mrc_misc.c38
-rw-r--r--src/northbridge/intel/haswell/mrc_misc.h2
3 files changed, 41 insertions, 101 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm
index 9bc2aab25b..d6b890f952 100644
--- a/src/northbridge/intel/haswell/mrc.asm
+++ b/src/northbridge/intel/haswell/mrc.asm
@@ -226,6 +226,7 @@ extern wait_5084
global fcn_fffab1b6
extern fcn_fffb933f
global MCHBAR_WRITE64
+extern fcn_fffb8fda
;;
mrc_entry:
@@ -24501,107 +24502,6 @@ pop edi
pop ebp
ret
-fcn_fffb8fda: ; not directly referenced
-push ebp
-mov ebp, esp
-push edi
-mov edi, eax
-push esi
-mov esi, edx
-push ebx
-shl esi, 0xa
-lea esp, [esp - 0x1c]
-mov dword [ebp - 0x24], ecx
-call mrc_get_timestamp
-add eax, 0x2710
-mov dword [ebp - 0x1c], eax
-lea eax, [esi + 0x4214]
-mov dword [ebp - 0x20], eax
-
-loc_fffb9004: ; not directly referenced
-mov edx, dword [edi + 0x103f]
-mov eax, dword [ebp - 0x20]
-add eax, edx
-mov eax, dword [eax]
-mov ecx, eax
-shr ecx, 0x18
-test cl, cl
-jns loc_fffb90ad ; jns 0xfffb90ad
-call mrc_get_timestamp
-cmp dword [ebp - 0x1c], eax
-ja short loc_fffb9004 ; ja 0xfffb9004
-
-loc_fffb9028: ; not directly referenced
-mov eax, 0x11
-jmp near loc_fffb90c6 ; jmp 0xfffb90c6
-
-loc_fffb9032: ; not directly referenced
-add edx, esi
-mov ebx, dword [edx]
-or ebx, 0x80000000
-mov dword [edx], ebx
-
-loc_fffb903e: ; not directly referenced
-mov al, byte [ebp + 8]
-mov ecx, dword [ebp + 0x10]
-mov ah, byte [ebp + 0xc]
-mov edx, dword [ebp - 0x24]
-or eax, 0x40000
-and ecx, 1
-shl ecx, 0x13
-and eax, 0xfff4ffff
-and edx, 3
-or eax, ecx
-shl edx, 0x10
-or eax, edx
-mov edx, dword [ebp - 0x20]
-add edx, dword [edi + 0x103f]
-or eax, 0x80000000
-mov dword [edx], eax
-call mrc_get_timestamp
-add eax, 0x2710
-mov dword [ebp - 0x1c], eax
-
-loc_fffb9081: ; not directly referenced
-mov edx, dword [edi + 0x103f]
-mov eax, dword [ebp - 0x20]
-add eax, edx
-mov eax, dword [eax]
-shr eax, 0x18
-test al, al
-jns short loc_fffb90be ; jns 0xfffb90be
-call mrc_get_timestamp
-cmp dword [ebp - 0x1c], eax
-ja short loc_fffb9081 ; ja 0xfffb9081
-jmp short loc_fffb9028 ; jmp 0xfffb9028
-
-loc_fffb90a1: ; not directly referenced
-add edx, esi
-and ebx, 0x7fffffff
-mov dword [edx], ebx
-jmp short loc_fffb90c4 ; jmp 0xfffb90c4
-
-loc_fffb90ad: ; not directly referenced
-add esi, 0x4010
-cmp dword [ebp + 0x14], 0
-je short loc_fffb903e ; je 0xfffb903e
-jmp near loc_fffb9032 ; jmp 0xfffb9032
-
-loc_fffb90be: ; not directly referenced
-cmp dword [ebp + 0x14], 0
-jne short loc_fffb90a1 ; jne 0xfffb90a1
-
-loc_fffb90c4: ; not directly referenced
-xor eax, eax
-
-loc_fffb90c6: ; not directly referenced
-lea esp, [esp + 0x1c]
-pop ebx
-pop esi
-pop edi
-pop ebp
-ret
-
fcn_fffb90cf: ; not directly referenced
imul edx, edx, 0x1347
push ebp
diff --git a/src/northbridge/intel/haswell/mrc_misc.c b/src/northbridge/intel/haswell/mrc_misc.c
index 06efc8cb21..de58ab9bfb 100644
--- a/src/northbridge/intel/haswell/mrc_misc.c
+++ b/src/northbridge/intel/haswell/mrc_misc.c
@@ -1912,3 +1912,41 @@ fcn_fffb933f(void *ramdata,uint8_t idx,uint8_t param_3,uint8_t param_4,uint32_t
return 0;
}
}
+
+int MRCABI fcn_fffb8fda(void *ramdata, int idx, uint32_t param_3, uint8_t param_4,
+ uint8_t param_5, uint32_t param_6, uint32_t param_7)
+{
+ int iVar4;
+ uint32_t t1;
+ uint32_t t2;
+
+ int iVar1 = idx * 0x400 + 0x4214;
+ t1 = mrc_get_timestamp();
+ do {
+ uint32_t uVar2 = MCHBAR32(iVar1);
+ if ((uVar2 & 0x80000000) == 0) {
+ iVar4 = idx * 0x400 + 0x4010;
+ uint32_t reg32;
+ if (param_7 != 0) {
+ reg32 = MCHBAR32(iVar4) | 0x80000000;
+ MCHBAR32(iVar4) = reg32;
+ }
+ MCHBAR32(iVar1) =
+ (uVar2 & 0xfff40000) | (((uint32_t)param_5 << 8) | param_4) | 0x40000
+ | ((param_6 & 1) << 0x13) | ((param_3 & 3) << 0x10) | 0x80000000;
+ t1 = mrc_get_timestamp();
+ do {
+ if ((MCHBAR32(iVar1) & 0x80000000) == 0) {
+ if (param_7 != 0) {
+ MCHBAR32(iVar4) = reg32 & 0x7fffffff;
+ }
+ return 0;
+ }
+ t2 = mrc_get_timestamp();
+ } while (t2 < t1 + 10000);
+ return 0x11;
+ }
+ t2 = mrc_get_timestamp();
+ } while (t2 < t1 + 10000);
+ return 0x11;
+}
diff --git a/src/northbridge/intel/haswell/mrc_misc.h b/src/northbridge/intel/haswell/mrc_misc.h
index 49ecab8cfe..ecd12aa7ef 100644
--- a/src/northbridge/intel/haswell/mrc_misc.h
+++ b/src/northbridge/intel/haswell/mrc_misc.h
@@ -65,3 +65,5 @@ void __attribute__((regparm(2))) MCHBAR_WRITE64(void *, uint32_t, uint64_t);
int MRCABI
fcn_fffb933f(void *ramdata,uint8_t param_2,uint8_t param_3,uint8_t param_4,uint32_t param_5,
void *param_6,uint8_t param_7);
+int MRCABI fcn_fffb8fda(void *ramdata, int idx, uint32_t param_3, uint8_t param_4,
+ uint8_t param_5, uint32_t param_6, uint32_t param_7);