]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/CpuRuntimeDxe/Cpu.c
UefiPayloadPkg: Add PCI root bridge info hob support for SBL
[mirror_edk2.git] / EmulatorPkg / CpuRuntimeDxe / Cpu.c
index fc8d325ffc26a7488fca033d4cac6f2af1aeebd0..00e93016af7c7c25bd2861476ed35dcbbf619ebf 100644 (file)
@@ -1,15 +1,9 @@
 /*++ @file\r
   Emu driver to produce CPU Architectural Protocol.\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2011 - 2012, Apple Inc. All rights reserved.\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
@@ -63,7 +57,7 @@ SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
       0, //  ProcessorXModel:    4;\r
       0, //  ProcessorXFamily:   8;\r
       0, //  ProcessorReserved2: 4;\r
-    }, \r
+    },\r
     {  // PROCESSOR_FEATURE_FLAGS\r
       0, //  ProcessorFpu       :1;\r
       0, //  ProcessorVme       :1;\r
@@ -100,13 +94,13 @@ SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
   },\r
   3,                    // ProcessorVersion String;\r
   {                     // Voltage;\r
-    1,  // ProcessorVoltageCapability5V        :1; \r
-    1,  // ProcessorVoltageCapability3_3V      :1;  \r
-    1,  // ProcessorVoltageCapability2_9V      :1;  \r
+    1,  // ProcessorVoltageCapability5V        :1;\r
+    1,  // ProcessorVoltageCapability3_3V      :1;\r
+    1,  // ProcessorVoltageCapability2_9V      :1;\r
     0,  // ProcessorVoltageCapabilityReserved  :1; ///< Bit 3, must be zero.\r
     0,  // ProcessorVoltageReserved            :3; ///< Bits 4-6, must be zero.\r
     0   // ProcessorVoltageIndicateLegacy      :1;\r
-  },              \r
+  },\r
   0,                      // ExternalClock;\r
   0,                      // MaxSpeed;\r
   0,                      // CurrentSpeed;\r
@@ -127,7 +121,7 @@ SMBIOS_TABLE_TYPE4 mCpuSmbiosType4 = {
 \r
 CHAR8 *mCpuSmbiosType4Strings[] = {\r
   "Socket",\r
-  "edk2.svn.sourceforge.net",\r
+  "http://www.tianocore.org/edk2/",\r
   "Emulated Processor",\r
   "1.0",\r
   "1.0",\r
@@ -151,26 +145,26 @@ CHAR8 *mCpuSmbiosType4Strings[] = {
     "Not Found",\r
     NULL\r
   };\r
-  \r
+\r
   ...\r
   LogSmbiosData (\r
-    (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12, \r
+    (EFI_SMBIOS_TABLE_HEADER*)&gSmbiosType12,\r
     gSmbiosType12Strings\r
     );\r
 \r
   @param  Template    Fixed SMBIOS structure, required.\r
-  @param  StringArray Array of strings to convert to an SMBIOS string pack. \r
+  @param  StringArray Array of strings to convert to an SMBIOS string pack.\r
                       NULL is OK.\r
 \r
 **/\r
 EFI_STATUS\r
 LogSmbiosData (\r
   IN  EFI_SMBIOS_TABLE_HEADER *Template,\r
-  IN  CHAR8                   **StringPack \r
+  IN  CHAR8                   **StringPack\r
   )\r
 {\r
   EFI_STATUS                Status;\r
-  EFI_SMBIOS_PROTOCOL       *Smbios;  \r
+  EFI_SMBIOS_PROTOCOL       *Smbios;\r
   EFI_SMBIOS_HANDLE         SmbiosHandle;\r
   EFI_SMBIOS_TABLE_HEADER   *Record;\r
   UINTN                     Index;\r
@@ -219,7 +213,7 @@ LogSmbiosData (
     Str += StringSize;\r
   }\r
   *Str = 0;\r
-  \r
+\r
   SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
   Status = Smbios->Add (\r
                      Smbios,\r
@@ -228,7 +222,7 @@ LogSmbiosData (
                      Record\r
                      );\r
   ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   FreePool (Record);\r
   return Status;\r
 }\r
@@ -241,10 +235,13 @@ CpuUpdateSmbios (
   IN UINTN  MaxCpus\r
   )\r
 {\r
-  mCpuSmbiosType4.CoreCount        = MaxCpus;\r
-  mCpuSmbiosType4.EnabledCoreCount = MaxCpus;\r
-  mCpuSmbiosType4.ThreadCount      = MaxCpus;\r
-\r
+  mCpuSmbiosType4.CoreCount        = (UINT8) MaxCpus;\r
+  mCpuSmbiosType4.EnabledCoreCount = (UINT8) MaxCpus;\r
+  mCpuSmbiosType4.ThreadCount      = (UINT8) MaxCpus;\r
+  //\r
+  // The value of 1234 is fake value for CPU frequency\r
+  //\r
+  mCpuSmbiosType4.CurrentSpeed = 1234;\r
   LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER *)&mCpuSmbiosType4, mCpuSmbiosType4Strings);\r
 }\r
 \r
@@ -327,9 +324,6 @@ EmuInit (
   IN EFI_CPU_INIT_TYPE      InitType\r
   )\r
 {\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
@@ -341,8 +335,6 @@ EmuRegisterInterruptHandler (
   IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler\r
   )\r
 {\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
   //\r
   // Do parameter checking for EFI spec conformance\r
   //\r
@@ -352,7 +344,6 @@ EmuRegisterInterruptHandler (
   //\r
   // Do nothing for Emu emulation\r
   //\r
-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r
@@ -392,8 +383,6 @@ EmuSetMemoryAttributes (
   IN UINT64                 Attributes\r
   )\r
 {\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
   //\r
   // Check for invalid parameter for Spec conformance\r
   //\r
@@ -404,7 +393,6 @@ EmuSetMemoryAttributes (
   //\r
   // Do nothing for Nt32 emulation\r
   //\r
-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
   return EFI_UNSUPPORTED;\r
 }\r
 \r