diff options
author | Iru Cai <mytbk920423@gmail.com> | 2019-11-14 21:18:00 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 15:10:47 +0800 |
commit | 724b95bd22a43368e328c7f23a966a7703b2adda (patch) | |
tree | 8e3da4885f830a89d84e7b82ae54e435680b7650 /src/northbridge | |
parent | ec9b1c226033e587301c82e7c284c47ce4b7974c (diff) | |
download | coreboot-724b95bd22a43368e328c7f23a966a7703b2adda.tar.xz |
fcn_fffa78a0 from ghidra
Diffstat (limited to 'src/northbridge')
-rw-r--r-- | src/northbridge/intel/haswell/mrc.asm | 144 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc_misc.c | 83 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/mrc_misc.h | 1 |
3 files changed, 85 insertions, 143 deletions
diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm index 2e95d81ca3..d6703c77a3 100644 --- a/src/northbridge/intel/haswell/mrc.asm +++ b/src/northbridge/intel/haswell/mrc.asm @@ -69,7 +69,6 @@ global ref_fffcd4e4 extern locate_hob extern fcn_fffa1d20 global fcn_fffa56ac -global fcn_fffa78a0 global fcn_fffa7a1c global fcn_fffa7e71 global fcn_fffa7e78 @@ -191,6 +190,7 @@ global fcn_fffa91af global fcn_fffa0020 extern do_smbus_op extern udiv64 +extern ref_fffcbc04 ;; @@ -4637,148 +4637,6 @@ ret loc_fffa782b: db 0x00 -fcn_fffa78a0: ; not directly referenced -push ebp -mov ebp, esp -push edi -push esi -push ebx -lea esp, [esp - 0x1c] -mov ebx, dword [ebp + 8] -mov eax, dword [ebx + 0x103b] -mov edx, dword [eax + 0xe4] -mov ecx, dword [eax + 0xe8] -xor eax, eax -and dl, 8 -setne al -mov edx, ecx -shr edx, 0x15 -mov dword [ebp - 0x20], eax -shr ecx, 4 -mov eax, dword [ebx + 0xff5] -mov dword [ebx + 0x16d2], eax -mov eax, dword [ebx + 0xff0] -mov dword [ebp - 0x1c], eax -dec eax -and ecx, 7 -cmp eax, 0x7ffffffe -mov eax, 0xa6b -cmovb eax, dword [ebp - 0x1c] -and edx, 7 -mov dword [ebp - 0x1c], eax -mov dword [ebx + 0x16c2], eax -jne short loc_fffa7911 ; jne 0xfffa7911 -mov dword [ebx + 0x16d2], 0 - -loc_fffa7911: ; not directly referenced -cmp dword [ebp - 0x20], 0 -mov esi, dword [ebx + 0x16d2] -je short loc_fffa7931 ; je 0xfffa7931 -test edx, edx -je short loc_fffa797e ; je 0xfffa797e -mov byte [ebx + 0x1747], 1 -xor ecx, ecx -mov edx, 7 -jmp short loc_fffa793a ; jmp 0xfffa793a - -loc_fffa7931: ; not directly referenced -movzx ecx, cl -xor edi, edi -test edx, edx -je short loc_fffa7971 ; je 0xfffa7971 - -loc_fffa793a: ; not directly referenced -add edx, 6 -mov eax, 0xbebc200 -imul edx, edx, 0x5f5e100 -mov dword [ebp - 0x24], ecx -mul edx -push 0x5af3 -add eax, 0x883d2000 -push 0x107a4000 -adc edx, 0x2d79 -push edx -push eax -call udiv64 ; call 0xfffc91d0 -mov edi, eax -add esp, 0x10 -mov ecx, dword [ebp - 0x24] - -loc_fffa7971: ; not directly referenced -test ecx, ecx -je short loc_fffa7980 ; je 0xfffa7980 -mov edx, 0xb -sub edx, ecx -jmp short loc_fffa7985 ; jmp 0xfffa7985 - -loc_fffa797e: ; not directly referenced -xor edi, edi - -loc_fffa7980: ; not directly referenced -mov edx, 0xa - -loc_fffa7985: ; not directly referenced -imul eax, edx, 0x5f5e100 -mov ecx, 0xfe502ab -mul ecx -push 0x5af3 -add eax, 0x883d2000 -push 0x107a4000 -adc edx, 0x2d79 -push edx -push eax -call udiv64 ; call 0xfffc91d0 -add esp, 0x10 -cmp dword [ebx + 0x1021], 0 -je short loc_fffa79d1 ; je 0xfffa79d1 -cmp dword [ebp - 0x20], 0 -je short loc_fffa79c8 ; je 0xfffa79c8 -cmp esi, 1 -cmovne edi, eax -jmp short loc_fffa79d5 ; jmp 0xfffa79d5 - -loc_fffa79c8: ; not directly referenced -cmp edi, eax -mov esi, 1 -ja short loc_fffa79d5 ; ja 0xfffa79d5 - -loc_fffa79d1: ; not directly referenced -mov edi, eax -xor esi, esi - -loc_fffa79d5: ; not directly referenced -cmp edi, dword [ebp - 0x1c] -jae short loc_fffa79e6 ; jae 0xfffa79e6 -mov dword [ebx + 0x16c2], edi -mov dword [ebx + 0x16d2], esi - -loc_fffa79e6: ; not directly referenced -mov ecx, dword [ebx + 0x16c2] -xor eax, eax - -loc_fffa79ee: ; not directly referenced -lea edx, [eax + eax*8] -cmp ecx, dword [edx + ref_fffcbc08] ; cmp ecx, dword [edx - 0x343f8] -jne short loc_fffa7a01 ; jne 0xfffa7a01 -mov eax, dword [edx + ref_fffcbc04] ; mov eax, dword [edx - 0x343fc] -jmp short loc_fffa7a0c ; jmp 0xfffa7a0c - -loc_fffa7a01: ; not directly referenced -inc eax -cmp eax, 0x11 -jne short loc_fffa79ee ; jne 0xfffa79ee -mov eax, 0x2625a0 - -loc_fffa7a0c: ; not directly referenced -mov dword [ebx + 0x16ca], eax -lea esp, [ebp - 0xc] -pop ebx -xor eax, eax -pop esi -pop edi -pop ebp -ret - fcn_fffa7a1c: ; 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 a5370971c7..ae640dabad 100644 --- a/src/northbridge/intel/haswell/mrc_misc.c +++ b/src/northbridge/intel/haswell/mrc_misc.c @@ -990,3 +990,86 @@ int fcn_fffaa6af(void *ram_data) *(uint8_t*)(ram_data + 0x1746) = *(uint8_t*)(ram_data + 0xfd7); return 0; } + +extern uint8_t ref_fffcbc04[]; + +int fcn_fffa78a0(void *ramdata) +{ + uint64_t lVar1; + uint32_t uVar2; + int iVar3; + uint32_t uVar5; + uint32_t uVar6; + uint32_t iVar7; + uint32_t uVar8; + bool bVar9; + uint64_t uVar10; + + uVar6 = *(uint32_t*)(*(void**)(ramdata + 0x103b) + 0xe8); + bVar9 = ((*(uint32_t*)(*(void**)(ramdata + 0x103b) + 0xe4) & 8) != 0); + *(uint32_t*)(ramdata + 0x16d2) = *(uint32_t*)(ramdata + 0xff5); + uVar5 = (uVar6 >> 4) & 7; + if (*(uint32_t*)(ramdata + 0xff0) - 1 < 0x7ffffffe) { + uVar2 = *(uint32_t*)(ramdata + 0xff0); + } else { + uVar2 = 0xa6b; + } + uVar6 = (uVar6 >> 0x15) & 7; + *(uint32_t*)(ramdata + 0x16c2) = uVar2; + if (uVar6 == 0) { + *(uint32_t*)(ramdata + 0x16d2) = 0; + } + iVar3 = *(int *)(ramdata + 0x16d2); + if (bVar9) { + if (uVar6 != 0) { + *(uint8_t*)(ramdata + 0x1747) = 1; + uVar5 = 0; + uVar6 = 7; +loc_fffa793a: + lVar1 = (uint64_t)((uVar6 + 6) * 100000000) * 200000000; + uVar10 = udiv64(lVar1 + 50000000000000ULL, 100000000000000ULL); + uVar8 = (uint32_t)uVar10; + goto loc_fffa7971; + } + uVar8 = 0; +loc_fffa7980: + iVar7 = 10; + } + else { + uVar8 = 0; + if (uVar6 != 0) goto loc_fffa793a; +loc_fffa7971: + if (uVar5 == 0) goto loc_fffa7980; + iVar7 = 0xb - uVar5; + } + lVar1 = (uint64_t)(iVar7 * 100000000) * 266666667; + uVar10 = udiv64(lVar1 + 50000000000000ULL, 100000000000000ULL); + uVar6 = (uint32_t)uVar10; + if (*(int *)(ramdata + 0x1021) != 0) { + if (bVar9) { + if (iVar3 != 1) { + uVar8 = uVar6; + } + goto loc_fffa79d5; + } + iVar3 = 1; + if (uVar6 < uVar8) goto loc_fffa79d5; + } + iVar3 = 0; + uVar8 = uVar6; +loc_fffa79d5: + if (uVar8 < uVar2) { + *(uint32_t*)(ramdata + 0x16c2) = uVar8; + *(int *)(ramdata + 0x16d2) = iVar3; + } + + for (int i = 0; i < 0x11; i++) { + if (*(int *)(ramdata + 0x16c2) == *(int *)((void*)ref_fffcbc04 + iVar3 * 9 + 4)) { + uint32_t uVar4 = *(uint32_t*)((void*)ref_fffcbc04 + iVar3 * 9); + *(uint32_t*)(ramdata + 0x16ca) = uVar4; + return 0; + } + } + *(uint32_t*)(ramdata + 0x16ca) = 2500000; + return 0; +} diff --git a/src/northbridge/intel/haswell/mrc_misc.h b/src/northbridge/intel/haswell/mrc_misc.h index 8baa82549a..0d0a781ac1 100644 --- a/src/northbridge/intel/haswell/mrc_misc.h +++ b/src/northbridge/intel/haswell/mrc_misc.h @@ -13,3 +13,4 @@ fcn_fffb5038(void *ram_data,uint32_t *param_2,uint8_t *param_3,uint32_t *param_4 uint64_t udiv64(uint64_t, uint64_t); int fcn_fffaa6af(void *ram_data); +int fcn_fffa78a0(void *ramdata); |