public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@ml01.01.org
Cc: Michael Kinney <michael.d.kinney@intel.com>,
	Feng Tian <feng.tian@intel.com>,
	Giri P Mudusuru <giri.p.mudusuru@intel.com>,
	Laszlo Ersek <lersek@redhat.com>
Subject: [Patch v4 05/46] UefiCpuPkg/MpInitLib: Add two instances PeiMpInitLib and DxeMpInitLib
Date: Sat, 30 Jul 2016 02:14:31 +0800	[thread overview]
Message-ID: <1469816112-8200-6-git-send-email-jeff.fan@intel.com> (raw)
In-Reply-To: <1469816112-8200-1-git-send-email-jeff.fan@intel.com>

Add two MP Initialize Library instances PeiMpInitLib.inf and DxeMpInitLib.inf
with NULL implementation.

One PeiMpInitLib.inf is consumed by PEI MP driver. Another DxeMpInitLib.inf is
consumed by DXE MP driver.

Place MpInitLibStartupAllAPs()/MpInitLibStartupThisAp()/MpInitLibSwitchBSP()/
MpInitLibEnableDisableAP() into PeiMpLib.c and DxeMpLib.c, because they have
the different implementations and will be updated in latter patches.

v4:
  1. Return EFI_UNSUPPORTED instead of EFI_SUCCESS for NULL implementation of
     all Functions.
  2. Sync MpInitLibxxx functions header updating described in v4 part of Patch
     #4.

v3:
  1. Rename MpInitLibSwitchBsp to MpInitLibSwitchBSP to match PI spec

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: Giri P Mudusuru <giri.p.mudusuru@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf      |  61 ++++++++++
 .../Library/MpInitLib/DxeMpInitLib.uni             |  12 +-
 .../MpInitLib.h => Library/MpInitLib/DxeMpLib.c}   | 123 +++------------------
 UefiCpuPkg/Library/MpInitLib/MpLib.c               | 119 ++++++++++++++++++++
 UefiCpuPkg/Library/MpInitLib/MpLib.h               |  40 +++++++
 .../MpInitLib/PeiMpInitLib.inf}                    |  65 +++--------
 .../Library/MpInitLib/PeiMpInitLib.uni             |  12 +-
 .../MpInitLib.h => Library/MpInitLib/PeiMpLib.c}   | 123 ++++-----------------
 UefiCpuPkg/UefiCpuPkg.dsc                          |   3 +-
 9 files changed, 291 insertions(+), 267 deletions(-)
 create mode 100644 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
 copy MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni => UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.uni (60%)
 copy UefiCpuPkg/{Include/Library/MpInitLib.h => Library/MpInitLib/DxeMpLib.c} (78%)
 create mode 100644 UefiCpuPkg/Library/MpInitLib/MpLib.c
 create mode 100644 UefiCpuPkg/Library/MpInitLib/MpLib.h
 copy UefiCpuPkg/{CpuMpPei/CpuMpPei.inf => Library/MpInitLib/PeiMpInitLib.inf} (54%)
 copy MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni => UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.uni (60%)
 copy UefiCpuPkg/{Include/Library/MpInitLib.h => Library/MpInitLib/PeiMpLib.c} (78%)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
new file mode 100644
index 0000000..1f131c0
--- /dev/null
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -0,0 +1,61 @@
+## @file
+#  MP Initialize Library instance for DXE driver.
+#
+#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution.  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = DxeMpInitLib
+  MODULE_UNI_FILE                = DxeMpInitLib.uni
+  FILE_GUID                      = B88F7146-9834-4c55-BFAC-481CC0C33736
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.1
+  LIBRARY_CLASS                  = MpInitLib|DXE_DRIVER
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources.common]
+  DxeMpLib.c
+  MpLib.c
+  MpLib.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  LocalApicLib
+  MemoryAllocationLib
+  HobLib
+  MtrrLib
+  CpuLib
+  UefiCpuLib
+  UefiBootServicesTableLib
+  HobLib
+
+[Guids]
+  gEfiEventExitBootServicesGuid                 ## CONSUMES  ## Event
+
+[Pcd]
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber        ## CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApInitTimeOutInMicroSeconds      ## SOMETIMES_CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApStackSize                      ## CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress            ## CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize         ## CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode                       ## CONSUMES
+  gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate                   ## SOMETIMES_CONSUMES
+
diff --git a/MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.uni
similarity index 60%
copy from MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni
copy to UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.uni
index 14b3a69..99d7997 100644
--- a/MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.uni
@@ -1,5 +1,7 @@
 // /** @file
