From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id B9BC41A1E79 for ; Tue, 2 Aug 2016 02:00:07 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 02 Aug 2016 02:00:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,459,1464678000"; d="scan'208";a="743018972" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by FMSMGA003.fm.intel.com with ESMTP; 02 Aug 2016 02:00:06 -0700 From: Jeff Fan To: edk2-devel@lists.01.org Cc: Michael Kinney , Feng Tian , Giri P Mudusuru , Laszlo Ersek Date: Tue, 2 Aug 2016 16:59:10 +0800 Message-Id: <1470128388-17960-11-git-send-email-jeff.fan@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1470128388-17960-1-git-send-email-jeff.fan@intel.com> References: <1470128388-17960-1-git-send-email-jeff.fan@intel.com> Subject: [Patch v5 10/48] 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: Tue, 02 Aug 2016 09:00:07 -0000 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 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 | 25 +++++++++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 3 +++ 4 files changed, 36 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..2be1351 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -35,6 +35,18 @@ #include #include +// +// 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 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