From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ml01.01.org (Postfix) with ESMTP id 6DC211A1E2D for ; Fri, 29 Jul 2016 11:15:30 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 29 Jul 2016 11:15:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,440,1464678000"; d="scan'208";a="1016339028" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by fmsmga001.fm.intel.com with ESMTP; 29 Jul 2016 11:15:29 -0700 From: Jeff Fan To: edk2-devel@ml01.01.org Cc: Michael Kinney , Feng Tian , Giri P Mudusuru , Laszlo Ersek Date: Sat, 30 Jul 2016 02:14:36 +0800 Message-Id: <1469816112-8200-11-git-send-email-jeff.fan@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1469816112-8200-1-git-send-email-jeff.fan@intel.com> References: <1469816112-8200-1-git-send-email-jeff.fan@intel.com> Subject: [Patch v4 10/46] UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 18:15:30 -0000 In MpInitLibInitialize(), invoke AsmGetAddress() to get get assembly functions' entry addresses and the sizes from returned MP_ASSEMBLY_ADDRESS_MAP structure. v4: 1. Add AsmRelocateApLoop information return in AsmGetAddress(). v3: 1. Rename AsmRellocateApLoop to AsmRelocateApLoop. Cc: Michael Kinney Cc: Feng Tian Cc: Giri P Mudusuru Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 2 ++ UefiCpuPkg/Library/MpInitLib/MpLib.c | 7 ++++++- UefiCpuPkg/Library/MpInitLib/MpLib.h | 23 +++++++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 3 +++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm index 49f5503..8f6f0bf 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 12bd04e..3ac79b6 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 39ec5de..eeb8d84 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -35,6 +35,16 @@ #include #include +// +// AP reset code information +// +typedef struct { + UINT8 *RendezvousFunnelAddress; + UINTN ModeEntryOffset; + UINTN RendezvousFunnelSize; + UINT8 *RelocateApLoopFuncAddress; + UINTN RelocateApLoopFuncSize; +} MP_ASSEMBLY_ADDRESS_MAP; #pragma pack(1) @@ -81,5 +91,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 d5d7efe..090e9fa 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 ;------------------------------------------------------------------------------------- -- 2.7.4.windows.1