-// SmmCommunicationBuffer Localized Strings and Content
+// MP Initialize Library instance for DXE driver.
+//
+// MP Initialize Library instance for DXE driver.
 //
 // Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 //
@@ -13,6 +15,8 @@
 //
 // **/
 
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"SMM Communication Buffer DXE Driver"
+
+#string STR_MODULE_ABSTRACT             #language en-US "MP Initialize Library instance for DXE driver."
+
+#string STR_MODULE_DESCRIPTION          #language en-US "MP Initialize Library instance for DXE driver."
+
diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
similarity index 78%
copy from UefiCpuPkg/Include/Library/MpInitLib.h
copy to UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index 3e19382..46a48a4 100644
--- a/UefiCpuPkg/Include/Library/MpInitLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -1,5 +1,5 @@
 /** @file
-  Multiple-Processor initialization Library.
+  MP initialize support functions for DXE phase.
 
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
@@ -12,82 +12,7 @@
 
 **/
 
-#ifndef __MP_INIT_LIB_H__
-#define __MP_INIT_LIB_H__
-
-#include <Ppi/SecPlatformInformation.h>
-#include <Protocol/MpService.h>
-
-/**
-  MP Initialize Library initialization.
-
-  This service will allocate AP reset vector and wakeup all APs to do APs
-  initialization.
-
-  This service must be invoked before all other MP Initialize Library
-  service are invoked.
-
-  @retval  EFI_SUCCESS           MP initialization succeeds.
-  @retval  Others                MP initialization fails.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibInitialize (
-  VOID
-  );
-
-/**
-  Retrieves the number of logical processor in the platform and the number of
-  those logical processors that are enabled on this boot. This service may only
-  be called from the BSP.
-
-  @param[out] NumberOfProcessors          Pointer to the total number of logical
-                                          processors in the system, including the BSP
-                                          and disabled APs.
-  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical
-                                          processors that exist in system, including
-                                          the BSP.
-
-  @retval EFI_SUCCESS             The number of logical processors and enabled
-                                  logical processors was retrieved.
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
-  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors
-                                  is NULL.
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibGetNumberOfProcessors (
-  OUT UINTN                     *NumberOfProcessors,       OPTIONAL
-  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL
-  );
-
-/**
-  Gets detailed MP-related information on the requested processor at the
-  instant this call is made. This service may only be called from the BSP.
-
-  @param[in]  ProcessorNumber       The handle number of processor.
-  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for
-                                    the requested processor is deposited.
-  @param[out] HealthData            Return processor health data.
-
-  @retval EFI_SUCCESS             Processor information was returned.
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
-  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.
-  @retval EFI_NOT_FOUND           The processor with the handle specified by
-                                  ProcessorNumber does not exist in the platform.
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibGetProcessorInfo (
-  IN  UINTN                      ProcessorNumber,
-  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,
-  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL
-  );
+#include "MpLib.h"
 
 /**
   This service executes a caller provided function on all enabled APs.
@@ -173,7 +98,10 @@ MpInitLibStartupAllAPs (
   IN  UINTN                     TimeoutInMicroseconds,
   IN  VOID                      *ProcedureArgument      OPTIONAL,
   OUT UINTN                     **FailedCpuList         OPTIONAL
-  );
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
 /**
   This service lets the caller get one enabled AP to execute a caller-provided
@@ -255,7 +183,10 @@ MpInitLibStartupThisAP (
   IN  UINTN                     TimeoutInMicroseconds,
   IN  VOID                      *ProcedureArgument      OPTIONAL,
   OUT BOOLEAN                   *Finished               OPTIONAL
-  );
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
 /**
   This service switches the requested AP to be the BSP from that point onward.
@@ -288,7 +219,10 @@ EFIAPI
 MpInitLibSwitchBSP (
   IN UINTN                     ProcessorNumber,
   IN BOOLEAN                   EnableOldBSP
-  );
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
 /**
   This service lets the caller enable or disable an AP from this point onward.
@@ -326,28 +260,7 @@ MpInitLibEnableDisableAP (
   IN  UINTN                     ProcessorNumber,
   IN  BOOLEAN                   EnableAP,
   IN  UINT32                    *HealthFlag OPTIONAL
-  );
-
-/**
-  This return the handle number for the calling processor.  This service may be
-  called from the BSP and APs.
-
-  @param[out] ProcessorNumber  Pointer to the handle number of AP.
-                               The range is from 0 to the total number of
-                               logical processors minus 1. The total number of
-                               logical processors can be retrieved by
-                               MpInitLibGetNumberOfProcessors().
-
-  @retval EFI_SUCCESS             The current processor handle number was returned
-                                  in ProcessorNumber.
-  @retval EFI_INVALID_PARAMETER   ProcessorNumber is NULL.
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibWhoAmI (
-  OUT UINTN                    *ProcessorNumber
-  );
-
-#endif
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
new file mode 100644
index 0000000..12bd04e
--- /dev/null
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -0,0 +1,119 @@
+/** @file
+  CPU MP Initialize Library common functions.
+
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include "MpLib.h"
+
+
+/**
+  MP Initialize Library initialization.
+
+  This service will allocate AP reset vector and wakeup all APs to do APs
+  initialization.
+
+  This service must be invoked before all other MP Initialize Library
+  service are invoked.
+
+  @retval  EFI_SUCCESS           MP initialization succeeds.
+  @retval  Others                MP initialization fails.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibInitialize (
+  VOID
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  Gets detailed MP-related information on the requested processor at the
+  instant this call is made. This service may only be called from the BSP.
+
+  @param[in]  ProcessorNumber       The handle number of processor.
+  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for
+                                    the requested processor is deposited.
+  @param[out]  HealthData            Return processor health data.
+
+  @retval EFI_SUCCESS             Processor information was returned.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.
+  @retval EFI_NOT_FOUND           The processor with the handle specified by
+                                  ProcessorNumber does not exist in the platform.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibGetProcessorInfo (
+  IN  UINTN                      ProcessorNumber,
+  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,
+  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+/**
+  This return the handle number for the calling processor.  This service may be
+  called from the BSP and APs.
+
+  @param[out] ProcessorNumber  Pointer to the handle number of AP.
+                               The range is from 0 to the total number of
+                               logical processors minus 1. The total number of
+                               logical processors can be retrieved by
+                               MpInitLibGetNumberOfProcessors().
+
+  @retval EFI_SUCCESS             The current processor handle number was returned
+                                  in ProcessorNumber.
+  @retval EFI_INVALID_PARAMETER   ProcessorNumber is NULL.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibWhoAmI (
+  OUT UINTN                    *ProcessorNumber
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+/**
+  Retrieves the number of logical processor in the platform and the number of
+  those logical processors that are enabled on this boot. This service may only
+  be called from the BSP.
+
+  @param[out] NumberOfProcessors          Pointer to the total number of logical
+                                          processors in the system, including the BSP
+                                          and disabled APs.
+  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical
+                                          processors that exist in system, including
+                                          the BSP.
+
+  @retval EFI_SUCCESS             The number of logical processors and enabled
+                                  logical processors was retrieved.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors
+                                  is NULL.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibGetNumberOfProcessors (
+  OUT UINTN                     *NumberOfProcessors,       OPTIONAL
+  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
new file mode 100644
index 0000000..66425d3
--- /dev/null
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -0,0 +1,40 @@
+/** @file
+  Common header file for MP Initialize Library.
+
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD License
+  which accompanies this distribution.  The full text of the license may be found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef _MP_LIB_H_
+#define _MP_LIB_H_
+
+#include <PiPei.h>
+
+#include <Register/Cpuid.h>
+#include <Register/Msr.h>
+#include <Register/LocalApic.h>
+#include <Register/Microcode.h>
+
+#include <Library/MpInitLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/LocalApicLib.h>
+#include <Library/CpuLib.h>
+#include <Library/UefiCpuLib.h>
+#include <Library/TimerLib.h>
+#include <Library/SynchronizationLib.h>
+#include <Library/MtrrLib.h>
+#include <Library/HobLib.h>
+
+
+#endif
+
diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
similarity index 54%
copy from UefiCpuPkg/CpuMpPei/CpuMpPei.inf
copy to UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index 5f45662..014a248 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -1,7 +1,7 @@
 ## @file
-#  CPU driver installs CPU PI Multi-processor PPI.
+#  MP Initialize Library instance for PEI driver.
 #
-#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
 #  which accompanies this distribution.  The full text of the license may be found at
@@ -14,12 +14,12 @@
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = CpuMpPei
-  MODULE_UNI_FILE                = CpuMpPei.uni
-  FILE_GUID                      = EDADEB9D-DDBA-48BD-9D22-C1C169C8C5C6
+  BASE_NAME                      = PeiMpInitLib
+  MODULE_UNI_FILE                = PeiMpInitLib.uni
+  FILE_GUID                      = B00F6090-7739-4830-B906-E0032D388987
   MODULE_TYPE                    = PEIM
-  VERSION_STRING                 = 1.0
-  ENTRY_POINT                    = CpuMpPeimInit
+  VERSION_STRING                 = 1.1
+  LIBRARY_CLASS                  = MpInitLib|PEIM
 
 #
 # The following information is for reference only and not required by the build tools.
@@ -27,55 +27,28 @@ [Defines]
 #  VALID_ARCHITECTURES           = IA32 X64
 #
 
-[Sources]
-  CpuMpPei.h
-  CpuMpPei.c
-  CpuBist.c
-  Microcode.h
-  Microcode.c
-  PeiMpServices.h
-  PeiMpServices.c
-
-[Sources.IA32]
-  Ia32/MpEqu.inc
-  Ia32/MpFuncs.asm
-  Ia32/MpFuncs.nasm
-
-[Sources.X64]
-  X64/MpEqu.inc
-  X64/MpFuncs.asm
-  X64/MpFuncs.nasm
+[Sources.common]
+  PeiMpLib.c
+  MpLib.c
+  MpLib.h
 
 [Packages]
   MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
   BaseLib
-  BaseMemoryLib
-  DebugLib
-  HobLib
   LocalApicLib
-  MtrrLib
-  PcdLib
-  PeimEntryPoint
+  MemoryAllocationLib
+  HobLib
   PeiServicesLib
-  ReportStatusCodeLib
-  SynchronizationLib
-  TimerLib
-  UefiCpuLib
+  MtrrLib
   CpuLib
-  CpuExceptionHandlerLib
+  UefiCpuLib
+  SynchronizationLib
 
 [Ppis]
-  gEfiPeiMpServicesPpiGuid                      ## PRODUCES
   gEfiEndOfPeiSignalPpiGuid                     ## NOTIFY
-  gEfiSecPlatformInformationPpiGuid             ## SOMETIMES_CONSUMES
-  ## SOMETIMES_CONSUMES
-  ## SOMETIMES_PRODUCES
-  gEfiSecPlatformInformation2PpiGuid
-  gEfiVectorHandoffInfoPpiGuid                  ## SOMETIMES_CONSUMES
 
 [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber        ## CONSUMES
@@ -86,9 +59,3 @@ [Pcd]
   gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode                       ## CONSUMES
   gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate                   ## SOMETIMES_CONSUMES
 
-[Depex]
-  gEfiPeiMemoryDiscoveredPpiGuid
-
-[UserExtensions.TianoCore."ExtraFiles"]
-  CpuMpPeiExtra.uni
-
diff --git a/MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.uni
similarity index 60%
copy from MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni
copy to UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.uni
index 14b3a69..d16f306 100644
--- a/MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferExtraDxe.uni
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.uni
@@ -1,5 +1,7 @@
 // /** @file
-// SmmCommunicationBuffer Localized Strings and Content
+// MP Initialize Library instance for PEI driver.
+//
+// MP Initialize Library instance for PEI driver.
 //
 // Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 //
@@ -13,6 +15,8 @@
 //
 // **/
 
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"SMM Communication Buffer DXE Driver"
+
+#string STR_MODULE_ABSTRACT             #language en-US "MP Initialize Library instance for PEI driver."
+
+#string STR_MODULE_DESCRIPTION          #language en-US "MP Initialize Library instance for PEI driver."
+
diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
similarity index 78%
copy from UefiCpuPkg/Include/Library/MpInitLib.h
copy to UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
index 3e19382..a7e9fb8 100644
--- a/UefiCpuPkg/Include/Library/MpInitLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
@@ -1,5 +1,5 @@
 /** @file
-  Multiple-Processor initialization Library.
+  MP initialize support functions for PEI phase.
 
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
@@ -12,82 +12,7 @@
 
 **/
 
