diff options
author | Iru Cai <mytbk920423@gmail.com> | 2019-01-02 16:07:44 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2019-11-17 15:10:46 +0800 |
commit | a6a1060c33e374a91c53381a0a36b2f47fe173e1 (patch) | |
tree | d010a4242f4740b58d4dabe1167a325b4366dd12 /src | |
parent | 44eab66ad5fb26bd4b9a8702caf9d05703fc8c72 (diff) | |
download | coreboot-a6a1060c33e374a91c53381a0a36b2f47fe173e1.tar.xz |
frag_usb_loop4
Diffstat (limited to 'src')
-rw-r--r-- | src/northbridge/intel/haswell/mrc_frags.c | 16 | ||||
-rw-r--r-- | src/northbridge/intel/haswell/pei_usb.asm | 86 |
2 files changed, 36 insertions, 66 deletions
diff --git a/src/northbridge/intel/haswell/mrc_frags.c b/src/northbridge/intel/haswell/mrc_frags.c index d30619d6e1..eec36fd6ce 100644 --- a/src/northbridge/intel/haswell/mrc_frags.c +++ b/src/northbridge/intel/haswell/mrc_frags.c @@ -699,6 +699,22 @@ void frag_usb_fffaf210(void *ebx, u32 *esi, int count) } } +void frag_usb_loop4(void *ebx, u32* esi, int count); +void frag_usb_loop4(void *ebx, u32* esi, int count) +{ + u32 tmp; + for (int i = 0; i < 10; i++) { + tmp = 0; + for (int j = 0; j < count; j++) { + void *addr = ebx + esi[j]; + tmp |= read32(addr); + } + usleep(10000); + if ((tmp & 0x10) == 0) + return; + } +} + void frag_usb_loop2(void *ebx, u32 *esi, int count); void frag_usb_loop2(void *ebx, u32 *esi, int count) { diff --git a/src/northbridge/intel/haswell/pei_usb.asm b/src/northbridge/intel/haswell/pei_usb.asm index 0d5b6be1b5..da1f68dca1 100644 --- a/src/northbridge/intel/haswell/pei_usb.asm +++ b/src/northbridge/intel/haswell/pei_usb.asm @@ -19,6 +19,7 @@ extern frag_usb_fffaf7d8 extern frag_usb_fffaf210 extern frag_usb_loop2 extern frag_usb_loop3 +extern frag_usb_loop4 mrc_init_usb: push ebp @@ -434,28 +435,11 @@ push ebx call frag_usb_fffaf210 add esp, 12 -mov dword [ebp - 0x2c], 0xa - -loc_fffaf41f: -xor ecx, ecx -xor eax, eax - -loc_fffaf423: -mov edx, dword [esi + eax*4] -inc eax -add edx, ebx -mov edx, dword [edx] -or ecx, edx -cmp eax, dword [ebp - 0x34] -jb short loc_fffaf423 ; jb 0xfffaf423 -mov eax, 0x2710 -mov dword [ebp - 0x70], ecx -call usleep -mov ecx, dword [ebp - 0x70] -and cl, 0x10 -je short loc_fffaf44c ; je 0xfffaf44c -dec dword [ebp - 0x2c] -jne short loc_fffaf41f ; jne 0xfffaf41f +push dword [ebp - 0x34] +push esi +push ebx +call frag_usb_loop4 +add esp, 12 loc_fffaf44c: mov eax, dword [ebp - 0x30] @@ -468,27 +452,11 @@ push ebx call frag_usb_loop3 add esp, 12 -mov dword [ebp - 0x2c], 0xa - -loc_fffaf480: -mov dword [ebp - 0x60], 0 -xor eax, eax - -loc_fffaf489: -mov edx, dword [ebp - 0x3c] -mov ecx, dword [edx + eax*4] -inc eax -add ecx, ebx -mov edx, dword [ecx] -or dword [ebp - 0x60], edx -cmp eax, dword [ebp - 0x38] -jb short loc_fffaf489 ; jb 0xfffaf489 -mov eax, 0x2710 -call usleep -test byte [ebp - 0x60], 0x10 -je short loc_fffaf4b1 ; je 0xfffaf4b1 -dec dword [ebp - 0x2c] -jne short loc_fffaf480 ; jne 0xfffaf480 +push dword [ebp - 0x38] +push dword [ebp - 0x3c] +push ebx +call frag_usb_loop4 +add esp, 12 loc_fffaf4b1: xor eax, eax @@ -566,33 +534,19 @@ and edx, 0xffffffc0 or edx, eax mov dword [edi + 0xa00d8], edx mov ecx, dword [ebp - 0x34] -mov dword [ebp - 0x38], 0xa lea ecx, [esi + ecx*4] mov dword [ebp - 0x2c], ecx -loc_fffaf57b: -mov eax, esi -xor edx, edx -jmp short loc_fffaf58c ; jmp 0xfffaf58c - -loc_fffaf581: -mov ecx, dword [eax] -add eax, 4 -add ecx, ebx -mov ecx, dword [ecx] -or edx, ecx +; count = ([ebp - 0x2c] - esi)/4 +mov eax, dword [ebp - 0x2c] +sub eax, esi +shr eax, 2 +push eax +push esi +push ebx +call frag_usb_loop4 +add esp, 12 -loc_fffaf58c: -cmp eax, dword [ebp - 0x2c] -jne short loc_fffaf581 ; jne 0xfffaf581 -mov eax, 0x2710 -mov dword [ebp - 0x70], edx -call usleep -mov edx, dword [ebp - 0x70] -and dl, 0x10 -je short loc_fffaf5c5 ; je 0xfffaf5c5 -dec dword [ebp - 0x38] -jne short loc_fffaf57b ; jne 0xfffaf57b jmp short loc_fffaf5c5 ; jmp 0xfffaf5c5 loc_fffaf5ad: |