mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg: Rename AsmRelocateApLoopStart.
Rename AsmRelocateApLoopStart to AsmRelocateApLoopStartAmdSev Cc: Guo Dong <guo.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Cc: James Lu <james.lu@intel.com> Cc: Gua Guo <gua.guo@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
facf52aeb8
commit
0d1ad06c27
|
@ -547,8 +547,8 @@ InitMpGlobalData (
|
||||||
// 64-bit AMD processors with SEV-ES
|
// 64-bit AMD processors with SEV-ES
|
||||||
//
|
//
|
||||||
Address = BASE_4GB - 1;
|
Address = BASE_4GB - 1;
|
||||||
ApLoopFunc = AddressMap->RelocateApLoopFuncAddress;
|
ApLoopFunc = AddressMap->RelocateApLoopFuncAddressAmdSev;
|
||||||
ApLoopFuncSize = AddressMap->RelocateApLoopFuncSize;
|
ApLoopFuncSize = AddressMap->RelocateApLoopFuncSizeAmdSev;
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Intel processors (32-bit or 64-bit), 32-bit AMD processors, or 64-bit AMD processors without SEV-ES
|
// Intel processors (32-bit or 64-bit), 32-bit AMD processors, or 64-bit AMD processors without SEV-ES
|
||||||
|
|
|
@ -26,8 +26,8 @@ struc MP_ASSEMBLY_ADDRESS_MAP
|
||||||
.RendezvousFunnelSize CTYPE_UINTN 1
|
.RendezvousFunnelSize CTYPE_UINTN 1
|
||||||
.RelocateApLoopFuncAddressGeneric CTYPE_UINTN 1
|
.RelocateApLoopFuncAddressGeneric CTYPE_UINTN 1
|
||||||
.RelocateApLoopFuncSizeGeneric CTYPE_UINTN 1
|
.RelocateApLoopFuncSizeGeneric CTYPE_UINTN 1
|
||||||
.RelocateApLoopFuncAddress CTYPE_UINTN 1
|
.RelocateApLoopFuncAddressAmdSev CTYPE_UINTN 1
|
||||||
.RelocateApLoopFuncSize CTYPE_UINTN 1
|
.RelocateApLoopFuncSizeAmdSev CTYPE_UINTN 1
|
||||||
.ModeTransitionOffset CTYPE_UINTN 1
|
.ModeTransitionOffset CTYPE_UINTN 1
|
||||||
.SwitchToRealNoNxOffset CTYPE_UINTN 1
|
.SwitchToRealNoNxOffset CTYPE_UINTN 1
|
||||||
.SwitchToRealPM16ModeOffset CTYPE_UINTN 1
|
.SwitchToRealPM16ModeOffset CTYPE_UINTN 1
|
||||||
|
|
|
@ -179,8 +179,8 @@ typedef struct {
|
||||||
UINTN RendezvousFunnelSize;
|
UINTN RendezvousFunnelSize;
|
||||||
UINT8 *RelocateApLoopFuncAddressGeneric;
|
UINT8 *RelocateApLoopFuncAddressGeneric;
|
||||||
UINTN RelocateApLoopFuncSizeGeneric;
|
UINTN RelocateApLoopFuncSizeGeneric;
|
||||||
UINT8 *RelocateApLoopFuncAddress;
|
UINT8 *RelocateApLoopFuncAddressAmdSev;
|
||||||
UINTN RelocateApLoopFuncSize;
|
UINTN RelocateApLoopFuncSizeAmdSev;
|
||||||
UINTN ModeTransitionOffset;
|
UINTN ModeTransitionOffset;
|
||||||
UINTN SwitchToRealNoNxOffset;
|
UINTN SwitchToRealNoNxOffset;
|
||||||
UINTN SwitchToRealPM16ModeOffset;
|
UINTN SwitchToRealPM16ModeOffset;
|
||||||
|
@ -388,7 +388,7 @@ typedef
|
||||||
**/
|
**/
|
||||||
typedef
|
typedef
|
||||||
VOID
|
VOID
|
||||||
(EFIAPI *ASM_RELOCATE_AP_LOOP)(
|
(EFIAPI *ASM_RELOCATE_AP_LOOP_AMDSEV)(
|
||||||
IN BOOLEAN MwaitSupport,
|
IN BOOLEAN MwaitSupport,
|
||||||
IN UINTN ApTargetCState,
|
IN UINTN ApTargetCState,
|
||||||
IN UINTN PmCodeSegment,
|
IN UINTN PmCodeSegment,
|
||||||
|
@ -429,7 +429,7 @@ AsmExchangeRole (
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
VOID *Data;
|
VOID *Data;
|
||||||
ASM_RELOCATE_AP_LOOP AmdSevEntry; // 64-bit AMD Sev processors
|
ASM_RELOCATE_AP_LOOP_AMDSEV AmdSevEntry; // 64-bit AMD Sev processors
|
||||||
ASM_RELOCATE_AP_LOOP_GENERIC GenericEntry; // Intel processors (32-bit or 64-bit), 32-bit AMD processors, or AMD non-Sev processors
|
ASM_RELOCATE_AP_LOOP_GENERIC GenericEntry; // Intel processors (32-bit or 64-bit), 32-bit AMD processors, or AMD non-Sev processors
|
||||||
} RELOCATE_AP_LOOP_ENTRY;
|
} RELOCATE_AP_LOOP_ENTRY;
|
||||||
|
|
||||||
|
|
|
@ -277,14 +277,14 @@ CProcedureInvoke:
|
||||||
%include "AmdSev.nasm"
|
%include "AmdSev.nasm"
|
||||||
|
|
||||||
RendezvousFunnelProcEnd:
|
RendezvousFunnelProcEnd:
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
; AsmRelocateApLoopAmdSev (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
|
||||||
|
;-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------------
|
AsmRelocateApLoopAmdSevStart:
|
||||||
; AsmRelocateApLoop (MwaitSupport, ApTargetCState, PmCodeSegment, TopOfApStack, CountTofinish, Pm16CodeSegment, SevEsAPJumpTable, WakeupBuffer);
|
|
||||||
;-------------------------------------------------------------------------------------
|
|
||||||
AsmRelocateApLoopStart:
|
|
||||||
BITS 64
|
BITS 64
|
||||||
cmp qword [rsp + 56], 0 ; SevEsAPJumpTable
|
cmp qword [rsp + 56], 0 ; SevEsAPJumpTable
|
||||||
je NoSevEs
|
je NoSevEsAmdSev
|
||||||
|
|
||||||
;
|
;
|
||||||
; Perform some SEV-ES related setup before leaving 64-bit mode
|
; Perform some SEV-ES related setup before leaving 64-bit mode
|
||||||
|
@ -329,7 +329,7 @@ BITS 64
|
||||||
pop rdx
|
pop rdx
|
||||||
pop rcx
|
pop rcx
|
||||||
|
|
||||||
NoSevEs:
|
NoSevEsAmdSev:
|
||||||
cli ; Disable interrupt before switching to 32-bit mode
|
cli ; Disable interrupt before switching to 32-bit mode
|
||||||
mov rax, [rsp + 40] ; CountTofinish
|
mov rax, [rsp + 40] ; CountTofinish
|
||||||
lock dec dword [rax] ; (*CountTofinish)--
|
lock dec dword [rax] ; (*CountTofinish)--
|
||||||
|
@ -345,7 +345,7 @@ NoSevEs:
|
||||||
push rcx ; Save MwaitSupport
|
push rcx ; Save MwaitSupport
|
||||||
push rdx ; Save ApTargetCState
|
push rdx ; Save ApTargetCState
|
||||||
|
|
||||||
lea rax, [PmEntry] ; rax <- The start address of transition code
|
lea rax, [PmEntryAmdSev] ; rax <- The start address of transition code
|
||||||
|
|
||||||
push r8
|
push r8
|
||||||
push rax
|
push rax
|
||||||
|
@ -365,10 +365,10 @@ NoSevEs:
|
||||||
;
|
;
|
||||||
; Far return into 32-bit mode
|
; Far return into 32-bit mode
|
||||||
;
|
;
|
||||||
retfq
|
o64 retf
|
||||||
|
|
||||||
BITS 32
|
BITS 32
|
||||||
PmEntry:
|
PmEntryAmdSev:
|
||||||
mov eax, cr0
|
mov eax, cr0
|
||||||
btr eax, 31 ; Clear CR0.PG
|
btr eax, 31 ; Clear CR0.PG
|
||||||
mov cr0, eax ; Disable paging and caches
|
mov cr0, eax ; Disable paging and caches
|
||||||
|
@ -386,11 +386,11 @@ PmEntry:
|
||||||
pop ecx,
|
pop ecx,
|
||||||
add esp, 4
|
add esp, 4
|
||||||
|
|
||||||
MwaitCheck:
|
MwaitCheckAmdSev:
|
||||||
cmp cl, 1 ; Check mwait-monitor support
|
cmp cl, 1 ; Check mwait-monitor support
|
||||||
jnz HltLoop
|
jnz HltLoopAmdSev
|
||||||
mov ebx, edx ; Save C-State to ebx
|
mov ebx, edx ; Save C-State to ebx
|
||||||
MwaitLoop:
|
MwaitLoopAmdSev:
|
||||||
cli
|
cli
|
||||||
mov eax, esp ; Set Monitor Address
|
mov eax, esp ; Set Monitor Address
|
||||||
xor ecx, ecx ; ecx = 0
|
xor ecx, ecx ; ecx = 0
|
||||||
|
@ -399,9 +399,9 @@ MwaitLoop:
|
||||||
mov eax, ebx ; Mwait Cx, Target C-State per eax[7:4]
|
mov eax, ebx ; Mwait Cx, Target C-State per eax[7:4]
|
||||||
shl eax, 4
|
shl eax, 4
|
||||||
mwait
|
mwait
|
||||||
jmp MwaitLoop
|
jmp MwaitLoopAmdSev
|
||||||
|
|
||||||
HltLoop:
|
HltLoopAmdSev:
|
||||||
pop edx ; PM16CodeSegment
|
pop edx ; PM16CodeSegment
|
||||||
add esp, 4
|
add esp, 4
|
||||||
pop ebx ; WakeupBuffer
|
pop ebx ; WakeupBuffer
|
||||||
|
@ -409,7 +409,7 @@ HltLoop:
|
||||||
pop eax ; SevEsAPJumpTable
|
pop eax ; SevEsAPJumpTable
|
||||||
add esp, 4
|
add esp, 4
|
||||||
cmp eax, 0 ; Check for SEV-ES
|
cmp eax, 0 ; Check for SEV-ES
|
||||||
je DoHlt
|
je DoHltAmdSev
|
||||||
|
|
||||||
cli
|
cli
|
||||||
;
|
;
|
||||||
|
@ -439,13 +439,13 @@ BITS 32
|
||||||
|
|
||||||
retf
|
retf
|
||||||
|
|
||||||
DoHlt:
|
DoHltAmdSev:
|
||||||
cli
|
cli
|
||||||
hlt
|
hlt
|
||||||
jmp DoHlt
|
jmp DoHltAmdSev
|
||||||
|
|
||||||
BITS 64
|
BITS 64
|
||||||
AsmRelocateApLoopEnd:
|
AsmRelocateApLoopAmdSevEnd:
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------------
|
||||||
; AsmRelocateApLoop (MwaitSupport, ApTargetCState, TopOfApStack, CountTofinish, Cr3);
|
; AsmRelocateApLoop (MwaitSupport, ApTargetCState, TopOfApStack, CountTofinish, Cr3);
|
||||||
|
@ -511,9 +511,9 @@ ASM_PFX(AsmGetAddressMap):
|
||||||
lea rax, [AsmRelocateApLoopGenericStart]
|
lea rax, [AsmRelocateApLoopGenericStart]
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressGeneric], rax
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressGeneric], rax
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeGeneric], AsmRelocateApLoopGenericEnd - AsmRelocateApLoopGenericStart
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeGeneric], AsmRelocateApLoopGenericEnd - AsmRelocateApLoopGenericStart
|
||||||
lea rax, [AsmRelocateApLoopStart]
|
lea rax, [AsmRelocateApLoopAmdSevStart]
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddress], rax
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncAddressAmdSev], rax
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSize], AsmRelocateApLoopEnd - AsmRelocateApLoopStart
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.RelocateApLoopFuncSizeAmdSev], AsmRelocateApLoopAmdSevEnd - AsmRelocateApLoopAmdSevStart
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.ModeTransitionOffset], Flat32Start - RendezvousFunnelProcStart
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.ModeTransitionOffset], Flat32Start - RendezvousFunnelProcStart
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealNoNxOffset], SwitchToRealProcStart - Flat32Start
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealNoNxOffset], SwitchToRealProcStart - Flat32Start
|
||||||
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealPM16ModeOffset], PM16Mode - RendezvousFunnelProcStart
|
mov qword [rcx + MP_ASSEMBLY_ADDRESS_MAP.SwitchToRealPM16ModeOffset], PM16Mode - RendezvousFunnelProcStart
|
||||||
|
|
Loading…
Reference in New Issue