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 29BE91A1E71 for ; Tue, 2 Aug 2016 02:00:01 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 02 Aug 2016 02:00:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,459,1464678000"; d="scan'208";a="743018712" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by FMSMGA003.fm.intel.com with ESMTP; 02 Aug 2016 02:00:00 -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:06 +0800 Message-Id: <1470128388-17960-7-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 06/48] UefiCpuPkg/MpInitLib: Add AP assembly code and MP_CPU_EXCHANGE_INFO 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:01 -0000 Add assembly code for AP reset vector and the definition of MP_CPU_EXCHANGE_INFO that are used to exchange the data between C code and assembly code when AP wake up. v4: 1. Copy MP_CPU_EXCHANGE_INFO from UefiCpuPkg/CpuMpPei/CpuMpPei.h 2. Copy MpEqu.inc and MpFuncs.nasm from UefiCpuPkg/CpuMpPei. v3: 1. Rename NumApsExecutingLoction to NumApsExecutingLocation 2. Add whitespace after ; in .nasm file 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/DxeMpInitLib.inf | 8 ++++++++ .../{CpuMpPei => Library/MpInitLib}/Ia32/MpEqu.inc | 0 .../MpInitLib}/Ia32/MpFuncs.nasm | 0 UefiCpuPkg/Library/MpInitLib/MpLib.h | 24 ++++++++++++++++++++++ UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 8 ++++++++ .../{CpuMpPei => Library/MpInitLib}/X64/MpEqu.inc | 0 .../MpInitLib}/X64/MpFuncs.nasm | 0 7 files changed, 40 insertions(+) copy UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Ia32/MpEqu.inc (100%) copy UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/Ia32/MpFuncs.nasm (100%) copy UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/X64/MpEqu.inc (100%) copy UefiCpuPkg/{CpuMpPei => Library/MpInitLib}/X64/MpFuncs.nasm (100%) diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf index 1f131c0..e9a2725 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -27,6 +27,14 @@ [Defines] # VALID_ARCHITECTURES = IA32 X64 # +[Sources.IA32] + Ia32/MpEqu.inc + Ia32/MpFuncs.nasm + +[Sources.X64] + X64/MpEqu.inc + X64/MpFuncs.nasm + [Sources.common] DxeMpLib.c MpLib.c diff --git a/UefiCpuPkg/CpuMpPei/Ia32/MpEqu.inc b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc similarity index 100% copy from UefiCpuPkg/CpuMpPei/Ia32/MpEqu.inc copy to UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc diff --git a/UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm similarity index 100% copy from UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm copy to UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index 66425d3..0453c22 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -36,5 +36,29 @@ #include +#pragma pack(1) + +// +// MP CPU exchange information for AP reset code +// This structure is required to be packed because fixed field offsets +// into this structure are used in assembly code in this module +// +typedef struct { + UINTN Lock; + UINTN StackStart; + UINTN StackSize; + UINTN CFunction; + IA32_DESCRIPTOR GdtrProfile; + IA32_DESCRIPTOR IdtrProfile; + UINTN BufferStart; + UINTN ModeOffset; + UINTN NumApsExecuting; + UINTN CodeSegment; + UINTN DataSegment; + UINTN Cr3; + PEI_CPU_MP_DATA *PeiCpuMpData; +} MP_CPU_EXCHANGE_INFO; + +#pragma pack() #endif diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf index 014a248..c195a38 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -27,6 +27,14 @@ [Defines] # VALID_ARCHITECTURES = IA32 X64 # +[Sources.IA32] + Ia32/MpEqu.inc + Ia32/MpFuncs.nasm + +[Sources.X64] + X64/MpEqu.inc + X64/MpFuncs.nasm + [Sources.common] PeiMpLib.c MpLib.c diff --git a/UefiCpuPkg/CpuMpPei/X64/MpEqu.inc b/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc similarity index 100% copy from UefiCpuPkg/CpuMpPei/X64/MpEqu.inc copy to UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc diff --git a/UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm similarity index 100% copy from UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm copy to UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm -- 2.7.4.windows.1