summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-11-16 12:53:50 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 15:10:47 +0800
commit40da44f5b70185e99c0f36f0205c7d9f30a75a2a (patch)
tree992bf67c22f79051b1ce72893683d20a41e7306a /src
parentfe8c781ae425a189d53bec3b78f2100110961c2a (diff)
downloadcoreboot-40da44f5b70185e99c0f36f0205c7d9f30a75a2a.tar.xz
fcn_fffb8689 from ghidra
Diffstat (limited to 'src')
-rw-r--r--src/northbridge/intel/haswell/mrc.asm332
-rw-r--r--src/northbridge/intel/haswell/mrc_misc.c152
-rw-r--r--src/northbridge/intel/haswell/mrc_misc.h40
3 files changed, 221 insertions, 303 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm
index d6703c77a3..812871f723 100644
--- a/src/northbridge/intel/haswell/mrc.asm
+++ b/src/northbridge/intel/haswell/mrc.asm
@@ -107,7 +107,6 @@ global fcn_fffb5cbc
global fcn_fffb8040
global fcn_fffb85ca
global fcn_fffb8625
-global fcn_fffb8689
global fcn_fffb89f8
global fcn_fffb8d2d
global fcn_fffba408
@@ -181,7 +180,6 @@ extern frag_fffba341
extern freq_sel
;; misc
-extern fcn_fffbd29a
global fcn_fffb2d76
global fcn_fffb1d24
global fcn_fffb2062
@@ -192,6 +190,37 @@ extern do_smbus_op
extern udiv64
extern ref_fffcbc04
+global fcn_fffbd356
+global fcn_fffbd30a
+global fcn_fffbd1e7
+global fcn_fffbd184
+global fcn_fffbd1b3
+global fcn_fffbd106
+global fcn_fffbd29a
+global fcn_fffbd213
+global fcn_fffbd0e4
+global fcn_fffbd0c8
+global fcn_fffbd046
+global fcn_fffbd01d
+
+global fcn_fffbce60
+global fcn_fffb73ef
+global fcn_fffb6f52
+global fcn_fffbcc31
+global fcn_fffbc869
+global fcn_fffbc643
+global fcn_fffbc441
+global fcn_fffb7633
+global fcn_fffbc277
+global fcn_fffbc075
+global fcn_fffbbe9c
+global fcn_fffbca4d
+global fcn_fffbbcd4
+global fcn_fffbbb0c
+global fcn_fffb7e5c
+global fcn_fffb7c94
+global fcn_fffb7acc
+global fcn_fffb7866
;;
mrc_entry:
@@ -24691,266 +24720,6 @@ call fcn_fffb03ba ; call 0xfffb03ba
leave
ret
-fcn_fffb8689: ; not directly referenced
-push ebp
-mov ebp, esp
-push edi
-push esi
-lea edi, [ebp - 0x60]
-push ebx
-lea esp, [esp - 0x9c]
-mov ebx, dword [ebp + 8]
-mov dword [ebp - 0x74], 0
-mov dword [ebp - 0x80], 0
-mov dword [ebp - 0x78], 0
-mov dword [ebp - 0x7c], 0x16
-mov dword [ebp - 0x6c], edi
-lea eax, [ebx + 0x10b7]
-lea edx, [ebx + 0x2974]
-mov dword [ebp - 0x8c], eax
-mov dword [ebp - 0x90], edx
-
-loc_fffb86d3: ; not directly referenced
-imul edx, dword [ebp - 0x74], 0x2fa
-mov eax, dword [ebp - 0x8c]
-mov ecx, dword [ebp - 0x90]
-mov dword [ebp - 0x70], 0
-mov dword [ebp - 0x88], edx
-lea eax, [eax + edx + 5]
-mov dword [ebp - 0x94], eax
-imul eax, dword [ebp - 0x74], 0x1347
-mov dword [ebp - 0x9c], eax
-lea ecx, [ecx + eax + 8]
-mov dword [ebp - 0x98], ecx
-
-loc_fffb8714: ; not directly referenced
-imul eax, dword [ebp - 0x70], 0x14f
-mov edi, dword [ebp - 0x94]
-cmp dword [edi + eax + 8], 1
-ja loc_fffb8880 ; ja 0xfffb8880
-mov edx, dword [ebp - 0x88]
-mov esi, ref_fffcbb8c ; mov esi, 0xfffcbb8c
-mov ecx, 0xc
-mov edi, dword [ebp - 0x6c]
-rep movsd ; rep movsd dword es:[edi], dword ptr [esi]
-lea eax, [eax + edx + 0x10c0]
-mov ecx, dword [ebp - 0x9c]
-lea esi, [ebx + eax + 0x28]
-imul eax, dword [ebp - 0x70], 0xfb
-lea eax, [eax + ecx + 0x3ab0]
-lea edi, [ebx + eax]
-xor eax, eax
-lea edx, [edi + 0x1d]
-mov dword [edi + 0x1d], 3
-mov dword [ebp - 0x84], edx
-
-loc_fffb8775: ; not directly referenced
-mov dl, byte [esi + eax]
-inc eax
-test dl, dl
-jne short loc_fffb87ae ; jne 0xfffb87ae
-cmp eax, 0x100
-jne short loc_fffb8775 ; jne 0xfffb8775
-jmp near loc_fffb8880 ; jmp 0xfffb8880
-
-loc_fffb8789: ; not directly referenced
-push eax
-push dword [ebp - 0x84]
-movzx eax, dl
-mov byte [ebp - 0xa0], dl
-push esi
-push ebx
-call dword [ebp + eax*4 - 0x60] ; ucall
-mov dl, byte [ebp - 0xa0]
-and eax, 1
-inc edx
-add esp, 0x10
-jmp short loc_fffb87b5 ; jmp 0xfffb87b5
-
-loc_fffb87ae: ; not directly referenced
-xor edx, edx
-mov eax, 1
-
-loc_fffb87b5: ; not directly referenced
-cmp dl, 0xb
-setbe cl
-test cl, al
-jne short loc_fffb8789 ; jne 0xfffb8789
-test eax, eax
-jne short loc_fffb87cf ; jne 0xfffb87cf
-mov dword [edi + 0x1d], 1
-jmp near loc_fffb8880 ; jmp 0xfffb8880
-
-loc_fffb87cf: ; not directly referenced
-imul eax, dword [ebp - 0x70], 0x14f
-mov ecx, dword [ebp - 0x88]
-mov dword [edi + 0x1d], 2
-mov edx, 0xb
-lea esi, [eax + ecx + 0x10a0]
-add esi, ebx
-mov ecx, dword [ebp - 0x84]
-add ecx, 0xdb
-lea eax, [esi + 0xbd]
-call crc16 ; call 0xfffb8646
-cmp dword [esi + 0x24], 1
-jne short loc_fffb8815 ; jne 0xfffb8815
-mov dword [edi + 0x1d], 1
-
-loc_fffb8815: ; not directly referenced
-imul eax, dword [ebp - 0x70], 0xfb
-mov edi, dword [ebp - 0x98]
-mov edx, dword [ebx + 0x1749]
-test edx, edx
-lea eax, [edi + eax + 0x1151]
-jne short loc_fffb8841 ; jne 0xfffb8841
-mov edx, dword [eax + 0xc5]
-mov dword [ebx + 0x1749], edx
-jmp short loc_fffb8853 ; jmp 0xfffb8853
-
-loc_fffb8841: ; not directly referenced
-cmp edx, dword [eax + 0xc5]
-mov edx, 0x19
-cmove edx, dword [ebp - 0x7c]
-mov dword [ebp - 0x7c], edx
-
-loc_fffb8853: ; not directly referenced
-cmp dword [ebp - 0x78], 0
-jne short loc_fffb8864 ; jne 0xfffb8864
-mov eax, dword [eax + 0xc9]
-mov dword [ebp - 0x78], eax
-jmp short loc_fffb8873 ; jmp 0xfffb8873
-
-loc_fffb8864: ; not directly referenced
-mov edx, dword [ebp - 0x78]
-cmp edx, dword [eax + 0xc9]
-jne loc_fffb89db ; jne 0xfffb89db
-
-loc_fffb8873: ; not directly referenced
-cmp dword [ebp - 0x7c], 0x19
-je loc_fffb89ed ; je 0xfffb89ed
-inc dword [ebp - 0x80]
-
-loc_fffb8880: ; not directly referenced
-inc dword [ebp - 0x70]
-cmp dword [ebp - 0x70], 2
-jne loc_fffb8714 ; jne 0xfffb8714
-inc dword [ebp - 0x74]
-cmp dword [ebp - 0x74], 2
-jne loc_fffb86d3 ; jne 0xfffb86d3
-cmp dword [ebp - 0x80], 0
-je loc_fffb89ed ; je 0xfffb89ed
-lea edi, [ebp - 0x60]
-mov esi, ref_fffcbbbc ; mov esi, 0xfffcbbbc
-mov ecx, 0x12
-mov eax, 1
-rep movsd ; rep movsd dword es:[edi], dword ptr [esi]
-jmp short loc_fffb88d8 ; jmp 0xfffb88d8
-
-loc_fffb88ba: ; not directly referenced
-sub esp, 0xc
-mov byte [ebp - 0xa0], cl
-movzx eax, cl
-push ebx
-call dword [ebp + eax*4 - 0x60] ; ucall
-mov cl, byte [ebp - 0xa0]
-and eax, 1
-inc ecx
-add esp, 0x10
-
-loc_fffb88d8: ; not directly referenced
-cmp cl, 0x11
-setbe dl
-test dl, al
-jne short loc_fffb88ba ; jne 0xfffb88ba
-test eax, eax
-je loc_fffb89ed ; je 0xfffb89ed
-lea edi, [ebx + 0x2974]
-mov byte [ebx + 0x1740], 1
-mov dword [ebp - 0x70], 0
-mov dword [ebp - 0x74], edi
-
-loc_fffb8901: ; not directly referenced
-imul eax, dword [ebp - 0x70], 0x1347
-mov edx, dword [ebp - 0x74]
-lea eax, [edx + eax + 8]
-xor edx, edx
-mov byte [eax + 0xf0], 1
-
-loc_fffb8918: ; not directly referenced
-imul ecx, edx, 0xfb
-lea ecx, [eax + ecx + 0x1150]
-mov edi, dword [ecx + 1]
-lea esi, [ecx + 1]
-dec edi
-cmp edi, 1
-ja short loc_fffb8937 ; ja 0xfffb8937
-inc dword [eax + 0xf5]
-
-loc_fffb8937: ; not directly referenced
-cmp dword [ecx + 1], 2
-jne short loc_fffb8989 ; jne 0xfffb8989
-mov cl, byte [esi + 0xdd]
-mov byte [ebp - 0x78], 0
-lea edi, [ecx - 1]
-mov ecx, edi
-cmp cl, 1
-ja short loc_fffb8960 ; ja 0xfffb8960
-and edi, 0xff
-mov cl, byte [edi + ref_fffcbc9d] ; mov cl, byte [edi - 0x34363]
-mov byte [ebp - 0x78], cl
-
-loc_fffb8960: ; not directly referenced
-movzx edi, byte [ebp - 0x78]
-lea ecx, [edx + edx]
-shl edi, cl
-mov ecx, edi
-or byte [eax + 0x114f], cl
-mov cl, byte [esi + 0xbc]
-and byte [eax + 0xf0], cl
-mov cl, byte [esi + 0xbc]
-and byte [ebx + 0x1740], cl
-
-loc_fffb8989: ; not directly referenced
-inc edx
-cmp edx, 2
-jne short loc_fffb8918 ; jne 0xfffb8918
-cmp dword [eax + 0xf5], 0
-je short loc_fffb89b9 ; je 0xfffb89b9
-cmp byte [eax + 0x114f], 0
-je short loc_fffb89b9 ; je 0xfffb89b9
-imul eax, dword [ebp - 0x70], 0x1347
-mov edi, dword [ebp - 0x74]
-inc byte [ebx + 0x297b]
-mov dword [edi + eax + 8], 2
-
-loc_fffb89b9: ; not directly referenced
-inc dword [ebp - 0x70]
-cmp dword [ebp - 0x70], 2
-jne loc_fffb8901 ; jne 0xfffb8901
-jmp short loc_fffb89e4 ; jmp 0xfffb89e4
-
-loc_fffb89c8: ; not directly referenced
-mov dword [ebx + 0x2974], 2
-mov dword [ebp - 0x7c], 0
-jmp short loc_fffb89ed ; jmp 0xfffb89ed
-
-loc_fffb89db: ; not directly referenced
-mov dword [ebp - 0x7c], 0x19
-jmp short loc_fffb89ed ; jmp 0xfffb89ed
-
-loc_fffb89e4: ; not directly referenced
-cmp byte [ebx + 0x297b], 0
-jne short loc_fffb89c8 ; jne 0xfffb89c8
-
-loc_fffb89ed: ; not directly referenced
-mov eax, dword [ebp - 0x7c]
-lea esp, [ebp - 0xc]
-pop ebx
-pop esi
-pop edi
-pop ebp
-ret
-
fcn_fffb89f8: ; not directly referenced
push ebp
mov ebp, esp
@@ -46263,40 +46032,6 @@ dd 0x0bb80bb8
dd 0x00000000
dd 0x00000000
-ref_fffcbb8c:
-dd fcn_fffbd356
-dd fcn_fffbd30a
-dd fcn_fffbd1e7
-dd fcn_fffbd184
-dd fcn_fffbd1b3
-dd fcn_fffbd106
-dd fcn_fffbd29a
-dd fcn_fffbd213
-dd fcn_fffbd0e4
-dd fcn_fffbd0c8
-dd fcn_fffbd046
-dd fcn_fffbd01d
-
-ref_fffcbbbc:
-dd fcn_fffbce60
-dd fcn_fffb73ef
-dd fcn_fffb6f52
-dd fcn_fffbcc31
-dd fcn_fffbc869
-dd fcn_fffbc643
-dd fcn_fffbc441
-dd fcn_fffb7633
-dd fcn_fffbc277
-dd fcn_fffbc075
-dd fcn_fffbbe9c
-dd fcn_fffbca4d
-dd fcn_fffbbcd4
-dd fcn_fffbbb0c
-dd fcn_fffb7e5c
-dd fcn_fffb7c94
-dd fcn_fffb7acc
-dd fcn_fffb7866
-
ref_fffcbc04:
dd 0xffffffff
@@ -46342,11 +46077,6 @@ dd 0x00000000
dd 0x00000000
db 0x00
-ref_fffcbc9d:
-db 0x01
-db 0x03
-db 0x00
-
ref_fffcbcd0:
dd loc_fffb9240
dd loc_fffb917c
diff --git a/src/northbridge/intel/haswell/mrc_misc.c b/src/northbridge/intel/haswell/mrc_misc.c
index b0c6eca251..bbd642e26f 100644
--- a/src/northbridge/intel/haswell/mrc_misc.c
+++ b/src/northbridge/intel/haswell/mrc_misc.c
@@ -75,8 +75,7 @@ uint8_t __attribute((regparm(1))) pci_setup_bridge(uint8_t bus)
return (r == 0)?bus:r;
}
-int fcn_fffbd29a(u32 a0, void * a1, void * a2);
-int fcn_fffbd29a(u32 a0, void * a1, void * a2)
+int fcn_fffbd29a(void * a0, void * a1, void * a2)
{
u32 b1 = (*(u8*)(a1 + 5) >> 3) & 7;
u32 *wb = (u32*)(a2 + 0xd5);
@@ -1103,3 +1102,152 @@ loc_fffa79d5:
*(uint32_t*)(ramdata + 0x16ca) = 2500000;
return 0;
}
+
+static const callback3_t ref_fffcbb8c[] = {
+ fcn_fffbd356, fcn_fffbd30a, fcn_fffbd1e7, fcn_fffbd184, fcn_fffbd1b3, fcn_fffbd106,
+ fcn_fffbd29a, fcn_fffbd213, fcn_fffbd0e4, fcn_fffbd0c8, fcn_fffbd046, fcn_fffbd01d};
+
+static const callback_t ref_fffcbbbc[] = {
+ fcn_fffbce60, fcn_fffb73ef, fcn_fffb6f52, fcn_fffbcc31, fcn_fffbc869, fcn_fffbc643,
+ fcn_fffbc441, fcn_fffb7633, fcn_fffbc277, fcn_fffbc075, fcn_fffbbe9c, fcn_fffbca4d,
+ fcn_fffbbcd4, fcn_fffbbb0c, fcn_fffb7e5c, fcn_fffb7c94, fcn_fffb7acc, fcn_fffb7866};
+
+static const uint8_t ref_fffcbc9d[] = {1, 3, 0};
+
+int fcn_fffb8689(void *ramdata)
+{
+ char *pcVar1;
+ char cVar2;
+ int iVar3;
+ uint32_t uVar4;
+ void * ptr5;
+ int iVar8;
+ int iVar9;
+ void * ptr9;
+ int local_84;
+ int local_80;
+ int local_7c;
+ int local_78;
+ int local_74;
+ void *local_64[21];
+
+ PRINT_FUNC;
+
+ local_78 = 0;
+ local_84 = 0;
+ local_7c = 0;
+ local_80 = 0x16;
+ do {
+ iVar8 = local_78 * 0x2fa;
+ local_74 = 0;
+ do {
+ if (*(uint32_t *)(ramdata + local_74 * 0x14f + iVar8 + 0x10c4) < 2) {
+ memcpy(local_64, ref_fffcbb8c, sizeof(callback3_t) * 12);
+ ptr9 = ramdata + local_74 * 0x14f + 0x10e8 + iVar8;
+ ptr5 = ramdata + local_74 * 0xfb + 0x3ab0 + local_78 * 0x1347;
+ iVar3 = 0;
+ *(uint32_t *)(ptr5 + 0x1d) = 3;
+ loc_fffb8775:
+ pcVar1 = (char *)(ptr9 + iVar3);
+ iVar3 = iVar3 + 1;
+ if (*pcVar1 == '\0')
+ goto code_r0x0002376f;
+ uVar4 = 1;
+ for (int k = 0; k < 12 && uVar4 != 0; k++) {
+ uVar4 = ((callback3_t)local_64[k])(ramdata, ptr9, ptr5 + 0x1d) & 1;
+ }
+ if (uVar4 == 0) {
+ *(uint32_t *)(ptr5 + 0x1d) = 1;
+ } else {
+ *(uint32_t *)(ptr5 + 0x1d) = 2;
+ ptr9 = ramdata + local_74 * 0x14f + 0x10a0 + iVar8;
+ crc16((uint8_t *)(ptr9 + 0xbd), 0xb,
+ (uint16_t *)(ptr5 + 0xf8));
+ if (*(int *)(ptr9 + 0x24) == 1) {
+ *(uint32_t *)(ptr5 + 0x1d) = 1;
+ }
+ ptr5 = ramdata + local_74 * 0xfb + local_78 * 0x1347
+ + 0x3acd;
+ if (*(int *)(ramdata + 0x1749) == 0) {
+ *(uint32_t *)(ramdata + 0x1749) =
+ *(uint32_t *)(ptr5 + 0xc5);
+ iVar9 = local_80;
+ } else {
+ iVar9 = 0x19;
+ if (*(int *)(ramdata + 0x1749)
+ == *(int *)(ptr5 + 0xc5)) {
+ iVar9 = local_80;
+ }
+ }
+ local_80 = iVar9;
+ if (local_7c == 0) {
+ local_7c = *(int *)(ptr5 + 0xc9);
+ } else {
+ if (local_7c != *(int *)(ptr5 + 0xc9)) {
+ return 0x19;
+ }
+ }
+ if (local_80 == 0x19) {
+ return 0x19;
+ }
+ local_84 = local_84 + 1;
+ }
+ }
+ loc_fffb8880:
+ local_74 = local_74 + 1;
+ } while (local_74 != 2);
+ local_78 = local_78 + 1;
+ if (local_78 == 2) {
+ if (local_84 != 0) {
+ memcpy(local_64, ref_fffcbbbc, sizeof(callback_t) * 18);
+ uVar4 = 1;
+ for (int k = 0; k < 18 && uVar4 != 0; k++) {
+ uVar4 = (((callback_t)local_64[k])(ramdata)) & 1;
+ }
+ if (uVar4 != 0) {
+ *(uint8_t *)(ramdata + 0x1740) = 1;
+ for (int i = 0; i < 2; i++) {
+ void *ptr8 = ramdata + i * 0x1347 + 0x297c;
+ *(uint8_t *)(ptr8 + 0xf0) = 1;
+ for (int j = 0; j < 2; j++) {
+ void *ptr10 = ptr8 + 0x1150 + j * 0xfb;
+ if (*(int *)(ptr10 + 1) - 1U < 2) {
+ *(int *)(ptr8 + 0xf5) += 1;
+ }
+ if (*(int *)(ptr10 + 1) == 2) {
+ uint8_t bVar12 = (*(uint8_t *)(ptr10 + 0xde) - 1);
+ if (bVar12 < 2) {
+ cVar2 = ref_fffcbc9d[bVar12];
+ } else {
+ cVar2 = 0;
+ }
+ *(uint8_t *)(ptr8 + 0x114f) |=
+ (cVar2 << (j * 2));
+ *(uint8_t *)(ptr8 + 0xf0) &=
+ *(uint8_t *)(ptr10 + 0xbd);
+ *(uint8_t *)(ramdata + 0x1740) &=
+ *(uint8_t *)(ptr10 + 0xbd);
+ }
+ }
+ if ((*(int *)(ptr8 + 0xf5) != 0)
+ && (*(char *)(ptr8 + 0x114f) != '\0')) {
+ *(char *)(ramdata + 0x297b) += 1;
+ *(uint32_t *)(ramdata
+ + i * 0x1347
+ + 0x297c) = 2;
+ }
+ }
+ if (*(char *)(ramdata + 0x297b) != '\0') {
+ *(uint32_t *)(ramdata + 0x2974) = 2;
+ local_80 = 0;
+ }
+ }
+ }
+ return local_80;
+ }
+ } while (true);
+code_r0x0002376f:
+ if (iVar3 == 0x100)
+ goto loc_fffb8880;
+ goto loc_fffb8775;
+}
diff --git a/src/northbridge/intel/haswell/mrc_misc.h b/src/northbridge/intel/haswell/mrc_misc.h
index 0d0a781ac1..3afc1aacfd 100644
--- a/src/northbridge/intel/haswell/mrc_misc.h
+++ b/src/northbridge/intel/haswell/mrc_misc.h
@@ -14,3 +14,43 @@ uint64_t udiv64(uint64_t, uint64_t);
int fcn_fffaa6af(void *ram_data);
int fcn_fffa78a0(void *ramdata);
+
+typedef int (*callback_t)(void *);
+typedef int (*callback3_t)(void *, void *, void *);
+
+#define DECL_CB1(f) int f(void *)
+#define DECL_CB3(f) int f(void *, void *, void *)
+
+DECL_CB3(fcn_fffbd356);
+DECL_CB3(fcn_fffbd30a);
+DECL_CB3(fcn_fffbd1e7);
+DECL_CB3(fcn_fffbd184);
+DECL_CB3(fcn_fffbd1b3);
+DECL_CB3(fcn_fffbd106);
+DECL_CB3(fcn_fffbd29a);
+DECL_CB3(fcn_fffbd213);
+DECL_CB3(fcn_fffbd0e4);
+DECL_CB3(fcn_fffbd0c8);
+DECL_CB3(fcn_fffbd046);
+DECL_CB3(fcn_fffbd01d);
+
+DECL_CB1(fcn_fffbce60);
+DECL_CB1(fcn_fffb73ef);
+DECL_CB1(fcn_fffb6f52);
+DECL_CB1(fcn_fffbcc31);
+DECL_CB1(fcn_fffbc869);
+DECL_CB1(fcn_fffbc643);
+DECL_CB1(fcn_fffbc441);
+DECL_CB1(fcn_fffb7633);
+DECL_CB1(fcn_fffbc277);
+DECL_CB1(fcn_fffbc075);
+DECL_CB1(fcn_fffbbe9c);
+DECL_CB1(fcn_fffbca4d);
+DECL_CB1(fcn_fffbbcd4);
+DECL_CB1(fcn_fffbbb0c);
+DECL_CB1(fcn_fffb7e5c);
+DECL_CB1(fcn_fffb7c94);
+DECL_CB1(fcn_fffb7acc);
+DECL_CB1(fcn_fffb7866);
+
+int fcn_fffb8689(void *ramdata);