From 79fccd9ba823849a797b998f57c0efe247583061 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Sat, 16 Nov 2019 20:46:02 +0800 Subject: frag_fffa5810 --- src/northbridge/intel/haswell/mrc.asm | 32 ++++++------------------------- src/northbridge/intel/haswell/mrc_frags.c | 24 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/northbridge/intel/haswell/mrc.asm b/src/northbridge/intel/haswell/mrc.asm index 10481ba8bf..b4087f6d7e 100644 --- a/src/northbridge/intel/haswell/mrc.asm +++ b/src/northbridge/intel/haswell/mrc.asm @@ -220,6 +220,8 @@ global fcn_fffb7e5c global fcn_fffb7c94 global fcn_fffb7acc global fcn_fffb7866 + +extern frag_fffa5810 ;; mrc_entry: @@ -2332,32 +2334,10 @@ jne short loc_fffa586c ; jne 0xfffa586c jmp near loc_fffa58b6 ; jmp 0xfffa58b6 loc_fffa5810: ; not directly referenced -cmp dword [ebx + 0x297c], 2 -jne short loc_fffa583d ; jne 0xfffa583d -imul eax, dword [ebp - 0x70], 0x2a -lea eax, [ebx + eax + 0x297c] -movzx esi, word [eax + 0x10] -mov cx, word [eax + 0xe] -movzx edx, cx -sub edx, esi -cmp edx, 4 -jle short loc_fffa583d ; jle 0xfffa583d -sub ecx, 4 -mov word [eax + 0x10], cx - -loc_fffa583d: ; not directly referenced -cmp dword [ebx + 0x3cc3], 2 -jne short loc_fffa57f9 ; jne 0xfffa57f9 -imul eax, dword [ebp - 0x70], 0x2a -lea eax, [ebx + eax + 0x3cc3] -movzx esi, word [eax + 0x10] -mov cx, word [eax + 0xe] -movzx edx, cx -sub edx, esi -cmp edx, 4 -jle short loc_fffa57f9 ; jle 0xfffa57f9 -sub ecx, 4 -mov word [eax + 0x10], cx +push dword [ebp - 0x70] +push ebx +call frag_fffa5810 +add esp, 8 jmp short loc_fffa57f9 ; jmp 0xfffa57f9 loc_fffa586c: ; not directly referenced diff --git a/src/northbridge/intel/haswell/mrc_frags.c b/src/northbridge/intel/haswell/mrc_frags.c index e3fb5ff86c..bd1e26ff33 100644 --- a/src/northbridge/intel/haswell/mrc_frags.c +++ b/src/northbridge/intel/haswell/mrc_frags.c @@ -20,6 +20,30 @@ void frag_fffa0ff3(void) pci_write_config32(PCI_DEV(0, 2, 0), 0x14, 0); } +void frag_fffa5810(void *ramdata, int idx); +void frag_fffa5810(void *ramdata, int idx) +{ + // ramdata in ebx, idx in [ebp - 0x70] + if (*(int *)(ramdata + 0x297c) == 2) { + void *ptr = ramdata + idx * 0x2a + 0x297c; + uint32_t t1 = *(uint16_t *)(ptr + 0xe); + uint32_t t2 = *(uint16_t *)(ptr + 0x10); + if (4 < (int)(t1 - t2)) { + *(short *)(ptr + 0x10) = t1 - 4; + } + } + // fffa583d + if (*(int *)(ramdata + 0x3cc3) == 2) { + void *ptr = ramdata + idx * 0x2a + 0x3cc3; + uint32_t t1 = *(uint16_t *)(ptr + 0xe); + uint32_t t2 = *(uint16_t *)(ptr + 0x10); + if (4 < (int)(t1 - t2)) { + *(short *)(ptr + 0x10) = t1 - 4; + } + } + // goto loc_fffa57f9 +} + void frag_fffa5d3c(void *bar, uint32_t offset); void frag_fffa5d3c(void *bar, uint32_t offset) { -- cgit v1.2.3