cmp esp, 0\r
jz ParamError\r
\r
+ ;\r
+ ; If microcode already loaded before this function, exit this function with SUCCESS.\r
+ ;\r
+ mov ecx, MSR_IA32_BIOS_SIGN_ID\r
+ xor eax, eax ; Clear EAX\r
+ xor edx, edx ; Clear EDX\r
+ wrmsr ; Load 0 to MSR at 8Bh\r
+\r
+ mov eax, 1\r
+ cpuid\r
+ mov ecx, MSR_IA32_BIOS_SIGN_ID\r
+ rdmsr ; Get current microcode signature\r
+ xor eax, eax\r
+ test edx, edx\r
+ jnz Exit2\r
+\r
; skip loading Microcode if the MicrocodeCodeSize is zero\r
; and report error if size is less than 2k\r
; first check UPD header revision\r
cmp ebx, dword [esi + MicrocodeHdr.MicrocodeHdrProcessor]\r
jne LoadMicrocodeDefault1\r
test edx, dword [esi + MicrocodeHdr.MicrocodeHdrFlags ]\r
- jnz LoadCheck ; Jif signature and platform ID match\r
+ jnz LoadMicrocode ; Jif signature and platform ID match\r
\r
LoadMicrocodeDefault1:\r
; Check if extended header exists\r
cmp dword [edi + ExtSig.ExtSigProcessor], ebx\r
jne LoadMicrocodeDefault2\r
test dword [edi + ExtSig.ExtSigFlags], edx\r
- jnz LoadCheck ; Jif signature and platform ID match\r
+ jnz LoadMicrocode ; Jif signature and platform ID match\r
LoadMicrocodeDefault2:\r
; Check if any more extended signatures exist\r
add edi, ExtSig.size\r
; Is valid Microcode start point ?\r
cmp dword [esi + MicrocodeHdr.MicrocodeHdrVersion], 0ffffffffh\r
jz Done\r
-\r
-LoadCheck:\r
- ; Get the revision of the current microcode update loaded\r
- mov ecx, MSR_IA32_BIOS_SIGN_ID\r
- xor eax, eax ; Clear EAX\r
- xor edx, edx ; Clear EDX\r
- wrmsr ; Load 0 to MSR at 8Bh\r
-\r
- mov eax, 1\r
- cpuid\r
- mov ecx, MSR_IA32_BIOS_SIGN_ID\r
- rdmsr ; Get current microcode signature\r
-\r
- ; Verify this microcode update is not already loaded\r
- cmp dword [esi + MicrocodeHdr.MicrocodeHdrRevision], edx\r
- je Continue\r
-\r
+ jmp CheckMainHeader\r
LoadMicrocode:\r
; EAX contains the linear address of the start of the Update Data\r
; EDX contains zero\r
mov eax, 1\r
cpuid\r
\r
-Continue:\r
- jmp NextMicrocode\r
-\r
Done:\r
+ mov ecx, MSR_IA32_BIOS_SIGN_ID\r
+ xor eax, eax ; Clear EAX\r
+ xor edx, edx ; Clear EDX\r
+ wrmsr ; Load 0 to MSR at 8Bh\r
+\r
mov eax, 1\r
cpuid\r
mov ecx, MSR_IA32_BIOS_SIGN_ID\r
jz ParamError\r
mov rsp, rcx\r
\r
+ ;\r
+ ; If microcode already loaded before this function, exit this function with SUCCESS.\r
+ ;\r
+ mov ecx, MSR_IA32_BIOS_SIGN_ID\r
+ xor eax, eax ; Clear EAX\r
+ xor edx, edx ; Clear EDX\r
+ wrmsr ; Load 0 to MSR at 8Bh\r
+\r
+ mov eax, 1\r
+ cpuid\r
+ mov ecx, MSR_IA32_BIOS_SIGN_ID\r
+ rdmsr ; Get current microcode signature\r
+ xor rax, rax\r
+ test edx, edx\r
+ jnz Exit2\r
+\r
; skip loading Microcode if the MicrocodeCodeSize is zero\r
; and report error if size is less than 2k\r
; first check UPD header revision\r
cmp ebx, dword [esi + MicrocodeHdr.MicrocodeHdrProcessor]\r
jne LoadMicrocodeDefault1\r
test edx, dword [esi + MicrocodeHdr.MicrocodeHdrFlags ]\r
- jnz LoadCheck ; Jif signature and platform ID match\r
+ jnz LoadMicrocode ; Jif signature and platform ID match\r
\r
LoadMicrocodeDefault1:\r
; Check if extended header exists\r
cmp dword [edi + ExtSig.ExtSigProcessor], ebx\r
jne LoadMicrocodeDefault2\r
test dword [edi + ExtSig.ExtSigFlags], edx\r
- jnz LoadCheck ; Jif signature and platform ID match\r
+ jnz LoadMicrocode ; Jif signature and platform ID match\r
LoadMicrocodeDefault2:\r
; Check if any more extended signatures exist\r
add edi, ExtSig.size\r
; Is valid Microcode start point ?\r
cmp dword [esi + MicrocodeHdr.MicrocodeHdrVersion], 0ffffffffh\r
jz Done\r
-\r
-LoadCheck:\r
- ; Get the revision of the current microcode update loaded\r
- mov ecx, MSR_IA32_BIOS_SIGN_ID\r
- xor eax, eax ; Clear EAX\r
- xor edx, edx ; Clear EDX\r
- wrmsr ; Load 0 to MSR at 8Bh\r
-\r
- mov eax, 1\r
- cpuid\r
- mov ecx, MSR_IA32_BIOS_SIGN_ID\r
- rdmsr ; Get current microcode signature\r
-\r
- ; Verify this microcode update is not already loaded\r
- cmp dword [esi + MicrocodeHdr.MicrocodeHdrRevision], edx\r
- je Continue\r
+ jmp CheckMainHeader\r
\r
LoadMicrocode:\r
; EAX contains the linear address of the start of the Update Data\r
mov eax, 1\r
cpuid\r
\r
-Continue:\r
- jmp NextMicrocode\r
-\r
Done:\r
+ mov ecx, MSR_IA32_BIOS_SIGN_ID\r
+ xor eax, eax ; Clear EAX\r
+ xor edx, edx ; Clear EDX\r
+ wrmsr ; Load 0 to MSR at 8Bh\r
+\r
mov eax, 1\r
cpuid\r
mov ecx, MSR_IA32_BIOS_SIGN_ID\r