From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E4D1B81E16 for ; Sun, 13 Nov 2016 19:47:16 -0800 (PST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 13 Nov 2016 19:47:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,488,1473145200"; d="scan'208";a="30688996" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by orsmga004.jf.intel.com with ESMTP; 13 Nov 2016 19:47:20 -0800 From: Jeff Fan To: edk2-devel@lists.01.org Cc: Feng Tian , Michael D Kinney Date: Mon, 14 Nov 2016 11:47:01 +0800 Message-Id: <20161114034701.5996-7-jeff.fan@intel.com> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20161114034701.5996-1-jeff.fan@intel.com> References: <20161114034701.5996-1-jeff.fan@intel.com> Subject: [PATCH 6/6] UefiCpuPkg/MpInitLib: Update AP information when BSP switched 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: Mon, 14 Nov 2016 03:47:17 -0000 When BSP switched, we need to update some AP information. For example, ApStartupSignalBuffer and ApTopOfStack. Cc: Feng Tian Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 3 +++ UefiCpuPkg/Library/MpInitLib/MpLib.h | 1 + 2 files changed, 4 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index 748c8e7..c74efb0 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -549,6 +549,8 @@ ApWakeupFunction ( GetProcessorNumber (CpuMpData, &ProcessorNumber); CpuMpData->CpuData[ProcessorNumber].ApFunction = 0; CpuMpData->CpuData[ProcessorNumber].ApFunctionArgument = 0; + ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal; + CpuInfoInHob[ProcessorNumber].ApTopOfStack = CpuInfoInHob[CpuMpData->NewBspNumber].ApTopOfStack; } else { // // Re-get the CPU APICID and Initial APICID @@ -1421,6 +1423,7 @@ SwitchBSPWorker ( CpuMpData->BSPInfo.State = CPU_SWITCH_STATE_IDLE; CpuMpData->APInfo.State = CPU_SWITCH_STATE_IDLE; CpuMpData->SwitchBspFlag = TRUE; + CpuMpData->NewBspNumber = ProcessorNumber; // // Clear the BSP bit of MSR_IA32_APIC_BASE diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index f81c819..0ac777a 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -216,6 +216,7 @@ struct _CPU_MP_DATA { AP_INIT_STATE InitFlag; BOOLEAN X2ApicEnable; BOOLEAN SwitchBspFlag; + UINTN NewBspNumber; CPU_EXCHANGE_ROLE_INFO BSPInfo; CPU_EXCHANGE_ROLE_INFO APInfo; MTRR_SETTINGS MtrrTable; -- 2.9.3.windows.2