summaryrefslogtreecommitdiff
path: root/UefiCpuPkg/Library/MpInitLib/MpLib.c
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2016-07-21 16:08:12 +0800
committerJeff Fan <jeff.fan@intel.com>2016-08-17 20:00:28 +0800
commit93ca4c0fd7d96f182790e56f147463ab1799da2a (patch)
treec6bd58289d48f2e85f27982b75a118f18869d7a8 /UefiCpuPkg/Library/MpInitLib/MpLib.c
parent94f63c765fb0b48b287cc1cf3bc61a46dde4f524 (diff)
downloadedk2-platforms-93ca4c0fd7d96f182790e56f147463ab1799da2a.tar.xz
UefiCpuPkg/MpInitLib: Save CPU MP Data pointer
In PeiMpInitLib, save CPU MP Data pointer into one local Guided HOB. In DxeMpInitLib, save CPU MP Data pointer into one global variable. Add helper functions GetCpuMpData()/SaveCpuMpData(). v5: 1. Move CPU_INIT_MP_LIB_HOB_GUID from MpLib.c to MpLib.h to make all C files visible. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Michael Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'UefiCpuPkg/Library/MpInitLib/MpLib.c')
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 7384f5d0d2..8dfbf5706a 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -14,6 +14,8 @@
#include "MpLib.h"
+EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
+
/**
Get the Application Processors state.
@@ -303,6 +305,12 @@ MpInitLibInitialize (
//
MtrrGetAllMtrrs (&CpuMpData->MtrrTable);
+
+ //
+ // Initialize global data for MP support
+ //
+ InitMpGlobalData (CpuMpData);
+
return EFI_SUCCESS;
}
@@ -386,3 +394,25 @@ MpInitLibGetNumberOfProcessors (
{
return EFI_UNSUPPORTED;
}
+/**
+ Get pointer to CPU MP Data structure from GUIDed HOB.
+
+ @return The pointer to CPU MP Data structure.
+**/
+CPU_MP_DATA *
+GetCpuMpDataFromGuidedHob (
+ VOID
+ )
+{
+ EFI_HOB_GUID_TYPE *GuidHob;
+ VOID *DataInHob;
+ CPU_MP_DATA *CpuMpData;
+
+ CpuMpData = NULL;
+ GuidHob = GetFirstGuidHob (&mCpuInitMpLibHobGuid);
+ if (GuidHob != NULL) {
+ DataInHob = GET_GUID_HOB_DATA (GuidHob);
+ CpuMpData = (CPU_MP_DATA *) (*(UINTN *) DataInHob);
+ }
+ return CpuMpData;
+}