-#ifndef __MP_INIT_LIB_H__
-#define __MP_INIT_LIB_H__
-
-#include <Ppi/SecPlatformInformation.h>
-#include <Protocol/MpService.h>
-
-/**
-  MP Initialize Library initialization.
-
-  This service will allocate AP reset vector and wakeup all APs to do APs
-  initialization.
-
-  This service must be invoked before all other MP Initialize Library
-  service are invoked.
-
-  @retval  EFI_SUCCESS           MP initialization succeeds.
-  @retval  Others                MP initialization fails.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibInitialize (
-  VOID
-  );
-
-/**
-  Retrieves the number of logical processor in the platform and the number of
-  those logical processors that are enabled on this boot. This service may only
-  be called from the BSP.
-
-  @param[out] NumberOfProcessors          Pointer to the total number of logical
-                                          processors in the system, including the BSP
-                                          and disabled APs.
-  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical
-                                          processors that exist in system, including
-                                          the BSP.
-
-  @retval EFI_SUCCESS             The number of logical processors and enabled
-                                  logical processors was retrieved.
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
-  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors
-                                  is NULL.
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibGetNumberOfProcessors (
-  OUT UINTN                     *NumberOfProcessors,       OPTIONAL
-  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL
-  );
-
-/**
-  Gets detailed MP-related information on the requested processor at the
-  instant this call is made. This service may only be called from the BSP.
-
-  @param[in]  ProcessorNumber       The handle number of processor.
-  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for
-                                    the requested processor is deposited.
-  @param[out] HealthData            Return processor health data.
-
-  @retval EFI_SUCCESS             Processor information was returned.
-  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
-  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.
-  @retval EFI_NOT_FOUND           The processor with the handle specified by
-                                  ProcessorNumber does not exist in the platform.
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibGetProcessorInfo (
-  IN  UINTN                      ProcessorNumber,
-  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,
-  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL
-  );
+#include "MpLib.h"
 
 /**
   This service executes a caller provided function on all enabled APs.
@@ -173,7 +98,10 @@ MpInitLibStartupAllAPs (
   IN  UINTN                     TimeoutInMicroseconds,
   IN  VOID                      *ProcedureArgument      OPTIONAL,
   OUT UINTN                     **FailedCpuList         OPTIONAL
-  );
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
 /**
   This service lets the caller get one enabled AP to execute a caller-provided
@@ -255,7 +183,10 @@ MpInitLibStartupThisAP (
   IN  UINTN                     TimeoutInMicroseconds,
   IN  VOID                      *ProcedureArgument      OPTIONAL,
   OUT BOOLEAN                   *Finished               OPTIONAL
-  );
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
 /**
   This service switches the requested AP to be the BSP from that point onward.
@@ -287,8 +218,11 @@ EFI_STATUS
 EFIAPI
 MpInitLibSwitchBSP (
   IN UINTN                     ProcessorNumber,
-  IN BOOLEAN                   EnableOldBSP
-  );
+  IN  BOOLEAN                  EnableOldBSP
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
 /**
   This service lets the caller enable or disable an AP from this point onward.
@@ -326,28 +260,9 @@ MpInitLibEnableDisableAP (
   IN  UINTN                     ProcessorNumber,
   IN  BOOLEAN                   EnableAP,
   IN  UINT32                    *HealthFlag OPTIONAL
-  );
-
-/**
-  This return the handle number for the calling processor.  This service may be
-  called from the BSP and APs.
+  )
+{
+  return EFI_UNSUPPORTED;
+}
 
-  @param[out] ProcessorNumber  Pointer to the handle number of AP.
-                               The range is from 0 to the total number of
-                               logical processors minus 1. The total number of
-                               logical processors can be retrieved by
-                               MpInitLibGetNumberOfProcessors().
-
-  @retval EFI_SUCCESS             The current processor handle number was returned
-                                  in ProcessorNumber.
-  @retval EFI_INVALID_PARAMETER   ProcessorNumber is NULL.
-  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
-
-**/
-EFI_STATUS
-EFIAPI
-MpInitLibWhoAmI (
-  OUT UINTN                    *ProcessorNumber
-  );
 
