summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-07-20 22:56:09 +0800
committerJeff Fan <jeff.fan@intel.com>2016-08-17 19:59:01 +0800
commitf7f85d83609842e7a3243f8cb15e3d4cb8345177 (patch)
treea3079daf08a36ed99ad391f51483712a343ea5b4
parent7615702169b838f9341c312739d29f0795ebd998 (diff)
downloadedk2-platforms-f7f85d83609842e7a3243f8cb15e3d4cb8345177.tar.xz
UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP
In MpInitLibInitialize(), invoke AsmGetAddress() to get get assembly functions' entry addresses and the sizes from returned MP_ASSEMBLY_ADDRESS_MAP structure. v5: 1. Add more detailed comments for structure MP_ASSEMBLY_ADDRESS_MAP. v4: 1. Add AsmRelocateApLoop information return in AsmGetAddress(). v3: 1. Rename AsmRellocateApLoop to AsmRelocateApLoop. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Michael Kinney <michael.d.kinney@intel.com>
-rw-r--r--UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm2
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c7
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.h25
-rw-r--r--UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm3
4 files changed, 36 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
index 49f5503530..8f6f0bfd5b 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
@@ -204,6 +204,8 @@ ASM_PFX(AsmGetAddressMap):
mov dword [ebx], RendezvousFunnelProcStart
mov dword [ebx + 4h], Flat32Start - RendezvousFunnelProcStart
mov dword [ebx + 8h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
+ mov dword [ebx + 0Ch], AsmRelocateApLoopStart
+ mov dword [ebx + 10h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart
popad
ret
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 12bd04e151..3ac79b6a90 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -34,7 +34,12 @@ MpInitLibInitialize (
VOID
)
{
- return EFI_UNSUPPORTED;
+ MP_ASSEMBLY_ADDRESS_MAP AddressMap;
+ UINTN ApResetVectorSize;
+
+ AsmGetAddressMap (&AddressMap);
+ ApResetVectorSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);
+ return EFI_SUCCESS;
}
/**
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 39ec5def5b..2be13516aa 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -35,6 +35,18 @@
#include <Library/MtrrLib.h>
#include <Library/HobLib.h>
+//
+// AP reset code information including code address and size,
+// this structure will be shared be C code and assembly code.
+// It is natural aligned by design.
+//
+typedef struct {
+ UINT8 *RendezvousFunnelAddress;
+ UINTN ModeEntryOffset;
+ UINTN RendezvousFunnelSize;
+ UINT8 *RelocateApLoopFuncAddress;
+ UINTN RelocateApLoopFuncSize;
+} MP_ASSEMBLY_ADDRESS_MAP;
#pragma pack(1)
@@ -81,5 +93,18 @@ VOID
IN UINTN ApTargetCState,
IN UINTN PmCodeSegment
);
+
+/**
+ Assembly code to get starting address and size of the rendezvous entry for APs.
+ Information for fixing a jump instruction in the code is also returned.
+
+ @param[out] AddressMap Output buffer for address map information.
+**/
+VOID
+EFIAPI
+AsmGetAddressMap (
+ OUT MP_ASSEMBLY_ADDRESS_MAP *AddressMap
+ );
+
#endif
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
index d5d7efe292..090e9fae07 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm
@@ -239,6 +239,9 @@ ASM_PFX(AsmGetAddressMap):
mov qword [rcx], rax
mov qword [rcx + 8h], LongModeStart - RendezvousFunnelProcStart
mov qword [rcx + 10h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart
+ mov rax, ASM_PFX(AsmRelocateApLoop)
+ mov qword [rcx + 18h], rax
+ mov qword [rcx + 20h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart
ret
;-------------------------------------------------------------------------------------