]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
edk2: Remove packages moved to edk2-platforms
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformSetupDxe / SetupInfoRecords.c
diff --git a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupInfoRecords.c
deleted file mode 100644 (file)
index c404ada..0000000
+++ /dev/null
@@ -1,1855 +0,0 @@
-/** @file\r
-\r
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>\r
-                                                                                   \r\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-                                                                                   \r\r
-\r
-\r
-Module Name:\r
-\r
-    SetupInfoRecords.c\r
-\r
-Abstract:\r
-\r
-    This is the filter driver to retrieve data hub entries.\r
-\r
-Revision History:\r
---*/\r
-\r
-#include "PlatformSetupDxe.h"\r
-#include <Protocol/LegacyBios.h>\r
-#include <Protocol/PciRootBridgeIo.h>\r
-#include <Protocol/SimpleNetwork.h>\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/DiskInfo.h>\r
-#include <Protocol/IdeControllerInit.h>\r
-#include <Protocol/MpService.h>\r
-#include <Protocol/PchPlatformPolicy.h>\r
-#include <Protocol/CpuIo2.h>\r
-#include <Protocol/Smbios.h>\r
-#include <IndustryStandard/SmBios.h>\r
-#include <Library/IoLib.h>\r
-#include <Library/I2CLib.h>\r
-#include <Guid/GlobalVariable.h>\r
-\r
-#include "Valleyview.h"\r
-#include "VlvAccess.h"\r
-#include "PchAccess.h"\r
-#include "SetupMode.h"\r
-#include "PchCommonDefinitions.h"\r
-#include <PlatformBaseAddresses.h>\r
-\r
-\r
-typedef struct {\r
-  UINT8  ID;\r
-  CHAR8  String[16];\r
-} VLV_REV;\r
-\r
-typedef struct {\r
-  UINT8 RevId;\r
-  CHAR8 String[16];\r
-} SB_REV;\r
-\r
-//\r
-// Silicon Steppings\r
-//\r
-SB_REV  SBRevisionTable[] = {\r
-  {V_PCH_LPC_RID_0, "(A0 Stepping)"},\r
-  {V_PCH_LPC_RID_1, "(A0 Stepping)"},\r
-  {V_PCH_LPC_RID_2, "(A1 Stepping)"},\r
-  {V_PCH_LPC_RID_3, "(A1 Stepping)"},\r
-  {V_PCH_LPC_RID_4, "(B0 Stepping)"},\r
-  {V_PCH_LPC_RID_5, "(B0 Stepping)"},\r
-  {V_PCH_LPC_RID_6, "(B1 Stepping)"},\r
-  {V_PCH_LPC_RID_7, "(B1 Stepping)"},\r
-  {V_PCH_LPC_RID_8, "(B2 Stepping)"},\r
-  {V_PCH_LPC_RID_9, "(B2 Stepping)"},\r
-  {V_PCH_LPC_RID_A, "(B3 Stepping)"},\r
-  {V_PCH_LPC_RID_B, "(B3 Stepping)"},\r
-  {V_PCH_LPC_RID_C, "(C0 Stepping)"},\r
-  {V_PCH_LPC_RID_D, "(C0 Stepping)"}\r
-};\r
-\r
-#define LEFT_JUSTIFY  0x01\r
-#define PREFIX_SIGN   0x02\r
-#define PREFIX_BLANK  0x04\r
-#define COMMA_TYPE    0x08\r
-#define LONG_TYPE     0x10\r
-#define PREFIX_ZERO   0x20\r
-\r
-#define ICH_REG_REV                 0x08\r
-#define MSR_IA32_PLATFORM_ID        0x17\r
-\r
-\r
-BOOLEAN                         mSetupInfoDone = FALSE;\r
-UINT8                           mUseProductKey = 0;\r
-EFI_EXP_BASE10_DATA             mProcessorFrequency;\r
-EFI_EXP_BASE10_DATA             mProcessorFsbFrequency;\r
-\r
-EFI_GUID                        mProcessorProducerGuid;\r
-EFI_HII_HANDLE                  mHiiHandle;\r
-EFI_PLATFORM_CPU_INFO           mPlatformCpuInfo;\r
-SYSTEM_CONFIGURATION            mSystemConfiguration;\r
-EFI_PLATFORM_INFO_HOB           *mPlatformInfo;\r
-\r
-\r
-#define memset SetMem\r
-\r
-UINT16                mMemorySpeed         = 0xffff;\r
-EFI_PHYSICAL_ADDRESS  mMemorySizeChannelASlot0  = 0;\r
-UINT16                mMemorySpeedChannelASlot0 = 0xffff;\r
-EFI_PHYSICAL_ADDRESS  mMemorySizeChannelASlot1  = 0;\r
-UINT16                mMemorySpeedChannelASlot1 = 0xffff;\r
-EFI_PHYSICAL_ADDRESS  mMemorySizeChannelBSlot0  = 0;\r
-UINT16                mMemorySpeedChannelBSlot0 = 0xffff;\r
-EFI_PHYSICAL_ADDRESS  mMemorySizeChannelBSlot1  = 0;\r
-UINT16                mMemorySpeedChannelBSlot1 = 0xffff;\r
-EFI_PHYSICAL_ADDRESS  mMemorySizeChannelCSlot0  = 0;\r
-UINT16                mMemorySpeedChannelCSlot0 = 0xffff;\r
-EFI_PHYSICAL_ADDRESS  mMemorySizeChannelCSlot1  = 0;\r
-UINT16                mMemorySpeedChannelCSlot1 = 0xffff;\r
-UINTN                 mMemoryMode          = 0xff;\r
-\r
-#define CHARACTER_NUMBER_FOR_VALUE  30\r
-  typedef struct {\r
-  EFI_STRING_TOKEN            MemoryDeviceLocator;\r
-  EFI_STRING_TOKEN            MemoryBankLocator;\r
-  EFI_STRING_TOKEN            MemoryManufacturer;\r
-  EFI_STRING_TOKEN            MemorySerialNumber;\r
-  EFI_STRING_TOKEN            MemoryAssetTag;\r
-  EFI_STRING_TOKEN            MemoryPartNumber;\r
-  EFI_INTER_LINK_DATA         MemoryArrayLink;\r
-  EFI_INTER_LINK_DATA         MemorySubArrayLink;\r
-  UINT16                      MemoryTotalWidth;\r
-  UINT16                      MemoryDataWidth;\r
-  UINT64                      MemoryDeviceSize;\r
-  EFI_MEMORY_FORM_FACTOR      MemoryFormFactor;\r
-  UINT8                       MemoryDeviceSet;\r
-  EFI_MEMORY_ARRAY_TYPE       MemoryType;\r
-  EFI_MEMORY_TYPE_DETAIL      MemoryTypeDetail;\r
-  UINT16                      MemorySpeed;\r
-  EFI_MEMORY_STATE            MemoryState;\r
-} EFI_MEMORY_ARRAY_LINK;\r
-\r
-\r
-typedef struct {\r
-  EFI_PHYSICAL_ADDRESS        MemoryArrayStartAddress;\r
-  EFI_PHYSICAL_ADDRESS        MemoryArrayEndAddress;\r
-  EFI_INTER_LINK_DATA         PhysicalMemoryArrayLink;\r
-  UINT16                      MemoryArrayPartitionWidth;\r
-} EFI_MEMORY_ARRAY_START_ADDRESS;\r
-\r
-\r
-typedef enum {\r
-  PCH_SATA_MODE_IDE = 0,\r
-  PCH_SATA_MODE_AHCI,\r
-  PCH_SATA_MODE_RAID,\r
-  PCH_SATA_MODE_MAX\r
-} PCH_SATA_MODE;\r
-\r
-/**\r
-  Acquire the string associated with the Index from smbios structure and return it.\r
-  The caller is responsible for free the string buffer.\r
-\r
-  @param OptionalStrStart   The start position to search the string\r
-  @param Index              The index of the string to extract\r
-  @param String             The string that is extracted\r
-\r
-  @retval EFI_SUCCESS       The function returns EFI_SUCCESS always.\r
-\r
-**/\r
-EFI_STATUS\r
-GetOptionalStringByIndex (\r
-  IN      CHAR8                   *OptionalStrStart,\r
-  IN      UINT8                   Index,\r
-  OUT     CHAR16                  **String\r
-  )\r
-{\r
-  UINTN          StrSize;\r
-\r
-  if (Index == 0) {\r
-    *String = AllocateZeroPool (sizeof (CHAR16));\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  StrSize = 0;\r
-  do {\r
-    Index--;\r
-    OptionalStrStart += StrSize;\r
-    StrSize           = AsciiStrSize (OptionalStrStart);\r
-  } while (OptionalStrStart[StrSize] != 0 && Index != 0);\r
-\r
-  if ((Index != 0) || (StrSize == 1)) {\r
-    //\r
-    // Meet the end of strings set but Index is non-zero, or\r
-    // Find an empty string\r
-    //\r
-    return EFI_NOT_FOUND;\r
-  } else {\r
-    *String = AllocatePool (StrSize * sizeof (CHAR16));\r
-    AsciiStrToUnicodeStr (OptionalStrStart, *String);\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  VSPrint worker function that prints a Value as a decimal number in Buffer\r
-\r
-  @param Buffer  Location to place ascii decimal number string of Value.\r
-  @param Value   Decimal value to convert to a string in Buffer.\r
-  @param Flags   Flags to use in printing decimal string, see file header for details.\r
-  @param Width   Width of hex value.\r
-\r
-  Number of characters printed.\r
-\r
-**/\r
-UINTN\r
-EfiValueToString (\r
-  IN  OUT CHAR16  *Buffer,\r
-  IN  INT64       Value,\r
-  IN  UINTN       Flags,\r
-  IN  UINTN       Width\r
-  )\r
-{\r
-  CHAR16    TempBuffer[CHARACTER_NUMBER_FOR_VALUE];\r
-  CHAR16    *TempStr;\r
-  CHAR16    *BufferPtr;\r
-  UINTN     Count;\r
-  UINTN     ValueCharNum;\r
-  UINTN     Remainder;\r
-  CHAR16    Prefix;\r
-  UINTN     Index;\r
-  BOOLEAN   ValueIsNegative;\r
-  UINT64    TempValue;\r
-\r
-  TempStr         = TempBuffer;\r
-  BufferPtr       = Buffer;\r
-  Count           = 0;\r
-  ValueCharNum    = 0;\r
-  ValueIsNegative = FALSE;\r
-\r
-  if (Width > CHARACTER_NUMBER_FOR_VALUE - 1) {\r
-    Width = CHARACTER_NUMBER_FOR_VALUE - 1;\r
-  }\r
-\r
-  if (Value < 0) {\r
-    Value           = -Value;\r
-    ValueIsNegative = TRUE;\r
-  }\r
-\r
-  do {\r
-    TempValue = Value;\r
-    Value = (INT64)DivU64x32 ((UINT64)Value, 10);\r
-    Remainder = (UINTN)((UINT64)TempValue - 10 * Value);\r
-    *(TempStr++) = (CHAR16)(Remainder + '0');\r
-    ValueCharNum++;\r
-    Count++;\r
-    if ((Flags & COMMA_TYPE) == COMMA_TYPE) {\r
-      if (ValueCharNum % 3 == 0 && Value != 0) {\r
-        *(TempStr++) = ',';\r
-        Count++;\r
-      }\r
-    }\r
-  } while (Value != 0);\r
-\r
-  if (ValueIsNegative) {\r
-    *(TempStr++)    = '-';\r
-    Count++;\r
-  }\r
-\r
-  if ((Flags & PREFIX_ZERO) && !ValueIsNegative) {\r
-    Prefix = '0';\r
-  } else {\r
-    Prefix = ' ';\r
-  }\r
-\r
-  Index = Count;\r
-  if (!(Flags & LEFT_JUSTIFY)) {\r
-    for (; Index < Width; Index++) {\r
-      *(TempStr++) = Prefix;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Reverse temp string into Buffer.\r
-  //\r
-  if (Width > 0 && (UINTN) (TempStr - TempBuffer) > Width) {\r
-    TempStr = TempBuffer + Width;\r
-  }\r
-  Index = 0;\r
-  while (TempStr != TempBuffer) {\r
-    *(BufferPtr++) = *(--TempStr);\r
-    Index++;\r
-  }\r
-\r
-  *BufferPtr = 0;\r
-  return Index;\r
-}\r
-\r
-static CHAR16 mHexStr[] = { L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7',\r
-                            L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F' };\r
-\r
-/**\r
-  VSPrint worker function that prints a Value as a hex number in Buffer\r
-\r
-  @param  Buffer  Location to place ascii hex string of Value.\r
-  @param  Value   Hex value to convert to a string in Buffer.\r
-  @param  Flags   Flags to use in printing Hex string, see file header for details.\r
-  @param  Width   Width of hex value.\r
-\r
-  @retval         Number of characters printed.\r
-\r
-**/\r
-UINTN\r
-EfiValueToHexStr (\r
-  IN  OUT CHAR16  *Buffer,\r
-  IN  UINT64      Value,\r
-  IN  UINTN       Flags,\r
-  IN  UINTN       Width\r
-  )\r
-{\r
-  CHAR16  TempBuffer[CHARACTER_NUMBER_FOR_VALUE];\r
-  CHAR16  *TempStr;\r
-  CHAR16  Prefix;\r
-  CHAR16  *BufferPtr;\r
-  UINTN   Count;\r
-  UINTN   Index;\r
-\r
-  TempStr   = TempBuffer;\r
-  BufferPtr = Buffer;\r
-\r
-  //\r
-  // Count starts at one since we will null terminate. Each iteration of the\r
-  // loop picks off one nibble. Oh yea TempStr ends up backwards\r
-  //\r
-  Count = 0;\r
-\r
-  if (Width > CHARACTER_NUMBER_FOR_VALUE - 1) {\r
-    Width = CHARACTER_NUMBER_FOR_VALUE - 1;\r
-  }\r
-\r
-  do {\r
-    Index = ((UINTN)Value & 0xf);\r
-    *(TempStr++) = mHexStr[Index];\r
-    Value = RShiftU64 (Value, 4);\r
-    Count++;\r
-  } while (Value != 0);\r
-\r
-  if (Flags & PREFIX_ZERO) {\r
-    Prefix = '0';\r
-  } else {\r
-    Prefix = ' ';\r
-  }\r
-\r
-  Index = Count;\r
-  if (!(Flags & LEFT_JUSTIFY)) {\r
-    for (; Index < Width; Index++) {\r
-      *(TempStr++) = Prefix;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Reverse temp string into Buffer.\r
-  //\r
-  if (Width > 0 && (UINTN) (TempStr - TempBuffer) > Width) {\r
-    TempStr = TempBuffer + Width;\r
-  }\r
-  Index = 0;\r
-  while (TempStr != TempBuffer) {\r
-    *(BufferPtr++) = *(--TempStr);\r
-    Index++;\r
-  }\r
-\r
-  *BufferPtr = 0;\r
-  return Index;\r
-}\r
-\r
-/*++\r
-  Converts MAC address to Unicode string.\r
-  The value is 64-bit and the resulting string will be 12\r
-  digit hex number in pairs of digits separated by dashes.\r
-\r
-  @param  String    string that will contain the value\r
-  @param  MacAddr   add argument and description to function comment\r
-  @param  AddrSize  add argument and description to function comment\r
-\r
-**/\r
-CHAR16 *\r
-StrMacToString (\r
-  OUT CHAR16              *String,\r
-  IN  EFI_MAC_ADDRESS     *MacAddr,\r
-  IN  UINT32              AddrSize\r
-  )\r
-{\r
-  UINT32  i;\r
-\r
-  for (i = 0; i < AddrSize; i++) {\r
-\r
-    EfiValueToHexStr (\r
-      &String[2 * i],\r
-      MacAddr->Addr[i] & 0xFF,\r
-      PREFIX_ZERO,\r
-      2\r
-      );\r
-  }\r
-\r
-  //\r
-  // Terminate the string.\r
-  //\r
-  String[2 * AddrSize] = L'\0';\r
-\r
-  return String;\r
-}\r
-\r
-VOID UpdateLatestBootTime() {\r
-  UINTN                         VarSize;\r
-  EFI_STATUS                   Status;\r
-  UINT64                       TimeValue;\r
-  CHAR16                       Buffer[40];\r
-  if (mSystemConfiguration.LogBootTime != 1) {\r
-    return;\r
-  }\r
-  VarSize = sizeof(TimeValue);\r
-  Status = gRT->GetVariable(\r
-                  BOOT_TIME_NAME,\r
-                  &gEfiNormalSetupGuid,\r
-                  NULL,\r
-                  &VarSize,\r
-                  &TimeValue\r
-                                         );\r
-  if (EFI_ERROR(Status)) {\r
-    return;\r
-  }\r
-  UnicodeSPrint (Buffer, sizeof (Buffer), L"%d ms", (UINT32)TimeValue);\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_LOG_BOOT_TIME_VALUE), Buffer, NULL);\r
-}\r
-\r
-/**\r
-  Get Cache Type for the specified Cache. This function is invoked when there is data records\r
-  available in the Data Hub.\r
-\r
-  Get Cache Type function arguments:\r
-\r
-  @param  Instance        The instance number of the subclass with the same ProducerName..\r
-  @param  SubInstance     The instance number of the RecordType for the same Instance.\r
-  @param  CacheType       Cache type, see definition of EFI_CACHE_TYPE_DATA.\r
-\r
-  @retval EFI_STATUS\r
-\r
-**/\r
-EFI_STATUS\r
-GetCacheType(\r
-  IN  UINT16                            Instance,\r
-  IN  UINT16                            SubInstance,\r
-  IN  EFI_CACHE_TYPE_DATA*              CacheType)\r
-{\r
-  EFI_STATUS                  Status;\r
-  EFI_DATA_HUB_PROTOCOL       *DataHub;\r
-  EFI_DATA_RECORD_HEADER      *Record;\r
-  UINT64                      MonotonicCount;\r
-  EFI_CACHE_VARIABLE_RECORD*  CacheVariableRecord;\r
-  EFI_SUBCLASS_TYPE1_HEADER   *DataHeader;\r
-\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiDataHubProtocolGuid,\r
-                  NULL,\r
-                  (void **)&DataHub\r
-                  );\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-  //\r
-  // Get all available data records from data hub\r
-  //\r
-  MonotonicCount = 0;\r
-  Record = NULL;\r
-\r
-  do {\r
-    Status = DataHub->GetNextRecord (\r
-                           DataHub,\r
-                                               &MonotonicCount,\r
-                                               NULL,\r
-                                               &Record\r
-                                               );\r
-    if (!EFI_ERROR(Status)) {\r
-      if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {\r
-        DataHeader  = (EFI_SUBCLASS_TYPE1_HEADER *)(Record + 1);\r
-\r
-        if(CompareGuid(&Record->DataRecordGuid, &gEfiCacheSubClassGuid) &&\r
-          (DataHeader->RecordType == CacheTypeRecordType) &&\r
-          (DataHeader->Instance == Instance) &&\r
-          (DataHeader->SubInstance == SubInstance)) {\r
-          CacheVariableRecord     = (EFI_CACHE_VARIABLE_RECORD  *)(DataHeader + 1);\r
-          if(CacheType){\r
-            *CacheType = CacheVariableRecord->CacheType;\r
-            return EFI_SUCCESS;\r
-          }\r
-        }\r
-      }\r
-    }\r
-  } while(!EFI_ERROR(Status) && (MonotonicCount != 0));\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
-  Setup data filter function. This function is invoked when there is data records\r
-  available in the Data Hub.\r
-\r
-\r
-  Standard event notification function arguments:\r
-  @param Event          The event that is signaled.\r
-  @param Context        Not used here.\r
-\r
-  @retval EFI_STATUS\r
-\r
-**/\r
-VOID\r
-PrepareSetupInformation (\r
-  )\r
-{\r
-\r
-  EFI_STATUS                  Status;\r
-  EFI_DATA_HUB_PROTOCOL       *DataHub;\r
-  EFI_DATA_RECORD_HEADER      *Record;\r
-  UINT8                       *SrcData;\r
-  EFI_SUBCLASS_TYPE1_HEADER   *DataHeader;\r
-  CHAR16                      *NewString;\r
-  CHAR16                      *NewString2;\r
-  CHAR16                      *NewStringToken;\r
-  STRING_REF                  TokenToUpdate;\r
-  EFI_PROCESSOR_VERSION_DATA  *ProcessorVersion;\r
-  UINTN                       Index;\r
-  UINTN                       DataOutput;\r
-\r
-  EFI_PROCESSOR_MICROCODE_REVISION_DATA   *CpuUcodeRevisionData;\r
-  EFI_MEMORY_ARRAY_START_ADDRESS          *MemoryArray;\r
-  EFI_MEMORY_ARRAY_LINK                   *MemoryArrayLink;\r
-  UINT64                      MonotonicCount;\r
-\r
-  CHAR16                      Version[100];         //Assuming that strings are < 100 UCHAR\r
-  CHAR16                      ReleaseDate[100];     //Assuming that strings are < 100 UCHAR\r
-  CHAR16                      ReleaseTime[100];     //Assuming that strings are < 100 UCHAR\r
-\r
-  NewString = AllocateZeroPool (0x100);\r
-  NewString2 = AllocateZeroPool (0x100);\r
-  SetMem(Version, sizeof(Version), 0);\r
-  SetMem(ReleaseDate, sizeof(ReleaseDate), 0);\r
-  SetMem(ReleaseTime, sizeof(ReleaseTime), 0);\r
-\r
-  //\r
-  // Get the Data Hub Protocol. Assume only one instance\r
-  //\r
-  Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (void **)&DataHub);\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-  //\r
-  // Get all available data records from data hub\r
-  //\r
-  MonotonicCount = 0;\r
-  Record = NULL;\r
-\r
-  do {\r
-    Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);\r
-    if (!EFI_ERROR(Status)) {\r
-      if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {\r
-        DataHeader  = (EFI_SUBCLASS_TYPE1_HEADER *)(Record + 1);\r
-        SrcData     = (UINT8  *)(DataHeader + 1);\r
-\r
-        //\r
-        // Processor\r
-        //\r
-        if (CompareGuid(&Record->DataRecordGuid, &gEfiProcessorSubClassGuid)) {\r
-          CopyMem (&mProcessorProducerGuid, &Record->ProducerName, sizeof(EFI_GUID));\r
-          switch (DataHeader->RecordType) {\r
-            case ProcessorCoreFrequencyRecordType:\r
-              CopyMem(&mProcessorFrequency, SrcData, sizeof(EFI_EXP_BASE10_DATA));\r
-              Index = EfiValueToString (\r
-                                   NewString,\r
-                                               ConvertBase10ToRaw ((EFI_EXP_BASE10_DATA *)SrcData)/1000000000,\r
-                                               PREFIX_ZERO,\r
-                                               0\r
-                                               );\r
-              StrCat (NewString, L".");\r
-              EfiValueToString (\r
-                           NewString + Index + 1,\r
-                               ((ConvertBase10ToRaw ((EFI_EXP_BASE10_DATA *)SrcData)%1000000000)/10000000),\r
-                               PREFIX_ZERO,\r
-                               0\r
-                               );\r
-              StrCat (NewString, L" GHz");\r
-              TokenToUpdate = (STRING_REF)STR_PROCESSOR_SPEED_VALUE;\r
-              HiiSetString(mHiiHandle, TokenToUpdate, NewString, NULL);\r
-              break;\r
-\r
-            case ProcessorVersionRecordType:\r
-              ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *)SrcData;\r
-              NewStringToken = HiiGetPackageString(&mProcessorProducerGuid, *ProcessorVersion, NULL);\r
-              TokenToUpdate = (STRING_REF)STR_PROCESSOR_VERSION_VALUE;\r
-              HiiSetString(mHiiHandle, TokenToUpdate, NewStringToken, NULL);\r
-              break;\r
-            case CpuUcodeRevisionDataRecordType:\r
-              CpuUcodeRevisionData = (EFI_PROCESSOR_MICROCODE_REVISION_DATA *) SrcData;\r
-              if (CpuUcodeRevisionData->ProcessorMicrocodeRevisionNumber != 0) {\r
-                EfiValueToHexStr (\r
-                                 NewString,\r
-                  CpuUcodeRevisionData->ProcessorMicrocodeRevisionNumber,\r
-                  PREFIX_ZERO,\r
-                  8\r
-                                 );\r
-                TokenToUpdate = (STRING_REF)STR_PROCESSOR_MICROCODE_VALUE;\r
-                HiiSetString(mHiiHandle, TokenToUpdate, NewString, NULL);\r
-              }\r
-              break;\r
-            default:\r
-              break;\r
-          }\r
-\r
-        //\r
-        // Cache\r
-        //\r
-        } else if (CompareGuid(&Record->DataRecordGuid, &gEfiCacheSubClassGuid) &&\r
-                   (DataHeader->RecordType == CacheSizeRecordType)) {\r
-          if (DataHeader->SubInstance == EFI_CACHE_L1) {\r
-            EFI_CACHE_TYPE_DATA              CacheType;\r
-            if (EFI_SUCCESS == GetCacheType(DataHeader->Instance, DataHeader->SubInstance,&CacheType)){\r
-              if (CacheType == EfiCacheTypeData) {\r
-                TokenToUpdate = (STRING_REF)STR_PROCESSOR_L1_DATA_CACHE_VALUE;\r
-              } else if (CacheType == EfiCacheTypeInstruction) {\r
-                  TokenToUpdate = (STRING_REF)STR_PROCESSOR_L1_INSTR_CACHE_VALUE;\r
-              } else {\r
-                continue;\r
-              }\r
-            } else {\r
-              continue;\r
-            }\r
-          }\r
-          else if (DataHeader->SubInstance == EFI_CACHE_L2) {\r
-            TokenToUpdate = (STRING_REF)STR_PROCESSOR_L2_CACHE_VALUE;\r
-          } else {\r
-            continue;\r
-          }\r
-          if (ConvertBase2ToRaw((EFI_EXP_BASE2_DATA *)SrcData)) {\r
-            DataOutput = ConvertBase2ToRaw((EFI_EXP_BASE2_DATA *)SrcData) >> 10;\r
-            EfiValueToString (NewString, DataOutput, PREFIX_ZERO, 0);\r
-\r
-            StrCat (NewString, L" KB");\r
-            if (DataHeader->SubInstance == EFI_CACHE_L3) {\r
-              HiiSetString(mHiiHandle, TokenToUpdate, NewString, NULL);\r
-            } else if(DataHeader->SubInstance == EFI_CACHE_L2 && mPlatformCpuInfo.CpuPackage.CoresPerPhysicalPackage > 1){\r
-                         //\r
-              // Show XxL2 string\r
-                         //\r
-              EfiValueToString (\r
-                           NewString2,\r
-                mPlatformCpuInfo.CpuPackage.CoresPerPhysicalPackage,\r
-                PREFIX_ZERO,\r
-                0\r
-                               );\r
-              StrCat(NewString2, L"x ");\r
-              StrCat(NewString2, NewString);\r
-              HiiSetString(mHiiHandle, TokenToUpdate, NewString2, NULL);\r
-            } else {\r
-              HiiSetString(mHiiHandle, TokenToUpdate, NewString, NULL);\r
-            }\r
-          }\r
-\r
-        //\r
-        // Memory\r
-        //\r
-        } else if (CompareGuid(&Record->DataRecordGuid, &gEfiMemorySubClassGuid)) {\r
-          switch (DataHeader->RecordType) {\r
-            case EFI_MEMORY_ARRAY_LINK_RECORD_NUMBER:\r
-              MemoryArrayLink = (EFI_MEMORY_ARRAY_LINK *)SrcData;\r
-\r
-              if (MemoryArrayLink->MemorySpeed > 0) {\r
-                //\r
-                // Save the lowest speed memory module\r
-                //\r
-                if (MemoryArrayLink->MemorySpeed < mMemorySpeed) {\r
-                  mMemorySpeed = MemoryArrayLink->MemorySpeed;\r
-                }\r
-                switch (DataHeader->SubInstance) {\r
-                  case 1:\r
-                    mMemorySpeedChannelASlot0 = MemoryArrayLink->MemorySpeed;\r
-                    mMemorySizeChannelASlot0 = MemoryArrayLink->MemoryDeviceSize;\r
-                    break;\r
-                  case 2:\r
-                    mMemorySpeedChannelASlot1 = MemoryArrayLink->MemorySpeed;\r
-                    mMemorySizeChannelASlot1 = MemoryArrayLink->MemoryDeviceSize;\r
-                    break;\r
-                  case 3:\r
-                    mMemorySpeedChannelBSlot0 = MemoryArrayLink->MemorySpeed;\r
-                    mMemorySizeChannelBSlot0 = MemoryArrayLink->MemoryDeviceSize;\r
-                    break;\r
-                  case 4:\r
-                    mMemorySpeedChannelBSlot1 = MemoryArrayLink->MemorySpeed;\r
-                    mMemorySizeChannelBSlot1 = MemoryArrayLink->MemoryDeviceSize;\r
-                    break;\r
-                  case 5:\r
-                    mMemorySpeedChannelCSlot0 = MemoryArrayLink->MemorySpeed;\r
-                    mMemorySizeChannelCSlot0 = MemoryArrayLink->MemoryDeviceSize;\r
-                    break;\r
-                  case 6:\r
-                    mMemorySpeedChannelCSlot1 = MemoryArrayLink->MemorySpeed;\r
-                    mMemorySizeChannelCSlot1 = MemoryArrayLink->MemoryDeviceSize;\r
-                    break;\r
-                  default:\r
-                    break;\r
-                  }\r
-              }\r
-              break;\r
-\r
-            case EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER:\r
-              MemoryArray = (EFI_MEMORY_ARRAY_START_ADDRESS *)SrcData;\r
-              if (MemoryArray->MemoryArrayEndAddress - MemoryArray->MemoryArrayStartAddress) {\r
-               DataOutput = (UINTN)RShiftU64((MemoryArray->MemoryArrayEndAddress - MemoryArray->MemoryArrayStartAddress + 1), 20);\r
-               EfiValueToString (NewString, DataOutput / 1024, PREFIX_ZERO, 0);\r
-               if(DataOutput % 1024) {\r
-                 StrCat (NewString, L".");\r
-                 DataOutput = ((DataOutput % 1024) * 1000) / 1024;\r
-                 while(!(DataOutput % 10))\r
-                   DataOutput = DataOutput / 10;\r
-                  EfiValueToString (NewString2, DataOutput, PREFIX_ZERO, 0);\r
-                  StrCat (NewString, NewString2);\r
-                }\r
-                StrCat (NewString, L" GB");\r
-                TokenToUpdate = (STRING_REF)STR_TOTAL_MEMORY_SIZE_VALUE;\r
-                HiiSetString(mHiiHandle, TokenToUpdate, NewString, NULL);\r
-              }\r
-              break;\r
-\r
-            default:\r
-              break;\r
-          }\r
-        }\r
-      }\r
-    }\r
-  } while (!EFI_ERROR(Status) && (MonotonicCount != 0));\r
-\r
-  Status = GetBiosVersionDateTime (\r
-             Version,\r
-                        ReleaseDate,\r
-                        ReleaseTime\r
-                        );\r
-\r
-  DEBUG ((EFI_D_ERROR, "GetBiosVersionDateTime :%s %s %s \n", Version, ReleaseDate, ReleaseTime));\r
-  if (!EFI_ERROR (Status)) {\r
-    UINTN         Length = 0;\r
-    CHAR16        *BuildDateTime;\r
-\r
-    Length = StrLen(ReleaseDate) + StrLen(ReleaseTime);\r
-\r
-    BuildDateTime = AllocateZeroPool ((Length+2) * sizeof(CHAR16));\r
-    StrCpy (BuildDateTime, ReleaseDate);\r
-    StrCat (BuildDateTime, L" ");\r
-    StrCat (BuildDateTime, ReleaseTime);\r
-\r
-    TokenToUpdate = (STRING_REF)STR_BIOS_VERSION_VALUE;\r
-    DEBUG ((EFI_D_ERROR, "update STR_BIOS_VERSION_VALUE\n"));\r
-    HiiSetString(mHiiHandle, TokenToUpdate, Version, NULL);\r
-\r
-    TokenToUpdate = (STRING_REF)STR_BIOS_BUILD_TIME_VALUE;\r
-    DEBUG ((EFI_D_ERROR, "update STR_BIOS_BUILD_TIME_VALUE\n"));\r
-    HiiSetString(mHiiHandle, TokenToUpdate, BuildDateTime, NULL);\r
-  }\r
-\r
-  //\r
-  // Calculate and update memory speed display in Main Page\r
-  //\r
-  //\r
-  // Update the overall memory speed\r
-  //\r
-  if (mMemorySpeed != 0xffff) {\r
-    EfiValueToString (NewString, mMemorySpeed, PREFIX_ZERO, 0);\r
-    StrCat (NewString, L" MHz");\r
-\r
-    TokenToUpdate = (STRING_REF)STR_SYSTEM_MEMORY_SPEED_VALUE;\r
-    HiiSetString(mHiiHandle, TokenToUpdate, NewString, NULL);\r
-  }\r
-\r
-  gBS->FreePool(NewString);\r
-  gBS->FreePool(NewString2);\r
-\r
-  return;\r
-}\r
-\r
-/**\r
-\r
-  Routine Description: update the SETUP info for "Additional Information" which is SMBIOS info.\r
-\r
-  @retval EFI_STATUS\r
-\r
-**/\r
-EFI_STATUS\r
-UpdateAdditionalInformation (\r
-  )\r
-{\r
-  EFI_STATUS                      Status;\r
-  UINT64                          MonotonicCount;\r
-  EFI_DATA_HUB_PROTOCOL           *DataHub;\r
-  EFI_DATA_RECORD_HEADER          *Record;\r
-  EFI_SUBCLASS_TYPE1_HEADER       *DataHeader;\r
-  EFI_SMBIOS_PROTOCOL             *Smbios;\r
-  EFI_SMBIOS_HANDLE               SmbiosHandle;\r
-  EFI_SMBIOS_TABLE_HEADER         *SmbiosRecord;\r
-  SMBIOS_TABLE_TYPE0              *Type0Record;\r
-  UINT8                           StrIndex;\r
-  CHAR16                          *BiosVersion = NULL;\r
-  CHAR16                          *IfwiVersion = NULL;\r
-  UINT16                          SearchIndex;\r
-  EFI_STRING_ID                   TokenToUpdate;\r
-#if defined( RVP_SUPPORT ) && RVP_SUPPORT\r
-  EFI_MISC_SYSTEM_MANUFACTURER    *SystemManufacturer;\r
-#endif\r
-\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiDataHubProtocolGuid,\r
-                  NULL,\r
-                  (void **)&DataHub\r
-                  );\r
-\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-  MonotonicCount  = 0;\r
-  Record = NULL;\r
-  do {\r
-    Status = DataHub->GetNextRecord (\r
-                        DataHub,\r
-                        &MonotonicCount,\r
-                        NULL,\r
-                        &Record\r
-                        );\r
-    if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {\r
-      DataHeader  = (EFI_SUBCLASS_TYPE1_HEADER *)(Record + 1);\r
-\r
-      if (CompareGuid(&Record->DataRecordGuid, &gEfiMiscSubClassGuid) &&\r
-          (DataHeader->RecordType == EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER)) {\r
-#if defined( RVP_SUPPORT ) && RVP_SUPPORT\r
-        //\r
-        // System Information\r
-        //\r
-        SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER *)(DataHeader + 1);\r
-\r
-        //\r
-        // UUID  (System Information)\r
-        //\r
-        SMBIOSString = EfiLibAllocateZeroPool (0x100);\r
-        GuidToString ( &SystemManufacturer->SystemUuid, SMBIOSString, 0x00 );\r
-\r
-        TokenToUpdate = (STRING_REF)STR_SYSTEM_UUID_VALUE;\r
-        HiiSetString(mHiiHandle, TokenToUpdate, SMBIOSString, NULL);\r
-\r
-        gBS->FreePool(SMBIOSString);\r
-#endif\r
-      }\r
-    }\r
-  } while (!EFI_ERROR(Status) && (MonotonicCount != 0));\r
-\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiSmbiosProtocolGuid,\r
-                  NULL,\r
-                  (VOID **) &Smbios\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
-  do {\r
-    Status = Smbios->GetNext (\r
-                       Smbios,\r
-                       &SmbiosHandle,\r
-                       NULL,\r
-                       &SmbiosRecord,\r
-                       NULL\r
-                       );\r
-    if (SmbiosRecord->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) {\r
-      Type0Record = (SMBIOS_TABLE_TYPE0 *) SmbiosRecord;\r
-      StrIndex = Type0Record->BiosVersion;\r
-      GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &BiosVersion);\r
-      TokenToUpdate = STRING_TOKEN (STR_BIOS_VERSION_VALUE);\r
-      for (SearchIndex = 0x0; SearchIndex < SMBIOS_STRING_MAX_LENGTH; SearchIndex++) {\r
-        if (BiosVersion[SearchIndex] == 0x0020) {\r
-          BiosVersion[SearchIndex] = 0x0000;\r
-          IfwiVersion = (CHAR16 *)(&BiosVersion[SearchIndex+1]);\r
-          break;\r
-        } else if (BiosVersion[SearchIndex] == 0x0000) {\r
-          break;\r
-        }\r
-      }\r
-      HiiSetString (mHiiHandle, TokenToUpdate, BiosVersion, NULL);\r
-\r
-      //\r
-      // Check IfwiVersion, to avoid no IFWI version in SMBIOS Type 0 strucntion\r
-      //\r
-      if(IfwiVersion) {\r
-        TokenToUpdate = STRING_TOKEN (STR_IFWI_VERSION_VALUE);\r
-        HiiSetString (mHiiHandle, TokenToUpdate, IfwiVersion, NULL);\r
-      }\r
-    }\r
-  } while (!EFI_ERROR(Status));\r
-\r
-  UpdateLatestBootTime();\r
-\r
-  return  EFI_SUCCESS;\r
-}\r
-\r
-VOID\r
-UpdateCPUInformation ()\r
-{\r
-  CHAR16                                                               Buffer[40];\r
-  UINT16                                FamilyId;\r
-  UINT8                                 Model;\r
-  UINT8                                 SteppingId;\r
-  UINT8                                 ProcessorType;\r
-  EFI_STATUS                            Status;\r
-  EFI_MP_SERVICES_PROTOCOL              *MpService;\r
-  UINTN                                 MaximumNumberOfCPUs;\r
-  UINTN                                 NumberOfEnabledCPUs;\r
-  UINT32                                                               Buffer32 = 0xFFFFFFFF;   // Keep buffer with unknown device\r
-\r
-  EfiCpuVersion (&FamilyId, &Model, &SteppingId, &ProcessorType);\r
-\r
-  //\r
-  //we need raw Model data\r
-  //\r
-  Model = Model & 0xf;\r
-\r
-  //\r
-  //Family/Model/Step\r
-  //\r
-  UnicodeSPrint (Buffer, sizeof (Buffer), L"%d/%d/%d", FamilyId,  Model, SteppingId);\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_PROCESSOR_ID_VALUE), Buffer, NULL);\r
-\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiMpServiceProtocolGuid,\r
-                  NULL,\r
-                  (void **)&MpService\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-    //\r
-    // Determine the number of processors\r
-    //\r
-    MpService->GetNumberOfProcessors (\r
-                 MpService,\r
-                 &MaximumNumberOfCPUs,\r
-                 &NumberOfEnabledCPUs\r
-                 );\r
-    UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", MaximumNumberOfCPUs);\r
-    HiiSetString(mHiiHandle,STRING_TOKEN(STR_PROCESSOR_CORE_VALUE), Buffer, NULL);\r
-  }\r
-  //\r
-  // Update Mobile / Desktop / Tablet SKU\r
-  //\r
-  Buffer32 =(UINT32) RShiftU64 (EfiReadMsr (MSR_IA32_PLATFORM_ID), 50) & 0x07;\r
-\r
-  switch(Buffer32){\r
-      case 0x0:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"(%d) - ISG SKU SOC", Buffer32);\r
-        break;\r
-      case 0x01:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"(%d) - Mobile SKU SOC", Buffer32);\r
-        break;\r
-      case 0x02:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"(%d) - Desktop SKU SOC", Buffer32);\r
-        break;\r
-      case 0x03:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"(%d) - Mobile SKU SOC", Buffer32);\r
-        break;\r
-      default:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"(%d) - Unknown SKU SOC", Buffer32);\r
-        break;\r
-    }\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_PROCESSOR_SKU_VALUE), Buffer, NULL);\r
-\r
-}\r
-\r
-\r
-EFI_STATUS\r
-SearchChildHandle(\r
-  EFI_HANDLE Father,\r
-  EFI_HANDLE *Child\r
-  )\r
-{\r
-  EFI_STATUS                                                 Status;\r
-  UINTN                                                          HandleIndex;\r
-  EFI_GUID                                                     **ProtocolGuidArray = NULL;\r
-  UINTN                                                          ArrayCount;\r
-  UINTN                                                          ProtocolIndex;\r
-  UINTN                                                          OpenInfoCount;\r
-  UINTN                                                          OpenInfoIndex;\r
-  EFI_OPEN_PROTOCOL_INFORMATION_ENTRY  *OpenInfo = NULL;\r
-  UINTN                                                          mHandleCount;\r
-  EFI_HANDLE                                                 *mHandleBuffer= NULL;\r
-\r
-  //\r
-  // Retrieve the list of all handles from the handle database\r
-  //\r
-  Status = gBS->LocateHandleBuffer (\r
-                  AllHandles,\r
-                  NULL,\r
-                  NULL,\r
-                  &mHandleCount,\r
-                  &mHandleBuffer\r
-                  );\r
-\r
-  for (HandleIndex = 0; HandleIndex < mHandleCount; HandleIndex++)\r
-  {\r
-    //\r
-    // Retrieve the list of all the protocols on each handle\r
-    //\r
-    Status = gBS->ProtocolsPerHandle (\r
-                    mHandleBuffer[HandleIndex],\r
-                    &ProtocolGuidArray,\r
-                    &ArrayCount\r
-                    );\r
-    if (!EFI_ERROR (Status))\r
-    {\r
-      for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++)\r
-      {\r
-        Status = gBS->OpenProtocolInformation (\r
-                        mHandleBuffer[HandleIndex],\r
-                        ProtocolGuidArray[ProtocolIndex],\r
-                        &OpenInfo,\r
-                        &OpenInfoCount\r
-                        );\r
-        if (!EFI_ERROR (Status))\r
-        {\r
-          for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++)\r
-          {\r
-            if(OpenInfo[OpenInfoIndex].AgentHandle == Father)\r
-            {\r
-              if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER)\r
-              {\r
-                *Child = mHandleBuffer[HandleIndex];\r
-                 Status = EFI_SUCCESS;\r
-                 goto TryReturn;\r
-              }\r
-            }\r
-          }\r
-          Status = EFI_NOT_FOUND;\r
-        }\r
-      }\r
-      if(OpenInfo != NULL)\r
-      {\r
-        FreePool(OpenInfo);\r
-        OpenInfo = NULL;\r
-      }\r
-    }\r
-    FreePool (ProtocolGuidArray);\r
-    ProtocolGuidArray = NULL;\r
-  }\r
-TryReturn:\r
-  if(OpenInfo != NULL)\r
-  {\r
-    FreePool (OpenInfo);\r
-    OpenInfo = NULL;\r
-  }\r
-  if(ProtocolGuidArray != NULL)\r
-  {\r
-    FreePool(ProtocolGuidArray);\r
-    ProtocolGuidArray = NULL;\r
-  }\r
-  if(mHandleBuffer != NULL)\r
-  {\r
-    FreePool (mHandleBuffer);\r
-    mHandleBuffer = NULL;\r
-  }\r
-  return Status;\r
-}\r
-\r
-EFI_STATUS\r
-JudgeHandleIsPCIDevice(\r
-  EFI_HANDLE    Handle,\r
-  UINT8            Device,\r
-  UINT8            Funs\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-  EFI_DEVICE_PATH   *DPath;\r
-\r
-  Status = gBS->HandleProtocol (\r
-                  Handle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &DPath\r
-                  );\r
-  if(!EFI_ERROR(Status))\r
-  {\r
-    while(!IsDevicePathEnd(DPath))\r
-    {\r
-      if((DPath->Type == HARDWARE_DEVICE_PATH) && (DPath->SubType == HW_PCI_DP))\r
-      {\r
-        PCI_DEVICE_PATH   *PCIPath;\r
-\r
-        PCIPath = (PCI_DEVICE_PATH*) DPath;\r
-        DPath = NextDevicePathNode(DPath);\r
-        if(IsDevicePathEnd(DPath) && (PCIPath->Device == Device) && (PCIPath->Function == Funs))\r
-        {\r
-          return EFI_SUCCESS;\r
-        }\r
-      }\r
-      else\r
-      {\r
-        DPath = NextDevicePathNode(DPath);\r
-      }\r
-    }\r
-  }\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-GetDriverName(\r
-  EFI_HANDLE   Handle,\r
-  CHAR16         *Name\r
-  )\r
-{\r
-  EFI_DRIVER_BINDING_PROTOCOL        *BindHandle = NULL;\r
-  EFI_STATUS                                        Status;\r
-  UINT32                                               Version;\r
-  UINT16                                               *Ptr;\r
-  Status = gBS->OpenProtocol(\r
-                  Handle,\r
-                  &gEfiDriverBindingProtocolGuid,\r
-                  (VOID**)&BindHandle,\r
-                  NULL,\r
-                  NULL,\r
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
-                  );\r
-\r
-  if (EFI_ERROR(Status))\r
-  {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-\r
-  Version = BindHandle->Version;\r
-  Ptr = (UINT16*)&Version;\r
-  UnicodeSPrint(Name, 40, L"%d.%d.%d", Version >> 24 , (Version >>16)& 0x0f ,*(Ptr));\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-GetGOPDriverName(\r
-  CHAR16 *Name\r
-  )\r
-{\r
-  UINTN                         HandleCount;\r
-  EFI_HANDLE                *Handles= NULL;\r
-  UINTN                         Index;\r
-  EFI_STATUS                Status;\r
-  EFI_HANDLE                Child = 0;\r
-\r
-  Status = gBS->LocateHandleBuffer(\r
-                             ByProtocol,\r
-                             &gEfiDriverBindingProtocolGuid,\r
-                             NULL,\r
-                             &HandleCount,\r
-                             &Handles\r
-                  );\r
-  for (Index = 0; Index < HandleCount ; Index++)\r
-  {\r
-    Status = SearchChildHandle(Handles[Index], &Child);\r
-    if(!EFI_ERROR(Status))\r
-    {\r
-      Status = JudgeHandleIsPCIDevice(\r
-                 Child,\r
-                 0x02,\r
-                 0x00\r
-                 );\r
-      if(!EFI_ERROR(Status))\r
-      {\r
-        return GetDriverName(Handles[Index], Name);\r
-      }\r
-    }\r
-  }\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-UpdatePlatformInformation (\r
-  )\r
-{\r
-  UINT32                   MicroCodeVersion;\r
-  CHAR16                   Buffer[40];\r
-  UINT8                    IgdVBIOSRevH;\r
-  UINT8                    IgdVBIOSRevL;\r
-  UINT16                   EDX;\r
-  EFI_IA32_REGISTER_SET    RegSet;\r
-  EFI_LEGACY_BIOS_PROTOCOL *LegacyBios = NULL;\r
-  EFI_STATUS               Status;\r
-  UINT8                    CpuFlavor=0;\r
-  EFI_PEI_HOB_POINTERS     GuidHob;\r
-  UINTN                    NumHandles;\r
-  EFI_HANDLE                        *HandleBuffer;\r
-  UINTN                             Index;\r
-  DXE_PCH_PLATFORM_POLICY_PROTOCOL  *PchPlatformPolicy;\r
-  UINTN                             PciD31F0RegBase;\r
-  UINT8                             count;\r
-  UINT8                             Data8;\r
-  UINT8                             PIDData8;\r
-\r
-  CHAR16                            Name[40];\r
-  UINT32                            MrcVersion;\r
-\r
-  //\r
-  // Get the HOB list.  If it is not present, then ASSERT.\r
-  //\r
-  GuidHob.Raw = GetHobList ();\r
-  if (GuidHob.Raw != NULL) {\r
-    if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) {\r
-      mPlatformInfo = GET_GUID_HOB_DATA (GuidHob.Guid);\r
-    }\r
-  }\r
-\r
-  //\r
-  //VBIOS version\r
-  //\r
-  Status = gBS->LocateProtocol(\r
-                  &gEfiLegacyBiosProtocolGuid,\r
-                  NULL,\r
-                  (void **)&LegacyBios\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-  RegSet.X.AX = 0x5f01;\r
-  Status = LegacyBios->Int86 (LegacyBios, 0x10, &RegSet);\r
-  ASSERT_EFI_ERROR(Status);\r
-\r
-  //\r
-  // simulate AMI int15 (ax=5f01) handler\r
-  // check NbInt15.asm in AMI code for asm edition\r
-  //\r
-  EDX = (UINT16)((RegSet.E.EBX >> 16) & 0xffff);\r
-  IgdVBIOSRevH = (UINT8)(((EDX & 0x0F00) >> 4) | (EDX & 0x000F));\r
-  IgdVBIOSRevL = (UINT8)(((RegSet.X.BX & 0x0F00) >> 4) | (RegSet.X.BX & 0x000F));\r
-\r
-  if (IgdVBIOSRevH==0 && IgdVBIOSRevL==0){\r
-    HiiSetString(mHiiHandle, STRING_TOKEN(STR_CHIP_IGD_VBIOS_REV_VALUE), L"N/A", NULL);\r
-  } else {\r
-    UnicodeSPrint (Buffer, sizeof (Buffer), L"%02X%02X", IgdVBIOSRevH,IgdVBIOSRevL);\r
-    HiiSetString(mHiiHandle, STRING_TOKEN(STR_CHIP_IGD_VBIOS_REV_VALUE), Buffer, NULL);\r
-    }\r
-  }\r
-\r
-  Status = GetGOPDriverName(Name);\r
-\r
-  if (!EFI_ERROR(Status))\r
-  {\r
-    HiiSetString(mHiiHandle, STRING_TOKEN(STR_GOP_VALUE), Name, NULL);\r
-  }\r
-\r
-\r
-  //\r
-  // CpuFlavor\r
-  // ISG-DC Tablet        000\r
-  // VLV-QC Tablet        001\r
-  // VLV-QC Desktop       010\r
-  // VLV-QC Notebook      011\r
-  //\r
-  CpuFlavor = RShiftU64 (EfiReadMsr (MSR_IA32_PLATFORM_ID), 50) & 0x07;\r
-\r
-  switch(CpuFlavor){\r
-    case 0x0:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-DC Tablet", CpuFlavor);\r
-      break;\r
-    case 0x01:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-QC Notebook", CpuFlavor);\r
-      break;\r
-    case 0x02:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-QC Desktop", CpuFlavor);\r
-      break;\r
-    case 0x03:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"VLV-QC Notebook", CpuFlavor);\r
-      break;\r
-    default:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%s (%01x)", L"Unknown CPU", CpuFlavor);\r
-      break;\r
-  }\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_CPU_FLAVOR_VALUE), Buffer, NULL);\r
-\r
-  if ( NULL != mPlatformInfo) {\r
-    //\r
-    //BoardId\r
-    //\r
-    switch(mPlatformInfo->BoardId){\r
-      case 0x2:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"BAY LAKE RVP(%02x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      case 0x4:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"BAY LAKE FFRD(%02x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      case 0x5:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"BAY ROCK RVP DDR3L (%02x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      case 0x20:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"BAYLEY BAY (%02x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      case 0x30:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"BAKER SPORT (%02x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      case 0x0:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"ALPINE VALLEY (%x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      case 0x3:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"BAY LAKE FFD8 (%x)", mPlatformInfo->BoardId);\r
-        break;\r
-\r
-      default:\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), L"Unknown BOARD (%02x)", mPlatformInfo->BoardId);\r
-        break;\r
-    }\r
-    HiiSetString(mHiiHandle,STRING_TOKEN(STR_BOARD_ID_VALUE), Buffer, NULL);\r
-\r
-\r
-    //\r
-    // Get Board FAB ID Info from protocol, update into the NVS area.\r
-    // bit0~bit3 are for Fab ID, 0x0F means unknow FAB.\r
-    //\r
-    if(mPlatformInfo->BoardRev == 0x0F) {\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%s", L"Unknown FAB");\r
-      HiiSetString(mHiiHandle,STRING_TOKEN(STR_FAB_ID_VALUE), Buffer, NULL);\r
-    } else {\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), L"%2x", mPlatformInfo->BoardRev);\r
-      HiiSetString(mHiiHandle,STRING_TOKEN(STR_FAB_ID_VALUE), Buffer, NULL);\r
-    }\r
-  }\r
-\r
-  //\r
-  //Update MRC Version\r
-  //\r
-  MrcVersion = 0x00000000;\r
-  MrcVersion &= 0xffff;\r
-  Index = EfiValueToString (Buffer, MrcVersion/100, PREFIX_ZERO, 0);\r
-  StrCat (Buffer, L".");\r
-  EfiValueToString (Buffer + Index + 1, (MrcVersion%100)/10, PREFIX_ZERO, 0);\r
-  EfiValueToString (Buffer + Index + 2, (MrcVersion%100)%10, PREFIX_ZERO, 0);\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_MRC_VERSION_VALUE), Buffer, NULL);\r
-\r
-  //\r
-  //Update Soc Version\r
-  //\r
-\r
-  //\r
-  // Retrieve all instances of PCH Platform Policy protocol\r
-  //\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  &gDxePchPlatformPolicyProtocolGuid,\r
-                  NULL,\r
-                  &NumHandles,\r
-                  &HandleBuffer\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-    //\r
-    // Find the matching PCH Policy protocol\r
-    //\r
-    for (Index = 0; Index < NumHandles; Index++) {\r
-      Status = gBS->HandleProtocol (\r
-                      HandleBuffer[Index],\r
-                      &gDxePchPlatformPolicyProtocolGuid,\r
-                      (void **)&PchPlatformPolicy\r
-                      );\r
-      if (!EFI_ERROR (Status)) {\r
-        PciD31F0RegBase = MmPciAddress (\r
-                            0,\r
-                            PchPlatformPolicy->BusNumber,\r
-                            PCI_DEVICE_NUMBER_PCH_LPC,\r
-                            PCI_FUNCTION_NUMBER_PCH_LPC,\r
-                            0\r
-                            );\r
-\r
-         Data8 = MmioRead8 (PciD31F0RegBase + R_PCH_LPC_RID_CC);\r
-         count = ARRAY_SIZE (SBRevisionTable);\r
-         for (Index = 0; Index < count; Index++) {\r
-           if(Data8 == SBRevisionTable[Index].RevId) {\r
-              UnicodeSPrint (Buffer, sizeof (Buffer), L"%02x %a", Data8, SBRevisionTable[Index].String);\r
-              HiiSetString(mHiiHandle,STRING_TOKEN(STR_SOC_VALUE), Buffer, NULL);\r
-             break;\r
-           }\r
-         }\r
-        break;\r
-      }\r
-    }\r
-  }\r
-\r
-  //\r
-  // Microcode Revision\r
-  //\r
-  EfiWriteMsr (EFI_MSR_IA32_BIOS_SIGN_ID, 0);\r
-  EfiCpuid (EFI_CPUID_VERSION_INFO, NULL);\r
-  MicroCodeVersion = (UINT32) RShiftU64 (EfiReadMsr (EFI_MSR_IA32_BIOS_SIGN_ID), 32);\r
-  UnicodeSPrint (Buffer, sizeof (Buffer), L"%x", MicroCodeVersion);\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_PROCESSOR_MICROCODE_VALUE), Buffer, NULL);\r
-\r
-  //\r
-  // Punit Version\r
-  //\r
-  Data8 = 0;\r
-  UnicodeSPrint (Buffer, sizeof (Buffer), L"0x%x", Data8);\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_PUNIT_FW_VALUE), Buffer, NULL);\r
-\r
-  //\r
-  //  PMC Version\r
-  //\r
-  Data8 = (UINT8)((MmioRead32 (PMC_BASE_ADDRESS + R_PCH_PMC_PRSTS)>>16)&0x00FF);\r
-  PIDData8 = (UINT8)((MmioRead32 (PMC_BASE_ADDRESS + R_PCH_PMC_PRSTS)>>24)&0x00FF);\r
-  UnicodeSPrint (Buffer, sizeof (Buffer), L"0x%X_%X",PIDData8, Data8);\r
-  HiiSetString(mHiiHandle,STRING_TOKEN(STR_PMC_FW_VALUE), Buffer, NULL);\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-\r
-  Update SATA Drivesize Strings for Setup and Boot order\r
-\r
-  @param NewString - pointer to string.\r
-  @param DeviceSpeed - speed of drive.\r
-\r
-**/\r
-VOID\r
-GetDeviceSpeedString (\r
-  CHAR16                      *NewString,\r
-  IN UINTN                    DeviceSpeed\r
-  )\r
-{\r
-  if (DeviceSpeed == 0x01) {\r
-    StrCat (NewString, L"1.5Gb/s");\r
-  } else if (DeviceSpeed == 0x02) {\r
-    StrCat (NewString, L"3.0Gb/s");\r
-  } else if (DeviceSpeed == 0x03) {\r
-    StrCat (NewString, L"6.0Gb/s");\r
-  } else if (DeviceSpeed == 0x0) {\r
-\r
-  }\r
-}\r
-\r
-UINT8\r
-GetChipsetSataPortSpeed (\r
-  UINTN PortNum\r
-  )\r
-{\r
-  UINT32                      DeviceSpeed;\r
-  UINT8                       DeviceConfigStatus;\r
-  UINT32                      IdeAhciBar;\r
-  EFI_PHYSICAL_ADDRESS        MemBaseAddress = 0;\r
-  UINT8                       FunNum;\r
-\r
-  DeviceSpeed = 0x01; // generation 1\r
-\r
-\r
-  //\r
-  // Allocate the AHCI BAR\r
-  //\r
-    FunNum = PCI_FUNCTION_NUMBER_PCH_SATA;\r
-    MemBaseAddress = 0x0ffffffff;\r
-    gDS->AllocateMemorySpace (\r
-           EfiGcdAllocateMaxAddressSearchBottomUp,\r
-           EfiGcdMemoryTypeMemoryMappedIo,\r
-           N_PCH_SATA_ABAR_ALIGNMENT,  // 2^11: 2K Alignment\r
-           V_PCH_SATA_ABAR_LENGTH,     // 2K Length\r
-           &MemBaseAddress,\r
-           mImageHandle,\r
-           NULL\r
-           );\r
-    IdeAhciBar = MmioRead32 (\r
-                   MmPciAddress (\r
-                                    0,\r
-                     0,\r
-                     PCI_DEVICE_NUMBER_PCH_SATA,\r
-                     FunNum,\r
-                     R_PCH_SATA_ABAR\r
-                     )\r
-                   );\r
-    IdeAhciBar &= 0xFFFFF800;\r
-    DeviceConfigStatus = 0;\r
-    if (IdeAhciBar == 0) {\r
-      DeviceConfigStatus = 1;\r
-      IdeAhciBar = (UINT32)MemBaseAddress;\r
-      MmioWrite32 (\r
-        MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_SATA, FunNum, R_PCH_SATA_ABAR),\r
-        IdeAhciBar\r
-        );\r
-      MmioOr16 (\r
-        MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_SATA, FunNum, R_PCH_SATA_COMMAND),\r
-        B_PCH_SATA_COMMAND_MSE\r
-        );\r
-    }\r
-\r
-    if (mSystemConfiguration.SataType == PCH_SATA_MODE_IDE){\r
-      //\r
-      // Program the "Ports Implemented Register"\r
-      //\r
-      MmioAndThenOr32 (IdeAhciBar + R_PCH_SATA_AHCI_PI, (UINT32)~(B_PCH_SATA_PORT0_IMPLEMENTED + B_PCH_SATA_PORT1_IMPLEMENTED), (UINT32)(B_PCH_SATA_PORT0_IMPLEMENTED + B_PCH_SATA_PORT1_IMPLEMENTED));\r
-    }\r
-\r
-    switch (PortNum)\r
-    {\r
-      case 0:\r
-        DeviceSpeed = *(volatile UINT32 *)(UINTN)(IdeAhciBar + R_PCH_SATA_AHCI_P0SSTS);\r
-        break;\r
-      case 1:\r
-        DeviceSpeed = *(volatile UINT32 *)(UINTN)(IdeAhciBar + R_PCH_SATA_AHCI_P1SSTS);\r
-        break;\r
-    }\r
-\r
-    if (MemBaseAddress) {\r
-      gDS->FreeMemorySpace (\r
-             MemBaseAddress,\r
-             V_PCH_SATA_ABAR_LENGTH\r
-             );\r
-    }\r
-\r
-  if (DeviceConfigStatus) {\r
-    IdeAhciBar = 0;\r
-    MmioWrite32 (\r
-      MmPciAddress (0, 0, PCI_DEVICE_NUMBER_PCH_SATA, FunNum, R_PCH_SATA_ABAR),\r
-      IdeAhciBar\r
-      );\r
-  }\r
-\r
-  DeviceSpeed = (UINT8)((DeviceSpeed >> 4) & 0x0F);\r
-\r
-  return (UINT8)DeviceSpeed;\r
-}\r
-\r
-/**\r
-\r
-  IDE data filter function.\r
-\r
-**/\r
-void\r
-IdeDataFilter (void)\r
-{\r
-  EFI_STATUS                  Status;\r
-  UINTN                       HandleCount;\r
-  EFI_HANDLE                  *HandleBuffer;\r
-  EFI_DISK_INFO_PROTOCOL      *DiskInfo;\r
-  EFI_DEVICE_PATH_PROTOCOL    *DevicePath, *DevicePathNode;\r
-  PCI_DEVICE_PATH             *PciDevicePath;\r
-  UINTN                       Index;\r
-  UINT8                       Index1;\r
-  UINT32                      BufferSize;\r
-  UINT32                      DriveSize;\r
-  UINT32                      IdeChannel;\r
-  UINT32                      IdeDevice;\r
-  EFI_ATA_IDENTIFY_DATA       *IdentifyDriveInfo;\r
-  CHAR16                      *NewString;\r
-  CHAR16                      SizeString[20];\r
-  STRING_REF                  NameToUpdate;\r
-  CHAR8                       StringBuffer[0x100];\r
-  UINT32                      DeviceSpeed;\r
-  UINTN                       PortNumber;\r
-\r
-  //\r
-  // Assume no line strings is longer than 256 bytes.\r
-  //\r
-  NewString = AllocateZeroPool (0x100);\r
-  PciDevicePath = NULL;\r
-\r
-  //\r
-  // Fill IDE Infomation\r
-  //\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  &gEfiDiskInfoProtocolGuid,\r
-                  NULL,\r
-                  &HandleCount,\r
-                  &HandleBuffer\r
-                                 );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    return;\r
-  }\r
-\r
-  for (Index = 0; Index < HandleCount; Index++) {\r
-\r
-    Status = gBS->HandleProtocol (\r
-                    HandleBuffer[Index],\r
-                    &gEfiDevicePathProtocolGuid,\r
-                    (VOID*)&DevicePath\r
-                                   );\r
-    ASSERT_EFI_ERROR (Status);\r
-\r
-    DevicePathNode = DevicePath;\r
-    while (!IsDevicePathEnd (DevicePathNode) ) {\r
-      if  ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&\r
-           ( DevicePathSubType (DevicePathNode) == HW_PCI_DP)) {\r
-        PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;\r
-        break;\r
-      }\r
-      DevicePathNode    = NextDevicePathNode (DevicePathNode);\r
-    }\r
-\r
-    if (PciDevicePath == NULL) {\r
-      continue;\r
-    }\r
-\r
-    //\r
-    // Check for onboard IDE\r
-    //\r
-    if (PciDevicePath->Device== PCI_DEVICE_NUMBER_PCH_SATA) {\r
-      Status = gBS->HandleProtocol (\r
-                         HandleBuffer[Index],\r
-                                         &gEfiDiskInfoProtocolGuid,\r
-                                         (void **)&DiskInfo\r
-                                         );\r
-      ASSERT_EFI_ERROR (Status);\r
-\r
-      Status = DiskInfo->WhichIde (\r
-                              DiskInfo,\r
-                           &IdeChannel,\r
-                           &IdeDevice\r
-                                                  );\r
-      ASSERT_EFI_ERROR (Status);\r
-\r
-      IdentifyDriveInfo = AllocatePool (sizeof(EFI_ATA_IDENTIFY_DATA));\r
-\r
-      BufferSize = sizeof(EFI_ATA_IDENTIFY_DATA);\r
-      Status = DiskInfo->Identify (\r
-                              DiskInfo,\r
-                           IdentifyDriveInfo,\r
-                           &BufferSize\r
-                           );\r
-      ASSERT_EFI_ERROR(Status);\r
-\r
-      //\r
-      // Onboard SATA Devices\r
-      //\r
-      if (PciDevicePath->Function == PCI_FUNCTION_NUMBER_PCH_SATA) {\r
-        if (IdeChannel == 0 && IdeDevice == 0) {\r
-          NameToUpdate = (STRING_REF)STR_SATA0_NAME;\r
-        } else if (IdeChannel == 1 && IdeDevice == 0) {\r
-          NameToUpdate = (STRING_REF)STR_SATA1_NAME;\r
-        } else {\r
-          continue;\r
-        }\r
-      } else {\r
-        continue;\r
-      }\r
-\r
-      ZeroMem(StringBuffer, sizeof(StringBuffer));\r
-      CopyMem(\r
-        StringBuffer,\r
-        (CHAR8 *)&IdentifyDriveInfo->ModelName,\r
-        sizeof(IdentifyDriveInfo->ModelName)\r
-        );\r
-      SwapEntries(StringBuffer);\r
-      AsciiToUnicode(StringBuffer, NewString);\r
-\r
-         //\r
-      // Chap it off after 16 characters\r
-         //\r
-      NewString[16] = 0;\r
-\r
-      //\r
-      // For HardDisk append the size. Otherwise display atapi\r
-      //\r
-      if ((IdentifyDriveInfo->config & 0x8000) == 00) {\r
-        //\r
-        // 48 bit address feature set is supported, get maximum capacity\r
-        //\r
-        if ((IdentifyDriveInfo->command_set_supported_83 & 0x0400) == 0) {\r
-        DriveSize = (((((IdentifyDriveInfo->user_addressable_sectors_hi << 16) +\r
-                      IdentifyDriveInfo->user_addressable_sectors_lo) / 1000) * 512) / 1000);\r
-        } else {\r
-          DriveSize    = IdentifyDriveInfo->maximum_lba_for_48bit_addressing[0];\r
-          for (Index1 = 1; Index1 < 4; Index1++) {\r
-            //\r
-            // Lower byte goes first: word[100] is the lowest word, word[103] is highest\r
-            //\r
-            DriveSize |= LShiftU64(IdentifyDriveInfo->maximum_lba_for_48bit_addressing[Index1], 16 * Index1);\r
-          }\r
-          DriveSize = (UINT32) DivU64x32(MultU64x32(DivU64x32(DriveSize, 1000), 512), 1000);\r
-        }\r
-\r
-        StrCat (NewString, L"(");\r
-        EfiValueToString (SizeString, DriveSize/1000, PREFIX_BLANK, 0);\r
-        StrCat (NewString, SizeString);\r
-        StrCat (NewString, L".");\r
-        EfiValueToString (SizeString, (DriveSize%1000)/100, PREFIX_BLANK, 0);\r
-        StrCat (NewString, SizeString);\r
-        StrCat (NewString, L"GB");\r
-      } else {\r
-        StrCat (NewString, L"(ATAPI");\r
-      }\r
-\r
-      //\r
-      // Update SPEED.\r
-      //\r
-      PortNumber = (IdeDevice << 1) + IdeChannel;\r
-      DeviceSpeed = GetChipsetSataPortSpeed(PortNumber);\r
-\r
-      if (DeviceSpeed) {\r
-        StrCat (NewString, L"-");\r
-        GetDeviceSpeedString( NewString, DeviceSpeed);\r
-      }\r
-\r
-      StrCat (NewString, L")");\r
-\r
-      HiiSetString(mHiiHandle, NameToUpdate, NewString, NULL);\r
-\r
-    }\r
-  }\r
-\r
-  if (HandleBuffer != NULL) {\r
-    gBS->FreePool (HandleBuffer);\r
-  }\r
-\r
-  gBS->FreePool(NewString);\r
-\r
-  return;\r
-}\r
-\r
-\r
-VOID\r
-EFIAPI\r
-SetupInfo (void)\r
-{\r
-  EFI_STATUS                  Status;\r
-  UINTN                       VarSize;\r
-  EFI_PEI_HOB_POINTERS        GuidHob;\r
-\r
-  if (mSetupInfoDone) {\r
-      return;\r
-  }\r
-\r
-  VarSize = sizeof(SYSTEM_CONFIGURATION);\r
-  Status = gRT->GetVariable(\r
-                  NORMAL_SETUP_NAME,\r
-                  &gEfiNormalSetupGuid,\r
-                  NULL,\r
-                  &VarSize,\r
-                  &mSystemConfiguration\r
-                                 );\r
-\r
-  if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {\r
-    //The setup variable is corrupted\r
-    VarSize = sizeof(SYSTEM_CONFIGURATION);\r
-    Status = gRT->GetVariable(\r
-              L"SetupRecovery",\r
-              &gEfiNormalSetupGuid,\r
-              NULL,\r
-              &VarSize,\r
-              &mSystemConfiguration\r
-              );\r
-    ASSERT_EFI_ERROR (Status);\r
-  }  \r
-\r
-  //\r
-  // Update HOB variable for PCI resource information\r
-  // Get the HOB list.  If it is not present, then ASSERT.\r
-  //\r
-  GuidHob.Raw = GetHobList ();\r
-  if (GuidHob.Raw != NULL) {\r
-    if ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformInfoGuid, GuidHob.Raw)) != NULL) {\r
-      mPlatformInfo = GET_GUID_HOB_DATA (GuidHob.Guid);\r
-    }\r
-  }\r
-\r
-\r
-  PrepareSetupInformation();\r
-  UpdateAdditionalInformation ();\r
-  UpdatePlatformInformation();\r
-  UpdateCPUInformation();\r
-  IdeDataFilter();\r
-  mSetupInfoDone = TRUE;\r
-\r
-  return;\r
-}\r
-\r
-\r
-#define EFI_SECURE_BOOT_MODE_NAME                   L"SecureBoot"\r
-\r
-VOID\r
-CheckSystemConfigLoad(SYSTEM_CONFIGURATION *SystemConfigPtr)\r
-{\r
-  EFI_STATUS              Status;\r
-  UINT8                   SecureBoot;\r
-  UINTN                   DataSize;\r
-\r
-\r
-  DataSize = sizeof(SecureBoot);\r
-  Status = gRT->GetVariable (\r
-                  EFI_SECURE_BOOT_MODE_NAME,\r
-                  &gEfiGlobalVariableGuid,\r
-                  NULL,\r
-                  &DataSize,\r
-                  &SecureBoot\r
-                  );\r
-\r
-  if (EFI_ERROR(Status)) {\r
-    SystemConfigPtr->SecureBoot = 0;\r
-  } else {\r
-    SystemConfigPtr->SecureBoot = SecureBoot;\r
-  }\r
-}\r
-\r
-\r
-//\r
-// "SecureBootEnable" variable for the Secure boot feature enable/disable.\r
-//\r
-#define EFI_SECURE_BOOT_ENABLE_NAME      L"SecureBootEnable"\r
-extern EFI_GUID gEfiSecureBootEnableDisableGuid;\r
-\r
-\r
-VOID\r
-CheckSystemConfigSave(SYSTEM_CONFIGURATION *SystemConfigPtr)\r
-{\r
-  EFI_STATUS              Status;\r
-  UINT8                   SecureBootCfg;\r
-  BOOLEAN                 SecureBootNotFound;\r
-  UINTN                   DataSize;\r
-\r
-\r
-    //\r
-    // Secure Boot configuration changes\r
-       //\r
-    DataSize = sizeof(SecureBootCfg);\r
-    SecureBootNotFound = FALSE;\r
-    Status = gRT->GetVariable (\r
-                    EFI_SECURE_BOOT_ENABLE_NAME,\r
-                    &gEfiSecureBootEnableDisableGuid,\r
-                    NULL,\r
-                    &DataSize,\r
-                    &SecureBootCfg\r
-                    );\r
-\r
-    if (EFI_ERROR(Status)) {\r
-      SecureBootNotFound = TRUE;\r
-    }\r
-    if (SecureBootNotFound) {\r
-      Status = gRT->GetVariable (\r
-                      EFI_SECURE_BOOT_ENABLE_NAME,\r
-                      &gEfiSecureBootEnableDisableGuid,\r
-                      NULL,\r
-                      &DataSize,\r
-                      &SecureBootCfg\r
-                      );\r
-      ASSERT_EFI_ERROR(Status);\r
-    }\r
-    if ((SecureBootCfg) != SystemConfigPtr->SecureBoot) {\r
-      SecureBootCfg = !SecureBootCfg;\r
-      Status = gRT->SetVariable (\r
-                      EFI_SECURE_BOOT_ENABLE_NAME,\r
-                      &gEfiSecureBootEnableDisableGuid,\r
-                      EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-                      sizeof (UINT8),\r
-                      &SecureBootCfg\r
-                      );\r
-    }\r
-\r
-}\r
-\r
-VOID\r
-ConfirmSecureBootTest()\r
-{\r
-\r
-}\r
-\r