-#endif
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index b35f41b..598c797 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -114,7 +114,8 @@ [Components.IA32, Components.X64]
   UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
   UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
   UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
-  UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+  UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+  UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
   UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
   UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
   UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf
-- 
2.7.4.windows.1



  parent reply	other threads:[~2016-07-29 18:15 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-29 18:14 [Patch v4 00/46] MP Initialize Library Jeff Fan
2016-07-29 18:14 ` [Patch v4 01/46] UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions Jeff Fan
2016-07-29 18:14 ` [Patch v4 02/46] UefiCpuPkg/MpInitLib: Add microcode definitions defined in IA32 SDM Jeff Fan
2016-07-29 18:14 ` [Patch v4 03/46] UefiCpuPkg/CpuS3DataDxe: Move StartupVector allocation to EndOfDxe() Jeff Fan
2016-07-29 18:14 ` [Patch v4 04/46] UefiCpuPkg/MpInitLib: Add MP Initialize library class definition Jeff Fan
2016-07-29 18:14 ` Jeff Fan [this message]
2016-07-29 18:14 ` [Patch v4 06/46] UefiCpuPkg/MpInitLib: Add AP assembly code and MP_CPU_EXCHANGE_INFO Jeff Fan
2016-07-29 18:14 ` [Patch v4 07/46] UefiCpuPkg/MpInitLib: Fix typo and clean up the code Jeff Fan
2016-07-29 18:14 ` [Patch v4 08/46] UefiCpuPkg/MpInitLib: Add EnableExecuteDisable in MP_CPU_EXCHANGE_INFO Jeff Fan
2016-07-29 18:14 ` [Patch v4 09/46] UefiCpuPkg/MpInitLib: Add AsmRelocateApLoop() assembly code Jeff Fan
2016-07-29 18:14 ` [Patch v4 10/46] UefiCpuPkg/MpInitLib: Add MP_ASSEMBLY_ADDRESS_MAP Jeff Fan
2016-07-29 18:14 ` [Patch v4 11/46] UefiCpuPkg/MpInitLib: Get ApLoopMode and MointorFilter size Jeff Fan
2016-07-29 18:14 ` [Patch v4 12/46] UefiCpuPkg/MpInitLib: Allocate and initialize memory of MP Data buffer Jeff Fan
2016-07-29 18:14 ` [Patch v4 13/46] UefiCpuPkg/MpInitLib: Initialize CPU_AP_DATA for CPU APs Jeff Fan
2016-07-29 18:14 ` [Patch v4 14/46] UefiCpuPkg/MpInitLib: Add CPU_VOLATILE_REGISTERS & worker functions Jeff Fan
2016-07-29 18:14 ` [Patch v4 15/46] UefiCpuPkg/MpInitLib: Add MicrocodeDetect() and load microcode on BSP Jeff Fan
2016-07-29 18:14 ` [Patch v4 16/46] UefiCpuPkg/MpInitLib: Save CPU MP Data pointer Jeff Fan
2016-07-29 18:14 ` [Patch v4 17/46] UefiCpuPkg/MpInitLib: Register one End of PEI callback function Jeff Fan
2016-07-29 18:14 ` [Patch v4 18/46] UefiCpuPkg/MpInitLib: Register one period event to check APs status Jeff Fan
2016-07-29 18:14 ` [Patch v4 19/46] UefiCpuPkg/MpInitLib: Allocate AP reset vector buffer under 1MB Jeff Fan
2016-07-29 18:14 ` [Patch v4 20/46] UefiCpuPkg/MpInitLib: Add ApCFunction() executed by assembly code Jeff Fan
2016-07-29 18:14 ` [Patch v4 21/46] UefiCpuPkg/MpInitLib: Fill MP_CPU_EXCHANGE_INFO fields Jeff Fan
2016-07-29 18:14 ` [Patch v4 22/46] UefiCpuPkg/MpInitLib: Add WakeUpAP() Jeff Fan
2016-07-29 18:14 ` [Patch v4 23/46] UefiCpuPkg/MpInitLib: Send INIT-SIPI-SIPI to get processor count Jeff Fan
2016-07-29 18:14 ` [Patch v4 24/46] UefiCpuPkg/MpInitLib: Enable x2APIC mode on BSP/APs Jeff Fan
2016-07-29 18:14 ` [Patch v4 25/46] UefiCpuPkg/MpInitLib: Sort processor by ascending order of APIC ID Jeff Fan
2016-07-29 18:14 ` [Patch v4 26/46] UefiCpuPkg/MpInitLib: Skip collect processor count if GUIDed HOB exist Jeff Fan
2016-07-29 18:14 ` [Patch v4 27/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetNumberOfProcessors() Jeff Fan
2016-07-29 18:14 ` [Patch v4 28/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibGetProcessorInfo() Jeff Fan
2016-07-29 18:14 ` [Patch v4 29/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibWhoAmI() Jeff Fan
2016-07-29 18:14 ` [Patch v4 30/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibSwitchBSP() Jeff Fan
2016-07-29 18:14 ` [Patch v4 31/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibEnableDisableAP() Jeff Fan
2016-07-29 18:14 ` [Patch v4 32/46] UefiCpuPkg/MpInitLib: Check APs Status and update APs status Jeff Fan
2016-07-29 18:14 ` [Patch v4 33/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupThisAP() Jeff Fan
2016-07-29 18:15 ` [Patch v4 34/46] UefiCpuPkg/MpInitLib: Implementation of MpInitLibStartupAllAPs() Jeff Fan
2016-07-29 18:15 ` [Patch v4 35/46] UefiCpuPkg/MpInitLib: Place APs in safe loop before hand-off to OS Jeff Fan
2016-07-29 18:15 ` [Patch v4 36/46] OvmfPkg: Add MpInitLib reference in DSC files Jeff Fan
2016-07-29 18:15 ` [Patch v4 37/46] QuarkPlatformPkg: " Jeff Fan
2016-07-29 18:15 ` [Patch v4 38/46] UefiCpuPkg/CpuMpPei: Consume MpInitLib to produce CPU MP PPI services Jeff Fan
2016-07-29 18:15 ` [Patch v4 39/46] UefiCpuPkg/CpuMpPei: Remove unused files and codes Jeff Fan
2016-07-29 18:15 ` [Patch v4 40/46] UefiCpuPkg/CpuMpPei: Delete PeiMpServices.c and PeiMpServices.h Jeff Fan
2016-07-29 18:15 ` [Patch v4 41/46] UefiCpuPkg/CpuDxe: Consume MpInitLib to produce CPU MP Protocol services Jeff Fan
2016-07-29 18:15 ` [Patch v4 42/46] UefiCpuPkg/CpuDxe: Move SetMtrrsFromBuffer() location Jeff Fan
2016-07-29 18:15 ` [Patch v4 43/46] UefiCpuPkg/CpuDxe: Remove unused codes and files Jeff Fan
2016-07-29 18:15 ` [Patch v4 44/46] MdePkg/MpService.h: Fixed typo in function header to match PI spec Jeff Fan
2016-07-29 18:15 ` [Patch v4 45/46] MdePkg/MpService.h: Trim whitespace at end of line Jeff Fan
2016-07-29 18:15 ` [Patch v4 46/46] UefiCpuPkg/CpuDxe: Fixed typo in function header to match PI spec Jeff Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469816112-8200-6-git-send-email-jeff.fan@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox