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 2F6041A1DFF for ; Fri, 29 Jul 2016 11:15:25 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 29 Jul 2016 11:15:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,440,1464678000"; d="scan'208";a="1016338964" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by fmsmga001.fm.intel.com with ESMTP; 29 Jul 2016 11:15:24 -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:32 +0800 Message-Id: <1469816112-8200-7-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 06/46] 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: Fri, 29 Jul 2016 18:15:25 -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