]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
UefiCpuPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / CpuS3.c
index fec53c522ff8bf84a3f8ec17a90ea801c7f4a691..2cfc61b2c66c3b8ff49b7fc59f7d0e0c9b9054f5 100644 (file)
@@ -2,13 +2,7 @@
 Code for Processor S3 restoration\r
 \r
 Copyright (c) 2006 - 2018, 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -41,9 +35,12 @@ typedef struct {
 // Flags used when program the register.\r
 //\r
 typedef struct {\r
-  volatile UINTN           ConsoleLogLock;       // Spinlock used to control console.\r
-  volatile UINTN           MemoryMappedLock;     // Spinlock used to program mmio\r
-  volatile UINT32          *SemaphoreCount;      // Semaphore used to program semaphore.\r
+  volatile UINTN           ConsoleLogLock;          // Spinlock used to control console.\r
+  volatile UINTN           MemoryMappedLock;        // Spinlock used to program mmio\r
+  volatile UINT32          *CoreSemaphoreCount;     // Semaphore container used to program\r
+                                                    // core level semaphore.\r
+  volatile UINT32          *PackageSemaphoreCount;  // Semaphore container used to program\r
+                                                    // package level semaphore.\r
 } PROGRAM_CPU_REGISTER_FLAGS;\r
 \r
 //\r
@@ -346,13 +343,14 @@ ProgramProcessorRegister (
       //  n * P(0)       n * P(1)      ...           n * P(n)\r
       //\r
       ASSERT (\r
-        (ApLocation != NULL) && \r
+        (ApLocation != NULL) &&\r
         (CpuStatus->ValidCoreCountPerPackage != 0) &&\r
-        (CpuFlags->SemaphoreCount) != NULL\r
+        (CpuFlags->CoreSemaphoreCount != NULL) &&\r
+        (CpuFlags->PackageSemaphoreCount != NULL)\r
         );\r
-      SemaphorePtr = CpuFlags->SemaphoreCount;\r
       switch (RegisterTableEntry->Value) {\r
       case CoreDepType:\r
+        SemaphorePtr = CpuFlags->CoreSemaphoreCount;\r
         //\r
         // Get Offset info for the first thread in the core which current thread belongs to.\r
         //\r
@@ -373,6 +371,7 @@ ProgramProcessorRegister (
         break;\r
 \r
       case PackageDepType:\r
+        SemaphorePtr = CpuFlags->PackageSemaphoreCount;\r
         ValidCoreCountPerPackage = (UINT32 *)(UINTN)CpuStatus->ValidCoreCountPerPackage;\r
         //\r
         // Get Offset info for the first thread in the package which current thread belongs to.\r
@@ -428,7 +427,7 @@ ProgramProcessorRegister (
 /**\r
 \r
   Set Processor register for one AP.\r
-  \r
+\r
   @param     PreSmmRegisterTable     Use pre Smm register table or register table.\r
 \r
 **/\r
@@ -451,6 +450,7 @@ SetRegister (
 \r
   InitApicId = GetInitialApicId ();\r
   RegisterTable = NULL;\r
+  ProcIndex = (UINTN)-1;\r
   for (Index = 0; Index < mAcpiCpuData.NumberOfCpus; Index++) {\r
     if (RegisterTables[Index].InitialApicId == InitApicId) {\r
       RegisterTable = &RegisterTables[Index];\r
@@ -1036,10 +1036,16 @@ GetAcpiCpuData (
     ASSERT (mAcpiCpuData.ApLocation != 0);\r
   }\r
   if (CpuStatus->PackageCount != 0) {\r
-    mCpuFlags.SemaphoreCount = AllocateZeroPool (\r
-                                 sizeof (UINT32) * CpuStatus->PackageCount *\r
-                                 CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount);\r
-    ASSERT (mCpuFlags.SemaphoreCount != NULL);\r
+    mCpuFlags.CoreSemaphoreCount = AllocateZeroPool (\r
+                                     sizeof (UINT32) * CpuStatus->PackageCount *\r
+                                     CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount\r
+                                     );\r
+    ASSERT (mCpuFlags.CoreSemaphoreCount != NULL);\r
+    mCpuFlags.PackageSemaphoreCount = AllocateZeroPool (\r
+                                        sizeof (UINT32) * CpuStatus->PackageCount *\r
+                                        CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount\r
+                                        );\r
+    ASSERT (mCpuFlags.PackageSemaphoreCount != NULL);\r
   }\r
   InitializeSpinLock((SPIN_LOCK*) &mCpuFlags.MemoryMappedLock);\r
   InitializeSpinLock((SPIN_LOCK*) &mCpuFlags.ConsoleLogLock);\r