]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP
authorJeff Fan <jeff.fan@intel.com>
Wed, 20 Jul 2016 14:56:09 +0000 (22:56 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 17 Aug 2016 11:59:01 +0000 (19:59 +0800)
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>
UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
UefiCpuPkg/Library/MpInitLib/MpLib.c
UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm

index 49f55035309643d38a548896332126ec3a03c59c..8f6f0bfd5b935b297fc34a0b73c86c9ffcd39f2e 100644 (file)
@@ -204,6 +204,8 @@ ASM_PFX(AsmGetAddressMap):
     mov        dword [ebx], RendezvousFunnelProcStart\r
     mov        dword [ebx +  4h], Flat32Start - RendezvousFunnelProcStart\r
     mov        dword [ebx +  8h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart\r
+    mov        dword [ebx + 0Ch], AsmRelocateApLoopStart\r
+    mov        dword [ebx + 10h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart\r
 \r
     popad\r
     ret\r
index 12bd04e151d5b246a0e1749c92279de8f5f59c25..3ac79b6a9031b9bbf8e8f7569dbc952d59fc0687 100644 (file)
@@ -34,7 +34,12 @@ MpInitLibInitialize (
   VOID\r
   )\r
 {\r
-  return EFI_UNSUPPORTED;\r
+  MP_ASSEMBLY_ADDRESS_MAP  AddressMap;\r
+  UINTN                    ApResetVectorSize;\r
+\r
+  AsmGetAddressMap (&AddressMap);\r
+  ApResetVectorSize = AddressMap.RendezvousFunnelSize + sizeof (MP_CPU_EXCHANGE_INFO);\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
index 39ec5def5ba741334d0c75ec13c5b9c82269470c..2be13516aa4e07b3c8fd90b2decbfc18ebf5dffb 100644 (file)
 #include <Library/MtrrLib.h>\r
 #include <Library/HobLib.h>\r
 \r
+//\r
+// AP reset code information including code address and size,\r
+// this structure will be shared be C code and assembly code.\r
+// It is natural aligned by design.\r
+//\r
+typedef struct {\r
+  UINT8             *RendezvousFunnelAddress;\r
+  UINTN             ModeEntryOffset;\r
+  UINTN             RendezvousFunnelSize;\r
+  UINT8             *RelocateApLoopFuncAddress;\r
+  UINTN             RelocateApLoopFuncSize;\r
+} MP_ASSEMBLY_ADDRESS_MAP;\r
 \r
 #pragma pack(1)\r
 \r
@@ -81,5 +93,18 @@ VOID
   IN UINTN                   ApTargetCState,\r
   IN UINTN                   PmCodeSegment\r
   );\r
+\r
+/**\r
+  Assembly code to get starting address and size of the rendezvous entry for APs.\r
+  Information for fixing a jump instruction in the code is also returned.\r
+\r
+  @param[out] AddressMap  Output buffer for address map information.\r
+**/\r
+VOID\r
+EFIAPI\r
+AsmGetAddressMap (\r
+  OUT MP_ASSEMBLY_ADDRESS_MAP    *AddressMap\r
+  );\r
+\r
 #endif\r
 \r
index d5d7efe2921cb30d20fec3be8fc6864a026fa940..090e9fae07cd793d2266939aee0f2b11f75877f4 100644 (file)
@@ -239,6 +239,9 @@ ASM_PFX(AsmGetAddressMap):
     mov        qword [rcx], rax\r
     mov        qword [rcx +  8h], LongModeStart - RendezvousFunnelProcStart\r
     mov        qword [rcx + 10h], RendezvousFunnelProcEnd - RendezvousFunnelProcStart\r
+    mov        rax, ASM_PFX(AsmRelocateApLoop)\r
+    mov        qword [rcx + 18h], rax\r
+    mov        qword [rcx + 20h], AsmRelocateApLoopEnd - AsmRelocateApLoopStart\r
     ret\r
 \r
 ;-------------------------------------------------------------------------------------\r