summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-11-17 21:25:34 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 22:37:22 +0800
commit42132fb09996afcf305cb75de1cc30f64a8c95c7 (patch)
treef101d128a6bb08b27abc67b05570440a37fc3cd0
parent0c32ce645c8ebb94883c65ae0e53a2e0dafd4a51 (diff)
downloadcoreboot-42132fb09996afcf305cb75de1cc30f64a8c95c7.tar.xz
fcn_fffb933f from ghidra
-rw-r--r--src/northbridge/intel/haswell/mrc.asm213
-rw-r--r--src/northbridge/intel/haswell/mrc_misc.c74
-rw-r--r--src/northbridge/intel/haswell/mrc_misc.h4
3 files changed, 80 insertions, 211 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm
index 82aafa9ad7..9bc2aab25b 100644
--- a/src/northbridge/intel/haswell/mrc.asm
+++ b/src/northbridge/intel/haswell/mrc.asm
@@ -224,6 +224,8 @@ extern frag_fffa58f7
extern wait_5030
extern wait_5084
global fcn_fffab1b6
+extern fcn_fffb933f
+global MCHBAR_WRITE64
;;
mrc_entry:
@@ -24834,217 +24836,6 @@ pop esi
pop ebp
ret
-fcn_fffb933f: ; not directly referenced
-push ebp
-mov ebp, esp
-push edi
-push esi
-mov esi, 4
-push ebx
-mov ebx, eax
-lea esp, [esp - 0x5c]
-mov byte [ebp - 0x1e], dl
-mov byte [ebp - 0x20], cl
-mov dl, byte [ebp + 0x14]
-movzx ecx, byte [ebp - 0x1e]
-mov byte [ebp - 0x1f], dl
-imul edx, ecx, 0x1347
-mov dword [ebp - 0x24], ecx
-mov ecx, dword [ebx + 0x103f]
-mov al, byte [ebp + 8]
-mov byte [ebp - 0x58], al
-mov edi, dword [ebp + 0xc]
-mov dword [ebp - 0x1c], 0
-mov byte [ebp - 0x1d], 0
-lea eax, [ebx + edx + 0x297c]
-mov byte [ecx + 0x4c31], 0
-cmp byte [eax + 0x120f], 1
-sete byte [ebp - 0x38]
-mov cl, byte [ebp - 0x38]
-or ecx, 2
-cmp byte [eax + 0x130a], 1
-mov al, byte [ebp - 0x38]
-cmove eax, ecx
-mov ecx, dword [ebp - 0x24]
-shl ecx, 0xa
-mov byte [ebp - 0x38], al
-mov eax, dword [ebx + 0x103f]
-mov dword [ebp - 0x28], ecx
-and esi, edi
-add edx, ebx
-mov dword [ebp - 0x40], edx
-lea eax, [ecx + eax + 0x41bc]
-mov ecx, edi
-mov byte [eax], 0
-mov eax, edi
-and eax, 2
-and ecx, 1
-shr al, 1
-add ecx, ecx
-or eax, esi
-or eax, ecx
-mov ecx, eax
-mov eax, edi
-shl ecx, 0x18
-movzx edi, al
-mov dword [ebp - 0x3c], ecx
-mov dword [ebp - 0x44], edi
-
-loc_fffb93f4: ; not directly referenced
-mov edx, dword [ebp - 0x40]
-mov edi, dword [ebp - 0x1c]
-mov ecx, edi
-mov esi, 1
-shl esi, cl
-mov al, byte [edx + 0x3acb]
-and eax, esi
-test byte [ebp - 0x20], al
-je loc_fffb94b6 ; je 0xfffb94b6
-mov ecx, dword [ebp - 0x44]
-xor edx, edx
-and ecx, 7
-mov eax, ecx
-mov ecx, edi
-shr cl, 1
-mov edi, dword [ebp + 0x10]
-movzx ecx, cl
-shl eax, 0x18
-test byte [ebp - 0x1c], 1
-mov di, word [edi + ecx*2]
-mov word [ebp - 0x68], di
-mov ax, di
-je short loc_fffb946f ; je 0xfffb946f
-lea edi, [ecx + 1]
-mov cl, byte [ebp - 0x38]
-test edi, ecx
-je short loc_fffb946f ; je 0xfffb946f
-and ax, 0x150
-mov edx, dword [ebp - 0x68]
-mov ecx, dword [ebp - 0x68]
-and dx, 0xfe07
-shr ax, 1
-and ecx, 0xa8
-mov edi, dword [ebp - 0x3c]
-or eax, edx
-add ecx, ecx
-xor edx, edx
-or eax, ecx
-movzx ecx, ax
-lea eax, [edi + ecx]
-
-loc_fffb946f: ; not directly referenced
-mov cl, byte [ebp - 0x58]
-mov dword [ebp - 0x48], edx
-and ecx, 7
-or dword [ebp - 0x48], 0xf000000
-mov edx, dword [ebp - 0x48]
-mov edi, ecx
-mov ecx, edx
-not esi
-shl edi, 8
-and ch, 0xf8
-or ecx, edi
-and esi, 0xf
-and ecx, 0xfffffff0
-mov edx, ecx
-push ecx
-or edx, esi
-push ecx
-mov ecx, dword [ebp - 0x28]
-push edx
-add ecx, 0x41c0
-push eax
-mov edx, ecx
-mov eax, ebx
-call MCHBAR_WRITE64
-inc byte [ebp - 0x1d]
-add esp, 0x10
-
-loc_fffb94b6: ; not directly referenced
-inc dword [ebp - 0x1c]
-cmp dword [ebp - 0x1c], 4
-jne loc_fffb93f4 ; jne 0xfffb93f4
-cmp byte [ebp - 0x1d], 0
-jne short loc_fffb94d3 ; jne 0xfffb94d3
-
-loc_fffb94c9: ; not directly referenced
-mov eax, 1
-jmp near loc_fffb9584 ; jmp 0xfffb9584
-
-loc_fffb94d3: ; not directly referenced
-mov dl, byte [ebp - 0x1f]
-mov al, 3
-and edx, 7
-cmp byte [ebp - 0x1f], 0
-mov edi, dword [ebp - 0x28]
-cmovne eax, edx
-mov dl, byte [ebp - 0x1d]
-dec edx
-and eax, 7
-and edx, 7
-shl edx, 0x10
-or eax, edx
-mov edx, dword [ebx + 0x103f]
-lea edx, [edi + edx + 0x419c]
-mov edi, dword [ebp - 0x24]
-mov dword [edx], eax
-mov esi, dword [ebx + 0x103f]
-lea ecx, [edi*8 + 0x48a8]
-add esi, ecx
-mov edx, dword [esi]
-mov eax, edx
-and ah, 0xc7
-or ah, 0x20
-mov dword [esi], eax
-lea eax, [edi*4 + 0x48b8]
-mov dword [ebp - 0x1c], eax
-add eax, dword [ebx + 0x103f]
-mov byte [eax], 5
-mov esi, dword [ebx + 0x103f]
-lea edi, [esi + 0x4804]
-
-loc_fffb9540: ; not directly referenced
-cmp byte [ebp - 0x1e], 0
-mov eax, dword [edi]
-jne short loc_fffb9551 ; jne 0xfffb9551
-test al, 1
-je short loc_fffb955a ; je 0xfffb955a
-jmp near loc_fffb94c9 ; jmp 0xfffb94c9
-
-loc_fffb9551: ; not directly referenced
-test al, 2
-je short loc_fffb9565 ; je 0xfffb9565
-jmp near loc_fffb94c9 ; jmp 0xfffb94c9
-
-loc_fffb955a: ; not directly referenced
-shr eax, 0x10
-and eax, 1
-xor eax, 1
-jmp short loc_fffb9570 ; jmp 0xfffb9570
-
-loc_fffb9565: ; not directly referenced
-shr eax, 0x10
-shr al, 1
-xor eax, 1
-and eax, 1
-
-loc_fffb9570: ; not directly referenced
-test al, al
-jne short loc_fffb9540 ; jne 0xfffb9540
-add esi, dword [ebp - 0x1c]
-xor eax, eax
-mov byte [esi], 4
-add ecx, dword [ebx + 0x103f]
-mov dword [ecx], edx
-
-loc_fffb9584: ; not directly referenced
-lea esp, [ebp - 0xc]
-pop ebx
-pop esi
-pop edi
-pop ebp
-ret
-
fcn_fffb958c: ; not directly referenced
push ebp
mov ebp, esp
diff --git a/src/northbridge/intel/haswell/mrc_misc.c b/src/northbridge/intel/haswell/mrc_misc.c
index dcb83576f9..06efc8cb21 100644
--- a/src/northbridge/intel/haswell/mrc_misc.c
+++ b/src/northbridge/intel/haswell/mrc_misc.c
@@ -1838,3 +1838,77 @@ int fcn_fffab280(void *ramdata)
return 0;
}
+
+int MRCABI
+fcn_fffb933f(void *ramdata,uint8_t idx,uint8_t param_3,uint8_t param_4,uint32_t param_5,
+ void *param_6,uint8_t param_7)
+
+{
+ int iVar1;
+ uint32_t uVar4;
+ int iVar7;
+ uint32_t uVar9;
+ int cnt;
+ void *ptr0;
+
+ cnt = 0;
+ ptr0 = (ramdata + idx * 0x1347 + 0x297c);
+ MCHBAR8(0x4c31) = 0;
+ uint8_t tmp8 = *(char *)(ptr0 + 0x120f) == '\x01';
+ if (*(char *)(ptr0 + 0x130a) == '\x01') {
+ tmp8 = tmp8 | 2;
+ }
+ iVar7 = idx * 0x400;
+ MCHBAR8(0x41bc + iVar7) = 0;
+ for (int i = 0; i < 4; i++) {
+ uVar9 = (1 << i);
+ if ((param_3 & *(uint8_t*)(ramdata + idx * 0x1347 + 0x3acb) & (uint8_t)uVar9) != 0) {
+ uint32_t uVar8 = i >> 1;
+ uint16_t uVar2 = *(uint16_t*)(param_6 + uVar8 * 2);
+ uVar4 = ((param_5 & 7) << 0x18) | (uint32_t)uVar2;
+ if (((i & 1) != 0) && (((uint32_t)tmp8 & (uVar8 + 1)) != 0)) {
+ uVar4 = (((param_5 & 2) >> 1) | (param_5 & 4) | ((param_5 & 1) * 2)) * 0x1000000 +
+ ((uint32_t)((uVar2 & 0x150) >> 1) | ((uint32_t)uVar2 & 0xfe07) | (((uint32_t)uVar2 & 0xa8) * 2));
+ }
+#define CONCAT44(hi,lo) ((uint64_t)((((uint64_t)(hi)) << 32) | lo))
+ MCHBAR_WRITE64(ramdata,iVar7 + 0x41c0,
+ CONCAT44((((uint32_t)param_4 & 7) << 8) | 0xf000000 | (~uVar9 & 0xf),uVar4));
+ cnt = cnt + 1;
+ }
+ }
+
+ if (cnt == 0) {
+ return 1;
+ } else {
+ if (param_7 != '\0') {
+ uVar9 = param_7 & 7;
+ } else {
+ uVar9 = 3;
+ }
+ MCHBAR32(iVar7 + 0x419c) = uVar9 | (((cnt - 1) & 7) << 0x10);
+ iVar7 = idx * 8 + 0x48a8;
+ uVar9 = MCHBAR32(iVar7);
+ MCHBAR32(iVar7) = (uVar9 & 0xffffc7ff) | 0x2000;
+ iVar1 = idx * 4 + 0x48b8;
+ MCHBAR8(iVar1) = 5;
+
+ uint8_t bVar3;
+ do {
+ uint32_t reg32 = MCHBAR32(0x4804);
+ if (idx == '\0') {
+ if ((reg32 & 1) != 0) {
+ return 1;
+ }
+ bVar3 = ((reg32 >> 0x10) & 1) ^ 1;
+ } else {
+ if ((reg32 & 2) != 0)
+ return 1;
+ bVar3 = ((reg32 >> 0x11) ^ 1) & 1;
+ }
+ } while (bVar3 != 0);
+
+ MCHBAR8(iVar1) = 4;
+ MCHBAR32(iVar7) = uVar9;
+ return 0;
+ }
+}
diff --git a/src/northbridge/intel/haswell/mrc_misc.h b/src/northbridge/intel/haswell/mrc_misc.h
index fc94358407..49ecab8cfe 100644
--- a/src/northbridge/intel/haswell/mrc_misc.h
+++ b/src/northbridge/intel/haswell/mrc_misc.h
@@ -61,3 +61,7 @@ int MRCABI wait_5084(void *ramdata);
int fcn_fffa7e78(void *ramdata);
int fcn_fffa948c(void *ramdata);
int fcn_fffab280(void *ramdata);
+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);