summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-01-02 15:46:40 +0800
committerIru Cai <mytbk920423@gmail.com>2019-11-17 15:10:46 +0800
commit44eab66ad5fb26bd4b9a8702caf9d05703fc8c72 (patch)
tree6e9a63e2a04fed7d56600bb7cb966826dbf3ce7c /src
parent5feee293046f08a8e5b408bbdb5cdbb691d4938e (diff)
downloadcoreboot-44eab66ad5fb26bd4b9a8702caf9d05703fc8c72.tar.xz
frag_usb_loop3
Diffstat (limited to 'src')
-rw-r--r--src/northbridge/intel/haswell/mrc_frags.c14
-rw-r--r--src/northbridge/intel/haswell/pei_usb.asm44
2 files changed, 25 insertions, 33 deletions
diff --git a/src/northbridge/intel/haswell/mrc_frags.c b/src/northbridge/intel/haswell/mrc_frags.c
index 2092dc5813..d30619d6e1 100644
--- a/src/northbridge/intel/haswell/mrc_frags.c
+++ b/src/northbridge/intel/haswell/mrc_frags.c
@@ -711,6 +711,20 @@ void frag_usb_loop2(void *ebx, u32 *esi, int count)
}
}
+void frag_usb_loop3(void *ebx, u32 *esi, int count);
+void frag_usb_loop3(void *ebx, u32 *esi, int count)
+{
+ for (int i = 0; i < count; i++) {
+ void *addr = ebx + esi[i];
+ u32 tmp = read32(addr);
+ if ((tmp & 1) == 0)
+ continue;
+ tmp &= 0xffffffed;
+ tmp |= 0x10;
+ write32(addr, tmp);
+ }
+}
+
/* from loc_fffaf684 to loc_fffaf75b */
void set_usb_overcurrent(PEI_USB *upd);
void set_usb_overcurrent(PEI_USB *upd)
diff --git a/src/northbridge/intel/haswell/pei_usb.asm b/src/northbridge/intel/haswell/pei_usb.asm
index 0bf63d20b1..0d5b6be1b5 100644
--- a/src/northbridge/intel/haswell/pei_usb.asm
+++ b/src/northbridge/intel/haswell/pei_usb.asm
@@ -18,6 +18,7 @@ extern frag_usb_fffaf75b
extern frag_usb_fffaf7d8
extern frag_usb_fffaf210
extern frag_usb_loop2
+extern frag_usb_loop3
mrc_init_usb:
push ebp
@@ -320,24 +321,12 @@ test eax, eax
je loc_fffaf3ef ; je 0xfffaf3ef
loc_fffaf2a0:
-xor eax, eax
-
-loc_fffaf2a2:
-mov edx, dword [ebp - 0x3c]
-mov ecx, ebx
-add ecx, dword [edx + eax*4]
-mov edx, dword [ecx]
-and dl, 1
-je short loc_fffaf2bb ; je 0xfffaf2bb
-mov edx, dword [ecx]
-and edx, 0xffffffed
-or edx, 0x10
-mov dword [ecx], edx
+push dword [ebp - 0x38]
+push dword [ebp - 0x3c]
+push ebx
+call frag_usb_loop3
+add esp, 12
-loc_fffaf2bb:
-inc eax
-cmp eax, dword [ebp - 0x38]
-jb short loc_fffaf2a2 ; jb 0xfffaf2a2
mov dword [ebp - 0x2c], 0xa
loc_fffaf2c8:
@@ -472,24 +461,13 @@ loc_fffaf44c:
mov eax, dword [ebp - 0x30]
test byte [eax + 0x57], 0x10
je loc_fffaf5ea ; je 0xfffaf5ea
-xor edx, edx
-loc_fffaf45b:
-mov eax, dword [ebp - 0x3c]
-mov ecx, ebx
-add ecx, dword [eax + edx*4]
-mov eax, dword [ecx]
-test al, 1
-je short loc_fffaf473 ; je 0xfffaf473
-mov eax, dword [ecx]
-and eax, 0xffffffed
-or eax, 0x10
-mov dword [ecx], eax
+push dword [ebp - 0x38]
+push dword [ebp - 0x3c]
+push ebx
+call frag_usb_loop3
+add esp, 12
-loc_fffaf473:
-inc edx
-cmp edx, dword [ebp - 0x38]
-jb short loc_fffaf45b ; jb 0xfffaf45b
mov dword [ebp - 0x2c], 0xa
loc_fffaf480: