13cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei/** @file
23cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
33cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
43cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
53cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
63cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  This program and the accompanying materials are licensed and made available under
73cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
83cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  the terms and conditions of the BSD License that accompanies this distribution.
93cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
103cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  The full text of the license may be found at
113cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
123cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  http://opensource.org/licenses/bsd-license.php.
133cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
143cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
153cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
163cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
173cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
183cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
193cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
203cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
213cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
223cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
233cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
243cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiModule Name:
253cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
263cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    SetupFunctions.c
273cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
283cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiAbstract:
293cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
303cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiRevision History
313cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
323cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei--*/
333cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
343cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#include "PlatformSetupDxe.h"
353cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
363cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiVOID
373cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiAsciiToUnicode (
383cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  IN    CHAR8     *AsciiString,
393cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  IN    CHAR16    *UnicodeString
403cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  )
413cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei{
423cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8           Index;
433cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
443cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  Index = 0;
453cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  while (AsciiString[Index] != 0) {
463cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    UnicodeString[Index] = (CHAR16)AsciiString[Index];
473cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    Index++;
483cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
493cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei}
503cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
513cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiVOID
523cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiSwapEntries (
533cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  IN  CHAR8 *Data
543cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  )
553cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei{
563cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT16  Index;
573cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  CHAR8   Temp8;
583cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
593cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  Index = 0;
603cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  while (Data[Index] != 0 && Data[Index+1] != 0) {
613cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    Temp8 = Data[Index];
623cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    Data[Index] = Data[Index+1];
633cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    Data[Index+1] = Temp8;
643cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    Index +=2;
653cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
663cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
673cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  return;
683cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei}
693cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
703cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiUINT32
713cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiConvertBase10ToRaw (
723cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  IN  EFI_EXP_BASE10_DATA             *Data)
733cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei{
743cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINTN         Index;
753cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32        RawData;
763cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
773cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  RawData = Data->Value;
783cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {
793cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei     RawData *= 10;
803cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
813cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
823cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  return  RawData;
833cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei}
843cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
853cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiUINT32
863cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiConvertBase2ToRaw (
873cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  IN  EFI_EXP_BASE2_DATA             *Data)
883cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei{
893cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINTN         Index;
903cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32        RawData;
91
92  RawData = Data->Value;
93  for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {
94     RawData <<= 1;
95  }
96
97  return  RawData;
98}
99
100