]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkUnixPkg/Dxe/UnixThunk/Cpu/Cpu.c
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / EdkUnixPkg / Dxe / UnixThunk / Cpu / Cpu.c
diff --git a/EdkUnixPkg/Dxe/UnixThunk/Cpu/Cpu.c b/EdkUnixPkg/Dxe/UnixThunk/Cpu/Cpu.c
deleted file mode 100644 (file)
index af20756..0000000
+++ /dev/null
@@ -1,730 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. 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
-\r
-Module Name:\r
-\r
-  Cpu.c\r
-\r
-Abstract:\r
-\r
-  Unix Emulation Architectural Protocol Driver as defined in Tiano.\r
-  This CPU module abstracts the interrupt subsystem of a platform and\r
-  the CPU-specific setjump/long pair.  Other services are not implemented\r
-  in this driver.\r
-\r
---*/\r
-\r
-#include "CpuDriver.h"\r
-\r
-#define EFI_CPU_DATA_MAXIMUM_LENGTH 0x100\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpu (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-UnixIoProtocolNotifyFunction (\r
-  IN EFI_EVENT                Event,\r
-  IN VOID                     *Context\r
-  );\r
-\r
-typedef union {\r
-  EFI_CPU_DATA_RECORD *DataRecord;\r
-  UINT8               *Raw;\r
-} EFI_CPU_DATA_RECORD_BUFFER;\r
-\r
-EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader = {\r
-  EFI_PROCESSOR_SUBCLASS_VERSION,       // Version\r
-  sizeof (EFI_SUBCLASS_TYPE1_HEADER),   // Header Size\r
-  0,                                    // Instance, Initialize later\r
-  EFI_SUBCLASS_INSTANCE_NON_APPLICABLE, // SubInstance\r
-  0                                     // RecordType, Initialize later\r
-};\r
-\r
-//\r
-// Service routines for the driver\r
-//\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixFlushCpuDataCache (\r
-  IN EFI_CPU_ARCH_PROTOCOL  *This,\r
-  IN EFI_PHYSICAL_ADDRESS   Start,\r
-  IN UINT64                 Length,\r
-  IN EFI_CPU_FLUSH_TYPE     FlushType\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine would provide support for flushing the CPU data cache.\r
-  In the case of UNIX emulation environment, this flushing is not necessary and\r
-  is thus not implemented.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-  Start adddress in memory to flush\r
-  Length of memory to flush\r
-  Flush type\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_SUCCESS\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    FlushType - add argument and description to function comment\r
-// TODO:    EFI_UNSUPPORTED - add return value to function comment\r
-{\r
-  if (FlushType == EfiCpuFlushTypeWriteBackInvalidate) {\r
-    //\r
-    // Only WB flush is supported. We actually need do nothing on UNIX emulator\r
-    // environment. Classify this to follow EFI spec\r
-    //\r
-    return EFI_SUCCESS;\r
-  }\r
-  //\r
-  // Other flush types are not supported by UNIX emulator\r
-  //\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixEnableInterrupt (\r
-  IN EFI_CPU_ARCH_PROTOCOL  *This\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine provides support for emulation of the interrupt enable of the\r
-  the system.  For our purposes, CPU enable is just a BOOLEAN that the Timer\r
-  Architectural Protocol observes in order to defer behaviour while in its\r
-  emulated interrupt, or timer tick.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_SUCCESS\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-{\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
-  Private                 = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
-  Private->InterruptState = TRUE;\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixDisableInterrupt (\r
-  IN EFI_CPU_ARCH_PROTOCOL  *This\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine provides support for emulation of the interrupt disable of the\r
-  the system.  For our purposes, CPU enable is just a BOOLEAN that the Timer\r
-  Architectural Protocol observes in order to defer behaviour while in its\r
-  emulated interrupt, or timer tick.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_SUCCESS\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-{\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
-  Private                 = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
-  Private->InterruptState = FALSE;\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixGetInterruptState (\r
-  IN EFI_CPU_ARCH_PROTOCOL  *This,\r
-  OUT BOOLEAN               *State\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine provides support for emulation of the interrupt disable of the\r
-  the system.  For our purposes, CPU enable is just a BOOLEAN that the Timer\r
-  Architectural Protocol observes in order to defer behaviour while in its\r
-  emulated interrupt, or timer tick.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_SUCCESS\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    State - add argument and description to function comment\r
-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-{\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
-  if (State == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
-  *State  = Private->InterruptState;\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixInit (\r
-  IN EFI_CPU_ARCH_PROTOCOL  *This,\r
-  IN EFI_CPU_INIT_TYPE      InitType\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine would support generation of a CPU INIT.  At\r
-  present, this code does not provide emulation.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-  INIT Type\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_UNSUPPORTED - not yet implemented\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    InitType - add argument and description to function comment\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
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixRegisterInterruptHandler (\r
-  IN EFI_CPU_ARCH_PROTOCOL      *This,\r
-  IN EFI_EXCEPTION_TYPE         InterruptType,\r
-  IN EFI_CPU_INTERRUPT_HANDLER  InterruptHandler\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine would support registration of an interrupt handler.  At\r
-  present, this code does not provide emulation.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-  Pointer to interrupt handlers\r
-  Interrupt type\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_UNSUPPORTED - not yet implemented\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    InterruptType - add argument and description to function comment\r
-// TODO:    InterruptHandler - add argument and description to function comment\r
-{\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
-  //\r
-  // Do parameter checking for EFI spec conformance\r
-  //\r
-  if (InterruptType < 0 || InterruptType > 0xff) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-  //\r
-  // Do nothing for Nt32 emulation\r
-  //\r
-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixGetTimerValue (\r
-  IN  EFI_CPU_ARCH_PROTOCOL *This,\r
-  IN  UINT32                TimerIndex,\r
-  OUT UINT64                *TimerValue,\r
-  OUT UINT64                *TimerPeriod OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine would support querying of an on-CPU timer.  At present,\r
-  this code does not provide timer emulation.\r
-\r
-Arguments:\r
-\r
-  This        - Pointer to CPU Architectural Protocol interface\r
-  TimerIndex  - Index of given CPU timer\r
-  TimerValue  - Output of the timer\r
-  TimerPeriod - Output of the timer period\r
-\r
-Returns:\r
-\r
-  EFI_UNSUPPORTED       - not yet implemented\r
-  EFI_INVALID_PARAMETER - TimeValue is NULL\r
-\r
---*/\r
-{\r
-  if (TimerValue == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // No timer supported\r
-  //\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-EFIAPI\r
-UnixSetMemoryAttributes (\r
-  IN EFI_CPU_ARCH_PROTOCOL  *This,\r
-  IN EFI_PHYSICAL_ADDRESS   BaseAddress,\r
-  IN UINT64                 Length,\r
-  IN UINT64                 Attributes\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This routine would support querying of an on-CPU timer.  At present,\r
-  this code does not provide timer emulation.\r
-\r
-Arguments:\r
-\r
-  Pointer to CPU Architectural Protocol interface\r
-  Start address of memory region\r
-  The size in bytes of the memory region\r
-  The bit mask of attributes to set for the memory region\r
-\r
-Returns:\r
-\r
-  Status\r
-    EFI_UNSUPPORTED - not yet implemented\r
-\r
---*/\r
-// TODO:    This - add argument and description to function comment\r
-// TODO:    BaseAddress - add argument and description to function comment\r
-// TODO:    Length - add argument and description to function comment\r
-// TODO:    Attributes - add argument and description to function comment\r
-// TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-{\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-\r
-  //\r
-  // Check for invalid parameter for Spec conformance\r
-  //\r
-  if (Length == 0) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // Do nothing for Nt32 emulation\r
-  //\r
-  Private = CPU_ARCH_PROTOCOL_PRIVATE_DATA_FROM_THIS (This);\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeCpu (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initialize the state information for the CPU Architectural Protocol\r
-\r
-Arguments:\r
-\r
-  ImageHandle of the loaded driver\r
-  Pointer to the System Table\r
-\r
-Returns:\r
-\r
-  Status\r
-\r
-  EFI_SUCCESS           - protocol instance can be published\r
-  EFI_OUT_OF_RESOURCES  - cannot allocate protocol data structure\r
-  EFI_DEVICE_ERROR      - cannot create the thread\r
-\r
---*/\r
-// TODO:    SystemTable - add argument and description to function comment\r
-{\r
-  EFI_STATUS                Status;\r
-  EFI_EVENT                 Event;\r
-  CPU_ARCH_PROTOCOL_PRIVATE *Private;\r
-  VOID                      *Registration;\r
-\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  sizeof (CPU_ARCH_PROTOCOL_PRIVATE),\r
-                  (VOID **)&Private\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  Private->Signature                    = CPU_ARCH_PROT_PRIVATE_SIGNATURE;\r
-  Private->Cpu.FlushDataCache           = UnixFlushCpuDataCache;\r
-  Private->Cpu.EnableInterrupt          = UnixEnableInterrupt;\r
-  Private->Cpu.DisableInterrupt         = UnixDisableInterrupt;\r
-  Private->Cpu.GetInterruptState        = UnixGetInterruptState;\r
-  Private->Cpu.Init                     = UnixInit;\r
-  Private->Cpu.RegisterInterruptHandler = UnixRegisterInterruptHandler;\r
-  Private->Cpu.GetTimerValue            = UnixGetTimerValue;\r
-  Private->Cpu.SetMemoryAttributes      = UnixSetMemoryAttributes;\r
-\r
-  Private->Cpu.NumberOfTimers           = 0;\r
-  Private->Cpu.DmaBufferAlignment       = 4;\r
-\r
-  Private->InterruptState               = TRUE;\r
-\r
-  Private->CpuIo.Mem.Read   = CpuMemoryServiceRead;\r
-  Private->CpuIo.Mem.Write  = CpuMemoryServiceWrite;\r
-  Private->CpuIo.Io.Read    = CpuIoServiceRead;\r
-  Private->CpuIo.Io.Write   = CpuIoServiceWrite;\r
-\r
-\r
-  Private->Handle                       = NULL;\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &Private->Handle,\r
-                  &gEfiCpuArchProtocolGuid,   &Private->Cpu,\r
-                  &gEfiCpuIoProtocolGuid,     &Private->CpuIo,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  //\r
-  // Install notify function to store processor data to HII database and data hub.\r
-  //\r
-  Status = gBS->CreateEvent (\r
-                  EVT_NOTIFY_SIGNAL,\r
-                  TPL_CALLBACK,\r
-                  UnixIoProtocolNotifyFunction,\r
-                  ImageHandle,\r
-                  &Event\r
-                  );\r
-  ASSERT (!EFI_ERROR (Status));\r
-\r
-  Status = gBS->RegisterProtocolNotify (\r
-                  &gEfiUnixIoProtocolGuid,\r
-                  Event,\r
-                  &Registration\r
-                  );\r
-  ASSERT (!EFI_ERROR (Status));\r
-\r
-  //\r
-  // Should be at EFI_D_INFO, but lets us now things are running\r
-  //\r
-  DEBUG ((EFI_D_ERROR, "CPU Architectural Protocol Loaded\n"));\r
-\r
-\r
-\r
-  return Status;\r
-}\r
-\r
-UINTN\r
-Atoi (\r
-  UINT16  *String\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Convert a unicode string to a UINTN\r
-\r
-Arguments:\r
-  String - Unicode string.\r
-\r
-Returns:\r
-  UINTN of the number represented by String.\r
-\r
---*/\r
-{\r
-  UINTN   Number;\r
-  UINT16   *Str;\r
-\r
-  //\r
-  // skip preceeding white space\r
-  //\r
-  Str = String;\r
-  while ((*Str) && (*Str == ' ' || *Str == '"')) {\r
-    Str++;\r
-  }\r
-  //\r
-  // Convert ot a Number\r
-  //\r
-  Number = 0;\r
-  while (*Str != '\0') {\r
-    if ((*Str >= '0') && (*Str <= '9')) {\r
-      Number = (Number * 10) +*Str - '0';\r
-    } else {\r
-      break;\r
-    }\r
-\r
-    Str++;\r
-  }\r
-\r
-  return Number;\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-UnixIoProtocolNotifyFunction (\r
-  IN EFI_EVENT                Event,\r
-  IN VOID                     *Context\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  This function will log processor version and frequency data to data hub.\r
-\r
-Arguments:\r
-  Event        - Event whose notification function is being invoked.\r
-  Context      - Pointer to the notification function's context.\r
-\r
-Returns:\r
-  None.\r
-\r
---*/\r
-{\r
-  EFI_STATUS                  Status;\r
-  EFI_CPU_DATA_RECORD_BUFFER  RecordBuffer;\r
-  EFI_DATA_RECORD_HEADER      *Record;\r
-  EFI_SUBCLASS_TYPE1_HEADER   *DataHeader;\r
-  UINT32                      HeaderSize;\r
-  UINT32                      TotalSize;\r
-  UINTN                       HandleCount;\r
-  UINTN                       HandleIndex;\r
-  UINT64                      MonotonicCount;\r
-  BOOLEAN                     RecordFound;\r
-  EFI_HANDLE                  *HandleBuffer;\r
-  EFI_UNIX_IO_PROTOCOL       *UnixIo;\r
-  EFI_DATA_HUB_PROTOCOL       *DataHub;\r
-  EFI_HII_PROTOCOL            *Hii;\r
-  EFI_HII_HANDLE              StringHandle;\r
-  EFI_HII_PACKAGES            *PackageList;\r
-  STRING_REF                  Token;\r
-\r
-  DataHub         = NULL;\r
-  Token           = 0;\r
-  MonotonicCount  = 0;\r
-  RecordFound     = FALSE;\r
-\r
-  //\r
-  // Retrieve the list of all handles from the handle database\r
-  //\r
-  Status = gBS->LocateHandleBuffer (\r
-                  AllHandles,\r
-                  &gEfiUnixIoProtocolGuid,\r
-                  NULL,\r
-                  &HandleCount,\r
-                  &HandleBuffer\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    return ;\r
-  }\r
-  //\r
-  // Locate HII protocol\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID **)&Hii);\r
-  if (EFI_ERROR (Status)) {\r
-    return ;\r
-  }\r
-  //\r
-  // Locate DataHub protocol.\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID **)&DataHub);\r
-  if (EFI_ERROR (Status)) {\r
-    return ;\r
-  }\r
-  //\r
-  // Initialize data record header\r
-  //\r
-  mCpuDataRecordHeader.Instance = 1;\r
-  HeaderSize                    = sizeof (EFI_SUBCLASS_TYPE1_HEADER);\r
-\r
-  RecordBuffer.Raw              = AllocatePool (HeaderSize + EFI_CPU_DATA_MAXIMUM_LENGTH);\r
-  if (RecordBuffer.Raw == NULL) {\r
-    return ;\r
-  }\r
-\r
-  CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);\r
-\r
-  //\r
-  // Search the Handle array to find the CPU model and speed information\r
-  //\r
-  for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {\r
-    Status = gBS->OpenProtocol (\r
-                    HandleBuffer[HandleIndex],\r
-                    &gEfiUnixIoProtocolGuid,\r
-                    (VOID **)&UnixIo,\r
-                    Context,\r
-                    NULL,\r
-                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                    );\r
-    if (EFI_ERROR (Status)) {\r
-      continue;\r
-    }\r
-\r
-    if ((UnixIo->UnixThunk->Signature == EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) &&\r
-        CompareGuid (UnixIo->TypeGuid, &gEfiUnixCPUModelGuid)\r
-          ) {\r
-      //\r
-      // Check if this record has been stored in data hub\r
-      //\r
-      do {\r
-        Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);\r
-        if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {\r
-          DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);\r
-          if (CompareGuid (&Record->DataRecordGuid, &gEfiProcessorSubClassGuid) &&\r
-              (DataHeader->RecordType == ProcessorVersionRecordType)\r
-              ) {\r
-            RecordFound = TRUE;\r
-          }\r
-        }\r
-      } while (MonotonicCount != 0);\r
-\r
-      if (RecordFound) {\r
-        RecordFound = FALSE;\r
-        continue;\r
-      }\r
-      //\r
-      // Initialize strings to HII database\r
-      //\r
-      PackageList = PreparePackages (1, &gEfiProcessorProducerGuid, CpuStrings);\r
-\r
-      Status      = Hii->NewPack (Hii, PackageList, &StringHandle);\r
-      ASSERT (!EFI_ERROR (Status));\r
-\r
-      gBS->FreePool (PackageList);\r
-\r
-      //\r
-      // Store processor version data record to data hub\r
-      //\r
-      Status = Hii->NewString (Hii, NULL, StringHandle, &Token, UnixIo->EnvString);\r
-      ASSERT (!EFI_ERROR (Status));\r
-\r
-      RecordBuffer.DataRecord->DataRecordHeader.RecordType      = ProcessorVersionRecordType;\r
-      RecordBuffer.DataRecord->VariableRecord.ProcessorVersion  = Token;\r
-      TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_VERSION_DATA);\r
-\r
-      Status = DataHub->LogData (\r
-                          DataHub,\r
-                          &gEfiProcessorSubClassGuid,\r
-                          &gEfiProcessorProducerGuid,\r
-                          EFI_DATA_RECORD_CLASS_DATA,\r
-                          RecordBuffer.Raw,\r
-                          TotalSize\r
-                          );\r
-    }\r
-\r
-    if ((UnixIo->UnixThunk->Signature == EFI_UNIX_THUNK_PROTOCOL_SIGNATURE) &&\r
-        CompareGuid (UnixIo->TypeGuid, &gEfiUnixCPUSpeedGuid)\r
-          ) {\r
-      //\r
-      // Check if this record has been stored in data hub\r
-      //\r
-      do {\r
-        Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);\r
-        if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {\r
-          DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);\r
-          if (CompareGuid (&Record->DataRecordGuid, &gEfiProcessorSubClassGuid) &&\r
-              (DataHeader->RecordType == ProcessorCoreFrequencyRecordType)\r
-              ) {\r
-            RecordFound = TRUE;\r
-          }\r
-        }\r
-      } while (MonotonicCount != 0);\r
-\r
-      if (RecordFound) {\r
-        RecordFound = FALSE;\r
-        continue;\r
-      }\r
-      //\r
-      // Store CPU frequency data record to data hub\r
-      //\r
-      RecordBuffer.DataRecord->DataRecordHeader.RecordType                    = ProcessorCoreFrequencyRecordType;\r
-      RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Value    = (UINT16) Atoi (UnixIo->EnvString);\r
-      RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Exponent = 6;\r
-      TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_FREQUENCY_DATA);\r
-\r
-      Status = DataHub->LogData (\r
-                          DataHub,\r
-                          &gEfiProcessorSubClassGuid,\r
-                          &gEfiProcessorProducerGuid,\r
-                          EFI_DATA_RECORD_CLASS_DATA,\r
-                          RecordBuffer.Raw,\r
-                          TotalSize\r
-                          );\r
-\r
-      gBS->FreePool (RecordBuffer.Raw);\r
-    }\r
-\r
-    gBS->CloseProtocol (\r
-          HandleBuffer[HandleIndex],\r
-          &gEfiUnixIoProtocolGuid,\r
-          Context,\r
-          NULL\r
-          );\r
-  }\r
-}\r