]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/MpInitLib: Fix X64 XCODE5/NASM compatibility issues
[mirror_edk2.git] / UefiCpuPkg / Library / MpInitLib / MpLib.h
index e53deb449d977be7ef81a6ae1ad72eb56961dd77..ea56412cbce04adb575786e214165032f4ddbf67 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Common header file for MP Initialize Library.\r
 \r
 /** @file\r
   Common header file for MP Initialize Library.\r
 \r
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -112,9 +112,6 @@ typedef struct {
   volatile UINT32                *StartupApSignal;\r
   volatile UINTN                 ApFunction;\r
   volatile UINTN                 ApFunctionArgument;\r
   volatile UINT32                *StartupApSignal;\r
   volatile UINTN                 ApFunction;\r
   volatile UINTN                 ApFunctionArgument;\r
-  UINT32                         InitialApicId;\r
-  UINT32                         ApicId;\r
-  UINT32                         Health;\r
   BOOLEAN                        CpuHealthy;\r
   volatile CPU_STATE             State;\r
   CPU_VOLATILE_REGISTERS         VolatileRegisters;\r
   BOOLEAN                        CpuHealthy;\r
   volatile CPU_STATE             State;\r
   CPU_VOLATILE_REGISTERS         VolatileRegisters;\r
@@ -132,11 +129,14 @@ typedef struct {
 // we need to make sure the each fields offset same in different\r
 // architecture.\r
 //\r
 // we need to make sure the each fields offset same in different\r
 // architecture.\r
 //\r
+#pragma pack (1)\r
 typedef struct {\r
   UINT32                         InitialApicId;\r
   UINT32                         ApicId;\r
   UINT32                         Health;\r
 typedef struct {\r
   UINT32                         InitialApicId;\r
   UINT32                         ApicId;\r
   UINT32                         Health;\r
+  UINT64                         ApTopOfStack;\r
 } CPU_INFO_IN_HOB;\r
 } CPU_INFO_IN_HOB;\r
+#pragma pack ()\r
 \r
 //\r
 // AP reset code information including code address and size,\r
 \r
 //\r
 // AP reset code information including code address and size,\r
@@ -174,7 +174,10 @@ typedef struct {
   UINTN                 DataSegment;\r
   UINTN                 EnableExecuteDisable;\r
   UINTN                 Cr3;\r
   UINTN                 DataSegment;\r
   UINTN                 EnableExecuteDisable;\r
   UINTN                 Cr3;\r
+  UINTN                 InitFlag;\r
+  CPU_INFO_IN_HOB       *CpuInfo;\r
   CPU_MP_DATA           *CpuMpData;\r
   CPU_MP_DATA           *CpuMpData;\r
+  UINTN                 InitializeFloatingPointUnitsAddress;\r
 } MP_CPU_EXCHANGE_INFO;\r
 \r
 #pragma pack()\r
 } MP_CPU_EXCHANGE_INFO;\r
 \r
 #pragma pack()\r
@@ -198,7 +201,7 @@ struct _CPU_MP_DATA {
   UINTN                          WakeupBuffer;\r
   UINTN                          BackupBuffer;\r
   UINTN                          BackupBufferSize;\r
   UINTN                          WakeupBuffer;\r
   UINTN                          BackupBuffer;\r
   UINTN                          BackupBufferSize;\r
-  BOOLEAN                        EndOfPeiFlag;\r
+  BOOLEAN                        SaveRestoreFlag;\r
 \r
   volatile UINT32                StartCount;\r
   volatile UINT32                FinishedCount;\r
 \r
   volatile UINT32                StartCount;\r
   volatile UINT32                FinishedCount;\r
@@ -216,6 +219,7 @@ struct _CPU_MP_DATA {
   AP_INIT_STATE                  InitFlag;\r
   BOOLEAN                        X2ApicEnable;\r
   BOOLEAN                        SwitchBspFlag;\r
   AP_INIT_STATE                  InitFlag;\r
   BOOLEAN                        X2ApicEnable;\r
   BOOLEAN                        SwitchBspFlag;\r
+  UINTN                          NewBspNumber;\r
   CPU_EXCHANGE_ROLE_INFO         BSPInfo;\r
   CPU_EXCHANGE_ROLE_INFO         APInfo;\r
   MTRR_SETTINGS                  MtrrTable;\r
   CPU_EXCHANGE_ROLE_INFO         BSPInfo;\r
   CPU_EXCHANGE_ROLE_INFO         APInfo;\r
   MTRR_SETTINGS                  MtrrTable;\r
@@ -224,6 +228,12 @@ struct _CPU_MP_DATA {
   UINT16                         PmCodeSegment;\r
   CPU_AP_DATA                    *CpuData;\r
   volatile MP_CPU_EXCHANGE_INFO  *MpCpuExchangeInfo;\r
   UINT16                         PmCodeSegment;\r
   CPU_AP_DATA                    *CpuData;\r
   volatile MP_CPU_EXCHANGE_INFO  *MpCpuExchangeInfo;\r
+\r
+  UINT32                         CurrentTimerCount;\r
+  UINTN                          DivideValue;\r
+  UINT8                          Vector;\r
+  BOOLEAN                        PeriodicMode;\r
+  BOOLEAN                        TimerInterruptState;\r
 };\r
 \r
 extern EFI_GUID mCpuInitMpLibHobGuid;\r
 };\r
 \r
 extern EFI_GUID mCpuInitMpLibHobGuid;\r
@@ -247,7 +257,9 @@ VOID
 (EFIAPI * ASM_RELOCATE_AP_LOOP) (\r
   IN BOOLEAN                 MwaitSupport,\r
   IN UINTN                   ApTargetCState,\r
 (EFIAPI * ASM_RELOCATE_AP_LOOP) (\r
   IN BOOLEAN                 MwaitSupport,\r
   IN UINTN                   ApTargetCState,\r
-  IN UINTN                   PmCodeSegment\r
+  IN UINTN                   PmCodeSegment,\r
+  IN UINTN                   TopOfApStack,\r
+  IN UINTN                   NumberToFinish\r
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
@@ -360,7 +372,7 @@ InitMpGlobalData (
                                       simultaneously.\r
   @param[in]  WaitEvent               The event created by the caller with CreateEvent()\r
                                       service.\r
                                       simultaneously.\r
   @param[in]  WaitEvent               The event created by the caller with CreateEvent()\r
                                       service.\r
-  @param[in]  TimeoutInMicrosecsond   Indicates the time limit in microseconds for\r
+  @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for\r
                                       APs to return from Procedure, either for\r
                                       blocking or non-blocking mode.\r
   @param[in]  ProcedureArgument       The parameter passed into Procedure for\r
                                       APs to return from Procedure, either for\r
                                       blocking or non-blocking mode.\r
   @param[in]  ProcedureArgument       The parameter passed into Procedure for\r
@@ -397,7 +409,7 @@ StartupAllAPsWorker (
   @param[in]  ProcessorNumber         The handle number of the AP.\r
   @param[in]  WaitEvent               The event created by the caller with CreateEvent()\r
                                       service.\r
   @param[in]  ProcessorNumber         The handle number of the AP.\r
   @param[in]  WaitEvent               The event created by the caller with CreateEvent()\r
                                       service.\r
-  @param[in]  TimeoutInMicrosecsond   Indicates the time limit in microseconds for\r
+  @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for\r
                                       APs to return from Procedure, either for\r
                                       blocking or non-blocking mode.\r
   @param[in]  ProcedureArgument       The parameter passed into Procedure for\r
                                       APs to return from Procedure, either for\r
                                       blocking or non-blocking mode.\r
   @param[in]  ProcedureArgument       The parameter passed into Procedure for\r
@@ -512,7 +524,7 @@ CheckAndUpdateApsStatus (
 /**\r
   Detect whether specified processor can find matching microcode patch and load it.\r
 \r
 /**\r
   Detect whether specified processor can find matching microcode patch and load it.\r
 \r
-  @param[in] PeiCpuMpData        Pointer to PEI CPU MP Data\r
+  @param[in]  CpuMpData  The pointer to CPU MP Data structure.\r
 **/\r
 VOID\r
 MicrocodeDetect (\r
 **/\r
 VOID\r
 MicrocodeDetect (\r
@@ -531,23 +543,32 @@ IsMwaitSupport (
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Notify function on End Of PEI PPI.\r
+  Get available system memory below 1MB by specified size.\r
 \r
 \r
-  On S3 boot, this function will restore wakeup buffer data.\r
-  On normal boot, this function will flag wakeup buffer to be un-used type.\r
+  @param[in]  CpuMpData  The pointer to CPU MP Data structure.\r
+**/\r
+VOID\r
+BackupAndPrepareWakeupBuffer(\r
+  IN CPU_MP_DATA              *CpuMpData\r
+  );\r
 \r
 \r
-  @param[in]  PeiServices        The pointer to the PEI Services Table.\r
-  @param[in]  NotifyDescriptor   Address of the notification descriptor data structure.\r
-  @param[in]  Ppi                Address of the PPI that was installed.\r
+/**\r
+  Restore wakeup buffer data.\r
 \r
 \r
-  @retval EFI_SUCCESS        When everything is OK.\r
+  @param[in]  CpuMpData  The pointer to CPU MP Data structure.\r
 **/\r
 **/\r
-EFI_STATUS\r
-EFIAPI\r
-CpuMpEndOfPeiCallback (\r
-  IN EFI_PEI_SERVICES             **PeiServices,\r
-  IN EFI_PEI_NOTIFY_DESCRIPTOR    *NotifyDescriptor,\r
-  IN VOID                         *Ppi\r
+VOID\r
+RestoreWakeupBuffer(\r
+  IN CPU_MP_DATA              *CpuMpData\r
+  );\r
+\r
+/**\r
+  Enable Debug Agent to support source debugging on AP function.\r
+\r
+**/\r
+VOID\r
+EnableDebugAgent (\r
+  VOID\r
   );\r
 \r
 #endif\r
   );\r
 \r
 #endif\r