]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/PlatformSetupDxe/SetupFunctions.c
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformSetupDxe / SetupFunctions.c
diff --git a/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupFunctions.c b/Vlv2TbltDevicePkg/PlatformSetupDxe/SetupFunctions.c
new file mode 100644 (file)
index 0000000..9d8d0a0
--- /dev/null
@@ -0,0 +1,90 @@
+/** @file\r
+\r
+  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>\r
+                                                                                   \r\r
+  This program and the accompanying materials are licensed and made available under\r\r
+  the terms and conditions of the BSD License that accompanies this distribution.  \r\r
+  The full text of the license may be found at                                     \r\r
+  http://opensource.org/licenses/bsd-license.php.                                  \r\r
+                                                                                   \r\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,            \r\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.    \r\r
+                                                                                   \r\r
+\r
+\r
+Module Name:\r
+\r
+    SetupFunctions.c\r
+\r
+Abstract:\r
+\r
+Revision History\r
+\r
+--*/\r
+\r
+#include "PlatformSetupDxe.h"\r
+\r
+VOID\r
+AsciiToUnicode (\r
+  IN    CHAR8     *AsciiString,\r
+  IN    CHAR16    *UnicodeString\r
+  )\r
+{\r
+  UINT8           Index;\r
+\r
+  Index = 0;\r
+  while (AsciiString[Index] != 0) {\r
+    UnicodeString[Index] = (CHAR16)AsciiString[Index];\r
+    Index++;\r
+  }\r
+}\r
+\r
+VOID\r
+SwapEntries (\r
+  IN  CHAR8 *Data\r
+  )\r
+{\r
+  UINT16  Index;\r
+  CHAR8   Temp8;\r
+\r
+  Index = 0;\r
+  while (Data[Index] != 0 && Data[Index+1] != 0) {\r
+    Temp8 = Data[Index];\r
+    Data[Index] = Data[Index+1];\r
+    Data[Index+1] = Temp8;\r
+    Index +=2;\r
+  }\r
+\r
+  return;\r
+}\r
+\r
+UINT32\r
+ConvertBase10ToRaw (\r
+  IN  EFI_EXP_BASE10_DATA             *Data)\r
+{\r
+  UINTN         Index;\r
+  UINT32        RawData;\r
+\r
+  RawData = Data->Value;\r
+  for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {\r
+     RawData *= 10;\r
+  }\r
+\r
+  return  RawData;\r
+}\r
+\r
+UINT32\r
+ConvertBase2ToRaw (\r
+  IN  EFI_EXP_BASE2_DATA             *Data)\r
+{\r
+  UINTN         Index;\r
+  UINT32        RawData;\r
+\r
+  RawData = Data->Value;\r
+  for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {\r
+     RawData <<= 1;\r
+  }\r
+\r
+  return  RawData;\r
+}\r
+\r