]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/PlatformSetupDxe/SetupFunctions.c
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformSetupDxe / SetupFunctions.c
1 /** @file
2
3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
4
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14
15 Module Name:
16
17 SetupFunctions.c
18
19 Abstract:
20
21 Revision History
22
23 --*/
24
25 #include "PlatformSetupDxe.h"
26
27 VOID
28 AsciiToUnicode (
29 IN CHAR8 *AsciiString,
30 IN CHAR16 *UnicodeString
31 )
32 {
33 UINT8 Index;
34
35 Index = 0;
36 while (AsciiString[Index] != 0) {
37 UnicodeString[Index] = (CHAR16)AsciiString[Index];
38 Index++;
39 }
40 }
41
42 VOID
43 SwapEntries (
44 IN CHAR8 *Data
45 )
46 {
47 UINT16 Index;
48 CHAR8 Temp8;
49
50 Index = 0;
51 while (Data[Index] != 0 && Data[Index+1] != 0) {
52 Temp8 = Data[Index];
53 Data[Index] = Data[Index+1];
54 Data[Index+1] = Temp8;
55 Index +=2;
56 }
57
58 return;
59 }
60
61 UINT32
62 ConvertBase10ToRaw (
63 IN EFI_EXP_BASE10_DATA *Data)
64 {
65 UINTN Index;
66 UINT32 RawData;
67
68 RawData = Data->Value;
69 for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {
70 RawData *= 10;
71 }
72
73 return RawData;
74 }
75
76 UINT32
77 ConvertBase2ToRaw (
78 IN EFI_EXP_BASE2_DATA *Data)
79 {
80 UINTN Index;
81 UINT32 RawData;
82
83 RawData = Data->Value;
84 for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {
85 RawData <<= 1;
86 }
87
88 return RawData;
89 }
90