diff options
Diffstat (limited to 'EdkModulePkg/Library')
110 files changed, 0 insertions, 35037 deletions
diff --git a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c b/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c deleted file mode 100644 index b165f474e3..0000000000 --- a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.c +++ /dev/null @@ -1,80 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseCustomDecompressLibNull.c
-
-Abstract:
-
- NULL Custom Decompress Library
-
---*/
-
-RETURN_STATUS
-EFIAPI
-CustomDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return RETURN_UNSUPPORTED;
-}
-
-RETURN_STATUS
-EFIAPI
-CustomDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return RETURN_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa b/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa deleted file mode 100644 index f224cab515..0000000000 --- a/EdkModulePkg/Library/BaseCustomDecompressLibNull/BaseCustomDecompressLibNull.msa +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>BaseCustomDecompressLibNull</ModuleName>
- <ModuleType>BASE</ModuleType>
- <GuidValue>e5566134-c75e-4ace-bad1-e23a3b335e30</GuidValue>
- <Version>1.0</Version>
- <Abstract>Base Custom Decompression Library</Abstract>
- <Description>Customer Decompress Library with NULL implementation.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>BaseCustomDecompressLibNull</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>CustomDecompressLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BaseCustomDecompressLibNull.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c b/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c deleted file mode 100644 index 3d3fc4c7cb..0000000000 --- a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.c +++ /dev/null @@ -1,840 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BaseUefiTianoDecompressLib.c
-
-Abstract:
-
- UEFI and Tiano Decompress Library
-
---*/
-
-#include "BaseUefiTianoDecompressLibInternals.h"
-
-VOID
-FillBuf (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- )
-/*++
-
-Routine Description:
-
- Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
-
-Arguments:
-
- Sd - The global scratch data
- NumOfBits - The number of bits to shift and read.
-
-Returns: (VOID)
-
---*/
-{
- Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);
-
- while (NumOfBits > Sd->mBitCount) {
-
- Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));
-
- if (Sd->mCompSize > 0) {
- //
- // Get 1 byte into SubBitBuf
- //
- Sd->mCompSize--;
- Sd->mSubBitBuf = 0;
- Sd->mSubBitBuf = Sd->mSrcBase[Sd->mInBuf++];
- Sd->mBitCount = 8;
-
- } else {
- //
- // No more bits from the source, just pad zero bit.
- //
- Sd->mSubBitBuf = 0;
- Sd->mBitCount = 8;
-
- }
- }
-
- Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);
- Sd->mBitBuf |= Sd->mSubBitBuf >> Sd->mBitCount;
-}
-
-UINT32
-GetBits (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- )
-/*++
-
-Routine Description:
-
- Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
- NumOfBits of bits from source. Returns NumOfBits of bits that are
- popped out.
-
-Arguments:
-
- Sd - The global scratch data.
- NumOfBits - The number of bits to pop and read.
-
-Returns:
-
- The bits that are popped out.
-
---*/
-{
- UINT32 OutBits;
-
- OutBits = (UINT32) (Sd->mBitBuf >> (BITBUFSIZ - NumOfBits));
-
- FillBuf (Sd, NumOfBits);
-
- return OutBits;
-}
-
-UINT16
-MakeTable (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfChar,
- IN UINT8 *BitLen,
- IN UINT16 TableBits,
- OUT UINT16 *Table
- )
-/*++
-
-Routine Description:
-
- Creates Huffman Code mapping table according to code length array.
-
-Arguments:
-
- Sd - The global scratch data
- NumOfChar - Number of symbols in the symbol set
- BitLen - Code length array
- TableBits - The width of the mapping table
- Table - The table
-
-Returns:
-
- 0 - OK.
- BAD_TABLE - The table is corrupted.
-
---*/
-{
- UINT16 Count[17];
- UINT16 Weight[17];
- UINT16 Start[18];
- UINT16 *Pointer;
- UINT16 Index3;
- volatile UINT16 Index;
- UINT16 Len;
- UINT16 Char;
- UINT16 JuBits;
- UINT16 Avail;
- UINT16 NextCode;
- UINT16 Mask;
- UINT16 WordOfStart;
- UINT16 WordOfCount;
-
- for (Index = 1; Index <= 16; Index++) {
- Count[Index] = 0;
- }
-
- for (Index = 0; Index < NumOfChar; Index++) {
- Count[BitLen[Index]]++;
- }
-
- Start[1] = 0;
-
- for (Index = 1; Index <= 16; Index++) {
- WordOfStart = Start[Index];
- WordOfCount = Count[Index];
- Start[Index + 1] = (UINT16) (WordOfStart + (WordOfCount << (16 - Index)));
- }
-
- if (Start[17] != 0) {
- /*(1U << 16)*/
- return (UINT16) BAD_TABLE;
- }
-
- JuBits = (UINT16) (16 - TableBits);
-
- for (Index = 1; Index <= TableBits; Index++) {
- Start[Index] >>= JuBits;
- Weight[Index] = (UINT16) (1U << (TableBits - Index));
- }
-
- while (Index <= 16) {
- Weight[Index] = (UINT16) (1U << (16 - Index));
- Index++;
- }
-
- Index = (UINT16) (Start[TableBits + 1] >> JuBits);
-
- if (Index != 0) {
- Index3 = (UINT16) (1U << TableBits);
- while (Index != Index3) {
- Table[Index++] = 0;
- }
- }
-
- Avail = NumOfChar;
- Mask = (UINT16) (1U << (15 - TableBits));
-
- for (Char = 0; Char < NumOfChar; Char++) {
-
- Len = BitLen[Char];
- if (Len == 0) {
- continue;
- }
-
- NextCode = (UINT16) (Start[Len] + Weight[Len]);
-
- if (Len <= TableBits) {
-
- for (Index = Start[Len]; Index < NextCode; Index++) {
- Table[Index] = Char;
- }
-
- } else {
-
- Index3 = Start[Len];
- Pointer = &Table[Index3 >> JuBits];
- Index = (UINT16) (Len - TableBits);
-
- while (Index != 0) {
- if (*Pointer == 0) {
- Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
- *Pointer = Avail++;
- }
-
- if (Index3 & Mask) {
- Pointer = &Sd->mRight[*Pointer];
- } else {
- Pointer = &Sd->mLeft[*Pointer];
- }
-
- Index3 <<= 1;
- Index--;
- }
-
- *Pointer = Char;
-
- }
-
- Start[Len] = NextCode;
- }
- //
- // Succeeds
- //
- return 0;
-}
-
-UINT32
-DecodeP (
- IN SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Decodes a position value.
-
-Arguments:
-
- Sd - the global scratch data
-
-Returns:
-
- The position value decoded.
-
---*/
-{
- UINT16 Val;
- UINT32 Mask;
- UINT32 Pos;
-
- Val = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
-
- if (Val >= MAXNP) {
- Mask = 1U << (BITBUFSIZ - 1 - 8);
-
- do {
-
- if (Sd->mBitBuf & Mask) {
- Val = Sd->mRight[Val];
- } else {
- Val = Sd->mLeft[Val];
- }
-
- Mask >>= 1;
- } while (Val >= MAXNP);
- }
- //
- // Advance what we have read
- //
- FillBuf (Sd, Sd->mPTLen[Val]);
-
- Pos = Val;
- if (Val > 1) {
- Pos = (UINT32) ((1U << (Val - 1)) + GetBits (Sd, (UINT16) (Val - 1)));
- }
-
- return Pos;
-}
-
-UINT16
-ReadPTLen (
- IN SCRATCH_DATA *Sd,
- IN UINT16 nn,
- IN UINT16 nbit,
- IN UINT16 Special
- )
-/*++
-
-Routine Description:
-
- Reads code lengths for the Extra Set or the Position Set
-
-Arguments:
-
- Sd - The global scratch data
- nn - Number of symbols
- nbit - Number of bits needed to represent nn
- Special - The special symbol that needs to be taken care of
-
-Returns:
-
- 0 - OK.
- BAD_TABLE - Table is corrupted.
-
---*/
-{
- UINT16 Number;
- UINT16 CharC;
- volatile UINT16 Index;
- UINT32 Mask;
-
- Number = (UINT16) GetBits (Sd, nbit);
-
- if (Number == 0) {
- CharC = (UINT16) GetBits (Sd, nbit);
-
- for (Index = 0; Index < 256; Index++) {
- Sd->mPTTable[Index] = CharC;
- }
-
- for (Index = 0; Index < nn; Index++) {
- Sd->mPTLen[Index] = 0;
- }
-
- return 0;
- }
-
- Index = 0;
-
- while (Index < Number) {
-
- CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
-
- if (CharC == 7) {
- Mask = 1U << (BITBUFSIZ - 1 - 3);
- while (Mask & Sd->mBitBuf) {
- Mask >>= 1;
- CharC += 1;
- }
- }
-
- FillBuf (Sd, (UINT16) ((CharC < 7) ? 3 : CharC - 3));
-
- Sd->mPTLen[Index++] = (UINT8) CharC;
-
- if (Index == Special) {
- CharC = (UINT16) GetBits (Sd, 2);
- while ((INT16) (--CharC) >= 0) {
- Sd->mPTLen[Index++] = 0;
- }
- }
- }
-
- while (Index < nn) {
- Sd->mPTLen[Index++] = 0;
- }
-
- return MakeTable (Sd, nn, Sd->mPTLen, 8, Sd->mPTTable);
-}
-
-VOID
-ReadCLen (
- SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Reads code lengths for Char&Len Set.
-
-Arguments:
-
- Sd - the global scratch data
-
-Returns: (VOID)
-
---*/
-{
- UINT16 Number;
- UINT16 CharC;
- volatile UINT16 Index;
- UINT32 Mask;
-
- Number = (UINT16) GetBits (Sd, CBIT);
-
- if (Number == 0) {
- CharC = (UINT16) GetBits (Sd, CBIT);
-
- for (Index = 0; Index < NC; Index++) {
- Sd->mCLen[Index] = 0;
- }
-
- for (Index = 0; Index < 4096; Index++) {
- Sd->mCTable[Index] = CharC;
- }
-
- return ;
- }
-
- Index = 0;
- while (Index < Number) {
-
- CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
- if (CharC >= NT) {
- Mask = 1U << (BITBUFSIZ - 1 - 8);
-
- do {
-
- if (Mask & Sd->mBitBuf) {
- CharC = Sd->mRight[CharC];
- } else {
- CharC = Sd->mLeft[CharC];
- }
-
- Mask >>= 1;
-
- } while (CharC >= NT);
- }
- //
- // Advance what we have read
- //
- FillBuf (Sd, Sd->mPTLen[CharC]);
-
- if (CharC <= 2) {
-
- if (CharC == 0) {
- CharC = 1;
- } else if (CharC == 1) {
- CharC = (UINT16) (GetBits (Sd, 4) + 3);
- } else if (CharC == 2) {
- CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
- }
-
- while ((INT16) (--CharC) >= 0) {
- Sd->mCLen[Index++] = 0;
- }
-
- } else {
-
- Sd->mCLen[Index++] = (UINT8) (CharC - 2);
-
- }
- }
-
- while (Index < NC) {
- Sd->mCLen[Index++] = 0;
- }
-
- MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
-
- return ;
-}
-
-UINT16
-DecodeC (
- SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Decode a character/length value.
-
-Arguments:
-
- Sd - The global scratch data.
-
-Returns:
-
- The value decoded.
-
---*/
-{
- UINT16 Index2;
- UINT32 Mask;
-
- if (Sd->mBlockSize == 0) {
- //
- // Starting a new block
- //
- Sd->mBlockSize = (UINT16) GetBits (Sd, 16);
- Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);
- if (Sd->mBadTableFlag != 0) {
- return 0;
- }
-
- ReadCLen (Sd);
-
- Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));
- if (Sd->mBadTableFlag != 0) {
- return 0;
- }
- }
-
- Sd->mBlockSize--;
- Index2 = Sd->mCTable[Sd->mBitBuf >> (BITBUFSIZ - 12)];
-
- if (Index2 >= NC) {
- Mask = 1U << (BITBUFSIZ - 1 - 12);
-
- do {
- if (Sd->mBitBuf & Mask) {
- Index2 = Sd->mRight[Index2];
- } else {
- Index2 = Sd->mLeft[Index2];
- }
-
- Mask >>= 1;
- } while (Index2 >= NC);
- }
- //
- // Advance what we have read
- //
- FillBuf (Sd, Sd->mCLen[Index2]);
-
- return Index2;
-}
-
-VOID
-Decode (
- SCRATCH_DATA *Sd
- )
-/*++
-
-Routine Description:
-
- Decode the source data and put the resulting data into the destination buffer.
-
-Arguments:
-
- Sd - The global scratch data
-
-Returns: (VOID)
-
- --*/
-{
- UINT16 BytesRemain;
- UINT32 DataIdx;
- UINT16 CharC;
-
- BytesRemain = (UINT16) (-1);
-
- DataIdx = 0;
-
- for (;;) {
- CharC = DecodeC (Sd);
- if (Sd->mBadTableFlag != 0) {
- goto Done ;
- }
-
- if (CharC < 256) {
- //
- // Process an Original character
- //
- if (Sd->mOutBuf >= Sd->mOrigSize) {
- goto Done ;
- } else {
- Sd->mDstBase[Sd->mOutBuf++] = (UINT8) CharC;
- }
-
- } else {
- //
- // Process a Pointer
- //
- CharC = (UINT16) (CharC - (UINT8_MAX + 1 - THRESHOLD));
-
- BytesRemain = CharC;
-
- DataIdx = Sd->mOutBuf - DecodeP (Sd) - 1;
-
- BytesRemain--;
- while ((INT16) (BytesRemain) >= 0) {
- Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
- if (Sd->mOutBuf >= Sd->mOrigSize) {
- goto Done ;
- }
-
- BytesRemain--;
- }
- }
- }
-
-Done:
- return ;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- UINT32 CompressedSize;
-
- ASSERT (Source != NULL);
- ASSERT (DestinationSize != NULL);
- ASSERT (ScratchSize != NULL);
-
- *ScratchSize = sizeof (SCRATCH_DATA);
-
- if (SourceSize < 8) {
- return RETURN_INVALID_PARAMETER;
- }
-
- CopyMem (&CompressedSize, Source, sizeof (UINT32));
- CopyMem (DestinationSize, (VOID *)((UINT8 *)Source + 4), sizeof (UINT32));
-
- if (SourceSize < (CompressedSize + 8)) {
- return RETURN_INVALID_PARAMETER;
- }
-
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiTianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch,
- IN UINT32 Version
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
- Version - 1 for UEFI Decompress algoruthm, 2 for Tiano Decompess algorithm
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- volatile UINT32 Index;
- UINT32 CompSize;
- UINT32 OrigSize;
- SCRATCH_DATA *Sd;
- CONST UINT8 *Src;
- UINT8 *Dst;
-
- ASSERT (Source != NULL);
- ASSERT (Destination != NULL);
- ASSERT (Scratch != NULL);
-
- Src = Source;
- Dst = Destination;
-
- Sd = (SCRATCH_DATA *) Scratch;
-
- CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
- OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
-
- //
- // If compressed file size is 0, return
- //
- if (OrigSize == 0) {
- return RETURN_SUCCESS;
- }
-
- Src = Src + 8;
-
- for (Index = 0; Index < sizeof (SCRATCH_DATA); Index++) {
- ((UINT8 *) Sd)[Index] = 0;
- }
- //
- // The length of the field 'Position Set Code Length Array Size' in Block Header.
- // For EFI 1.1 de/compression algorithm(Version 1), mPBit = 4
- // For Tiano de/compression algorithm(Version 2), mPBit = 5
- //
- switch (Version) {
- case 1 :
- Sd->mPBit = 4;
- break;
- case 2 :
- Sd->mPBit = 5;
- break;
- default:
- ASSERT (FALSE);
- }
- Sd->mSrcBase = (UINT8 *)Src;
- Sd->mDstBase = Dst;
- Sd->mCompSize = CompSize;
- Sd->mOrigSize = OrigSize;
-
- //
- // Fill the first BITBUFSIZ bits
- //
- FillBuf (Sd, BITBUFSIZ);
-
- //
- // Decompress it
- //
- Decode (Sd);
-
- if (Sd->mBadTableFlag != 0) {
- //
- // Something wrong with the source
- //
- return RETURN_INVALID_PARAMETER;
- }
-
- return RETURN_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return UefiTianoDecompress (Source, Destination, Scratch, 1);
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return UefiTianoDecompress (Source, Destination, Scratch, 2);
-}
diff --git a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa b/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa deleted file mode 100644 index eab5f543e3..0000000000 --- a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.msa +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>BaseUefiTianoDecompressLib</ModuleName>
- <ModuleType>BASE</ModuleType>
- <GuidValue>d774c4d9-c121-4da3-a5e2-0f317e3c630c</GuidValue>
- <Version>1.0</Version>
- <Abstract>Uefi Tiano Decomression Library</Abstract>
- <Description>Uefi Decompression library instance</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>BaseUefiTianoDecompressLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>UefiDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>TianoDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BaseUefiTianoDecompressLib.c</Filename>
- <Filename>BaseUefiTianoDecompressLibInternals.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h b/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h deleted file mode 100644 index bb7aa5ae13..0000000000 --- a/EdkModulePkg/Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLibInternals.h +++ /dev/null @@ -1,224 +0,0 @@ -/** @file
- Internal include file for Base UEFI Decompress Libary.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: BaseUefiDecompressLibInternals.h
-
-**/
-
-#ifndef __BASE_UEFI_TIANO_DECOMPRESS_LIB_INTERNALS_H__
-#define __BASE_UEFI_TIANO_DECOMPRESS_LIB_INTERNALS_H__
-
-//
-// Decompression algorithm begins here
-//
-#define BITBUFSIZ 32
-#define MAXMATCH 256
-#define THRESHOLD 3
-#define CODE_BIT 16
-#define BAD_TABLE - 1
-
-//
-// C: Char&Len Set; P: Position Set; T: exTra Set
-//
-#define NC (0xff + MAXMATCH + 2 - THRESHOLD)
-#define CBIT 9
-#define MAXPBIT 5
-#define TBIT 5
-#define MAXNP ((1U << MAXPBIT) - 1)
-#define NT (CODE_BIT + 3)
-#if NT > MAXNP
-#define NPT NT
-#else
-#define NPT MAXNP
-#endif
-
-typedef struct {
- UINT8 *mSrcBase; // Starting address of compressed data
- UINT8 *mDstBase; // Starting address of decompressed data
- UINT32 mOutBuf;
- UINT32 mInBuf;
-
- UINT16 mBitCount;
- UINT32 mBitBuf;
- UINT32 mSubBitBuf;
- UINT16 mBlockSize;
- UINT32 mCompSize;
- UINT32 mOrigSize;
-
- UINT16 mBadTableFlag;
-
- UINT16 mLeft[2 * NC - 1];
- UINT16 mRight[2 * NC - 1];
- UINT8 mCLen[NC];
- UINT8 mPTLen[NPT];
- UINT16 mCTable[4096];
- UINT16 mPTTable[256];
-
- //
- // The length of the field 'Position Set Code Length Array Size' in Block Header.
- // For EFI 1.1 de/compression algorithm, mPBit = 4
- // For Tiano de/compression algorithm, mPBit = 5
- //
- UINT8 mPBit;
-} SCRATCH_DATA;
-
-/**
- Read NumOfBit of bits from source into mBitBuf
-
- Shift mBitBuf NumOfBits left. Read in NumOfBits of bits from source.
-
- @param Sd The global scratch data
- @param NumOfBits The number of bits to shift and read.
-
-**/
-VOID
-FillBuf (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- );
-
-/**
- Get NumOfBits of bits out from mBitBuf
-
- Get NumOfBits of bits out from mBitBuf. Fill mBitBuf with subsequent
- NumOfBits of bits from source. Returns NumOfBits of bits that are
- popped out.
-
- @param Sd The global scratch data.
- @param NumOfBits The number of bits to pop and read.
-
- @return The bits that are popped out.
-
-**/
-UINT32
-GetBits (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfBits
- );
-
-/**
- Creates Huffman Code mapping table according to code length array.
-
- Creates Huffman Code mapping table for Extra Set, Char&Len Set
- and Position Set according to code length array.
-
- @param Sd The global scratch data
- @param NumOfChar Number of symbols in the symbol set
- @param BitLen Code length array
- @param TableBits The width of the mapping table
- @param Table The table
-
- @retval 0 OK.
- @retval BAD_TABLE The table is corrupted.
-
-**/
-UINT16
-MakeTable (
- IN SCRATCH_DATA *Sd,
- IN UINT16 NumOfChar,
- IN UINT8 *BitLen,
- IN UINT16 TableBits,
- OUT UINT16 *Table
- );
-
-/**
- Decodes a position value.
-
- Get a position value according to Position Huffman Table.
-
- @param Sd the global scratch data
-
- @return The position value decoded.
-
-**/
-UINT32
-DecodeP (
- IN SCRATCH_DATA *Sd
- );
-
-/**
- Reads code lengths for the Extra Set or the Position Set.
-
- Read in the Extra Set or Pointion Set Length Arrary, then
- generate the Huffman code mapping for them.
-
- @param Sd The global scratch data.
- @param nn Number of symbols.
- @param nbit Number of bits needed to represent nn.
- @param Special The special symbol that needs to be taken care of.
-
- @retval 0 OK.
- @retval BAD_TABLE Table is corrupted.
-
-**/
-UINT16
-ReadPTLen (
- IN SCRATCH_DATA *Sd,
- IN UINT16 nn,
- IN UINT16 nbit,
- IN UINT16 Special
- );
-
-/**
- Reads code lengths for Char&Len Set.
-
- Read in and decode the Char&Len Set Code Length Array, then
- generate the Huffman Code mapping table for the Char&Len Set.
-
- @param Sd the global scratch data
-
-**/
-VOID
-ReadCLen (
- SCRATCH_DATA *Sd
- );
-
-/**
- Decode a character/length value.
-
- Read one value from mBitBuf, Get one code from mBitBuf. If it is at block boundary, generates
- Huffman code mapping table for Extra Set, Code&Len Set and
- Position Set.
-
- @param Sd The global scratch data.
-
- @return The value decoded.
-
-**/
-UINT16
-DecodeC (
- SCRATCH_DATA *Sd
- );
-
-/**
- Decode the source data and put the resulting data into the destination buffer.
-
- Decode the source data and put the resulting data into the destination buffer.
-
- @param Sd The global scratch data
-
-**/
-VOID
-Decode (
- SCRATCH_DATA *Sd
- );
-
-RETURN_STATUS
-EFIAPI
-UefiTianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch,
- IN UINT32 Version
- );
-
-#endif
diff --git a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c b/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c deleted file mode 100644 index 8b58cfa5ea..0000000000 --- a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.c +++ /dev/null @@ -1,106 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCoreCustomDecompressLibFromHob.c
-
-Abstract:
-
- Custom Decompress Library from HOBs
-
---*/
-
-static DECOMPRESS_LIBRARY mCustomDecompress;
-
-EFI_STATUS
-EFIAPI
-DxeCoreCustomDecompressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiCustomizedDecompressProtocolGuid);
- ASSERT (GuidHob != NULL);
- CopyMem (&mCustomDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mCustomDecompress));
- return EFI_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-CustomDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mCustomDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-CustomDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mCustomDecompress.Decompress (Source, Destination, Scratch);
-}
diff --git a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa b/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa deleted file mode 100644 index 59ba0aeb99..0000000000 --- a/EdkModulePkg/Library/DxeCoreCustomDecompressLibFromHob/DxeCoreCustomDecompressLibFromHob.msa +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCoreCustomDecompressLibFromHob</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>942e0182-3e1d-47f9-92dc-4939d1a0ba00</GuidValue>
- <Version>1.0</Version>
- <Abstract>Custom Decompress Library from HOBs</Abstract>
- <Description>Instance of Decompress Library, interfaces are retrieved from HOB</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCoreCustomDecompressLibFromHob</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE">
- <Keyword>CustomDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCoreCustomDecompressLibFromHob.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiCustomizedDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes HobGuidCName="gEfiCustomizedDecompressProtocolGuid" Usage="ALWAYS_CONSUMED">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCoreCustomDecompressLibConstructor</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c deleted file mode 100644 index 727133226c..0000000000 --- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ /dev/null @@ -1,637 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCorePerformance.c
-
-Abstract:
-
- Support for measurement of DXE performance
-
---*/
-
-//
-// Interface declarations for Performance Protocol.
-//
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-StartGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- );
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-EndGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- );
-
-/**
- Retrieves a previously logged performance measurement.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntry stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
- if the retrieval is successful.
-
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.
- @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
- @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
- @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-GetGauge (
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY **GaugeDataEntry
- );
-
-//
-// Definition for global variables.
-//
-STATIC GAUGE_DATA_HEADER *mGaugeData;
-STATIC UINT32 mMaxGaugeRecords;
-
-EFI_HANDLE mHandle = NULL;
-PERFORMANCE_PROTOCOL mPerformanceInterface = {
- StartGauge,
- EndGauge,
- GetGauge
- };
-
-
-/**
- Searches in the gauge array with keyword Handle, Token and Module.
-
- This internal function searches for the gauge entry in the gauge array.
- If there is an entry that exactly matches the given key word triple
- and its end time stamp is zero, then the index of that gauge entry is returned;
- otherwise, the the number of gauge entries in the array is returned.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
-
- @retval The index of gauge entry in the array.
-
-**/
-STATIC
-UINT32
-InternalSearchForGaugeEntry (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module OPTIONAL
- )
-{
- UINT32 Index;
- UINT32 NumberOfEntries;
- GAUGE_DATA_ENTRY *GaugeEntryArray;
-
- if (Token == NULL) {
- Token = "";
- }
- if (Module == NULL) {
- Module = "";
- }
-
- NumberOfEntries = mGaugeData->NumberOfEntries;
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- for (Index = 0; Index < NumberOfEntries; Index++) {
- if ((GaugeEntryArray[Index].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&
- AsciiStrnCmp (GaugeEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- AsciiStrnCmp (GaugeEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- GaugeEntryArray[Index].EndTimeStamp == 0
- ) {
- break;
- }
- }
-
- return Index;
-}
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The data was read correctly from the device.
- @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-StartGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- GAUGE_DATA_ENTRY *GaugeEntryArray;
- UINTN GaugeDataSize;
- UINTN OldGaugeDataSize;
- GAUGE_DATA_HEADER *OldGaugeData;
- UINT32 Index;
-
- Index = mGaugeData->NumberOfEntries;
- if (Index >= mMaxGaugeRecords) {
- //
- // Try to enlarge the scale of gauge arrary.
- //
- OldGaugeData = mGaugeData;
- OldGaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;
-
- mMaxGaugeRecords *= 2;
- GaugeDataSize = sizeof (GAUGE_DATA_HEADER) + sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords;
-
- mGaugeData = AllocateZeroPool (GaugeDataSize);
- if (mGaugeData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize new data arry and migrate old data one.
- //
- mGaugeData = CopyMem (mGaugeData, OldGaugeData, OldGaugeDataSize);
-
- FreePool (OldGaugeData);
- }
-
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
- GaugeEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;
-
- if (Token != NULL) {
- AsciiStrnCpy (GaugeEntryArray[Index].Token, Token, DXE_PERFORMANCE_STRING_LENGTH);
- }
- if (Module != NULL) {
- AsciiStrnCpy (GaugeEntryArray[Index].Module, Module, DXE_PERFORMANCE_STRING_LENGTH);
- }
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
- GaugeEntryArray[Index].StartTimeStamp = TimeStamp;
-
- mGaugeData->NumberOfEntries++;
-
- return EFI_SUCCESS;
-}
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return EFI_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval EFI_SUCCESS The end of the measurement was recorded.
- @retval EFI_NOT_FOUND The specified measurement record could not be found.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-EndGauge (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- GAUGE_DATA_ENTRY *GaugeEntryArray;
- UINT32 Index;
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
-
- Index = InternalSearchForGaugeEntry (Handle, Token, Module);
- if (Index >= mGaugeData->NumberOfEntries) {
- return EFI_NOT_FOUND;
- }
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
- GaugeEntryArray[Index].EndTimeStamp = TimeStamp;
-
- return EFI_SUCCESS;
-}
-
-/**
- Retrieves a previously logged performance measurement.
-
- Retrieves the performance log entry from the performance log specified by LogEntryKey.
- If it stands for a valid entry, then EFI_SUCCESS is returned and
- GaugeDataEntry stores the pointer to that entry.
-
- @param LogEntryKey The key for the previous performance measurement log entry.
- If 0, then the first performance measurement log entry is retrieved.
- @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
- if the retrieval is successful.
-
- @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.
- @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
- @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
- @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
-
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-GetGauge (
- IN UINTN LogEntryKey,
- OUT GAUGE_DATA_ENTRY **GaugeDataEntry
- )
-{
- UINTN NumberOfEntries;
- GAUGE_DATA_ENTRY *LogEntryArray;
-
- NumberOfEntries = (UINTN) (mGaugeData->NumberOfEntries);
- if (LogEntryKey > NumberOfEntries) {
- return EFI_INVALID_PARAMETER;
- }
- if (LogEntryKey == NumberOfEntries) {
- return EFI_NOT_FOUND;
- }
-
- LogEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- if (GaugeDataEntry == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- *GaugeDataEntry = &LogEntryArray[LogEntryKey];
-
- return EFI_SUCCESS;
-}
-
-/**
- Dumps all the PEI performance log to DXE performance gauge array.
-
- This internal function dumps all the PEI performance log to the DXE performance gauge array.
- It retrieves the optional GUID HOB for PEI performance and then saves the performance data
- to DXE performance data structures.
-
-**/
-STATIC
-VOID
-InternalGetPeiPerformance (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- PEI_PERFORMANCE_LOG_HEADER *LogHob;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- GAUGE_DATA_ENTRY *GaugeEntryArray;
- UINT32 Index;
- UINT32 NumberOfEntries;
-
- NumberOfEntries = 0;
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- //
- // Dump PEI Log Entries to DXE Guage Data structure.
- //
- GuidHob = GetFirstGuidHob (&gPeiPerformanceHobGuid);
- if (GuidHob != NULL) {
- LogHob = GET_GUID_HOB_DATA (GuidHob);
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (LogHob + 1);
- GaugeEntryArray = (GAUGE_DATA_ENTRY *) (mGaugeData + 1);
-
- NumberOfEntries = LogHob->NumberOfEntries;
- for (Index = 0; Index < NumberOfEntries; Index++) {
- GaugeEntryArray[Index].Handle = LogEntryArray[Index].Handle;
- AsciiStrnCpy (GaugeEntryArray[Index].Token, LogEntryArray[Index].Token, DXE_PERFORMANCE_STRING_LENGTH);
- AsciiStrnCpy (GaugeEntryArray[Index].Module, LogEntryArray[Index].Module, DXE_PERFORMANCE_STRING_LENGTH);
- GaugeEntryArray[Index].StartTimeStamp = LogEntryArray[Index].StartTimeStamp;
- GaugeEntryArray[Index].EndTimeStamp = LogEntryArray[Index].EndTimeStamp;
- }
- }
- mGaugeData->NumberOfEntries = NumberOfEntries;
-}
-
-/**
- The constructor function initializes Performance infrastructure for DXE phase.
-
- The constructor function publishes Performance protocol, allocates memory to log DXE performance
- and merges PEI performance data to DXE performance log.
- It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS.
-
- @param ImageHandle The firmware allocated handle for the EFI image.
- @param SystemTable A pointer to the EFI System Table.
-
- @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-DxeCorePerformanceLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- if (!PerformanceMeasurementEnabled ()) {
- //
- // Do not initialize performance infrastructure if not required.
- //
- return EFI_SUCCESS;
- }
- //
- // Install the protocol interfaces.
- //
- Status = gBS->InstallProtocolInterface (
- &mHandle,
- &gPerformanceProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &mPerformanceInterface
- );
- ASSERT_EFI_ERROR (Status);
-
- mMaxGaugeRecords = INIT_DXE_GAUGE_DATA_ENTRIES + PcdGet8 (PcdMaxPeiPerformanceLogEntries);
-
- mGaugeData = AllocateZeroPool (sizeof (GAUGE_DATA_HEADER) + (sizeof (GAUGE_DATA_ENTRY) * mMaxGaugeRecords));
- ASSERT (mGaugeData != NULL);
-
- InternalGetPeiPerformance ();
-
- return Status;
-}
-
-/**
- Adds a record at the end of the performance measurement log
- that records the start time of a performance measurement.
-
- Adds a record to the end of the performance measurement log
- that contains the Handle, Token, and Module.
- The end time of the new record must be set to zero.
- If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
- If TimeStamp is zero, the start time in the record is filled in with the value
- read from the current time stamp.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The start of the measurement was recorded.
- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-RETURN_STATUS
-EFIAPI
-StartPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = StartGauge (Handle, Token, Module, TimeStamp);
- return (RETURN_STATUS) Status;
-}
-
-/**
- Searches the performance measurement log from the beginning of the log
- for the first matching record that contains a zero end time and fills in a valid end time.
-
- Searches the performance measurement log from the beginning of the log
- for the first record that matches Handle, Token, and Module and has an end time value of zero.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then the end time in the record is filled in with the value specified by TimeStamp.
- If the record is found and TimeStamp is zero, then the end time in the matching record
- is filled in with the current time stamp value.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The end of the measurement was recorded.
- @retval RETURN_NOT_FOUND The specified measurement record could not be found.
-
-**/
-RETURN_STATUS
-EFIAPI
-EndPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = EndGauge (Handle, Token, Module, TimeStamp);
- return (RETURN_STATUS) Status;
-}
-
-/**
- Attempts to retrieve a performance measurement log entry from the performance measurement log.
-
- Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
- zero on entry, then an attempt is made to retrieve the first entry from the performance log,
- and the key for the second entry in the log is returned. If the performance log is empty,
- then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
- log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
- returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
- retrieved and an implementation specific non-zero key value that specifies the end of the performance
- log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
- is retrieved and zero is returned. In the cases where a performance log entry can be returned,
- the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
- If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
- If Handle is NULL, then ASSERT().
- If Token is NULL, then ASSERT().
- If Module is NULL, then ASSERT().
- If StartTimeStamp is NULL, then ASSERT().
- If EndTimeStamp is NULL, then ASSERT().
-
- @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
- 0, then the first performance measurement log entry is retrieved.
- On exit, the key of the next performance lof entry entry.
- @param Handle Pointer to environment specific context used to identify the component
- being measured.
- @param Token Pointer to a Null-terminated ASCII string that identifies the component
- being measured.
- @param Module Pointer to a Null-terminated ASCII string that identifies the module
- being measured.
- @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was started.
- @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was ended.
-
- @return The key for the next performance log entry (in general case).
-
-**/
-UINTN
-EFIAPI
-GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
- )
-{
- EFI_STATUS Status;
- GAUGE_DATA_ENTRY *GaugeData;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
-
- Status = GetGauge (LogEntryKey++, &GaugeData);
-
- //
- // Make sure that LogEntryKey is a valid log entry key,
- //
- ASSERT (Status != EFI_INVALID_PARAMETER);
-
- if (EFI_ERROR (Status)) {
- //
- // The LogEntryKey is the last entry (equals to the total entry number).
- //
- return 0;
- }
-
- ASSERT (GaugeData != NULL);
-
- *Handle = (VOID *) (UINTN) GaugeData->Handle;
- *Token = GaugeData->Token;
- *Module = GaugeData->Module;
- *StartTimeStamp = GaugeData->StartTimeStamp;
- *EndTimeStamp = GaugeData->EndTimeStamp;
-
- return LogEntryKey;
-}
-
-/**
- Returns TRUE if the performance measurement macros are enabled.
-
- This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set.
- @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-PerformanceMeasurementEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa b/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa deleted file mode 100644 index 444867af86..0000000000 --- a/EdkModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.msa +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCorePerformanceLib</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>D0F78BBF-0A30-4c63-8A48-0F618A4AFACD</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for DxeCore Performance Library</Abstract>
- <Description>This library provides intrastructure for DxeCore to log performance.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCorePerformanceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TimerLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCorePerformanceLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_PRODUCED">
- <ProtocolCName>gPerformanceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gPeiPerformanceHobGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCorePerformanceLibConstructor</Constructor>
- </Extern>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of - Performance Measurement.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdMaxPeiPerformanceLogEntries</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Maximun number of performance log entries during PEI phase.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c b/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c deleted file mode 100644 index 54f0bc22f0..0000000000 --- a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.c +++ /dev/null @@ -1,107 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCoreTianoDecompressLibFromHob.c
-
-Abstract:
-
- Tiano Decompress Library from HOBs
-
---*/
-
-static DECOMPRESS_LIBRARY mTianoDecompress;
-
-EFI_STATUS
-EFIAPI
-DxeCoreTianoDecompressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiTianoDecompressProtocolGuid);
- ASSERT (GuidHob != NULL);
- CopyMem (&mTianoDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mTianoDecompress));
- return EFI_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mTianoDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-TianoDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mTianoDecompress.Decompress (Source, Destination, Scratch);
-}
-
diff --git a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa b/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa deleted file mode 100644 index 4542089038..0000000000 --- a/EdkModulePkg/Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.msa +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCoreTianoDecompressLibFromHob</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>cef487a1-751d-4fe0-a39b-e6892b4610c8</GuidValue>
- <Version>1.0</Version>
- <Abstract>Tiano Decompress Library from HOBs</Abstract>
- <Description>Instance of Decompress Library, interface is retrieved from HOB.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCoreTianoDecompressLibFromHob</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>TianoDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCoreTianoDecompressLibFromHob.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiTianoDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes HobGuidCName="gEfiTianoDecompressProtocolGuid" Usage="ALWAYS_CONSUMED">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCoreTianoDecompressLibConstructor</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c b/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c deleted file mode 100644 index d0bf854fb6..0000000000 --- a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.c +++ /dev/null @@ -1,106 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxeCoreUefiDecompressLibFromHob.c
-
-Abstract:
-
- UEFI Decompress Library from HOBs
-
---*/
-
-static DECOMPRESS_LIBRARY mEfiDecompress;
-
-EFI_STATUS
-EFIAPI
-DxeCoreUefiDecompressLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiDecompressProtocolGuid);
- ASSERT (GuidHob != NULL);
- CopyMem (&mEfiDecompress, GET_GUID_HOB_DATA (GuidHob), sizeof (mEfiDecompress));
- return EFI_SUCCESS;
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompressGetInfo (
- IN CONST VOID *Source,
- IN UINT32 SourceSize,
- OUT UINT32 *DestinationSize,
- OUT UINT32 *ScratchSize
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- SourceSize - The size of source buffer
- DestinationSize - The size of destination buffer.
- ScratchSize - The size of scratch buffer.
-
-Returns:
-
- RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mEfiDecompress.GetInfo (Source, SourceSize, DestinationSize, ScratchSize);
-}
-
-RETURN_STATUS
-EFIAPI
-UefiDecompress (
- IN CONST VOID *Source,
- IN OUT VOID *Destination,
- IN OUT VOID *Scratch
- )
-/*++
-
-Routine Description:
-
- The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
-
-Arguments:
-
- Source - The source buffer containing the compressed data.
- Destination - The destination buffer to store the decompressed data
- Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
-
-Returns:
-
- RETURN_SUCCESS - Decompression is successfull
- RETURN_INVALID_PARAMETER - The source data is corrupted
-
---*/
-{
- return mEfiDecompress.Decompress (Source, Destination, Scratch);
-}
diff --git a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa b/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa deleted file mode 100644 index d137496e1e..0000000000 --- a/EdkModulePkg/Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.msa +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeCoreUefiDecompressLibFromHob</ModuleName>
- <ModuleType>DXE_CORE</ModuleType>
- <GuidValue>5c12c06f-5cf8-48a6-9860-6c5b2c036bbf</GuidValue>
- <Version>1.0</Version>
- <Abstract>UEFI Decompress Library from HOBs</Abstract>
- <Description>Instance of Decompression library based on EFI_DECOMPRESS_PROTOCOL_GUID'ed HOB</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxeCoreUefiDecompressLibFromHob</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>UefiDecompressLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxeCoreUefiDecompressLibFromHob.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiDecompressProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Hobs>
- <HobTypes HobGuidCName="gEfiDecompressProtocolGuid" Usage="ALWAYS_CONSUMED">
- <HobType>GUID_EXTENSION</HobType>
- </HobTypes>
- </Hobs>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>DxeCoreUefiDecompressLibConstructor</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c b/EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c deleted file mode 100644 index cf3ac787bd..0000000000 --- a/EdkModulePkg/Library/DxeDebugLibSerialPort/DebugLib.c +++ /dev/null @@ -1,243 +0,0 @@ -/** @file
- UEFI Debug Library that uses PrintLib to send messages to CONOUT.
-
- Copyright (c) 2006, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-//
-// Define the maximum debug and assert message length that this library supports
-//
-#define MAX_DEBUG_MESSAGE_LENGTH 0x100
-
-
-/**
-
- Prints a debug message to the debug output device if the specified error level is enabled.
-
- If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print
- the message specified by Format and the associated variable argument list to
- the debug output device.
-
- If Format is NULL, then ASSERT().
-
- @param ErrorLevel The error level of the debug message.
- @param Format Format string for the debug message to print.
-
-**/
-VOID
-EFIAPI
-DebugPrint (
- IN UINTN ErrorLevel,
- IN CONST CHAR8 *Format,
- ...
- )
-{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
- VA_LIST Marker;
-
- //
- // If Format is NULL, then ASSERT().
- //
- ASSERT (Format != NULL);
-
- //
- // Check driver debug mask value and global mask
- //
- if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {
- return;
- }
-
- //
- // Convert the DEBUG() message to an ASCII String
- //
- VA_START (Marker, Format);
- AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
- VA_END (Marker);
-
- //
- // Send the print string to a Serial Port
- //
- SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer));
-}
-
-
-/**
-
- Prints an assert message containing a filename, line number, and description.
- This may be followed by a breakpoint or a dead loop.
-
- Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
- to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
- PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
- DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
- CpuDeadLoop() is called. If neither of these bits are set, then this function
- returns immediately after the message is printed to the debug output device.
- DebugAssert() must actively prevent recusrsion. If DebugAssert() is called while
- processing another DebugAssert(), then DebugAssert() must return immediately.
-
- If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
-
- If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
-
- @param FileName Pointer to the name of the source file that generated the assert condition.
- @param LineNumber The line number in the source file that generated the assert condition
- @param Description Pointer to the description of the assert condition.
-
-**/
-VOID
-EFIAPI
-DebugAssert (
- IN CONST CHAR8 *FileName,
- IN UINTN LineNumber,
- IN CONST CHAR8 *Description
- )
-{
- CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-
- //
- // Generate the ASSERT() message in Unicode format
- //
- AsciiSPrint (Buffer, sizeof (Buffer), "ASSERT %a(%d): %a\n", FileName, LineNumber, Description);
-
- //
- // Send the print string to the Console Output device
- //
- SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen(Buffer));
-
- //
- // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings
- //
- if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {
- CpuBreakpoint ();
- } else if ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {
- CpuDeadLoop ();
- }
-}
-
-
-/**
-
- Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
-
- This function fills Length bytes of Buffer with the value specified by
- PcdDebugClearMemoryValue, and returns Buffer.
-
- If Buffer is NULL, then ASSERT().
-
- If Length is greater than (MAX_ADDRESS ? Buffer + 1), then ASSERT().
-
- @param Buffer Pointer to the target buffer to fill with PcdDebugClearMemoryValue.
- @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
-
- @return Buffer
-
-**/
-VOID *
-EFIAPI
-DebugClearMemory (
- OUT VOID *Buffer,
- IN UINTN Length
- )
-{
- //
- // If Buffer is NULL, then ASSERT().
- //
- ASSERT (Buffer != NULL);
-
- //
- // SetMem() checks for the the ASSERT() condition on Length and returns Buffer
- //
- return SetMem (Buffer, Length, PcdGet8(PcdDebugClearMemoryValue));
-}
-
-
-/**
-
- Returns TRUE if ASSERT() macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugAssertEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG()macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugPrintEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG_CODE()macros are enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugCodeEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);
-}
-
-
-/**
-
- Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
-
- This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
- PcdDebugProperyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
- @retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-DebugClearMemoryEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa b/EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa deleted file mode 100644 index ddfb3ec506..0000000000 --- a/EdkModulePkg/Library/DxeDebugLibSerialPort/DxeDebugLibSerialPort.msa +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxeDebugLibSerialPort</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>BB83F95F-EDBC-4884-A520-CD42AF388FAE</GuidValue>
- <Version>1.0</Version>
- <Abstract>Debug Library for UEFI drivers</Abstract>
- <Description>Library to abstract Framework extensions that conflict with UEFI 2.0 Specification</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>UefiDebugLibConOut</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DebugLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of Debug - Assert, Debug Print, Debug Code, Clear Memory, Assert - Breakpoint and Assert Deadloop.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdDebugClearMemoryValue</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The value used by DebugClearMemory () to fill a certain range - of memory.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdDebugPrintErrorLevel</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the kind of debug message - output when Debug Print is enabled.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c b/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c deleted file mode 100644 index d143039828..0000000000 --- a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c +++ /dev/null @@ -1,250 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DxePerformanceLib.c
-
-Abstract:
-
- Performance Library
-
---*/
-
-STATIC PERFORMANCE_PROTOCOL *mPerformance = NULL;
-
-/**
- The constructor function caches the pointer to Performance protocol.
-
- The constructor function locates Performance protocol from protocol database.
- It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
-
- @retval EFI_SUCCESS Performance protocol is successfully located.
- @retval Other Performance protocol is not located to log performance.
-
-**/
-STATIC
-EFI_STATUS
-GetPerformanceProtocol (
- VOID
- )
-{
- EFI_STATUS Status;
- PERFORMANCE_PROTOCOL *Performance;
-
- if (mPerformance != NULL) {
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID **) &Performance);
- if (!EFI_ERROR (Status)) {
- ASSERT (Performance != NULL);
- //
- // Cache performance protocol.
- //
- mPerformance = Performance;
- }
-
- return Status;
-}
-
-/**
- Creates a record for the beginning of a performance measurement.
-
- Creates a record that contains the Handle, Token, and Module.
- If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
- If TimeStamp is zero, then this function reads the current time stamp
- and adds that time stamp value to the record as the start time.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The start of the measurement was recorded.
- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-RETURN_STATUS
-EFIAPI
-StartPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return RETURN_OUT_OF_RESOURCES;
- }
-
- Status = mPerformance->StartGauge (Handle, Token, Module, TimeStamp);
-
- return (RETURN_STATUS) Status;
-}
-
-/**
- Fills in the end time of a performance measurement.
-
- Looks up the record that matches Handle, Token, and Module.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then TimeStamp is added to the record as the end time.
- If the record is found and TimeStamp is zero, then this function reads
- the current time stamp and adds that time stamp value to the record as the end time.
- If this function is called multiple times for the same record, then the end time is overwritten.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The end of the measurement was recorded.
- @retval RETURN_NOT_FOUND The specified measurement record could not be found.
-
-**/
-RETURN_STATUS
-EFIAPI
-EndPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- EFI_STATUS Status;
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return RETURN_NOT_FOUND;
- }
-
- Status = mPerformance->EndGauge (Handle, Token, Module, TimeStamp);
-
- return (RETURN_STATUS) Status;
-}
-
-/**
- Attempts to retrieve a performance measurement log entry from the performance measurement log.
-
- Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
- zero on entry, then an attempt is made to retrieve the first entry from the performance log,
- and the key for the second entry in the log is returned. If the performance log is empty,
- then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
- log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
- returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
- retrieved and an implementation specific non-zero key value that specifies the end of the performance
- log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
- is retrieved and zero is returned. In the cases where a performance log entry can be returned,
- the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
- If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
- If Handle is NULL, then ASSERT().
- If Token is NULL, then ASSERT().
- If Module is NULL, then ASSERT().
- If StartTimeStamp is NULL, then ASSERT().
- If EndTimeStamp is NULL, then ASSERT().
-
- @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
- 0, then the first performance measurement log entry is retrieved.
- On exit, the key of the next performance lof entry entry.
- @param Handle Pointer to environment specific context used to identify the component
- being measured.
- @param Token Pointer to a Null-terminated ASCII string that identifies the component
- being measured.
- @param Module Pointer to a Null-terminated ASCII string that identifies the module
- being measured.
- @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was started.
- @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was ended.
-
- @return The key for the next performance log entry (in general case).
-
-**/
-UINTN
-EFIAPI
-GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
- )
-{
- EFI_STATUS Status;
- GAUGE_DATA_ENTRY *GaugeData;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return 0;
- }
-
- Status = mPerformance->GetGauge (LogEntryKey++, &GaugeData);
-
- //
- // Make sure that LogEntryKey is a valid log entry key,
- //
- ASSERT (Status != EFI_INVALID_PARAMETER);
-
- if (EFI_ERROR (Status)) {
- //
- // The LogEntryKey is the last entry (equals to the total entry number).
- //
- return 0;
- }
-
- ASSERT (GaugeData != NULL);
-
- *Handle = (VOID *) (UINTN) GaugeData->Handle;
- *Token = GaugeData->Token;
- *Module = GaugeData->Module;
- *StartTimeStamp = GaugeData->StartTimeStamp;
- *EndTimeStamp = GaugeData->EndTimeStamp;
-
- return LogEntryKey;
-}
-
-/**
- Returns TRUE if the performance measurement macros are enabled.
-
- This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set.
- @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-PerformanceMeasurementEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa b/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa deleted file mode 100644 index 3555a24da0..0000000000 --- a/EdkModulePkg/Library/DxePerformanceLib/DxePerformanceLib.msa +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>DxePerformanceLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>8B8B4CCC-65FC-41a5-8067-308B8E42CCF2</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Dxe Performance Library</Abstract>
- <Description>This library provides intrastructure for Dxe driver to log performance.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>DxePerformanceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>DxePerformanceLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gPerformanceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of - Performance Measurement.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa b/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa deleted file mode 100644 index 7351c7351a..0000000000 --- a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxePeCoffLoaderFromHobLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>ed3de5c8-c389-44f2-a35e-2ebdc9802a49</GuidValue>
- <Version>1.0</Version>
- <Abstract>EdkPeCoffLoaderLib library instance</Abstract>
- <Description>This library gets PeCoffLoader Protocol from Hob List</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxePeCoffLoaderFromHobLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkPeCoffLoaderLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeCoff.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiPeiPeCoffLoaderGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c b/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c deleted file mode 100644 index 7afe9c2446..0000000000 --- a/EdkModulePkg/Library/EdkDxePeCoffLoaderFromHobLib/PeCoff.c +++ /dev/null @@ -1,38 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Decompress.c
-
-Abstract:
-
---*/
-
-
-
-
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *
-EFIAPI
-GetPeCoffLoaderProtocol (
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
-
- GuidHob = GetFirstGuidHob (&gEfiPeiPeCoffLoaderGuid);
- if (GuidHob == NULL) {
- return NULL;
- } else {
- return (EFI_PEI_PE_COFF_LOADER_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
- }
-}
-
diff --git a/EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa b/EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa deleted file mode 100644 index d302a8bae6..0000000000 --- a/EdkModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.msa +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxePrintLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>50bcb105-6634-441d-b403-659110a03ad2</GuidValue>
- <Version>1.0</Version>
- <Abstract>DXE Print library</Abstract>
- <Description>Print Library based on EFI_PRINT_PROTOCOL</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxePrintLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PrintLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiPrintProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c b/EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c deleted file mode 100644 index 30c0354021..0000000000 --- a/EdkModulePkg/Library/EdkDxePrintLib/PrintLib.c +++ /dev/null @@ -1,145 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PrintLib.c
-
-Abstract:
-
- Print Library
-
---*/
-
-
-
-static EFI_PRINT_PROTOCOL *gPrintProtocol = NULL;
-
-UINTN
-UnicodeVSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR16 *FormatString,
- IN VA_LIST Marker
- )
-/*++
-
-Routine Description:
-
- VSPrint function to process format and place the results in Buffer. Since a
- VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
- this is the main print working routine
-
-Arguments:
-
- StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
-
- BufferSize - Maximum number of characters to put into buffer. Zero means
- no limit.
-
- FormatString - Unicode format string see file header for more details.
-
- Marker - Vararg list consumed by processing Format.
-
-Returns:
-
- Number of characters printed.
-
---*/
-{
- EFI_STATUS Status;
-
- if (gPrintProtocol == NULL) {
- Status = gBS->LocateProtocol (
- &gEfiPrintProtocolGuid,
- NULL,
- (VOID **)&gPrintProtocol
- );
- if (EFI_ERROR (Status)) {
- gPrintProtocol = NULL;
- }
- if (gPrintProtocol == NULL) {
- return 0;
- }
- }
- return gPrintProtocol->VSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
-}
-
-UINTN
-UnicodeSPrint (
- OUT CHAR16 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR16 *FormatString,
- ...
- )
-
-{
- UINTN Return;
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- Return = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
- VA_END (Marker);
- return Return;
-}
-
-UINTN
-AsciiVSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR8 *FormatString,
- IN VA_LIST Marker
- )
-/*++
-
-Routine Description:
-
- VSPrint function to process format and place the results in Buffer. Since a
- VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
- this is the main print working routine
-
-Arguments:
-
- StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
-
- BufferSize - Maximum number of characters to put into buffer. Zero means
- no limit.
-
- FormatString - Unicode format string see file header for more details.
-
- Marker - Vararg list consumed by processing Format.
-
-Returns:
-
- Number of characters printed.
-
---*/
-{
- return 0;
-}
-
-UINTN
-AsciiSPrint (
- OUT CHAR8 *StartOfBuffer,
- IN UINTN BufferSize,
- IN const CHAR8 *FormatString,
- ...
- )
-
-{
- UINTN Return;
- VA_LIST Marker;
-
- VA_START (Marker, FormatString);
- Return = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
- VA_END (Marker);
- return Return;
-}
diff --git a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa b/EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa deleted file mode 100644 index 24a56a2155..0000000000 --- a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/EdkDxeRuntimeSalLib.msa +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxeRuntimeSalLib</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>61999c3c-72a5-4506-a4ff-4271d18a1d14</GuidValue>
- <Version>1.0</Version>
- <Abstract>SAL library for BS/RT drivers</Abstract>
- <Description>Contains APIs to register/invoke SAL functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxeSalLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_RUNTIME_DRIVER DXE_SAL_DRIVER">
- <Keyword>EdkDxeSalLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>
- <Filename SupArchList="IPF">Ipf/AsmEsalServiceLib.s</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <SetVirtualAddressMapCallBack>DxeSalVirtualNotifyEvent</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s b/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s deleted file mode 100644 index c5cb881fe2..0000000000 --- a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/AsmEsalServiceLib.s +++ /dev/null @@ -1,149 +0,0 @@ -//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// EsalLib.s
-//
-// Abstract:
-//
-//
-// Revision History:
-//
-//--
-
-.file "EsalLib.s"
-
-#include "IpfMacro.i"
-
-//
-// Exports
-//
-.globl GetEsalEntryPoint
-
-
-//-----------------------------------------------------------------------------
-//++
-// GetEsalEntryPoint
-//
-// Return Esal global and PSR register.
-//
-// On Entry :
-//
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-// r9 = Physical Plabel
-// r10 = Virtual Plabel
-// r11 = psr
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (GetEsalEntryPoint)
-
- NESTED_SETUP (0,8,0,0)
-
-EsalCalcStart:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart), r8;;
- mov r9 = r8;;
- add r10 = 0x10, r8;;
- mov r11 = psr;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (GetEsalEntryPoint)
-
-
-
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalPhysicalEntryPoint
-//
-// Set the dispatcher entry point
-//
-// On Entry:
-// in0 = Physical address of Esal Dispatcher
-// in1 = Physical GP
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalPhysicalEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart1:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart1), r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalPhysicalEntryPoint)
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalVirtualEntryPoint
-//
-// Register physical address of Esal globals.
-//
-// On Entry :
-// in0 = Virtual address of Esal Dispatcher
-// in1 = Virtual GP
-//
-// Return Value:
-// r8 = EFI_SAL_ERROR
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalVirtualEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart2:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart2), r8;;
- add r8 = 0x10, r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalVirtualEntryPoint)
-
-
-
-
-.align 32
-EsalEntryPoint:
- data8 0 // Physical Entry
- data8 0 // GP
- data8 0 // Virtual Entry
- data8 0 // GP
-
-
diff --git a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c b/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c deleted file mode 100644 index 471525a9fc..0000000000 --- a/EdkModulePkg/Library/EdkDxeRuntimeSalLib/Ipf/EsalServiceLib.c +++ /dev/null @@ -1,280 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EsalServiceLib.c
-
-Abstract:
-
---*/
-
-#include <Ipf/IpfDefines.h>
-
-EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;
-EFI_PLABEL mPlabel;
-
-STATIC
-EFI_STATUS
-EFIAPI
-DxeSalLibInitialize (
- VOID
- )
-{
- EFI_PLABEL *Plabel;
- EFI_STATUS Status;
-
- if (mEsalBootService != NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // The protocol contains a function pointer, which is an indirect procedure call.
- // An indirect procedure call goes through a plabel, and pointer to a function is
- // a pointer to a plabel. To implement indirect procedure calls that can work in
- // both physical and virtual mode, two plabels are required (one physical and one
- // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
- // away. We cache it in a module global, so we can register the vitrual version.
- //
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, (VOID **) &mEsalBootService);
- if (EFI_ERROR (Status)) {
- mEsalBootService = NULL;
- return EFI_SUCCESS;
- }
-
- Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;
-
- mPlabel.EntryPoint = Plabel->EntryPoint;
- mPlabel.GP = Plabel->GP;
- SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-
- return EFI_SUCCESS;
-}
-
-VOID
-EFIAPI
-DxeSalVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Fixup virtual address pointer of label.
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- UINT64 PhysicalEntryPoint;
-
- PhysicalEntryPoint = mPlabel.EntryPoint;
-
- EfiConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);
- mPlabel.GP += mPlabel.EntryPoint - PhysicalEntryPoint;
-
- SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalFunction (
- IN UINT64 FunctionId,
- IN EFI_GUID *ClassGuid,
- IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
- IN VOID *ModuleGlobal
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class Function and it's asociated global.
- This function is boot service only!
-
-Arguments:
- FunctionId - ID of function to register
- ClassGuid - GUID of function class
- Function - Function to register under ClassGuid/FunctionId pair
- ModuleGlobal - Module global for Function.
-
-Returns:
- EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
-
---*/
-{
- DxeSalLibInitialize ();
- return mEsalBootService->AddExtendedSalProc (
- mEsalBootService,
- ClassGuid,
- FunctionId,
- Function,
- ModuleGlobal
- );
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalClass (
- IN EFI_GUID *ClassGuid,
- IN VOID *ModuleGlobal,
- ...
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class and it's asociated global.
- This function is boot service only!
-
-Arguments:
- ClassGuid - GUID of function class
- ModuleGlobal - Module global for Function.
- ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
- indicates the end of the list.
-
-Returns:
- EFI_SUCCESS - All members of ClassGuid registered
-
---*/
-{
- VA_LIST Args;
- EFI_STATUS Status;
- SAL_INTERNAL_EXTENDED_SAL_PROC Function;
- UINT64 FunctionId;
- EFI_HANDLE NewHandle;
-
- VA_START (Args, ModuleGlobal);
-
- Status = EFI_SUCCESS;
- while (!EFI_ERROR (Status)) {
- Function = (SAL_INTERNAL_EXTENDED_SAL_PROC) VA_ARG (Args, SAL_INTERNAL_EXTENDED_SAL_PROC);
- if (Function == NULL) {
- break;
- }
-
- FunctionId = VA_ARG (Args, UINT64);
-
- Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- NewHandle = NULL;
- return gBS->InstallProtocolInterface (
- &NewHandle,
- ClassGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
-}
-
-SAL_RETURN_REGS
-EFIAPI
-EfiCallEsalService (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- )
-/*++
-
-Routine Description:
-
- Call module that is not linked direclty to this module. This code is IP
- relative and hides the binding issues of virtual or physical calling. The
- function that gets dispatched has extra arguments that include the registered
- module global and a boolean flag to indicate if the system is in virutal mode.
-
-Arguments:
- ClassGuid - GUID of function
- FunctionId - Function in ClassGuid to call
- Arg2 - Argument 2 ClassGuid/FunctionId defined
- Arg3 - Argument 3 ClassGuid/FunctionId defined
- Arg4 - Argument 4 ClassGuid/FunctionId defined
- Arg5 - Argument 5 ClassGuid/FunctionId defined
- Arg6 - Argument 6 ClassGuid/FunctionId defined
- Arg7 - Argument 7 ClassGuid/FunctionId defined
- Arg8 - Argument 8 ClassGuid/FunctionId defined
-
-Returns:
- Status of ClassGuid/FuncitonId
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- SAL_EXTENDED_SAL_PROC EsalProc;
-
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
-
- //
- // Look at the physical mode ESAL entry point to determine of the ESAL entry point has been initialized
- //
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // Both the function ponter and the GP value are zero, so attempt to initialize the ESAL Entry Point
- //
- DxeSalLibInitialize ();
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // The ESAL Entry Point could not be initialized
- //
- ReturnReg.Status = EFI_SAL_ERROR;
- return ReturnReg;
- }
- }
-
- if (ReturnReg.r11 & PSR_IT_MASK) {
- //
- // Virtual mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r10;
- } else {
- //
- // Physical mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r9;
- }
-
- return EsalProc (
- ClassGuid,
- FunctionId,
- Arg2,
- Arg3,
- Arg4,
- Arg5,
- Arg6,
- Arg7,
- Arg8
- );
-}
diff --git a/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa b/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa deleted file mode 100644 index 3b55b13a06..0000000000 --- a/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkDxeSalLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>F0AC8548-34DE-45bd-9B0A-A5A2DE819E65</GuidValue>
- <Version>1.0</Version>
- <Abstract>SAL library for BS/RT drivers</Abstract>
- <Description>Contains APIs to register/invoke SAL functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkDxeSalLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkDxeSalLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>
- <Filename SupArchList="IPF">Ipf/AsmEsalServiceLib.s</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s b/EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s deleted file mode 100644 index c5cb881fe2..0000000000 --- a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmEsalServiceLib.s +++ /dev/null @@ -1,149 +0,0 @@ -//++
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// EsalLib.s
-//
-// Abstract:
-//
-//
-// Revision History:
-//
-//--
-
-.file "EsalLib.s"
-
-#include "IpfMacro.i"
-
-//
-// Exports
-//
-.globl GetEsalEntryPoint
-
-
-//-----------------------------------------------------------------------------
-//++
-// GetEsalEntryPoint
-//
-// Return Esal global and PSR register.
-//
-// On Entry :
-//
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-// r9 = Physical Plabel
-// r10 = Virtual Plabel
-// r11 = psr
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (GetEsalEntryPoint)
-
- NESTED_SETUP (0,8,0,0)
-
-EsalCalcStart:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart), r8;;
- mov r9 = r8;;
- add r10 = 0x10, r8;;
- mov r11 = psr;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (GetEsalEntryPoint)
-
-
-
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalPhysicalEntryPoint
-//
-// Set the dispatcher entry point
-//
-// On Entry:
-// in0 = Physical address of Esal Dispatcher
-// in1 = Physical GP
-//
-// Return Value:
-// r8 = EFI_SAL_SUCCESS
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalPhysicalEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart1:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart1), r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalPhysicalEntryPoint)
-
-
-//-----------------------------------------------------------------------------
-//++
-// SetEsalVirtualEntryPoint
-//
-// Register physical address of Esal globals.
-//
-// On Entry :
-// in0 = Virtual address of Esal Dispatcher
-// in1 = Virtual GP
-//
-// Return Value:
-// r8 = EFI_SAL_ERROR
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY (SetEsalVirtualEntryPoint)
-
- NESTED_SETUP (2,8,0,0)
-
-EsalCalcStart2:
- mov r8 = ip;;
- add r8 = (EsalEntryPoint - EsalCalcStart2), r8;;
- add r8 = 0x10, r8;;
- st8 [r8] = in0;;
- add r8 = 0x08, r8;;
- st8 [r8] = in1;;
- mov r8 = r0;;
-
- NESTED_RETURN
-
-PROCEDURE_EXIT (SetEsalVirtualEntryPoint)
-
-
-
-
-.align 32
-EsalEntryPoint:
- data8 0 // Physical Entry
- data8 0 // GP
- data8 0 // Virtual Entry
- data8 0 // GP
-
-
diff --git a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c b/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c deleted file mode 100644 index 98a401efda..0000000000 --- a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c +++ /dev/null @@ -1,246 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EsalServiceLib.c
-
-Abstract:
-
---*/
-
-#include <Ipf/IpfDefines.h>
-
-EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService = NULL;
-EFI_PLABEL mPlabel;
-
-STATIC
-EFI_STATUS
-EFIAPI
-DxeSalLibInitialize (
- VOID
- )
-{
- EFI_PLABEL *Plabel;
- EFI_STATUS Status;
-
- if (mEsalBootService != NULL) {
- return EFI_SUCCESS;
- }
-
- //
- // The protocol contains a function pointer, which is an indirect procedure call.
- // An indirect procedure call goes through a plabel, and pointer to a function is
- // a pointer to a plabel. To implement indirect procedure calls that can work in
- // both physical and virtual mode, two plabels are required (one physical and one
- // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
- // away. We cache it in a module global, so we can register the vitrual version.
- //
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, (VOID **) &mEsalBootService);
- if (EFI_ERROR (Status)) {
- mEsalBootService = NULL;
- return EFI_SUCCESS;
- }
-
- Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;
-
- mPlabel.EntryPoint = Plabel->EntryPoint;
- mPlabel.GP = Plabel->GP;
- SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalFunction (
- IN UINT64 FunctionId,
- IN EFI_GUID *ClassGuid,
- IN SAL_INTERNAL_EXTENDED_SAL_PROC Function,
- IN VOID *ModuleGlobal
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class Function and it's asociated global.
- This function is boot service only!
-
-Arguments:
- FunctionId - ID of function to register
- ClassGuid - GUID of function class
- Function - Function to register under ClassGuid/FunctionId pair
- ModuleGlobal - Module global for Function.
-
-Returns:
- EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
-
---*/
-{
- DxeSalLibInitialize ();
- return mEsalBootService->AddExtendedSalProc (
- mEsalBootService,
- ClassGuid,
- FunctionId,
- Function,
- ModuleGlobal
- );
-}
-
-EFI_STATUS
-EFIAPI
-RegisterEsalClass (
- IN EFI_GUID *ClassGuid,
- IN VOID *ModuleGlobal,
- ...
- )
-/*++
-
-Routine Description:
-
- Register ESAL Class and it's asociated global.
- This function is boot service only!
-
-Arguments:
- ClassGuid - GUID of function class
- ModuleGlobal - Module global for Function.
- ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
- indicates the end of the list.
-
-Returns:
- EFI_SUCCESS - All members of ClassGuid registered
-
---*/
-{
- VA_LIST Args;
- EFI_STATUS Status;
- SAL_INTERNAL_EXTENDED_SAL_PROC Function;
- UINT64 FunctionId;
- EFI_HANDLE NewHandle;
-
- VA_START (Args, ModuleGlobal);
-
- Status = EFI_SUCCESS;
- while (!EFI_ERROR (Status)) {
- Function = (SAL_INTERNAL_EXTENDED_SAL_PROC) VA_ARG (Args, SAL_INTERNAL_EXTENDED_SAL_PROC);
- if (Function == NULL) {
- break;
- }
-
- FunctionId = VA_ARG (Args, UINT64);
-
- Status = RegisterEsalFunction (FunctionId, ClassGuid, Function, ModuleGlobal);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- NewHandle = NULL;
- return gBS->InstallProtocolInterface (
- &NewHandle,
- ClassGuid,
- EFI_NATIVE_INTERFACE,
- NULL
- );
-}
-
-SAL_RETURN_REGS
-EFIAPI
-EfiCallEsalService (
- IN EFI_GUID *ClassGuid,
- IN UINT64 FunctionId,
- IN UINT64 Arg2,
- IN UINT64 Arg3,
- IN UINT64 Arg4,
- IN UINT64 Arg5,
- IN UINT64 Arg6,
- IN UINT64 Arg7,
- IN UINT64 Arg8
- )
-/*++
-
-Routine Description:
-
- Call module that is not linked direclty to this module. This code is IP
- relative and hides the binding issues of virtual or physical calling. The
- function that gets dispatched has extra arguments that include the registered
- module global and a boolean flag to indicate if the system is in virutal mode.
-
-Arguments:
- ClassGuid - GUID of function
- FunctionId - Function in ClassGuid to call
- Arg2 - Argument 2 ClassGuid/FunctionId defined
- Arg3 - Argument 3 ClassGuid/FunctionId defined
- Arg4 - Argument 4 ClassGuid/FunctionId defined
- Arg5 - Argument 5 ClassGuid/FunctionId defined
- Arg6 - Argument 6 ClassGuid/FunctionId defined
- Arg7 - Argument 7 ClassGuid/FunctionId defined
- Arg8 - Argument 8 ClassGuid/FunctionId defined
-
-Returns:
- Status of ClassGuid/FuncitonId
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- SAL_EXTENDED_SAL_PROC EsalProc;
-
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
-
- //
- // Look at the physical mode ESAL entry point to determine of the ESAL entry point has been initialized
- //
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // Both the function ponter and the GP value are zero, so attempt to initialize the ESAL Entry Point
- //
- DxeSalLibInitialize ();
- ReturnReg = GetEsalEntryPoint ();
- if (ReturnReg.Status != EFI_SAL_SUCCESS) {
- return ReturnReg;
- }
- if (*(UINT64 *)ReturnReg.r9 == 0 && *(UINT64 *)(ReturnReg.r9 + 8) == 0) {
- //
- // The ESAL Entry Point could not be initialized
- //
- ReturnReg.Status = EFI_SAL_ERROR;
- return ReturnReg;
- }
- }
-
- if (ReturnReg.r11 & PSR_IT_MASK) {
- //
- // Virtual mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r10;
- } else {
- //
- // Physical mode plabel to entry point
- //
- EsalProc = (SAL_EXTENDED_SAL_PROC) ReturnReg.r9;
- }
-
- return EsalProc (
- ClassGuid,
- FunctionId,
- Arg2,
- Arg3,
- Arg4,
- Arg5,
- Arg6,
- Arg7,
- Arg8
- );
-}
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa b/EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa deleted file mode 100644 index 08322c1e3c..0000000000 --- a/EdkModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.msa +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkFvbServiceLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>bd4d540e-04b0-4b10-8fd5-4a7bb533cf67</GuidValue>
- <Version>1.0</Version>
- <Abstract>FvbService Library for UEFI drivers</Abstract>
- <Description>This library instance provide sevice functions to access Firmware Volume Block protocol.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkFvbServiceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkFvbServiceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Fvb.h</Filename>
- <Filename SupArchList="IA32">Ia32/Fvb.c</Filename>
- <Filename SupArchList="X64">x64/Fvb.c</Filename>
- <Filename SupArchList="IPF">Ipf/Fvb.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <ProtocolCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED" SupArchList="IA32 X64">
- <ProtocolCName>gEfiFvbExtensionProtocolGuid</ProtocolCName>
- </Protocol>
- <ProtocolNotify Usage="SOMETIMES_CONSUMED">
- <ProtocolNotifyCName>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolNotifyCName>
- </ProtocolNotify>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>FvbLibInitialize</Constructor>
- </Extern>
- <Extern>
- <SetVirtualAddressMapCallBack>FvbVirtualAddressChangeNotifyEvent</SetVirtualAddressMapCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h b/EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h deleted file mode 100644 index 3a0cd507d9..0000000000 --- a/EdkModulePkg/Library/EdkFvbServiceLib/Fvb.h +++ /dev/null @@ -1,24 +0,0 @@ -/**
- The internal header file for EdkFvbServiceLib.
-
-Copyright (c) 2006 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-**/
-
-#ifndef __FVB_H__
-#define __FVB_H__
-
-#define MAX_FVB_COUNT 16
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
- EFI_FVB_EXTENSION_PROTOCOL *FvbExtension;
- BOOLEAN IsRuntimeAccess;
-} FVB_ENTRY;
-
-#endif
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c b/EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c deleted file mode 100644 index 12a55c97d3..0000000000 --- a/EdkModulePkg/Library/EdkFvbServiceLib/Ia32/Fvb.c +++ /dev/null @@ -1,611 +0,0 @@ -/**@file
-
- Firmware Volume Block Protocol Runtime Abstraction
-
- mFvbEntry is an array of Handle Fvb pairs. The Fvb Lib Instance matches the
- index in the mFvbEntry array. This should be the same sequence as the FVB's
- were described in the HOB. We have to remember the handle so we can tell if
- the protocol has been reinstalled and it needs updateing.
-
- If you are using any of these lib functions.you must first call FvbInitialize ().
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Fvb.h"
-
-//
-// Lib will ASSERT if more FVB devices than this are added to the system.
-//
-STATIC FVB_ENTRY *mFvbEntry;
-STATIC EFI_EVENT mFvbRegistration;
-STATIC BOOLEAN mEfiFvbInitialized = FALSE;
-STATIC UINTN mFvbCount;
-
-/**
- Check whether an address is runtime memory or not.
-
- @param Address The Address being checked.
-
- @retval TRUE The address is runtime memory.
- @retval FALSE The address is not runtime memory.
-**/
-BOOLEAN
-IsRuntimeMemory (
- IN VOID *Address
- )
-{
- EFI_STATUS Status;
- UINT8 TmpMemoryMap[1];
- UINTN MapKey;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINTN MemoryMapSize;
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- EFI_MEMORY_DESCRIPTOR *MemoryMapPtr;
- BOOLEAN IsRuntime;
- UINTN Index;
-
- IsRuntime = FALSE;
-
- //
- // Get System MemoryMapSize
- //
- MemoryMapSize = 1;
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- (EFI_MEMORY_DESCRIPTOR *)TmpMemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
- //
- // Enlarge space here, because we will allocate pool now.
- //
- MemoryMapSize += EFI_PAGE_SIZE;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- MemoryMapSize,
- (VOID**)&MemoryMap
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get System MemoryMap
- //
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT_EFI_ERROR (Status);
-
- MemoryMapPtr = MemoryMap;
- //
- // Search the request Address
- //
- for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) {
- if (((EFI_PHYSICAL_ADDRESS)(UINTN)Address >= MemoryMap->PhysicalStart) &&
- ((EFI_PHYSICAL_ADDRESS)(UINTN)Address < MemoryMap->PhysicalStart
- + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
- //
- // Found it
- //
- if (MemoryMap->Attribute & EFI_MEMORY_RUNTIME) {
- IsRuntime = TRUE;
- }
- break;
- }
- //
- // Get next item
- //
- MemoryMap = (EFI_MEMORY_DESCRIPTOR *)((UINTN)MemoryMap + DescriptorSize);
- }
-
- //
- // Done
- //
- gBS->FreePool (MemoryMapPtr);
-
- return IsRuntime;
-}
-
-/**
- Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is
- reinstalled.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-STATIC
-VOID
-EFIAPI
-FvbNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UINTN Index;
- UINTN UpdateIndex;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- mFvbRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- UpdateIndex = MAX_FVB_COUNT;
- for (Index = 0; Index < mFvbCount; Index++) {
- if (mFvbEntry[Index].Handle == Handle) {
- //
- // If the handle is already in the table just update the protocol
- //
- UpdateIndex = Index;
- break;
- }
- }
-
- if (UpdateIndex == MAX_FVB_COUNT) {
- //
- // Use the next free slot for a new entry
- //
- UpdateIndex = mFvbCount++;
- //
- // Check the UpdateIndex whether exceed the maximum value.
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
- mFvbEntry[UpdateIndex].Handle = Handle;
- }
- //
- // The array does not have enough entries
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
-
- //
- // Get the interface pointer and if it's ours, skip it
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].Fvb
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFvbExtensionProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].FvbExtension
- );
- if (Status != EFI_SUCCESS) {
- mFvbEntry[UpdateIndex].FvbExtension = NULL;
- }
-
- //
- // Check the FVB can be accessed in RUNTIME, The FVBs in FVB handle list comes
- // from two way:
- // 1) Dxe Core. (FVB information is transferred from FV HOB).
- // 2) FVB driver.
- // The FVB produced Dxe core is used for discoverying DXE driver and dispatch. These
- // FVBs can only be accessed in boot time.
- // FVB driver will discovery all FV in FLASH and these FVBs can be accessed in runtime.
- // The FVB itself produced by FVB driver is allocated in runtime memory. So we can
- // determine the what FVB can be accessed in RUNTIME by judging whether FVB itself is allocated
- // in RUNTIME memory.
- //
- mFvbEntry[UpdateIndex].IsRuntimeAccess = IsRuntimeMemory (mFvbEntry[UpdateIndex].Fvb);
- }
-}
-
-/**
- Convert all pointers in mFvbEntry after ExitBootServices.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
- if (mFvbEntry != NULL) {
- for (Index = 0; Index < MAX_FVB_COUNT; Index++) {
- if (!mFvbEntry[Index].IsRuntimeAccess) {
- continue;
- }
-
- if (NULL != mFvbEntry[Index].Fvb) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetBlockSize);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetPhysicalAddress);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->SetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Read);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Write);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->EraseBlocks);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb);
- }
-
- if (NULL != mFvbEntry[Index].FvbExtension) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension->EraseFvbCustomBlock);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension);
- }
- }
-
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry);
- }
-}
-
-/**
- Library constructor function entry.
-
- @param ImageHandle The handle of image who call this libary.
- @param SystemTable The point of System Table.
-
- @retval EFI_SUCESS Sucess construct this library.
- @retval Others Fail to contruct this libary.
-**/
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINTN Status;
- mFvbCount = 0;
-
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- (UINTN) sizeof (FVB_ENTRY) * MAX_FVB_COUNT,
- (VOID *) &mFvbEntry
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (mFvbEntry, sizeof (FVB_ENTRY) * MAX_FVB_COUNT);
-
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeBlockProtocolGuid,
- TPL_CALLBACK,
- FvbNotificationEvent,
- NULL,
- &mFvbRegistration
- );
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- // Status = gBS->CreateEvent (
- // EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- // TPL_NOTIFY,
- // EfiRuntimeLibFvbVirtualNotifyEvent,
- // NULL,
- // &mEfiFvbVirtualNotifyEvent
- // );
- // ASSERT_EFI_ERROR (Status);
- //
-
- //
- // Register SetVirtualAddressMap () notify function
- //
-
- ASSERT_EFI_ERROR (Status);
-
- mEfiFvbInitialized = TRUE;
-
- return EFI_SUCCESS;
-}
-
-//
-// =============================================================================
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-// EfiFvbInitialize () must be called before any of the following functions
-// must be called.
-// =============================================================================
-//
-
-/**
- Reads specified number of bytes into a buffer from the specified block
-
- @param Instance The FV instance to be read from.
- @param Lba The logical block address to be read from
- @param Offset Offset into the block at which to begin reading
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- @param Buffer Pointer to a caller allocated buffer that will be
- used to hold the data read
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to Read block
- @retval Others Fail to read block
-**/
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Read (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Writes specified number of bytes from the input buffer to the block
-
- @param Instance The FV instance to be written to
- @param Lba The starting logical block index to write to
- @param Offset Offset into the block at which to begin writing
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- @param Buffer Pointer to a caller allocated buffer that contains
- the source for the write
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to write block
- @retval Others Fail to write block
-**/
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Write (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Erases and initializes a firmware volume block
-
- @param Instance The FV instance to be erased
- @param Lba The logical block index to be erased
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase block
- @retval Others Fail to erase block
-**/
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->EraseBlocks (mFvbEntry[Instance].Fvb, Lba, -1);
-}
-
-/**
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
- @param Instance The FV instance whose attributes is going to be returned
- @param Attributes Output buffer which contains attributes
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get Fv attribute
- @retval Others Fail to get Fv attribute
-**/
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetVolumeAttributes (mFvbEntry[Instance].Fvb, Attributes);
-}
-
-/**
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
- @param Instance The FV instance whose attributes is going to be
- modified
- @param Attributes On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to set Fv attribute
- @retval Others Fail to set Fv attribute
-**/
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->SetVolumeAttributes (mFvbEntry[Instance].Fvb, &Attributes);
-}
-
-/**
- Retrieves the physical address of a memory mapped FV
-
- @param Instance The FV instance whose base address is going to be
- returned
- @param BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get physical address
- @retval Others Fail to get physical address
-**/
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetPhysicalAddress (mFvbEntry[Instance].Fvb, BaseAddress);
-}
-
-/**
- Retrieve the size of a logical block
-
- @param Instance The FV instance whose block size is going to be
- returned
- @param Lba Indicates which block to return the size for.
- @param BlockSize A pointer to a caller allocated UINTN in which
- the size of the block is returned
- @param NumOfBlocks a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get block size
- @retval Others Fail to get block size
-**/
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetBlockSize (mFvbEntry[Instance].Fvb, Lba, BlockSize, NumOfBlocks);
-}
-
-/**
- Erases and initializes a specified range of a firmware volume
-
- @param Instance The FV instance to be erased
- @param StartLba The starting logical block index to be erased
- @param OffsetStartLba Offset into the starting block at which to
- begin erasing
- @param LastLba The last logical block index to be erased
- @param OffsetLastLba Offset into the last block at which to end erasing
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase custom block range
- @retval Others Fail to erase custom block range
-**/
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension)) {
- return EFI_UNSUPPORTED;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock)) {
- return EFI_UNSUPPORTED;
- }
-
- return mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock (
- mFvbEntry[Instance].FvbExtension,
- StartLba,
- OffsetStartLba,
- LastLba,
- OffsetLastLba
- );
-}
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c b/EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c deleted file mode 100644 index fd455deca2..0000000000 --- a/EdkModulePkg/Library/EdkFvbServiceLib/Ipf/Fvb.c +++ /dev/null @@ -1,349 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Fvb.c
-
-Abstract:
-
- Light weight lib to support Tiano Firmware Volume Block
- protocol abstraction at runtime.
-
- All these functions convert EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID
- class function to the Runtime Lib function. There is a 1 to 1 mapping.
-
- If you are using any of these lib functions.you must first call FvbInitialize ().
-
---*/
-
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
- Initialize globals and register Fvb Protocol notification function.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
-
---*/
-{
- return EFI_SUCCESS;
-}
-//
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-// EfiFvbInitialize () must be called before any of the following functions
-// must be called.
-//
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Reads specified number of bytes into a buffer from the specified block
-
-Arguments:
- Instance - The FV instance to be read from
- Lba - The logical block address to be read from
- Offset - Offset into the block at which to begin reading
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- Buffer - Pointer to a caller allocated buffer that will be
- used to hold the data read
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, ReadFunctionId, Instance, Lba, Offset, (UINT64) NumBytes, (UINT64) Buffer, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-/*++
-
-Routine Description:
- Writes specified number of bytes from the input buffer to the block
-
-Arguments:
- Instance - The FV instance to be written to
- Lba - The starting logical block index to write to
- Offset - Offset into the block at which to begin writing
- NumBytes - Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- Buffer - Pointer to a caller allocated buffer that contains
- the source for the write
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, WriteFunctionId, Instance, Lba, Offset, (UINT64) NumBytes, (UINT64) Buffer, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN UINTN Lba
- )
-/*++
-
-Routine Description:
- Erases and initializes a firmware volume block
-
-Arguments:
- Instance - The FV instance to be erased
- Lba - The logical block index to be erased
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, EraseBlockFunctionId, Instance, Lba, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-/*++
-
-Routine Description:
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- returned
- Attributes - Output buffer which contains attributes
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, SetVolumeAttributesFunctionId, Instance, (UINT64) Attributes, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-/*++
-
-Routine Description:
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
-Arguments:
- Instance - The FV instance whose attributes is going to be
- modified
- Attributes - On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, SetVolumeAttributesFunctionId, Instance, (UINT64) Attributes, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-/*++
-
-Routine Description:
- Retrieves the physical address of a memory mapped FV
-
-Arguments:
- Instance - The FV instance whose base address is going to be
- returned
- BaseAddress - Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (&Guid, GetPhysicalAddressFunctionId, Instance, (UINT64) BaseAddress, 0, 0, 0, 0, 0).Status;
-}
-
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-/*++
-
-Routine Description:
- Retrieve the size of a logical block
-
-Arguments:
- Instance - The FV instance whose block size is going to be
- returned
- Lba - Indicates which block to return the size for.
- BlockSize - A pointer to a caller allocated UINTN in which
- the size of the block is returned
- NumOfBlocks - a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
-Returns:
- EFI_SUCCESS - The firmware volume was read successfully and
- contents are in Buffer
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (
- &Guid,
- GetBlockSizeFunctionId,
- Instance,
- Lba,
- (UINT64) BlockSize,
- (UINT64) NumOfBlocks,
- 0,
- 0,
- 0
- ).Status;
-}
-
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-/*++
-
-Routine Description:
- Erases and initializes a specified range of a firmware volume
-
-Arguments:
- Instance - The FV instance to be erased
- StartLba - The starting logical block index to be erased
- OffsetStartLba - Offset into the starting block at which to
- begin erasing
- LastLba - The last logical block index to be erased
- OffsetLastLba - Offset into the last block at which to end erasing
-
-Returns:
- Status code
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_FV_BLOCK_SERVICES_PROTOCOL_GUID_HI;
-
- return EsalCall (
- &Guid,
- EraseCustomBlockRangeFunctionId,
- Instance,
- StartLba,
- OffsetStartLba,
- LastLba,
- OffsetLastLba,
- 0,
- 0
- ).Status;
-}
-
-
-/**
- BugBug: Can't turn this off in the current MSA so we need a stub
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
-}
diff --git a/EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c b/EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c deleted file mode 100644 index 12a55c97d3..0000000000 --- a/EdkModulePkg/Library/EdkFvbServiceLib/x64/Fvb.c +++ /dev/null @@ -1,611 +0,0 @@ -/**@file
-
- Firmware Volume Block Protocol Runtime Abstraction
-
- mFvbEntry is an array of Handle Fvb pairs. The Fvb Lib Instance matches the
- index in the mFvbEntry array. This should be the same sequence as the FVB's
- were described in the HOB. We have to remember the handle so we can tell if
- the protocol has been reinstalled and it needs updateing.
-
- If you are using any of these lib functions.you must first call FvbInitialize ().
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Fvb.h"
-
-//
-// Lib will ASSERT if more FVB devices than this are added to the system.
-//
-STATIC FVB_ENTRY *mFvbEntry;
-STATIC EFI_EVENT mFvbRegistration;
-STATIC BOOLEAN mEfiFvbInitialized = FALSE;
-STATIC UINTN mFvbCount;
-
-/**
- Check whether an address is runtime memory or not.
-
- @param Address The Address being checked.
-
- @retval TRUE The address is runtime memory.
- @retval FALSE The address is not runtime memory.
-**/
-BOOLEAN
-IsRuntimeMemory (
- IN VOID *Address
- )
-{
- EFI_STATUS Status;
- UINT8 TmpMemoryMap[1];
- UINTN MapKey;
- UINTN DescriptorSize;
- UINT32 DescriptorVersion;
- UINTN MemoryMapSize;
- EFI_MEMORY_DESCRIPTOR *MemoryMap;
- EFI_MEMORY_DESCRIPTOR *MemoryMapPtr;
- BOOLEAN IsRuntime;
- UINTN Index;
-
- IsRuntime = FALSE;
-
- //
- // Get System MemoryMapSize
- //
- MemoryMapSize = 1;
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- (EFI_MEMORY_DESCRIPTOR *)TmpMemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT (Status == EFI_BUFFER_TOO_SMALL);
- //
- // Enlarge space here, because we will allocate pool now.
- //
- MemoryMapSize += EFI_PAGE_SIZE;
- Status = gBS->AllocatePool (
- EfiBootServicesData,
- MemoryMapSize,
- (VOID**)&MemoryMap
- );
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get System MemoryMap
- //
- Status = gBS->GetMemoryMap (
- &MemoryMapSize,
- MemoryMap,
- &MapKey,
- &DescriptorSize,
- &DescriptorVersion
- );
- ASSERT_EFI_ERROR (Status);
-
- MemoryMapPtr = MemoryMap;
- //
- // Search the request Address
- //
- for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) {
- if (((EFI_PHYSICAL_ADDRESS)(UINTN)Address >= MemoryMap->PhysicalStart) &&
- ((EFI_PHYSICAL_ADDRESS)(UINTN)Address < MemoryMap->PhysicalStart
- + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {
- //
- // Found it
- //
- if (MemoryMap->Attribute & EFI_MEMORY_RUNTIME) {
- IsRuntime = TRUE;
- }
- break;
- }
- //
- // Get next item
- //
- MemoryMap = (EFI_MEMORY_DESCRIPTOR *)((UINTN)MemoryMap + DescriptorSize);
- }
-
- //
- // Done
- //
- gBS->FreePool (MemoryMapPtr);
-
- return IsRuntime;
-}
-
-/**
- Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is
- reinstalled.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-STATIC
-VOID
-EFIAPI
-FvbNotificationEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- EFI_HANDLE Handle;
- UINTN Index;
- UINTN UpdateIndex;
-
- while (TRUE) {
- BufferSize = sizeof (Handle);
- Status = gBS->LocateHandle (
- ByRegisterNotify,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- mFvbRegistration,
- &BufferSize,
- &Handle
- );
- if (EFI_ERROR (Status)) {
- //
- // Exit Path of While Loop....
- //
- break;
- }
-
- UpdateIndex = MAX_FVB_COUNT;
- for (Index = 0; Index < mFvbCount; Index++) {
- if (mFvbEntry[Index].Handle == Handle) {
- //
- // If the handle is already in the table just update the protocol
- //
- UpdateIndex = Index;
- break;
- }
- }
-
- if (UpdateIndex == MAX_FVB_COUNT) {
- //
- // Use the next free slot for a new entry
- //
- UpdateIndex = mFvbCount++;
- //
- // Check the UpdateIndex whether exceed the maximum value.
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
- mFvbEntry[UpdateIndex].Handle = Handle;
- }
- //
- // The array does not have enough entries
- //
- ASSERT (UpdateIndex < MAX_FVB_COUNT);
-
- //
- // Get the interface pointer and if it's ours, skip it
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFirmwareVolumeBlockProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].Fvb
- );
- ASSERT_EFI_ERROR (Status);
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiFvbExtensionProtocolGuid,
- (VOID **) &mFvbEntry[UpdateIndex].FvbExtension
- );
- if (Status != EFI_SUCCESS) {
- mFvbEntry[UpdateIndex].FvbExtension = NULL;
- }
-
- //
- // Check the FVB can be accessed in RUNTIME, The FVBs in FVB handle list comes
- // from two way:
- // 1) Dxe Core. (FVB information is transferred from FV HOB).
- // 2) FVB driver.
- // The FVB produced Dxe core is used for discoverying DXE driver and dispatch. These
- // FVBs can only be accessed in boot time.
- // FVB driver will discovery all FV in FLASH and these FVBs can be accessed in runtime.
- // The FVB itself produced by FVB driver is allocated in runtime memory. So we can
- // determine the what FVB can be accessed in RUNTIME by judging whether FVB itself is allocated
- // in RUNTIME memory.
- //
- mFvbEntry[UpdateIndex].IsRuntimeAccess = IsRuntimeMemory (mFvbEntry[UpdateIndex].Fvb);
- }
-}
-
-/**
- Convert all pointers in mFvbEntry after ExitBootServices.
-
- @param Event The Event that is being processed
- @param Context Event Context
-
-**/
-VOID
-EFIAPI
-FvbVirtualAddressChangeNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
- if (mFvbEntry != NULL) {
- for (Index = 0; Index < MAX_FVB_COUNT; Index++) {
- if (!mFvbEntry[Index].IsRuntimeAccess) {
- continue;
- }
-
- if (NULL != mFvbEntry[Index].Fvb) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetBlockSize);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetPhysicalAddress);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->SetVolumeAttributes);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Read);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Write);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->EraseBlocks);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb);
- }
-
- if (NULL != mFvbEntry[Index].FvbExtension) {
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension->EraseFvbCustomBlock);
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension);
- }
- }
-
- EfiConvertPointer (0x0, (VOID **) &mFvbEntry);
- }
-}
-
-/**
- Library constructor function entry.
-
- @param ImageHandle The handle of image who call this libary.
- @param SystemTable The point of System Table.
-
- @retval EFI_SUCESS Sucess construct this library.
- @retval Others Fail to contruct this libary.
-**/
-EFI_STATUS
-EFIAPI
-FvbLibInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- UINTN Status;
- mFvbCount = 0;
-
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- (UINTN) sizeof (FVB_ENTRY) * MAX_FVB_COUNT,
- (VOID *) &mFvbEntry
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- ZeroMem (mFvbEntry, sizeof (FVB_ENTRY) * MAX_FVB_COUNT);
-
- EfiCreateProtocolNotifyEvent (
- &gEfiFirmwareVolumeBlockProtocolGuid,
- TPL_CALLBACK,
- FvbNotificationEvent,
- NULL,
- &mFvbRegistration
- );
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- // Status = gBS->CreateEvent (
- // EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- // TPL_NOTIFY,
- // EfiRuntimeLibFvbVirtualNotifyEvent,
- // NULL,
- // &mEfiFvbVirtualNotifyEvent
- // );
- // ASSERT_EFI_ERROR (Status);
- //
-
- //
- // Register SetVirtualAddressMap () notify function
- //
-
- ASSERT_EFI_ERROR (Status);
-
- mEfiFvbInitialized = TRUE;
-
- return EFI_SUCCESS;
-}
-
-//
-// =============================================================================
-// The following functions wrap Fvb protocol in the Runtime Lib functions.
-// The Instance translates into Fvb instance. The Fvb order defined by HOBs and
-// thus the sequence of FVB protocol addition define Instance.
-//
-// EfiFvbInitialize () must be called before any of the following functions
-// must be called.
-// =============================================================================
-//
-
-/**
- Reads specified number of bytes into a buffer from the specified block
-
- @param Instance The FV instance to be read from.
- @param Lba The logical block address to be read from
- @param Offset Offset into the block at which to begin reading
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes read
- @param Buffer Pointer to a caller allocated buffer that will be
- used to hold the data read
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to Read block
- @retval Others Fail to read block
-**/
-EFI_STATUS
-EfiFvbReadBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Read (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Writes specified number of bytes from the input buffer to the block
-
- @param Instance The FV instance to be written to
- @param Lba The starting logical block index to write to
- @param Offset Offset into the block at which to begin writing
- @param NumBytes Pointer that on input contains the total size of
- the buffer. On output, it contains the total number
- of bytes actually written
- @param Buffer Pointer to a caller allocated buffer that contains
- the source for the write
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to write block
- @retval Others Fail to write block
-**/
-EFI_STATUS
-EfiFvbWriteBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- IN UINTN Offset,
- IN OUT UINTN *NumBytes,
- IN UINT8 *Buffer
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->Write (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);
-}
-
-/**
- Erases and initializes a firmware volume block
-
- @param Instance The FV instance to be erased
- @param Lba The logical block index to be erased
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase block
- @retval Others Fail to erase block
-**/
-EFI_STATUS
-EfiFvbEraseBlock (
- IN UINTN Instance,
- IN EFI_LBA Lba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->EraseBlocks (mFvbEntry[Instance].Fvb, Lba, -1);
-}
-
-/**
- Retrieves attributes, insures positive polarity of attribute bits, returns
- resulting attributes in output parameter
-
- @param Instance The FV instance whose attributes is going to be returned
- @param Attributes Output buffer which contains attributes
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get Fv attribute
- @retval Others Fail to get Fv attribute
-**/
-EFI_STATUS
-EfiFvbGetVolumeAttributes (
- IN UINTN Instance,
- OUT EFI_FVB_ATTRIBUTES *Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetVolumeAttributes (mFvbEntry[Instance].Fvb, Attributes);
-}
-
-/**
- Modifies the current settings of the firmware volume according to the
- input parameter, and returns the new setting of the volume
-
- @param Instance The FV instance whose attributes is going to be
- modified
- @param Attributes On input, it is a pointer to EFI_FVB_ATTRIBUTES
- containing the desired firmware volume settings.
- On successful return, it contains the new settings
- of the firmware volume
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to set Fv attribute
- @retval Others Fail to set Fv attribute
-**/
-EFI_STATUS
-EfiFvbSetVolumeAttributes (
- IN UINTN Instance,
- IN EFI_FVB_ATTRIBUTES Attributes
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->SetVolumeAttributes (mFvbEntry[Instance].Fvb, &Attributes);
-}
-
-/**
- Retrieves the physical address of a memory mapped FV
-
- @param Instance The FV instance whose base address is going to be
- returned
- @param BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS
- that on successful return, contains the base address
- of the firmware volume.
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get physical address
- @retval Others Fail to get physical address
-**/
-EFI_STATUS
-EfiFvbGetPhysicalAddress (
- IN UINTN Instance,
- OUT EFI_PHYSICAL_ADDRESS *BaseAddress
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetPhysicalAddress (mFvbEntry[Instance].Fvb, BaseAddress);
-}
-
-/**
- Retrieve the size of a logical block
-
- @param Instance The FV instance whose block size is going to be
- returned
- @param Lba Indicates which block to return the size for.
- @param BlockSize A pointer to a caller allocated UINTN in which
- the size of the block is returned
- @param NumOfBlocks a pointer to a caller allocated UINTN in which the
- number of consecutive blocks starting with Lba is
- returned. All blocks in this range have a size of
- BlockSize
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to get block size
- @retval Others Fail to get block size
-**/
-EFI_STATUS
-EfiFvbGetBlockSize (
- IN UINTN Instance,
- IN EFI_LBA Lba,
- OUT UINTN *BlockSize,
- OUT UINTN *NumOfBlocks
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- return mFvbEntry[Instance].Fvb->GetBlockSize (mFvbEntry[Instance].Fvb, Lba, BlockSize, NumOfBlocks);
-}
-
-/**
- Erases and initializes a specified range of a firmware volume
-
- @param Instance The FV instance to be erased
- @param StartLba The starting logical block index to be erased
- @param OffsetStartLba Offset into the starting block at which to
- begin erasing
- @param LastLba The last logical block index to be erased
- @param OffsetLastLba Offset into the last block at which to end erasing
-
- @retval EFI_INVALID_PARAMETER Invalid parameter
- @retval EFI_SUCESS Sucess to erase custom block range
- @retval Others Fail to erase custom block range
-**/
-EFI_STATUS
-EfiFvbEraseCustomBlockRange (
- IN UINTN Instance,
- IN EFI_LBA StartLba,
- IN UINTN OffsetStartLba,
- IN EFI_LBA LastLba,
- IN UINTN OffsetLastLba
- )
-{
- if (Instance >= mFvbCount) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {
- return EFI_INVALID_PARAMETER;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension)) {
- return EFI_UNSUPPORTED;
- }
-
- if (!(mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock)) {
- return EFI_UNSUPPORTED;
- }
-
- return mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock (
- mFvbEntry[Instance].FvbExtension,
- StartLba,
- OffsetStartLba,
- LastLba,
- OffsetLastLba
- );
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c deleted file mode 100644 index 4513aa94af..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsBoot.c +++ /dev/null @@ -1,1102 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsBoot.c
-
-Abstract:
-
- BDS Lib functions which relate with create or process the boot
- option.
-
---*/
-#include "Performance.h"
-
-BOOLEAN mEnumBootDevice = FALSE;
-
-EFI_STATUS
-BdsLibDoLegacyBoot (
- IN BDS_COMMON_OPTION *Option
- )
-/*++
-
-Routine Description:
-
- Boot the legacy system with the boot option
-
-Arguments:
-
- Option - The legacy boot option which have BBS device path
-
-Returns:
-
- EFI_UNSUPPORTED - There is no legacybios protocol, do not support
- legacy boot.
-
- EFI_STATUS - Return the status of LegacyBios->LegacyBoot ().
-
---*/
-{
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
-
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, - (void **)&LegacyBios);
- if (EFI_ERROR (Status)) {
- //
- // If no LegacyBios protocol we do not support legacy boot
- //
- return EFI_UNSUPPORTED;
- }
- //
- // Notes: if we seperate the int 19, then we don't need to refresh BBS
- //
- BdsRefreshBbsTableForBoot (Option);
-
- //
- // Write boot to OS performance data to a file
- //
- PERF_CODE (
- WriteBootToOsPerformanceData ();
- );
-
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));
- return LegacyBios->LegacyBoot (
- LegacyBios,
- (BBS_BBS_DEVICE_PATH *) Option->DevicePath,
- Option->LoadOptionsSize,
- Option->LoadOptions
- );
-}
-
-EFI_STATUS
-BdsLibBootViaBootOption (
- IN BDS_COMMON_OPTION * Option,
- IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Process the boot option follow the EFI 1.1 specification and
- special treat the legacy boot option with BBS_DEVICE_PATH.
-
-Arguments:
-
- Option - The boot option need to be processed
-
- DevicePath - The device path which describe where to load
- the boot image or the legcy BBS device path
- to boot the legacy OS
-
- ExitDataSize - Returned directly from gBS->StartImage ()
-
- ExitData - Returned directly from gBS->StartImage ()
-
-Returns:
-
- EFI_SUCCESS - Status from gBS->StartImage (),
- or BdsBootByDiskSignatureAndPartition ()
-
- EFI_NOT_FOUND - If the Device Path is not found in the system
-
---*/
-{
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- EFI_HANDLE ImageHandle;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
- EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- VOID *Buffer;
-
- //
- // Record the performance data for End of BDS
- //
- PERF_END (0, BDS_TOK, NULL, 0);
-
- *ExitDataSize = 0;
- *ExitData = NULL;
-
- //
- // Notes: put EFI64 ROM Shadow Solution
- //
- EFI64_SHADOW_ALL_LEGACY_ROM ();
-
- //
- // Notes: this code can be remove after the s3 script table
- // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or
- // EFI_EVENT_SIGNAL_LEGACY_BOOT
- //
- Status = gBS->LocateProtocol (&gEfiAcpiS3SaveProtocolGuid, NULL, - (VOID **)&AcpiS3Save);
- if (!EFI_ERROR (Status)) {
- AcpiS3Save->S3Save (AcpiS3Save, NULL);
- }
- //
- // If it's Device Path that starts with a hard drive path,
- // this routine will do the booting.
- //
- Status = BdsBootByDiskSignatureAndPartition (
- Option,
- (HARDDRIVE_DEVICE_PATH *) DevicePath,
- Option->LoadOptionsSize,
- Option->LoadOptions,
- ExitDataSize,
- ExitData
- );
- if (!EFI_ERROR (Status)) {
- //
- // If we found a disk signature and partition device path return success
- //
- return EFI_SUCCESS;
- }
-
- EfiSignalEventReadyToBoot ();
-
- //
- // Set Boot Current
- //
- gRT->SetVariable (
- L"BootCurrent",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (UINT16),
- &Option->BootCurrent
- );
-
- if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)
- ) {
- //
- // Check to see if we should legacy BOOT. If yes then do the legacy boot
- //
- return BdsLibDoLegacyBoot (Option);
- }
-
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));
-
- Status = gBS->LoadImage (
- TRUE,
- mBdsImageHandle,
- DevicePath,
- NULL,
- 0,
- &ImageHandle
- );
-
- //
- // If we didn't find an image, we may need to load the default
- // boot behavior for the device.
- //
- if (EFI_ERROR (Status)) {
- //
- // Find a Simple File System protocol on the device path. If the remaining
- // device path is set to end then no Files are being specified, so try
- // the removable media file name.
- //
- TempDevicePath = DevicePath;
- Status = gBS->LocateDevicePath (
- &gEfiSimpleFileSystemProtocolGuid,
- &TempDevicePath,
- &Handle
- );
- if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {
- FilePath = FileDevicePath (Handle, EFI_REMOVABLE_MEDIA_FILE_NAME);
- if (FilePath) {
- //
- // Issue a dummy read to the device to check for media change.
- // When the removable media is changed, any Block IO read/write will
- // cause the BlockIo protocol be reinstalled and EFI_MEDIA_CHANGED is
- // returned. After the Block IO protocol is reinstalled, subsequent
- // Block IO read/write will success.
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
- );
- if (!EFI_ERROR (Status)) {
- Buffer = AllocatePool (BlkIo->Media->BlockSize);
- if (Buffer != NULL) {
- BlkIo->ReadBlocks (
- BlkIo,
- BlkIo->Media->MediaId,
- 0,
- BlkIo->Media->BlockSize,
- Buffer
- );
- gBS->FreePool (Buffer);
- }
- }
-
- Status = gBS->LoadImage (
- TRUE,
- mBdsImageHandle,
- FilePath,
- NULL,
- 0,
- &ImageHandle
- );
- if (EFI_ERROR (Status)) {
- //
- // The DevicePath failed, and it's not a valid
- // removable media device.
- //
- goto Done;
- }
- }
- } else {
- Status = EFI_NOT_FOUND;
- }
- }
-
- if (EFI_ERROR (Status)) {
- //
- // It there is any error from the Boot attempt exit now.
- //
- goto Done;
- }
- //
- // Provide the image with it's load options
- //
- Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, - (VOID **) &ImageInfo);
- ASSERT_EFI_ERROR (Status);
-
- if (Option->LoadOptionsSize != 0) {
- ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
- ImageInfo->LoadOptions = Option->LoadOptions;
- }
- //
- // Before calling the image, enable the Watchdog Timer for
- // the 5 Minute period
- //
- gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
-
- Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));
-
- //
- // Clear the Watchdog Timer after the image returns
- //
- gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
-
-Done:
- //
- // Clear Boot Current
- //
- gRT->SetVariable (
- L"BootCurrent",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 0,
- &Option->BootCurrent
- );
-
- return Status;
-}
-
-EFI_STATUS
-BdsBootByDiskSignatureAndPartition (
- IN BDS_COMMON_OPTION * Option,
- IN HARDDRIVE_DEVICE_PATH * HardDriveDevicePath,
- IN UINT32 LoadOptionsSize,
- IN VOID *LoadOptions,
- OUT UINTN *ExitDataSize,
- OUT CHAR16 **ExitData OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Check to see if a hard ware device path was passed in. If it was then search
- all the block IO devices for the passed in hard drive device path.
-
-Arguments:
-
- Option - The current processing boot option.
-
- HardDriveDevicePath - EFI Device Path to boot, if it starts with a hard
- drive device path.
-
- LoadOptionsSize - Passed into gBS->StartImage ()
- via the loaded image protocol.
-
- LoadOptions - Passed into gBS->StartImage ()
- via the loaded image protocol.
-
- ExitDataSize - returned directly from gBS->StartImage ()
-
- ExitData - returned directly from gBS->StartImage ()
-
-Returns:
-
- EFI_SUCCESS - Status from gBS->StartImage (),
- or BootByDiskSignatureAndPartition ()
-
- EFI_NOT_FOUND - If the Device Path is not found in the system
-
---*/
-{
- EFI_STATUS Status;
- UINTN BlockIoHandleCount;
- EFI_HANDLE *BlockIoBuffer;
- EFI_DEVICE_PATH_PROTOCOL *BlockIoDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *BlockIoHdDevicePath;
- HARDDRIVE_DEVICE_PATH *TmpHdPath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- UINTN Index;
- BOOLEAN DevicePathMatch;
- HARDDRIVE_DEVICE_PATH *TempPath;
-
- *ExitDataSize = 0;
- *ExitData = NULL;
-
- if ( !((DevicePathType (&HardDriveDevicePath->Header) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType (&HardDriveDevicePath->Header) == MEDIA_HARDDRIVE_DP))
- ) {
- //
- // If the HardDriveDevicePath does not start with a Hard Drive Device Path
- // exit.
- //
- return EFI_NOT_FOUND;
- }
- //
- // The boot device have already been connected
- //
- Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer);
- if (EFI_ERROR (Status) || BlockIoHandleCount == 0) {
- //
- // If there was an error or there are no device handles that support
- // the BLOCK_IO Protocol, then return.
- //
- return EFI_NOT_FOUND;
- }
- //
- // Loop through all the device handles that support the BLOCK_IO Protocol
- //
- for (Index = 0; Index < BlockIoHandleCount; Index++) {
-
- Status = gBS->HandleProtocol (BlockIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID *) &BlockIoDevicePath);
- if (EFI_ERROR (Status) || BlockIoDevicePath == NULL) {
- continue;
- }
- //
- // Make PreviousDevicePath == the device path node before the end node
- //
- DevicePath = BlockIoDevicePath;
- BlockIoHdDevicePath = NULL;
-
- //
- // find HardDriver device path node
- //
- while (!IsDevicePathEnd (DevicePath)) {
- if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP)
- ) {
- BlockIoHdDevicePath = DevicePath;
- break;
- }
-
- DevicePath = NextDevicePathNode (DevicePath);
- }
-
- if (BlockIoHdDevicePath == NULL) {
- continue;
- }
- //
- // See if the harddrive device path in blockio matches the orig Hard Drive Node
- //
- DevicePathMatch = FALSE;
-
- TmpHdPath = (HARDDRIVE_DEVICE_PATH *) BlockIoHdDevicePath;
- TempPath = (HARDDRIVE_DEVICE_PATH *) BdsLibUnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);
-
- //
- // Only several fields will be checked. NOT whole NODE
- //
- if ( TmpHdPath->PartitionNumber == TempPath->PartitionNumber &&
- TmpHdPath->MBRType == TempPath->MBRType &&
- TmpHdPath->SignatureType == TempPath->SignatureType &&
- CompareGuid ((EFI_GUID *) TmpHdPath->Signature, (EFI_GUID *) TempPath->Signature)) {
- //
- // Get the matched device path
- //
- DevicePathMatch = TRUE;
- }
- //
- // Only do the boot, when devicepath match
- //
- if (DevicePathMatch) {
- //
- // Combine the Block IO and Hard Drive Device path together and try
- // to boot from it.
- //
- DevicePath = NextDevicePathNode ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);
- NewDevicePath = AppendDevicePath (BlockIoDevicePath, DevicePath);
-
- //
- // Recursive boot with new device path
- //
- Status = BdsLibBootViaBootOption (Option, NewDevicePath, ExitDataSize, ExitData);
- if (!EFI_ERROR (Status)) {
- break;
- }
- }
- }
-
- gBS->FreePool (BlockIoBuffer);
- return Status;
-}
-
-EFI_STATUS
-BdsLibDeleteOptionFromHandle (
- IN EFI_HANDLE Handle
- )
-/*++
-
-Routine Description:
-
- Delete the boot option associated with the handle passed in
-
-Arguments:
-
- Handle - The handle which present the device path to create boot option
-
-Returns:
-
- EFI_SUCCESS - Delete the boot option success
-
- EFI_NOT_FOUND - If the Device Path is not found in the system
-
- EFI_OUT_OF_RESOURCES - Lack of memory resource
-
- Other - Error return value from SetVariable()
-
---*/
-{
- UINT16 *BootOrder;
- UINT8 *BootOptionVar;
- UINTN BootOrderSize;
- UINTN BootOptionSize;
- EFI_STATUS Status;
- UINTN Index;
- UINT16 BootOption[BOOT_OPTION_MAX_CHAR];
- UINTN DevicePathSize;
- UINTN OptionDevicePathSize;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
- UINT8 *TempPtr;
- CHAR16 *Description;
-
- Status = EFI_SUCCESS;
- BootOrder = NULL;
- BootOrderSize = 0;
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- return EFI_NOT_FOUND;
- }
-
- DevicePath = DevicePathFromHandle (Handle);
- if (DevicePath == NULL) {
- return EFI_NOT_FOUND;
- }
- DevicePathSize = GetDevicePathSize (DevicePath);
-
- Index = 0;
- while (Index < BootOrderSize / sizeof (UINT16)) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- gBS->FreePool (BootOrder);
- return EFI_OUT_OF_RESOURCES;
- }
-
- TempPtr = BootOptionVar;
- TempPtr += sizeof (UINT32) + sizeof (UINT16);
- Description = (CHAR16 *) TempPtr;
- TempPtr += StrSize ((CHAR16 *) TempPtr);
- OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
- OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);
-
- //
- // Check whether the device path match
- //
- if ((OptionDevicePathSize == DevicePathSize) &&
- (CompareMem (DevicePath, OptionDevicePath, DevicePathSize) == 0)) {
- BdsDeleteBootOption (BootOrder[Index], BootOrder, &BootOrderSize);
- gBS->FreePool (BootOptionVar);
- break;
- }
-
- gBS->FreePool (BootOptionVar);
- Index++;
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- BootOrderSize,
- BootOrder
- );
-
- gBS->FreePool (BootOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsDeleteAllInvalidEfiBootOption (
- VOID
- )
-/*++
-
-Routine Description:
-
- Delete all invalid EFI boot options. The probable invalid boot option could
- be Removable media or Network boot device.
-
-Arguments:
-
- VOID
-
-Returns:
-
- EFI_SUCCESS - Delete all invalid boot option success
-
- EFI_NOT_FOUND - Variable "BootOrder" is not found
-
- EFI_OUT_OF_RESOURCES - Lack of memory resource
-
- Other - Error return value from SetVariable()
-
---*/
-{
- UINT16 *BootOrder;
- UINT8 *BootOptionVar;
- UINTN BootOrderSize;
- UINTN BootOptionSize;
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
- UINT16 BootOption[BOOT_OPTION_MAX_CHAR];
- UINTN OptionDevicePathSize;
- EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *LastDeviceNode;
- EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
- UINT8 *TempPtr;
- CHAR16 *Description;
- EFI_HANDLE Handle;
- BOOLEAN NeedDelete;
-
- Status = EFI_SUCCESS;
- BootOrder = NULL;
- BootOrderSize = 0;
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- return EFI_NOT_FOUND;
- }
-
- Index = 0;
- while (Index < BootOrderSize / sizeof (UINT16)) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- gBS->FreePool (BootOrder);
- return EFI_OUT_OF_RESOURCES;
- }
-
- TempPtr = BootOptionVar;
- TempPtr += sizeof (UINT32) + sizeof (UINT16);
- Description = (CHAR16 *) TempPtr;
- TempPtr += StrSize ((CHAR16 *) TempPtr);
- OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
- OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);
-
- //
- // Skip legacy boot option (BBS boot device)
- //
- if ((DevicePathType (OptionDevicePath) == BBS_DEVICE_PATH) &&
- (DevicePathSubType (OptionDevicePath) == BBS_BBS_DP)) {
- gBS->FreePool (BootOptionVar);
- Index++;
- continue;
- }
-
- TempDevicePath = OptionDevicePath;
- LastDeviceNode = OptionDevicePath;
- while (!EfiIsDevicePathEnd (TempDevicePath)) {
- LastDeviceNode = TempDevicePath;
- TempDevicePath = EfiNextDevicePathNode (TempDevicePath);
- }
- //
- // Skip the boot option that point to a file, since the device path in
- // removable media boot option doesn't contains a file name.
- //
- if (((DevicePathType (LastDeviceNode) == MEDIA_DEVICE_PATH) &&
- (DevicePathSubType (LastDeviceNode) == MEDIA_FILEPATH_DP)) ||
- //
- // Skip boot option for internal Shell, it's always valid
- //
- (EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode) != NULL)) {
- gBS->FreePool (BootOptionVar);
- Index++;
- continue;
- }
-
- NeedDelete = TRUE;
- //
- // Check if it's a valid boot option for removable media
- //
- TempDevicePath = OptionDevicePath;
- Status = gBS->LocateDevicePath (
- &gEfiSimpleFileSystemProtocolGuid,
- &TempDevicePath,
- &Handle
- );
- if (!EFI_ERROR (Status)) {
- NeedDelete = FALSE;
- }
- //
- // Check if it's a valid boot option for network boot device
- //
- TempDevicePath = OptionDevicePath;
- Status = gBS->LocateDevicePath (
- &gEfiLoadFileProtocolGuid,
- &TempDevicePath,
- &Handle
- );
- if (!EFI_ERROR (Status)) {
- NeedDelete = FALSE;
- }
-
- if (NeedDelete) {
- //
- // Delete this invalid boot option "Boot####"
- //
- Status = gRT->SetVariable (
- BootOption,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- NULL
- );
- //
- // Mark this boot option in boot order as deleted
- //
- BootOrder[Index] = 0xffff;
- }
-
- gBS->FreePool (BootOptionVar);
- Index++;
- }
-
- //
- // Adjust boot order array
- //
- Index2 = 0;
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {
- if (BootOrder[Index] != 0xffff) {
- BootOrder[Index2] = BootOrder[Index];
- Index2 ++;
- }
- }
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- Index2 * sizeof (UINT16),
- BootOrder
- );
-
- gBS->FreePool (BootOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsLibEnumerateAllBootOption (
- IN OUT LIST_ENTRY *BdsBootOptionList
- )
-/*++
-
-Routine Description:
-
- This function will enumerate all possible boot device in the system,
- it will only excute once of every boot.
-
-Arguments:
-
- BdsBootOptionList - The header of the link list which indexed all
- current boot options
-
-Returns:
-
- EFI_SUCCESS - Finished all the boot device enumerate and create
- the boot option base on that boot device
-
---*/
-{
- EFI_STATUS Status;
- UINT16 BootOptionNumber;
- UINTN NumberFileSystemHandles;
- EFI_HANDLE *FileSystemHandles;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- UINTN Index;
- UINTN NumberLoadFileHandles;
- EFI_HANDLE *LoadFileHandles;
- VOID *ProtocolInstance;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
- UINTN FvHandleCount;
- EFI_HANDLE *FvHandleBuffer;
- EFI_FV_FILETYPE Type;
- UINTN Size;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- UINT32 AuthenticationStatus;
- EFI_DEVICE_PATH_PROTOCOL *FilePath;
- EFI_HANDLE ImageHandle;
- EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
- BOOLEAN NeedDelete;
-
- BootOptionNumber = 0;
-
- //
- // If the boot device enumerate happened, just get the boot
- // device from the boot order variable
- //
- if (mEnumBootDevice) {
- BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
- return EFI_SUCCESS;
- }
- //
- // Notes: this dirty code is to get the legacy boot option from the
- // BBS table and create to variable as the EFI boot option, it should
- // be removed after the CSM can provide legacy boot option directly
- //
- REFRESH_LEGACY_BOOT_OPTIONS;
-
- //
- // Delete invalid boot option
- //
- BdsDeleteAllInvalidEfiBootOption ();
- //
- // Parse removable media
- //
- gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &NumberFileSystemHandles,
- &FileSystemHandles
- );
- for (Index = 0; Index < NumberFileSystemHandles; Index++) {
- Status = gBS->HandleProtocol (
- FileSystemHandles[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID **) &BlkIo
- );
- if (!EFI_ERROR (Status)) {
- if (!BlkIo->Media->RemovableMedia) {
- //
- // If the file system handle supports a BlkIo protocol,
- // skip the removable media devices
- //
- continue;
- }
- }
-
- //
- // Do the removable Media thing. \EFI\BOOT\boot{machinename}.EFI
- // machinename is ia32, ia64, x64, ...
- //
- FilePath = FileDevicePath (FileSystemHandles[Index], EFI_REMOVABLE_MEDIA_FILE_NAME);
- NeedDelete = TRUE;
- Status = gBS->LoadImage (
- TRUE,
- mBdsImageHandle,
- FilePath,
- NULL,
- 0,
- &ImageHandle
- );
- if (!EFI_ERROR(Status)) {
- //
- // Verify the image is a EFI application (and not a driver)
- //
- Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);
- ASSERT (!EFI_ERROR(Status));
-
- if (ImageInfo->ImageCodeType == EfiLoaderCode) {
- NeedDelete = FALSE;
- }
- }
-
- if (NeedDelete) {
- //
- // No such file or the file is not a EFI application, delete this boot option
- //
- BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);
- } else {
- BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList);
- BootOptionNumber++;
- }
- }
-
- if (NumberFileSystemHandles) {
- gBS->FreePool (FileSystemHandles);
- }
- //
- // Parse Network Boot Device
- //
- gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleNetworkProtocolGuid,
- NULL,
- &NumberLoadFileHandles,
- &LoadFileHandles
- );
- for (Index = 0; Index < NumberLoadFileHandles; Index++) {
- Status = gBS->HandleProtocol (
- LoadFileHandles[Index],
- &gEfiLoadFileProtocolGuid,
- (VOID **) &ProtocolInstance
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- BdsLibBuildOptionFromHandle (LoadFileHandles[Index], BdsBootOptionList);
- BootOptionNumber++;
- }
-
- if (NumberLoadFileHandles) {
- gBS->FreePool (LoadFileHandles);
- }
- //
- // Check if we have on flash shell
- //
- gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeProtocolGuid,
- NULL,
- &FvHandleCount,
- &FvHandleBuffer
- );
- for (Index = 0; Index < FvHandleCount; Index++) {
- gBS->HandleProtocol (
- FvHandleBuffer[Index],
- &gEfiFirmwareVolumeProtocolGuid,
- (VOID **) &Fv
- );
-
- Status = Fv->ReadFile (
- Fv,
- &gEfiShellFileGuid,
- NULL,
- &Size,
- &Type,
- &Attributes,
- &AuthenticationStatus
- );
- if (EFI_ERROR (Status)) {
- //
- // Skip if no shell file in the FV
- //
- continue;
- }
- //
- // Build the shell boot option
- //
- BdsLibBuildOptionFromShell (FvHandleBuffer[Index], BdsBootOptionList);
- BootOptionNumber++;
- }
-
- if (FvHandleCount) {
- gBS->FreePool (FvHandleBuffer);
- }
- //
- // Make sure every boot only have one time
- // boot device enumerate
- //
- BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");
- mEnumBootDevice = TRUE;
-
- return EFI_SUCCESS;
-}
-
-VOID
-BdsLibBuildOptionFromHandle (
- IN EFI_HANDLE Handle,
- IN LIST_ENTRY *BdsBootOptionList
- )
-/*++
-
-Routine Description:
-
- Build the boot option with the handle parsed in
-
-Arguments:
-
- Handle - The handle which present the device path to create boot option
-
- BdsBootOptionList - The header of the link list which indexed all current
- boot options
-
-Returns:
-
- VOID
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- CHAR16 *TempString;
-
- DevicePath = DevicePathFromHandle (Handle);
- TempString = DevicePathToStr (DevicePath);
-
- //
- // Create and register new boot option
- //
- BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, TempString, L"BootOrder");
-}
-
-VOID
-BdsLibBuildOptionFromShell (
- IN EFI_HANDLE Handle,
- IN OUT LIST_ENTRY *BdsBootOptionList
- )
-/*++
-
-Routine Description:
-
- Build the on flash shell boot option with the handle parsed in
-
-Arguments:
-
- Handle - The handle which present the device path to create on flash shell
- boot option
-
- BdsBootOptionList - The header of the link list which indexed all current
- boot options
-
-Returns:
-
- None
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode;
-
- DevicePath = DevicePathFromHandle (Handle);
-
- //
- // Build the shell device path
- //
- EfiInitializeFwVolDevicepathNode (&ShellNode, &gEfiShellFileGuid);
- DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);
-
- //
- // Create and register the shell boot option
- //
- BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, L"Internal EFI Shell", L"BootOrder");
-
-}
-
-VOID
-BdsLibBootNext (
- VOID
- )
-/*++
-
-Routine Description:
-
- Boot from the EFI1.1 spec defined "BootNext" variable
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- UINT16 *BootNext;
- UINTN BootNextSize;
- CHAR16 Buffer[20];
- BDS_COMMON_OPTION *BootOption;
- LIST_ENTRY TempList;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
-
- //
- // Init the boot option name buffer and temp link list
- //
- InitializeListHead (&TempList);
- ZeroMem (Buffer, sizeof (Buffer));
-
- BootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- //
- // Clear the boot next variable first
- //
- if (BootNext != NULL) {
- gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- BootNext
- );
-
- //
- // Start to build the boot option and try to boot
- //
- UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *BootNext);
- BootOption = BdsLibVariableToOption (&TempList, Buffer);
- BdsLibConnectDevicePath (BootOption->DevicePath);
- BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
- }
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c deleted file mode 100644 index 9c649f1f82..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConnect.c +++ /dev/null @@ -1,357 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsConnect.c
-
-Abstract:
-
- BDS Lib functions which relate with connect the device
-
---*/
-
-VOID
-BdsLibConnectAll (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect all the system driver to controller
- first, and then special connect the default console, this make
- sure all the system controller avialbe and the platform default
- console connected.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- //
- // Connect the platform console first
- //
- BdsLibConnectAllDefaultConsoles ();
-
- //
- // Generic way to connect all the drivers
- //
- BdsLibConnectAllDriversToAllControllers ();
-
- //
- // Here we have the assumption that we have already had
- // platform default console
- //
- BdsLibConnectAllDefaultConsoles ();
-}
-
-VOID
-BdsLibGenericConnectAll (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect all the system drivers to all controllers
- first, and then connect all the console devices the system current
- have. After this we should get all the device work and console avariable
- if the system have console device.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- //
- // Most generic way to connect all the drivers
- //
- BdsLibConnectAllDriversToAllControllers ();
- BdsLibConnectAllConsoles ();
-}
-
-EFI_STATUS
-BdsLibConnectDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
- )
-/*++
-
-Routine Description:
- This function will create all handles associate with every device
- path node. If the handle associate with one device path node can not
- be created success, then still give one chance to do the dispatch,
- which load the missing drivers if possible.
-
-Arguments:
-
- DevicePathToConnect - The device path which will be connected, it can
- be a multi-instance device path
-
-Returns:
-
- EFI_SUCCESS - All handles associate with every device path
- node have been created
-
- EFI_OUT_OF_RESOURCES - There is no resource to create new handles
-
- EFI_NOT_FOUND - Create the handle associate with one device
- path node failed
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *Next;
- EFI_HANDLE Handle;
- EFI_HANDLE PreviousHandle;
- UINTN Size;
-
- if (DevicePathToConnect == NULL) {
- return EFI_SUCCESS;
- }
-
- DevicePath = DuplicateDevicePath (DevicePathToConnect);
- CopyOfDevicePath = DevicePath;
- if (DevicePath == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- do {
- //
- // The outer loop handles multi instance device paths.
- // Only console variables contain multiple instance device paths.
- //
- // After this call DevicePath points to the next Instance
- //
- Instance = GetNextDevicePathInstance (&DevicePath, &Size);
- Next = Instance;
- while (!IsDevicePathEndType (Next)) {
- Next = NextDevicePathNode (Next);
- }
-
- SetDevicePathEndNode (Next);
-
- //
- // Start the real work of connect with RemainingDevicePath
- //
- PreviousHandle = NULL;
- do {
- //
- // Find the handle that best matches the Device Path. If it is only a
- // partial match the remaining part of the device path is returned in
- // RemainingDevicePath.
- //
- RemainingDevicePath = Instance;
- Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);
-
- if (!EFI_ERROR (Status)) {
- if (Handle == PreviousHandle) {
- //
- // If no forward progress is made try invoking the Dispatcher.
- // A new FV may have been added to the system an new drivers
- // may now be found.
- // Status == EFI_SUCCESS means a driver was dispatched
- // Status == EFI_NOT_FOUND means no new drivers were dispatched
- //
- Status = gDS->Dispatch ();
- }
-
- if (!EFI_ERROR (Status)) {
- PreviousHandle = Handle;
- //
- // Connect all drivers that apply to Handle and RemainingDevicePath,
- // the Recursive flag is FALSE so only one level will be expanded.
- //
- // Do not check the connect status here, if the connect controller fail,
- // then still give the chance to do dispatch, because partial
- // RemainingDevicepath may be in the new FV
- //
- // 1. If the connect fail, RemainingDevicepath and handle will not
- // change, so next time will do the dispatch, then dispatch's status
- // will take effect
- // 2. If the connect success, the RemainingDevicepath and handle will
- // change, then avoid the dispatch, we have chance to continue the
- // next connection
- //
- gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);
- }
- }
- //
- // Loop until RemainingDevicePath is an empty device path
- //
- } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));
-
- } while (DevicePath != NULL);
-
- if (CopyOfDevicePath != NULL) {
- gBS->FreePool (CopyOfDevicePath);
- }
- //
- // All handle with DevicePath exists in the handle database
- //
- return Status;
-}
-
-EFI_STATUS
-BdsLibConnectAllEfi (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect all current system handles recursively. The
- connection will finish until every handle's child handle created if it have.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - All handles and it's child handle have been connected
-
- EFI_STATUS - Return the status of gBS->LocateHandleBuffer().
-
---*/
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
-
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
- }
-
- gBS->FreePool (HandleBuffer);
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsLibDisconnectAllEfi (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will disconnect all current system handles. The disconnection
- will finish until every handle have been disconnected.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - All handles have been disconnected
-
- EFI_STATUS - Return the status of gBS->LocateHandleBuffer().
-
---*/
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
-
- //
- // Disconnect all
- //
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);
- }
-
- gBS->FreePool (HandleBuffer);
-
- return EFI_SUCCESS;
-}
-
-VOID
-BdsLibConnectAllDriversToAllControllers (
- VOID
- )
-/*++
-
-Routine Description:
-
- Connects all drivers to all controllers.
- This function make sure all the current system driver will manage
- the correspoinding controllers if have. And at the same time, make
- sure all the system controllers have driver to manage it if have.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
-
- do {
- //
- // Connect All EFI 1.10 drivers following EFI 1.10 algorithm
- //
- BdsLibConnectAllEfi ();
-
- //
- // Check to see if it's possible to dispatch an more DXE drivers.
- // The BdsLibConnectAllEfi () may have made new DXE drivers show up.
- // If anything is Dispatched Status == EFI_SUCCESS and we will try
- // the connect again.
- //
- Status = gDS->Dispatch ();
-
- } while (!EFI_ERROR (Status));
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c deleted file mode 100644 index 300c19947c..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsConsole.c +++ /dev/null @@ -1,387 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsConsole.c
-
-Abstract:
-
- BDS Lib functions which contain all the code to connect console device
-
---*/
-
-BOOLEAN
-IsNvNeed (
- IN CHAR16 *ConVarName
- )
-{
- CHAR16 *Ptr;
-
- Ptr = ConVarName;
-
- //
- // If the variable includes "Dev" at last, we consider
- // it does not support NV attribute.
- //
- while (*Ptr) {
- Ptr++;
- }
-
- if ((*(Ptr - 3) == 'D') && (*(Ptr - 2) == 'e') && (*(Ptr - 1) == 'v')) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-EFI_STATUS
-BdsLibUpdateConsoleVariable (
- IN CHAR16 *ConVarName,
- IN EFI_DEVICE_PATH_PROTOCOL *CustomizedConDevicePath,
- IN EFI_DEVICE_PATH_PROTOCOL *ExclusiveDevicePath
- )
-/*++
-
-Routine Description:
-
- This function update console variable based on ConVarName, it can
- add or remove one specific console device path from the variable
-
-Arguments:
-
- ConVarName - Console related variable name, ConIn, ConOut, ErrOut.
-
- CustomizedConDevicePath - The console device path which will be added to
- the console variable ConVarName, this parameter
- can not be multi-instance.
-
- ExclusiveDevicePath - The console device path which will be removed
- from the console variable ConVarName, this
- parameter can not be multi-instance.
-
-Returns:
-
- EFI_UNSUPPORTED - Add or remove the same device path.
-
- EFI_SUCCESS - Success add or remove the device path from
- the console variable.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *VarConsole;
- UINTN DevicePathSize;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
- UINT32 Attributes;
-
- VarConsole = NULL;
- DevicePathSize = 0;
- Status = EFI_UNSUPPORTED;
-
- //
- // Notes: check the device path point, here should check
- // with compare memory
- //
- if (CustomizedConDevicePath == ExclusiveDevicePath) {
- return EFI_UNSUPPORTED;
- }
- //
- // Delete the ExclusiveDevicePath from current default console
- //
- VarConsole = BdsLibGetVariableAndSize (
- ConVarName,
- &gEfiGlobalVariableGuid,
- &DevicePathSize
- );
-
- //
- // Initialize NewDevicePath
- //
- NewDevicePath = VarConsole;
-
- //
- // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.
- // In the end, NewDevicePath is the final device path.
- //
- if (ExclusiveDevicePath != NULL && VarConsole != NULL) {
- NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);
- }
- //
- // Try to append customized device path to NewDevicePath.
- //
- if (CustomizedConDevicePath != NULL) {
- if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {
- //
- // Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.
- //
- NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);
- //
- // In the first check, the default console variable will be null,
- // just append current customized device path
- //
- TempNewDevicePath = NewDevicePath;
- NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);
- BdsLibSafeFreePool(TempNewDevicePath);
- }
- }
-
- //
- // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.
- //
- if (IsNvNeed(ConVarName)) {
- //
- // ConVarName has NV attribute.
- //
- Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;
- } else {
- //
- // ConVarName does not have NV attribute.
- //
- Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
- }
-
- //
- // Finally, Update the variable of the default console by NewDevicePath
- //
- gRT->SetVariable (
- ConVarName,
- &gEfiGlobalVariableGuid,
- Attributes,
- GetDevicePathSize (NewDevicePath),
- NewDevicePath
- );
-
- if (VarConsole == NewDevicePath) {
- BdsLibSafeFreePool(VarConsole);
- } else {
- BdsLibSafeFreePool(VarConsole);
- BdsLibSafeFreePool(NewDevicePath);
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-BdsLibConnectConsoleVariable (
- IN CHAR16 *ConVarName
- )
-/*++
-
-Routine Description:
-
- Connect the console device base on the variable ConVarName, if
- device path of the ConVarName is multi-instance device path, if
- anyone of the instances is connected success, then this function
- will return success.
-
-Arguments:
-
- ConVarName - Console related variable name, ConIn, ConOut, ErrOut.
-
-Returns:
-
- EFI_NOT_FOUND - There is not any console devices connected success
-
- EFI_SUCCESS - Success connect any one instance of the console
- device path base on the variable ConVarName.
-
---*/
-{
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *StartDevicePath;
- UINTN VariableSize;
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *Next;
- EFI_DEVICE_PATH_PROTOCOL *CopyOfDevicePath;
- UINTN Size;
- BOOLEAN DeviceExist;
-
- Status = EFI_SUCCESS;
- DeviceExist = FALSE;
-
- //
- // Check if the console variable exist
- //
- StartDevicePath = BdsLibGetVariableAndSize (
- ConVarName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if (StartDevicePath == NULL) {
- return EFI_UNSUPPORTED;
- }
-
- CopyOfDevicePath = StartDevicePath;
- do {
- //
- // Check every instance of the console variable
- //
- Instance = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);
- Next = Instance;
- while (!IsDevicePathEndType (Next)) {
- Next = NextDevicePathNode (Next);
- }
-
- SetDevicePathEndNode (Next);
-
- //
- // Connect the instance device path
- //
- Status = BdsLibConnectDevicePath (Instance);
- if (EFI_ERROR (Status)) {
- //
- // Delete the instance from the console varialbe
- //
- BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);
- } else {
- DeviceExist = TRUE;
- }
- BdsLibSafeFreePool(Instance);
- } while (CopyOfDevicePath != NULL);
-
- gBS->FreePool (StartDevicePath);
-
- if (DeviceExist == FALSE) {
- return EFI_NOT_FOUND;
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-BdsLibConnectAllConsoles (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will search every simpletxt devive in current system,
- and make every simpletxt device as pertantial console device.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
-
- Index = 0;
- HandleCount = 0;
- HandleBuffer = NULL;
- ConDevicePath = NULL;
-
- //
- // Update all the console variables
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleTextInProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ConDevicePath
- );
- BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);
- }
-
- BdsLibSafeFreePool(HandleBuffer);
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleTextOutProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID **) &ConDevicePath
- );
- BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);
- BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);
- }
-
- BdsLibSafeFreePool(HandleBuffer);
-
- //
- // Connect all console variables
- //
- BdsLibConnectAllDefaultConsoles ();
-
-}
-
-EFI_STATUS
-BdsLibConnectAllDefaultConsoles (
- VOID
- )
-/*++
-
-Routine Description:
-
- This function will connect console device base on the console
- device variable ConIn, ConOut and ErrOut.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - At least one of the ConIn and ConOut device have
- been connected success.
-
- EFI_STATUS - Return the status of BdsLibConnectConsoleVariable ().
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Connect all default console variables
- //
- Status = BdsLibConnectConsoleVariable (L"ConIn");
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = BdsLibConnectConsoleVariable (L"ConOut");
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Special treat the err out device, becaues the null
- // err out var is legal.
- //
- BdsLibConnectConsoleVariable (L"ErrOut");
-
- return EFI_SUCCESS;
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c b/EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c deleted file mode 100644 index f1591846d8..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/BdsMisc.c +++ /dev/null @@ -1,1089 +0,0 @@ -/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsMisc.c
-
-Abstract:
-
- Misc BDS library function
-
---*/
-
-#define MAX_STRING_LEN 200
-static BOOLEAN mFeaturerSwitch = TRUE;
-static BOOLEAN mResetRequired = FALSE;
-extern UINT16 gPlatformBootTimeOutDefault;
-
-UINT16
-BdsLibGetTimeout (
- VOID
- )
-/*++
-
-Routine Description:
-
- Return the default value for system Timeout variable.
-
-Arguments:
-
- None
-
-Returns:
-
- Timeout value.
-
---*/
-{
- UINT16 Timeout;
- UINTN Size;
- EFI_STATUS Status;
-
- //
- // Return Timeout variable or 0xffff if no valid
- // Timeout variable exists.
- //
- Size = sizeof (UINT16);
- Status = gRT->GetVariable (L"Timeout", &gEfiGlobalVariableGuid, NULL, &Size, &Timeout);
- if (!EFI_ERROR (Status)) {
- return Timeout;
- }
- //
- // To make the current EFI Automatic-Test activity possible, just add
- // following code to make AutoBoot enabled when this variable is not
- // present.
- // This code should be removed later.
- //
- Timeout = gPlatformBootTimeOutDefault;
-
- //
- // Notes: Platform should set default variable if non exists on all error cases!!!
- //
- Status = gRT->SetVariable (
- L"Timeout",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT16),
- &Timeout
- );
- return Timeout;
-}
-
-VOID
-BdsLibLoadDrivers (
- IN LIST_ENTRY *BdsDriverLists
- )
-/*++
-
-Routine Description:
-
- The function will go through the driver optoin link list, load and start
- every driver the driver optoin device path point to.
-
-Arguments:
-
- BdsDriverLists - The header of the current driver option link list
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- BDS_COMMON_OPTION *Option;
- EFI_HANDLE ImageHandle;
- EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- BOOLEAN ReconnectAll;
-
- ReconnectAll = FALSE;
-
- //
- // Process the driver option
- //
- for (Link = BdsDriverLists->ForwardLink; Link != BdsDriverLists; Link = Link->ForwardLink) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
- //
- // If a load option is not marked as LOAD_OPTION_ACTIVE,
- // the boot manager will not automatically load the option.
- //
- if (!IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_ACTIVE)) {
- continue;
- }
- //
- // If a driver load option is marked as LOAD_OPTION_FORCE_RECONNECT,
- // then all of the EFI drivers in the system will be disconnected and
- // reconnected after the last driver load option is processed.
- //
- if (IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_FORCE_RECONNECT)) {
- ReconnectAll = TRUE;
- }
- //
- // Make sure the driver path is connected.
- //
- BdsLibConnectDevicePath (Option->DevicePath);
-
- //
- // Load and start the image that Driver#### describes
- //
- Status = gBS->LoadImage (
- FALSE,
- mBdsImageHandle,
- Option->DevicePath,
- NULL,
- 0,
- &ImageHandle
- );
-
- if (!EFI_ERROR (Status)) {
- gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid,
- (VOID **)&ImageInfo);
-
- //
- // Verify whether this image is a driver, if not,
- // exit it and continue to parse next load option
- //
- if (ImageInfo->ImageCodeType != EfiBootServicesCode && ImageInfo->ImageCodeType != EfiRuntimeServicesCode) {
- gBS->Exit (ImageHandle, EFI_INVALID_PARAMETER, 0, NULL);
- continue;
- }
-
- if (Option->LoadOptionsSize != 0) {
- ImageInfo->LoadOptionsSize = Option->LoadOptionsSize;
- ImageInfo->LoadOptions = Option->LoadOptions;
- }
- //
- // Before calling the image, enable the Watchdog Timer for
- // the 5 Minute period
- //
- gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);
-
- Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);
- DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Driver Return Status = %r\n", Status));
-
- //
- // Clear the Watchdog Timer after the image returns
- //
- gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);
- }
- }
- //
- // Process the LOAD_OPTION_FORCE_RECONNECT driver option
- //
- if (ReconnectAll) {
- BdsLibDisconnectAllEfi ();
- BdsLibConnectAll ();
- }
-
-}
-
-EFI_STATUS
-BdsLibRegisterNewOption (
- IN LIST_ENTRY *BdsOptionList,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- IN CHAR16 *String,
- IN CHAR16 *VariableName
- )
-/*++
-
-Routine Description:
-
- This function will register the new boot#### or driver#### option base on
- the VariableName. The new registered boot#### or driver#### will be linked
- to BdsOptionList and also update to the VariableName. After the boot#### or
- driver#### updated, the BootOrder or DriverOrder will also be updated.
-
-Arguments:
-
- BdsOptionList - The header of the boot#### or driver#### link list
-
- DevicePath - The device path which the boot####
- or driver#### option present
-
- String - The description of the boot#### or driver####
-
- VariableName - Indicate if the boot#### or driver#### option
-
-Returns:
-
- EFI_SUCCESS - The boot#### or driver#### have been success registered
-
- EFI_STATUS - Return the status of gRT->SetVariable ().
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- UINT16 MaxOptionNumber;
- UINT16 RegisterOptionNumber;
- UINT16 *TempOptionPtr;
- UINTN TempOptionSize;
- UINT16 *OptionOrderPtr;
- VOID *OptionPtr;
- UINTN OptionSize;
- UINT8 *TempPtr;
- EFI_DEVICE_PATH_PROTOCOL *OptionDevicePath;
- CHAR16 *Description;
- CHAR16 OptionName[10];
- BOOLEAN UpdateBootDevicePath;
-
- OptionPtr = NULL;
- OptionSize = 0;
- TempPtr = NULL;
- OptionDevicePath = NULL;
- Description = NULL;
- MaxOptionNumber = 0;
- OptionOrderPtr = NULL;
- UpdateBootDevicePath = FALSE;
- ZeroMem (OptionName, sizeof (OptionName));
-
- TempOptionSize = 0;
- TempOptionPtr = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &TempOptionSize
- );
- //
- // Compare with current option variable
- //
- for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {
- //
- // Got the max option#### number
- //
- if (MaxOptionNumber < TempOptionPtr[Index]) {
- MaxOptionNumber = TempOptionPtr[Index];
- }
-
- if (*VariableName == 'B') {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);
- } else {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", TempOptionPtr[Index]);
- }
-
- OptionPtr = BdsLibGetVariableAndSize (
- OptionName,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- TempPtr = OptionPtr;
- TempPtr += sizeof (UINT32) + sizeof (UINT16);
- Description = (CHAR16 *) TempPtr;
- TempPtr += StrSize ((CHAR16 *) TempPtr);
- OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
-
- //
- // Notes: the description may will change base on the GetStringToken
- //
- if (CompareMem (Description, String, StrSize (Description)) == 0) {
- if (CompareMem (OptionDevicePath, DevicePath, GetDevicePathSize (OptionDevicePath)) == 0) {
- //
- // Got the option, so just return
- //
- gBS->FreePool (OptionPtr);
- gBS->FreePool (TempOptionPtr);
- return EFI_SUCCESS;
- } else {
- //
- // Boot device path changed, need update.
- //
- UpdateBootDevicePath = TRUE;
- break;
- }
- }
-
- gBS->FreePool (OptionPtr);
- }
-
- OptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (String) + GetDevicePathSize (DevicePath);
- OptionPtr = AllocateZeroPool (OptionSize);
- TempPtr = OptionPtr;
- *(UINT32 *) TempPtr = LOAD_OPTION_ACTIVE;
- TempPtr += sizeof (UINT32);
- *(UINT16 *) TempPtr = (UINT16) GetDevicePathSize (DevicePath);
- TempPtr += sizeof (UINT16);
- CopyMem (TempPtr, String, StrSize (String));
- TempPtr += StrSize (String);
- CopyMem (TempPtr, DevicePath, GetDevicePathSize (DevicePath));
-
- if (UpdateBootDevicePath) {
- //
- // The number in option#### to be updated
- //
- RegisterOptionNumber = TempOptionPtr[Index];
- } else {
- //
- // The new option#### number
- //
- RegisterOptionNumber = MaxOptionNumber + 1;
- }
-
- if (*VariableName == 'B') {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", RegisterOptionNumber);
- } else {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", RegisterOptionNumber);
- }
-
- Status = gRT->SetVariable (
- OptionName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- OptionSize,
- OptionPtr
- );
- if (EFI_ERROR (Status) || UpdateBootDevicePath) {
- gBS->FreePool (OptionPtr);
- gBS->FreePool (TempOptionPtr);
- return Status;
- }
-
- gBS->FreePool (OptionPtr);
-
- //
- // Update the option order variable
- //
- OptionOrderPtr = AllocateZeroPool ((Index + 1) * sizeof (UINT16));
- CopyMem (OptionOrderPtr, TempOptionPtr, Index * sizeof (UINT16));
- OptionOrderPtr[Index] = RegisterOptionNumber;
- Status = gRT->SetVariable (
- VariableName,
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- (Index + 1) * sizeof (UINT16),
- OptionOrderPtr
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (TempOptionPtr);
- gBS->FreePool (OptionOrderPtr);
- return Status;
- }
-
- gBS->FreePool (TempOptionPtr);
- gBS->FreePool (OptionOrderPtr);
-
- return EFI_SUCCESS;
-}
-
-BDS_COMMON_OPTION *
-BdsLibVariableToOption (
- IN OUT LIST_ENTRY *BdsCommonOptionList,
- IN CHAR16 *VariableName
- )
-/*++
-
-Routine Description:
-
- Build the boot#### or driver#### option from the VariableName, the
- build boot#### or driver#### will also be linked to BdsCommonOptionList
-
-Arguments:
-
- BdsCommonOptionList - The header of the boot#### or driver#### option link list
-
- VariableName - EFI Variable name indicate if it is boot#### or driver####
-
-Returns:
-
- BDS_COMMON_OPTION - Get the option just been created
-
- NULL - Failed to get the new option
-
---*/
-{
- UINT32 Attribute;
- UINT16 FilePathSize;
- UINT8 *Variable;
- UINT8 *TempPtr;
- UINTN VariableSize;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BDS_COMMON_OPTION *Option;
- VOID *LoadOptions;
- UINT32 LoadOptionsSize;
- CHAR16 *Description;
-
- //
- // Read the variable. We will never free this data.
- //
- Variable = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &VariableSize
- );
- if (Variable == NULL) {
- return NULL;
- }
- //
- // Notes: careful defined the variable of Boot#### or
- // Driver####, consider use some macro to abstract the code
- //
- //
- // Get the option attribute
- //
- TempPtr = Variable;
- Attribute = *(UINT32 *) Variable;
- TempPtr += sizeof (UINT32);
-
- //
- // Get the option's device path size
- //
- FilePathSize = *(UINT16 *) TempPtr;
- TempPtr += sizeof (UINT16);
-
- //
- // Get the option's description string
- //
- Description = (CHAR16 *) TempPtr;
-
- //
- // Get the option's description string size
- //
- TempPtr += StrSize ((CHAR16 *) TempPtr);
-
- //
- // Get the option's device path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;
- TempPtr += FilePathSize;
-
- LoadOptions = TempPtr;
- LoadOptionsSize = (UINT32) (VariableSize - (UINTN) (TempPtr - Variable));
-
- //
- // The Console variables may have multiple device paths, so make
- // an Entry for each one.
- //
- Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));
- if (Option == NULL) {
- return NULL;
- }
-
- Option->Signature = BDS_LOAD_OPTION_SIGNATURE;
- Option->DevicePath = AllocateZeroPool (GetDevicePathSize (DevicePath));
- CopyMem (Option->DevicePath, DevicePath, GetDevicePathSize (DevicePath));
- Option->Attribute = Attribute;
- Option->Description = AllocateZeroPool (StrSize (Description));
- CopyMem (Option->Description, Description, StrSize (Description));
- Option->LoadOptions = AllocateZeroPool (LoadOptionsSize);
- CopyMem (Option->LoadOptions, LoadOptions, LoadOptionsSize);
- Option->LoadOptionsSize = LoadOptionsSize;
-
- //
- // Insert active entry to BdsDeviceList
- //
- if ((Option->Attribute & LOAD_OPTION_ACTIVE) == LOAD_OPTION_ACTIVE) {
- InsertTailList (BdsCommonOptionList, &Option->Link);
- gBS->FreePool (Variable);
- return Option;
- }
-
- gBS->FreePool (Variable);
- gBS->FreePool (Option);
- return NULL;
-
-}
-
-EFI_STATUS
-BdsLibBuildOptionFromVar (
- IN LIST_ENTRY *BdsCommonOptionList,
- IN CHAR16 *VariableName
- )
-/*++
-
-Routine Description:
-
- Process BootOrder, or DriverOrder variables, by calling
- BdsLibVariableToOption () for each UINT16 in the variables.
-
-Arguments:
-
- BdsCommonOptionList - The header of the option list base on variable
- VariableName
-
- VariableName - EFI Variable name indicate the BootOrder or DriverOrder
-
-Returns:
-
- EFI_SUCCESS - Success create the boot option or driver option list
-
- EFI_OUT_OF_RESOURCES - Failed to get the boot option or driver option list
-
---*/
-{
- UINT16 *OptionOrder;
- UINTN OptionOrderSize;
- UINTN Index;
- BDS_COMMON_OPTION *Option;
- CHAR16 OptionName[20];
-
- //
- // Zero Buffer in order to get all BOOT#### variables
- //
- ZeroMem (OptionName, sizeof (OptionName));
-
- //
- // Read the BootOrder, or DriverOrder variable.
- //
- OptionOrder = BdsLibGetVariableAndSize (
- VariableName,
- &gEfiGlobalVariableGuid,
- &OptionOrderSize
- );
- if (OptionOrder == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {
- if (*VariableName == 'B') {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", OptionOrder[Index]);
- } else {
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", OptionOrder[Index]);
- }
- Option = BdsLibVariableToOption (BdsCommonOptionList, OptionName);
- Option->BootCurrent = OptionOrder[Index];
-
- }
-
- gBS->FreePool (OptionOrder);
-
- return EFI_SUCCESS;
-}
-
-VOID *
-BdsLibGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VariableSize
- )
-/*++
-
-Routine Description:
-
- Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
- buffer, and the size of the buffer. If failure return NULL.
-
-Arguments:
-
- Name - String part of EFI variable name
-
- VendorGuid - GUID part of EFI variable name
-
- VariableSize - Returns the size of the EFI variable that was read
-
-Returns:
-
- Dynamically allocated memory that contains a copy of the EFI variable.
- Caller is responsible freeing the buffer.
-
- NULL - Variable was not read
-
---*/
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- VOID *Buffer;
-
- Buffer = NULL;
-
- //
- // Pass in a zero size buffer to find the required buffer size.
- //
- BufferSize = 0;
- Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Allocate the buffer to return
- //
- Buffer = AllocateZeroPool (BufferSize);
- if (Buffer == NULL) {
- return NULL;
- }
- //
- // Read variable into the allocated buffer.
- //
- Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
- if (EFI_ERROR (Status)) {
- BufferSize = 0;
- }
- }
-
- *VariableSize = BufferSize;
- return Buffer;
-}
-
-VOID
-BdsLibSafeFreePool (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
-
- Free pool safely.
-
-Arguments:
-
- Buffer - The allocated pool entry to free
-
-Returns:
-
- Pointer of the buffer allocated.
-
---*/
-{
- if (Buffer != NULL) {
- gBS->FreePool (Buffer);
- Buffer = NULL;
- }
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-BdsLibDelPartMatchInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- )
-/*++
-
-Routine Description:
-
- Delete the instance in Multi which matches partly with Single instance
-
-Arguments:
-
- Multi - A pointer to a multi-instance device path data structure.
-
- Single - A pointer to a single-instance device path data structure.
-
-Returns:
-
- This function will remove the device path instances in Multi which partly
- match with the Single, and return the result device path. If there is no
- remaining device path as a result, this function will return NULL.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Instance;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *TempNewDevicePath;
- UINTN InstanceSize;
- UINTN SingleDpSize;
- UINTN Size;
-
- NewDevicePath = NULL;
- TempNewDevicePath = NULL;
-
- if (Multi == NULL || Single == NULL) {
- return Multi;
- }
-
- Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);
- SingleDpSize = GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;
- InstanceSize -= END_DEVICE_PATH_LENGTH;
-
- while (Instance != NULL) {
-
- Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;
-
- if ((CompareMem (Instance, Single, Size) != 0)) {
- //
- // Append the device path instance which does not match with Single
- //
- TempNewDevicePath = NewDevicePath;
- NewDevicePath = AppendDevicePathInstance (NewDevicePath, Instance);
- BdsLibSafeFreePool(TempNewDevicePath);
- }
- BdsLibSafeFreePool(Instance);
- Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);
- InstanceSize -= END_DEVICE_PATH_LENGTH;
- }
-
- return NewDevicePath;
-}
-
-BOOLEAN
-BdsLibMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- )
-/*++
-
-Routine Description:
-
- Function compares a device path data structure to that of all the nodes of a
- second device path instance.
-
-Arguments:
-
- Multi - A pointer to a multi-instance device path data structure.
-
- Single - A pointer to a single-instance device path data structure.
-
-Returns:
-
- TRUE - If the Single is contained within Multi
-
- FALSE - The Single is not match within Multi
-
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- UINTN Size;
-
- if (!Multi || !Single) {
- return FALSE;
- }
-
- DevicePath = Multi;
- DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
-
- //
- // Search for the match of 'Single' in 'Multi'
- //
- while (DevicePathInst != NULL) {
- //
- // If the single device path is found in multiple device paths,
- // return success
- //
- if (CompareMem (Single, DevicePathInst, Size) == 0) {
- gBS->FreePool (DevicePathInst);
- return TRUE;
- }
-
- gBS->FreePool (DevicePathInst);
- DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
- }
-
- return FALSE;
-}
-
-EFI_STATUS
-BdsLibOutputStrings (
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *ConOut,
- ...
- )
-/*++
-
-Routine Description:
-
- This function prints a series of strings.
-
-Arguments:
-
- ConOut - Pointer to EFI_SIMPLE_TEXT_OUT_PROTOCOL
-
- ... - A variable argument list containing series of strings,
- the last string must be NULL.
-
-Returns:
-
- EFI_SUCCESS - Success print out the string using ConOut.
-
- EFI_STATUS - Return the status of the ConOut->OutputString ().
-
---*/
-{
- VA_LIST args;
- EFI_STATUS Status;
- CHAR16 *String;
-
- Status = EFI_SUCCESS;
- VA_START (args, ConOut);
-
- while (!EFI_ERROR (Status)) {
- //
- // If String is NULL, then it's the end of the list
- //
- String = VA_ARG (args, CHAR16 *);
- if (!String) {
- break;
- }
-
- Status = ConOut->OutputString (ConOut, String);
-
- if (EFI_ERROR (Status)) {
- break;
- }
- }
-
- return Status;
-}
-
-//
-// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
-// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
-// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
-//
-
-VOID
-EnableResetReminderFeature (
- VOID
- )
-/*++
-
-Routine Description:
-
- Enable the setup browser reset reminder feature.
- This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mFeaturerSwitch = TRUE;
-}
-
-VOID
-DisableResetReminderFeature (
- VOID
- )
-/*++
-
-Routine Description:
-
- Disable the setup browser reset reminder feature.
- This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mFeaturerSwitch = FALSE;
-}
-
-VOID
-EnableResetRequired (
- VOID
- )
-/*++
-
-Routine Description:
-
- Record the info that a reset is required.
- A module boolean variable is used to record whether a reset is required.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mResetRequired = TRUE;
-}
-
-VOID
-DisableResetRequired (
- VOID
- )
-/*++
-
-Routine Description:
-
- Record the info that no reset is required.
- A module boolean variable is used to record whether a reset is required.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- mResetRequired = FALSE;
-}
-
-BOOLEAN
-IsResetReminderFeatureEnable (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check whether platform policy enable the reset reminder feature. The default is enabled.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- return mFeaturerSwitch;
-}
-
-BOOLEAN
-IsResetRequired (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check if user changed any option setting which needs a system reset to be effective.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- return mResetRequired;
-}
-
-VOID
-SetupResetReminder (
- VOID
- )
-/*++
-
-Routine Description:
-
- Check whether a reset is needed, and finish the reset reminder feature.
- If a reset is needed, Popup a menu to notice user, and finish the feature
- according to the user selection.
-
-Arguments:
-
- VOID
-
-Returns:
-
- VOID
-
---*/
-{
- EFI_STATUS Status;
- EFI_FORM_BROWSER_PROTOCOL *Browser;
- EFI_INPUT_KEY Key;
- CHAR16 *StringBuffer1;
- CHAR16 *StringBuffer2;
-
-
- //
- //check any reset required change is applied? if yes, reset system
- //
- if (IsResetReminderFeatureEnable ()) {
- if (IsResetRequired ()) {
-
- Status = gBS->LocateProtocol (
- &gEfiFormBrowserProtocolGuid,
- NULL,
- (VOID **)&Browser
- );
-
- StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
- ASSERT (StringBuffer1 != NULL);
- StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
- ASSERT (StringBuffer2 != NULL);
- StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");
- StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)");
- //
- // Popup a menu to notice user
- //
- do {
- Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);
- } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
-
- gBS->FreePool (StringBuffer1);
- gBS->FreePool (StringBuffer2);
- //
- // If the user hits the YES Response key, reset
- //
- if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- }
- gST->ConOut->ClearScreen (gST->ConOut);
- }
- }
-}
-
-EFI_STATUS
-BdsLibGetHiiHandles (
- IN EFI_HII_PROTOCOL *Hii,
- IN OUT UINT16 *HandleBufferLength,
- OUT EFI_HII_HANDLE **HiiHandleBuffer
- )
-/*++
-
-Routine Description:
-
- Determines the handles that are currently active in the database.
- It's the caller's responsibility to free handle buffer.
-
-Arguments:
-
- This - A pointer to the EFI_HII_PROTOCOL instance.
- HandleBufferLength - On input, a pointer to the length of the handle buffer. On output,
- the length of the handle buffer that is required for the handles found.
- HiiHandleBuffer - Pointer to an array of EFI_HII_PROTOCOL instances returned.
-
-Returns:
-
- EFI_SUCCESS - Get an array of EFI_HII_PROTOCOL instances successfully.
- EFI_INVALID_PARAMETER - Hii is NULL.
- EFI_NOT_FOUND - Database not found.
-
---*/
-{
- UINT16 TempBufferLength;
- EFI_STATUS Status;
-
- TempBufferLength = 0;
-
- //
- // Try to find the actual buffer size for HiiHandle Buffer.
- //
- Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);
-
- if (Status == EFI_BUFFER_TOO_SMALL) {
- *HiiHandleBuffer = AllocateZeroPool (TempBufferLength);
- Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);
- //
- // we should not fail here.
- //
- ASSERT_EFI_ERROR (Status);
- }
-
- *HandleBufferLength = TempBufferLength;
-
- return Status;
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c b/EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c deleted file mode 100644 index 253f2a9537..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/DevicePath.c +++ /dev/null @@ -1,1027 +0,0 @@ -/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DevicePath.c
-
-Abstract:
-
- BDS internal function define the default device path string, it can be
- replaced by platform device path.
-
---*/
-
-EFI_GUID mEfiUnixThunkProtocolGuid = EFI_UNIX_THUNK_PROTOCOL_GUID;
-EFI_GUID mEfiUnixUgaGuid = EFI_UNIX_UGA_GUID;
-EFI_GUID mEfiMsgPcAnsiGuid = DEVICE_PATH_MESSAGING_PC_ANSI;
-EFI_GUID mEfiMsgVt100Guid = DEVICE_PATH_MESSAGING_VT_100;
-EFI_GUID mEfiMsgVt100PlusGuid = DEVICE_PATH_MESSAGING_VT_100_PLUS;
-EFI_GUID mEfiMsgVt100Utf8Guid = DEVICE_PATH_MESSAGING_VT_UTF8;
-
-VOID *
-ReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- )
-/*++
-
-Routine Description:
-
- Adjusts the size of a previously allocated buffer.
-
-Arguments:
-
- OldPool - A pointer to the buffer whose size is being adjusted.
-
- OldSize - The size of the current buffer.
-
- NewSize - The size of the new buffer.
-
-Returns:
-
- EFI_SUCEESS - The requested number of bytes were allocated.
-
- EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
-
- EFI_INVALID_PARAMETER - The buffer was invalid.
-
---*/
-{
- VOID *NewPool;
-
- NewPool = NULL;
- if (NewSize) {
- NewPool = AllocateZeroPool (NewSize);
- }
-
- if (OldPool) {
- if (NewPool) {
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
- }
-
- gBS->FreePool (OldPool);
- }
-
- return NewPool;
-}
-
-CHAR16 *
-CatPrint (
- IN OUT POOL_PRINT *Str,
- IN CHAR16 *fmt,
- ...
- )
-/*++
-
-Routine Description:
-
- Concatenates a formatted unicode string to allocated pool.
- The caller must free the resulting buffer.
-
-Arguments:
-
- Str - Tracks the allocated pool, size in use, and
- amount of pool allocated.
-
- fmt - The format string
-
-Returns:
-
- Allocated buffer with the formatted string printed in it.
- The caller must free the allocated buffer. The buffer
- allocation is not packed.
-
---*/
-{
- UINT16 *AppendStr;
- VA_LIST args;
- UINTN strsize;
-
- AppendStr = AllocateZeroPool (0x1000);
- if (AppendStr == NULL) {
- return Str->str;
- }
-
- VA_START (args, fmt);
- UnicodeVSPrint (AppendStr, 0x1000, fmt, args);
- VA_END (args);
- if (NULL == Str->str) {
- strsize = StrSize (AppendStr);
- Str->str = AllocateZeroPool (strsize);
- ASSERT (Str->str != NULL);
- } else {
- strsize = StrSize (AppendStr) + StrSize (Str->str) - sizeof (UINT16);
- Str->str = ReallocatePool (
- Str->str,
- StrSize (Str->str),
- strsize
- );
- ASSERT (Str->str != NULL);
- }
-
- Str->maxlen = MAX_CHAR * sizeof (UINT16);
- if (strsize < Str->maxlen) {
- StrCat (Str->str, AppendStr);
- Str->len = strsize - sizeof (UINT16);
- }
-
- gBS->FreePool (AppendStr);
- return Str->str;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-BdsLibUnpackDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
-Routine Description:
-
- Function unpacks a device path data structure so that all the nodes
- of a device path are naturally aligned.
-
-Arguments:
-
- DevPath - A pointer to a device path data structure
-
-Returns:
-
- If the memory for the device path is successfully allocated, then a
- pointer to the new device path is returned. Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Src;
- EFI_DEVICE_PATH_PROTOCOL *Dest;
- EFI_DEVICE_PATH_PROTOCOL *NewPath;
- UINTN Size;
-
- //
- // Walk device path and round sizes to valid boundries
- //
- Src = DevPath;
- Size = 0;
- for (;;) {
- Size += DevicePathNodeLength (Src);
- Size += ALIGN_SIZE (Size);
-
- if (IsDevicePathEnd (Src)) {
- break;
- }
-
- Src = NextDevicePathNode (Src);
- }
- //
- // Allocate space for the unpacked path
- //
- NewPath = AllocateZeroPool (Size);
- if (NewPath) {
-
- ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);
-
- //
- // Copy each node
- //
- Src = DevPath;
- Dest = NewPath;
- for (;;) {
- Size = DevicePathNodeLength (Src);
- CopyMem (Dest, Src, Size);
- Size += ALIGN_SIZE (Size);
- SetDevicePathNodeLength (Dest, Size);
- Dest->Type |= EFI_DP_TYPE_UNPACKED;
- Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);
-
- if (IsDevicePathEnd (Src)) {
- break;
- }
-
- Src = NextDevicePathNode (Src);
- }
- }
-
- return NewPath;
-}
-
-VOID
-DevPathPci (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- PCI_DEVICE_PATH *Pci;
-
- Pci = DevPath;
- CatPrint (Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);
-}
-
-VOID
-DevPathPccard (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- PCCARD_DEVICE_PATH *Pccard;
-
- Pccard = DevPath;
- CatPrint (Str, L"Pcmcia(Function%x)", Pccard->FunctionNumber);
-}
-
-VOID
-DevPathMemMap (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MEMMAP_DEVICE_PATH *MemMap;
-
- MemMap = DevPath;
- CatPrint (
- Str,
- L"MemMap(%d:%.lx-%.lx)",
- MemMap->MemoryType,
- MemMap->StartingAddress,
- MemMap->EndingAddress
- );
-}
-
-VOID
-DevPathController (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CONTROLLER_DEVICE_PATH *Controller;
-
- Controller = DevPath;
- CatPrint (Str, L"Ctrl(%d)", Controller->ControllerNumber);
-}
-
-VOID
-DevPathVendor (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-/*++
-
-Routine Description:
-
- Convert Vendor device path to device name
-
-Arguments:
-
- Str - The buffer store device name
- DevPath - Pointer to vendor device path
-
-Returns:
-
- When it return, the device name have been stored in *Str.
-
---*/
-{
- VENDOR_DEVICE_PATH *Vendor;
- CHAR16 *Type;
- INT32 *Temp;
-
- Vendor = DevPath;
- Temp = (INT32 *) (&Vendor->Guid);
-
- switch (DevicePathType (&Vendor->Header)) {
- case HARDWARE_DEVICE_PATH:
- //
- // If the device is an Unix device, we will give it a readable device name.
- //
- if (CompareGuid (&Vendor->Guid, &mEfiUnixThunkProtocolGuid)) {
- CatPrint (Str, L"%s", L"UnixBus");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiUnixUgaGuid)) {
- CatPrint (Str, L"%s", L"UGA");
- return ;
- } else {
- Type = L"Hw";
- break;
- }
-
- case MESSAGING_DEVICE_PATH:
- //
- // If the device is an Unix device, we will give it a readable device name.
- //
- if (CompareGuid (&Vendor->Guid, &mEfiMsgPcAnsiGuid)) {
- CatPrint (Str, L"%s", L"PC-ANSI");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Guid)) {
- CatPrint (Str, L"%s", L"VT100");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100PlusGuid)) {
- CatPrint (Str, L"%s", L"VT100+");
- return ;
- } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Utf8Guid)) {
- CatPrint (Str, L"%s", L"VT100-UTF8");
- return ;
- } else {
- Type = L"Msg";
- break;
- }
-
- case MEDIA_DEVICE_PATH:
- Type = L"Media";
- break;
-
- default:
- Type = L"?";
- break;
- }
-
- CatPrint (Str, L"Ven%s(%g)", Type, &Vendor->Guid);
-}
-
-VOID
-DevPathAcpi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- ACPI_HID_DEVICE_PATH *Acpi;
-
- Acpi = DevPath;
- if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
- CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
- } else {
- CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);
- }
-}
-
-VOID
-DevPathAtapi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- ATAPI_DEVICE_PATH *Atapi;
-
- Atapi = DevPath;
- CatPrint (
- Str,
- L"Ata(%s,%s)",
- Atapi->PrimarySecondary ? L"Secondary" : L"Primary",
- Atapi->SlaveMaster ? L"Slave" : L"Master"
- );
-}
-
-VOID
-DevPathScsi (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- SCSI_DEVICE_PATH *Scsi;
-
- Scsi = DevPath;
- CatPrint (Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);
-}
-
-VOID
-DevPathFibre (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- FIBRECHANNEL_DEVICE_PATH *Fibre;
-
- Fibre = DevPath;
- CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);
-}
-
-VOID
-DevPath1394 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- F1394_DEVICE_PATH *F1394;
-
- F1394 = DevPath;
- CatPrint (Str, L"1394(%g)", &F1394->Guid);
-}
-
-VOID
-DevPathUsb (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- USB_DEVICE_PATH *Usb;
-
- Usb = DevPath;
- CatPrint (Str, L"Usb(%x, %x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
-}
-
-VOID
-DevPathUsbClass (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- USB_CLASS_DEVICE_PATH *UsbClass;
-
- UsbClass = DevPath;
- CatPrint (
- Str,
- L"Usb Class(%x, %x, %x, %x, %x)",
- UsbClass->VendorId,
- UsbClass->ProductId,
- UsbClass->DeviceClass,
- UsbClass->DeviceSubClass,
- UsbClass->DeviceProtocol
- );
-}
-
-VOID
-DevPathI2O (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- I2O_DEVICE_PATH *I2O;
-
- I2O = DevPath;
- CatPrint (Str, L"I2O(%x)", I2O->Tid);
-}
-
-VOID
-DevPathMacAddr (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MAC_ADDR_DEVICE_PATH *MAC;
- UINTN HwAddressSize;
- UINTN Index;
-
- MAC = DevPath;
-
- HwAddressSize = sizeof (EFI_MAC_ADDRESS);
- if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {
- HwAddressSize = 6;
- }
-
- CatPrint (Str, L"Mac(");
-
- for (Index = 0; Index < HwAddressSize; Index++) {
- CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);
- }
-
- CatPrint (Str, L")");
-}
-
-VOID
-DevPathIPv4 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- IPv4_DEVICE_PATH *IP;
-
- IP = DevPath;
- CatPrint (
- Str,
- L"IPv4(%d.%d.%d.%d:%d)",
- IP->RemoteIpAddress.Addr[0],
- IP->RemoteIpAddress.Addr[1],
- IP->RemoteIpAddress.Addr[2],
- IP->RemoteIpAddress.Addr[3],
- IP->RemotePort
- );
-}
-
-VOID
-DevPathIPv6 (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- IPv6_DEVICE_PATH *IP;
-
- IP = DevPath;
- CatPrint (Str, L"IP-v6(not-done)");
-}
-
-VOID
-DevPathInfiniBand (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- INFINIBAND_DEVICE_PATH *InfiniBand;
-
- InfiniBand = DevPath;
- CatPrint (Str, L"InfiniBand(not-done)");
-}
-
-VOID
-DevPathUart (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- UART_DEVICE_PATH *Uart;
- CHAR8 Parity;
-
- Uart = DevPath;
- switch (Uart->Parity) {
- case 0:
- Parity = 'D';
- break;
-
- case 1:
- Parity = 'N';
- break;
-
- case 2:
- Parity = 'E';
- break;
-
- case 3:
- Parity = 'O';
- break;
-
- case 4:
- Parity = 'M';
- break;
-
- case 5:
- Parity = 'S';
- break;
-
- default:
- Parity = 'x';
- break;
- }
-
- if (Uart->BaudRate == 0) {
- CatPrint (Str, L"Uart(DEFAULT %c", Parity);
- } else {
- CatPrint (Str, L"Uart(%d %c", Uart->BaudRate, Parity);
- }
-
- if (Uart->DataBits == 0) {
- CatPrint (Str, L"D");
- } else {
- CatPrint (Str, L"%d", Uart->DataBits);
- }
-
- switch (Uart->StopBits) {
- case 0:
- CatPrint (Str, L"D)");
- break;
-
- case 1:
- CatPrint (Str, L"1)");
- break;
-
- case 2:
- CatPrint (Str, L"1.5)");
- break;
-
- case 3:
- CatPrint (Str, L"2)");
- break;
-
- default:
- CatPrint (Str, L"x)");
- break;
- }
-}
-
-VOID
-DevPathHardDrive (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- HARDDRIVE_DEVICE_PATH *Hd;
-
- Hd = DevPath;
- switch (Hd->SignatureType) {
- case SIGNATURE_TYPE_MBR:
- CatPrint (
- Str,
- L"HD(Part%d,Sig%08x)",
- Hd->PartitionNumber,
- *((UINT32 *) (&(Hd->Signature[0])))
- );
- break;
-
- case SIGNATURE_TYPE_GUID:
- CatPrint (
- Str,
- L"HD(Part%d,Sig%g)",
- Hd->PartitionNumber,
- (EFI_GUID *) &(Hd->Signature[0])
- );
- break;
-
- default:
- CatPrint (
- Str,
- L"HD(Part%d,MBRType=%02x,SigType=%02x)",
- Hd->PartitionNumber,
- Hd->MBRType,
- Hd->SignatureType
- );
- break;
- }
-}
-
-VOID
-DevPathCDROM (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CDROM_DEVICE_PATH *Cd;
-
- Cd = DevPath;
- CatPrint (Str, L"CDROM(Entry%x)", Cd->BootEntry);
-}
-
-VOID
-DevPathFilePath (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- FILEPATH_DEVICE_PATH *Fp;
-
- Fp = DevPath;
- CatPrint (Str, L"%s", Fp->PathName);
-}
-
-VOID
-DevPathMediaProtocol (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
-
- MediaProt = DevPath;
- CatPrint (Str, L"%g", &MediaProt->Protocol);
-}
-
-VOID
-DevPathFvFilePath (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;
-
- FvFilePath = DevPath;
- CatPrint (Str, L"%g", &FvFilePath->NameGuid);
-}
-
-VOID
-DevPathBssBss (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- BBS_BBS_DEVICE_PATH *Bbs;
- CHAR16 *Type;
-
- Bbs = DevPath;
- switch (Bbs->DeviceType) {
- case BBS_TYPE_FLOPPY:
- Type = L"Floppy";
- break;
-
- case BBS_TYPE_HARDDRIVE:
- Type = L"Harddrive";
- break;
-
- case BBS_TYPE_CDROM:
- Type = L"CDROM";
- break;
-
- case BBS_TYPE_PCMCIA:
- Type = L"PCMCIA";
- break;
-
- case BBS_TYPE_USB:
- Type = L"Usb";
- break;
-
- case BBS_TYPE_EMBEDDED_NETWORK:
- Type = L"Net";
- break;
-
- default:
- Type = L"?";
- break;
- }
- //
- // Since current Print function hasn't implemented %a (for ansi string)
- // we will only print Unicode strings.
- //
- CatPrint (Str, L"Legacy-%s", Type);
-}
-
-VOID
-DevPathEndInstance (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CatPrint (Str, L",");
-}
-
-VOID
-DevPathNodeUnknown (
- IN OUT POOL_PRINT *Str,
- IN VOID *DevPath
- )
-{
- CatPrint (Str, L"?");
-}
-
-DEVICE_PATH_STRING_TABLE DevPathTable[] = {
- { - HARDWARE_DEVICE_PATH,
- HW_PCI_DP,
- DevPathPci
- }, - { - HARDWARE_DEVICE_PATH,
- HW_PCCARD_DP,
- DevPathPccard
- }, - { - HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- DevPathMemMap
- }, - { - HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- DevPathVendor
- }, - { - HARDWARE_DEVICE_PATH,
- HW_CONTROLLER_DP,
- DevPathController
- }, - { - ACPI_DEVICE_PATH,
- ACPI_DP,
- DevPathAcpi
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_ATAPI_DP,
- DevPathAtapi
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_SCSI_DP,
- DevPathScsi
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_FIBRECHANNEL_DP,
- DevPathFibre
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_1394_DP,
- DevPath1394
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_USB_DP,
- DevPathUsb
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_USB_CLASS_DP,
- DevPathUsbClass
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_I2O_DP,
- DevPathI2O
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_MAC_ADDR_DP,
- DevPathMacAddr
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_IPv4_DP,
- DevPathIPv4
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_IPv6_DP,
- DevPathIPv6
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_INFINIBAND_DP,
- DevPathInfiniBand
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_UART_DP,
- DevPathUart
- }, - { - MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- DevPathVendor
- }, - { - MEDIA_DEVICE_PATH,
- MEDIA_HARDDRIVE_DP,
- DevPathHardDrive
- }, - { - MEDIA_DEVICE_PATH,
- MEDIA_CDROM_DP,
- DevPathCDROM
- }, - { - MEDIA_DEVICE_PATH,
- MEDIA_VENDOR_DP,
- DevPathVendor
- }, - { - MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- DevPathFilePath
- }, - { - MEDIA_DEVICE_PATH,
- MEDIA_PROTOCOL_DP,
- DevPathMediaProtocol
- }, -
- { - BBS_DEVICE_PATH,
- BBS_BBS_DP,
- DevPathBssBss
- }, - { - END_DEVICE_PATH_TYPE,
- END_INSTANCE_DEVICE_PATH_SUBTYPE,
- DevPathEndInstance
- }, - { - 0,
- 0,
- NULL
- } -};
-
-CHAR16 *
-DevicePathToStr (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
- Turns the Device Path into a printable string. Allcoates
- the string from pool. The caller must SafeFreePool the returned
- string.
-
---*/
-{
- POOL_PRINT Str;
- EFI_DEVICE_PATH_PROTOCOL *DevPathNode;
- VOID (*DumpNode) (POOL_PRINT *, VOID *);
-
- UINTN Index;
- UINTN NewSize;
-
- ZeroMem (&Str, sizeof (Str));
-
- if (DevPath == NULL) {
- goto Done;
- }
- //
- // Unpacked the device path
- //
- DevPath = BdsLibUnpackDevicePath (DevPath);
- ASSERT (DevPath);
-
- //
- // Process each device path node
- //
- DevPathNode = DevPath;
- while (!IsDevicePathEnd (DevPathNode)) {
- //
- // Find the handler to dump this device path node
- //
- DumpNode = NULL;
- for (Index = 0; DevPathTable[Index].Function; Index += 1) {
-
- if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&
- DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType
- ) {
- DumpNode = DevPathTable[Index].Function;
- break;
- }
- }
- //
- // If not found, use a generic function
- //
- if (!DumpNode) {
- DumpNode = DevPathNodeUnknown;
- }
- //
- // Put a path seperator in if needed
- //
- if (Str.len && DumpNode != DevPathEndInstance) {
- CatPrint (&Str, L"/");
- }
- //
- // Print this node of the device path
- //
- DumpNode (&Str, DevPathNode);
-
- //
- // Next device path node
- //
- DevPathNode = NextDevicePathNode (DevPathNode);
- }
- //
- // Shrink pool used for string allocation
- //
- gBS->FreePool (DevPath);
-
-Done:
- NewSize = (Str.len + 1) * sizeof (CHAR16);
- Str.str = ReallocatePool (Str.str, NewSize, NewSize);
- ASSERT (Str.str != NULL);
- Str.str[Str.len] = 0;
- return Str.str;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-LibDuplicateDevicePathInstance (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
-Routine Description:
-
- Function creates a device path data structure that identically matches the
- device path passed in.
-
-Arguments:
-
- DevPath - A pointer to a device path data structure.
-
-Returns:
-
- The new copy of DevPath is created to identically match the input.
- Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- EFI_DEVICE_PATH_PROTOCOL *Temp;
- UINTN Size;
-
- //
- // get the size of an instance from the input
- //
- Temp = DevPath;
- DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
-
- //
- // Make a copy
- //
- NewDevPath = NULL;
- if (Size) {
- NewDevPath = AllocateZeroPool (Size);
- ASSERT (NewDevPath != NULL);
- }
-
- if (NewDevPath) {
- CopyMem (NewDevPath, DevicePathInst, Size);
- }
-
- return NewDevPath;
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa b/EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa deleted file mode 100644 index 8c2c718854..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa +++ /dev/null @@ -1,116 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">
- <MsaHeader>
- <ModuleName>EdkGenericBdsLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>f3aaea62-8985-11db-baff-0040d02b1835</GuidValue>
- <Version>1.0</Version>
- <Abstract>EDK Generic BDS Common APIs Library Instance.</Abstract>
- <Description>The library instance provides common library routines help in
- performance measurement, device path debug print, boot device selections,
- boot device connection, console supports in BDS phase and boot from boot
- device.
- </Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkGenericBdsLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>EdkGenericBdsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DxeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DevicePathLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>PeCoffLib</Keyword> - </LibraryClass> - </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>BdsBoot.c</Filename>
- <Filename>BdsConsole.c</Filename>
- <Filename>BdsConnect.c</Filename>
- <Filename>DevicePath.c</Filename>
- <Filename>Performance.h</Filename>
- <Filename>Performance.c</Filename>
- <Filename>BdsMisc.c</Filename>
- <Filename SupArchList="IPF">Ipf/ShadowRom.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- <Package PackageGuid="f2805c44-8985-11db-9e98-0040d02b1835"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiAcpiS3SaveProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiShellFileGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea> diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c b/EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c deleted file mode 100644 index bbd72200a2..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/Ipf/ShadowRom.c +++ /dev/null @@ -1,48 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ShadowRom.c
-
-Abstract:
-
- Shadow all option rom
-
-Revision History
-
---*/
-
-UINT8 mShadowRomFlag = 0;
-
-VOID
-ShadowAllOptionRom()
-{
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- //
- // Rom shadow only do once.
- //
- if (mShadowRomFlag == 0) {
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
- LegacyBios->PrepareToBootEfi (LegacyBios, NULL, NULL);
- }
-
- mShadowRomFlag = 1;
- }
-
- return ;
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.c b/EdkModulePkg/Library/EdkGenericBdsLib/Performance.c deleted file mode 100644 index 1d92a4d5f6..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.c +++ /dev/null @@ -1,399 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Performance.c
-
-Abstract:
-
- This file include the file which can help to get the system
- performance, all the function will only include if the performance
- switch is set.
-
---*/
-
-#include "Performance.h"
-
-VOID
-ClearDebugRegisters (
- VOID
- )
-{
- //
- // BugBug: We should not need to do this. We need to root cause this bug!!!!
- //
- AsmWriteDr0 (0);
- AsmWriteDr1 (0);
-}
-
-STATIC
-VOID
-GetShortPdbFileName (
- CHAR8 *PdbFileName,
- CHAR8 *GaugeString
- )
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINTN Index;
- UINTN Index1;
- UINTN StartIndex;
- UINTN EndIndex;
-
- if (PdbFileName == NULL) {
- AsciiStrCpy (GaugeString, " ");
- } else {
- StartIndex = 0;
- for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
- ;
-
- for (Index = 0; PdbFileName[Index] != 0; Index++) {
- if (PdbFileName[Index] == '\\') {
- StartIndex = Index + 1;
- }
-
- if (PdbFileName[Index] == '.') {
- EndIndex = Index;
- }
- }
-
- Index1 = 0;
- for (Index = StartIndex; Index < EndIndex; Index++) {
- GaugeString[Index1] = PdbFileName[Index];
- Index1++;
- if (Index1 == PERF_TOKEN_LENGTH - 1) {
- break;
- }
- }
-
- GaugeString[Index1] = 0;
- }
-
- return ;
-}
-
-
-
-STATIC
-CHAR8 *
-GetPdbPath (
- VOID *ImageBase
- )
-/*++
-
-Routine Description:
-
- Located PDB path name in PE image
-
-Arguments:
-
- ImageBase - base of PE to search
-
-Returns:
-
- Pointer into image at offset of PDB file name if PDB file name is found,
- Otherwise a pointer to an empty string.
-
---*/
-{
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
-
- ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.Handle = ImageBase;
- ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
-
- PeCoffLoaderGetImageInfo (&ImageContext);
-
- return ImageContext.PdbPointer;
-}
-
-
-STATIC
-VOID
-GetNameFromHandle (
- IN EFI_HANDLE Handle,
- OUT CHAR8 *GaugeString
- )
-{
- EFI_STATUS Status;
- EFI_LOADED_IMAGE_PROTOCOL *Image;
- CHAR8 *PdbFileName;
- EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;
-
- AsciiStrCpy (GaugeString, " ");
-
- //
- // Get handle name from image protocol
- //
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&Image
- );
-
- if (EFI_ERROR (Status)) {
- Status = gBS->OpenProtocol (
- Handle,
- &gEfiDriverBindingProtocolGuid,
- (VOID **) &DriverBinding,
- NULL,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
- //
- // Get handle name from image protocol
- //
- Status = gBS->HandleProtocol (
- DriverBinding->ImageHandle,
- &gEfiLoadedImageProtocolGuid,
- (VOID **)&Image
- );
- }
-
- PdbFileName = GetPdbPath (Image->ImageBase);
-
- if (PdbFileName != NULL) {
- GetShortPdbFileName (PdbFileName, GaugeString);
- }
-
- return ;
-}
-
-
-
-VOID
-WriteBootToOsPerformanceData (
- VOID
- )
-/*++
-
-Routine Description:
-
- Allocates a block of memory and writes performance data of booting to OS into it.
-
-Arguments:
-
- None
-
-Returns:
-
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_CPU_ARCH_PROTOCOL *Cpu;
- EFI_PHYSICAL_ADDRESS mAcpiLowMemoryBase;
- UINT32 mAcpiLowMemoryLength;
- UINT32 LimitCount;
- PERF_HEADER mPerfHeader;
- PERF_DATA mPerfData;
- EFI_HANDLE *Handles;
- UINTN NoHandles;
- CHAR8 GaugeString[PERF_TOKEN_LENGTH];
- UINT8 *Ptr;
- UINT32 mIndex;
- UINT64 Ticker;
- UINT64 Freq;
- UINT32 Duration;
- UINT64 CurrentTicker;
- UINT64 TimerPeriod;
- UINTN LogEntryKey;
- CONST VOID *Handle;
- CONST CHAR8 *Token;
- CONST CHAR8 *Module;
- UINT64 StartTicker;
- UINT64 EndTicker;
-
- //
- // Retrive time stamp count as early as possilbe
- //
- Ticker = AsmReadTsc ();
-
- //
- // Allocate a block of memory that contain performance data to OS
- //
- mAcpiLowMemoryBase = 0xFFFFFFFF;
- Status = gBS->AllocatePages (
- AllocateMaxAddress,
- EfiReservedMemoryType,
- 4,
- &mAcpiLowMemoryBase
- );
- if (EFI_ERROR (Status)) {
- return ;
- }
-
- mAcpiLowMemoryLength = EFI_PAGES_TO_SIZE(4);
-
- Ptr = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));
- LimitCount = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);
-
- //
- // Initialize performance data structure
- //
- ZeroMem (&mPerfHeader, sizeof (PERF_HEADER));
-
- //
- // Get CPU frequency
- //
- Status = gBS->LocateProtocol (
- &gEfiCpuArchProtocolGuid,
- NULL,
- (VOID **)&Cpu
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePages (mAcpiLowMemoryBase, 4);
- return ;
- }
- //
- // Get Cpu Frequency
- //
- Status = Cpu->GetTimerValue (Cpu, 0, &(CurrentTicker), &TimerPeriod);
- if (EFI_ERROR (Status)) {
- gBS->FreePages (mAcpiLowMemoryBase, 4);
- return ;
- }
-
- Freq = DivU64x32 (1000000000000ULL, (UINTN) TimerPeriod);
-
- mPerfHeader.CpuFreq = Freq;
-
- //
- // Record BDS raw performance data
- //
- mPerfHeader.BDSRaw = Ticker;
-
- //
- // Put Detailed performance data into memory
- //
- Handles = NULL;
- Status = gBS->LocateHandleBuffer (
- AllHandles,
- NULL,
- NULL,
- &NoHandles,
- &Handles
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePages (mAcpiLowMemoryBase, 4);
- return ;
- }
- //
- // Get DXE drivers performance
- //
- for (mIndex = 0; mIndex < NoHandles; mIndex++) {
- Ticker = 0;
- LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
- LogEntryKey,
- &Handle,
- &Token,
- &Module,
- &StartTicker,
- &EndTicker)) != 0) {
- if ((Handle == Handles[mIndex]) && (StartTicker < EndTicker)) {
- Ticker += (EndTicker - StartTicker);
- }
- }
-
- Duration = (UINT32) DivU64x32 (
- Ticker,
- (UINT32) Freq
- );
-
- if (Duration > 0) {
- ZeroMem (&mPerfData, sizeof (PERF_DATA));
-
- GetNameFromHandle (Handles[mIndex], GaugeString);
-
- AsciiStrCpy (mPerfData.Token, GaugeString);
- mPerfData.Duration = Duration;
-
- CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
- Ptr += sizeof (PERF_DATA);
-
- mPerfHeader.Count++;
- if (mPerfHeader.Count == LimitCount) {
- goto Done;
- }
- }
- }
-
- gBS->FreePool (Handles);
-
- //
- // Get inserted performance data
- //
- LogEntryKey = 0;
- while ((LogEntryKey = GetPerformanceMeasurement (
- LogEntryKey,
- &Handle,
- &Token,
- &Module,
- &StartTicker,
- &EndTicker)) != 0) {
- if ((Handle == NULL) && (StartTicker <= EndTicker)) {
-
- ZeroMem (&mPerfData, sizeof (PERF_DATA));
-
- AsciiStrnCpy (mPerfData.Token, Token, DXE_PERFORMANCE_STRING_SIZE);
- mPerfData.Duration = (UINT32) DivU64x32 (
- EndTicker - StartTicker,
- (UINT32) Freq
- );
-
- CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));
- Ptr += sizeof (PERF_DATA);
-
- mPerfHeader.Count++;
- if (mPerfHeader.Count == LimitCount) {
- goto Done;
- }
- }
- }
-
-Done:
-
- ClearDebugRegisters ();
-
- mPerfHeader.Signiture = 0x66726550;
-
- //
- // Put performance data to memory
- //
- CopyMem (
- (UINT32 *) (UINT32) mAcpiLowMemoryBase,
- &mPerfHeader,
- sizeof (PERF_HEADER)
- );
-
- gRT->SetVariable (
- L"PerfDataMemAddr",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof (UINT32),
- (VOID *) &mAcpiLowMemoryBase
- );
-
- return ;
-}
diff --git a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.h b/EdkModulePkg/Library/EdkGenericBdsLib/Performance.h deleted file mode 100644 index e7f80ab2c0..0000000000 --- a/EdkModulePkg/Library/EdkGenericBdsLib/Performance.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Performance.h
-
-Abstract:
-
- This file included the performance relete function header and
- definition.
-
---*/
-
-#ifndef _PERF_H_
-#define _PERF_H_
-
-#define PERF_TOKEN_LENGTH 28
-#define PERF_PEI_ENTRY_MAX_NUM 50
-
-typedef struct {
- CHAR8 Token[PERF_TOKEN_LENGTH];
- UINT32 Duration;
-} PERF_DATA;
-
-typedef struct {
- UINT64 BootToOs;
- UINT64 S3Resume;
- UINT32 S3EntryNum;
- PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
- UINT64 CpuFreq;
- UINT64 BDSRaw;
- UINT32 Count;
- UINT32 Signiture;
-} PERF_HEADER;
-
-VOID
-WriteBootToOsPerformanceData (
- VOID
- );
-
-VOID
-ClearDebugRegisters (
- VOID
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs deleted file mode 100644 index 63355efc61..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.dxs +++ /dev/null @@ -1,26 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Bds.dxs
-
-Abstract:
-
- Dependency expression source file. This driver produces an arch protocol, so
- must dipatch early.
-
---*/
-#include <DxeDepex.h>
-
-DEPENDENCY_START
- EFI_HII_PROTOCOL_GUID
-DEPENDENCY_END
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h deleted file mode 100644 index 2548aaf925..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Bds.h +++ /dev/null @@ -1,44 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Bds.h
-
-Abstract:
-
- Head file for BDS Architectural Protocol implementation
-
-Revision History
-
---*/
-
-#ifndef _BDS_H
-#define _BDS_H
-
-
-//
-// Prototypes
-//
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- );
-
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c deleted file mode 100644 index 0a9d359cfc..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsBoot.c +++ /dev/null @@ -1,103 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsPlatform.c
-
-Abstract:
-
- This file include all platform action which can be customized
- by IBV/OEM.
-
---*/
-
-#include "String.h" -
-VOID
-PlatformBdsBootSuccess (
- IN BDS_COMMON_OPTION *Option
- )
-/*++
-
-Routine Description:
-
- Hook point after a boot attempt succeeds. We don't expect a boot option to
- return, so the EFI 1.0 specification defines that you will default to an
- interactive mode and stop processing the BootOrder list in this case. This
- is alos a platform implementation and can be customized by IBV/OEM.
-
-Arguments:
-
- Option - Pointer to Boot Option that succeeded to boot.
-
-Returns:
-
- None.
-
---*/
-{
- CHAR16 *TmpStr;
-
- //
- // If Boot returned with EFI_SUCCESS and there is not in the boot device
- // select loop then we need to pop up a UI and wait for user input.
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
- gBS->FreePool (TmpStr);
- }
-}
-
-VOID
-PlatformBdsBootFail (
- IN BDS_COMMON_OPTION *Option,
- IN EFI_STATUS Status,
- IN CHAR16 *ExitData,
- IN UINTN ExitDataSize
- )
-/*++
-
-Routine Description:
-
- Hook point after a boot attempt fails.
-
-Arguments:
-
- Option - Pointer to Boot Option that failed to boot.
-
- Status - Status returned from failed boot.
-
- ExitData - Exit data returned from failed boot.
-
- ExitDataSize - Exit data size returned from failed boot.
-
-Returns:
-
- None.
-
---*/
-{
- CHAR16 *TmpStr;
-
- //
- // If Boot returned with failed status then we need to pop up a UI and wait
- // for user input.
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, TmpStr, Option->Description, L"\n\r", NULL);
- gBS->FreePool (TmpStr);
- }
-
-}
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c deleted file mode 100644 index 07789a36ab..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BdsEntry.c +++ /dev/null @@ -1,362 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BdsEntry.c
-
-Abstract:
-
- The entry of the bds
-
---*/
-
-#include "Bds.h"
-#include "FrontPage.h"
-#include "Language.h" -
-EFI_BDS_ARCH_PROTOCOL_INSTANCE gBdsInstanceTemplate = {
- EFI_BDS_ARCH_PROTOCOL_INSTANCE_SIGNATURE,
- NULL,
- {
- BdsEntry
- },
- 0xFFFF,
- TRUE,
- EXTENSIVE
-};
-
-UINT16 *mBootNext = NULL;
-
-EFI_HANDLE mBdsImageHandle;
-
-EFI_STATUS
-EFIAPI
-BdsInitialize (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Install Boot Device Selection Protocol
-
-Arguments:
-
- (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
-
-Returns:
-
- EFI_SUCEESS - BDS has finished initializing.
- Rerun the
- dispatcher and recall BDS.Entry
-
- Other - Return value from EfiLibAllocatePool()
- or gBS->InstallProtocolInterface
-
---*/
-{
- EFI_STATUS Status;
-
- mBdsImageHandle = ImageHandle;
-
- //
- // Install protocol interface
- //
- Status = gBS->InstallProtocolInterface (
- &gBdsInstanceTemplate.Handle,
- &gEfiBdsArchProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &gBdsInstanceTemplate.Bds
- );
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-VOID
-BdsBootDeviceSelect (
- VOID
- )
-/*++
-
-Routine Description:
-
- In the loop of attempt to boot for the boot order
-
-Arguments:
-
- None.
-
-Returns:
-
- None.
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- BDS_COMMON_OPTION *BootOption;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- UINT16 Timeout;
- LIST_ENTRY BootLists;
- CHAR16 Buffer[20];
- BOOLEAN BootNextExist;
- LIST_ENTRY *LinkBootNext;
-
- //
- // Got the latest boot option
- //
- BootNextExist = FALSE;
- LinkBootNext = NULL;
- InitializeListHead (&BootLists);
-
- //
- // First check the boot next option
- //
- ZeroMem (Buffer, sizeof (Buffer));
-
- if (mBootNext != NULL) {
- //
- // Indicate we have the boot next variable, so this time
- // boot will always have this boot option
- //
- BootNextExist = TRUE;
-
- //
- // Clear the this variable so it's only exist in this time boot
- //
- gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- 0,
- mBootNext
- );
-
- //
- // Add the boot next boot option
- //
- UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *mBootNext);
- BootOption = BdsLibVariableToOption (&BootLists, Buffer);
- }
- //
- // Parse the boot order to get boot option
- //
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
-
- //
- // Parameter check, make sure the loop will be valid
- //
- if (Link == NULL) {
- return ;
- }
- //
- // Here we make the boot in a loop, every boot success will
- // return to the front page
- //
- for (;;) {
- //
- // Check the boot option list first
- //
- if (Link == &BootLists) {
- //
- // There are two ways to enter here:
- // 1. There is no active boot option, give user chance to
- // add new boot option
- // 2. All the active boot option processed, and there is no
- // one is success to boot, then we back here to allow user
- // add new active boot option
- //
- Timeout = 0xffff;
- PlatformBdsEnterFrontPage (Timeout, FALSE);
- InitializeListHead (&BootLists);
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
- continue;
- }
- //
- // Get the boot option from the link list
- //
- BootOption = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- //
- // According to EFI Specification, if a load option is not marked
- // as LOAD_OPTION_ACTIVE, the boot manager will not automatically
- // load the option.
- //
- if (!IS_LOAD_OPTION_TYPE (BootOption->Attribute, LOAD_OPTION_ACTIVE)) {
- //
- // skip the header of the link list, becuase it has no boot option
- //
- Link = Link->ForwardLink;
- continue;
- }
- //
- // Make sure the boot option device path connected,
- // but ignore the BBS device path
- //
- if (DevicePathType (BootOption->DevicePath) != BBS_DEVICE_PATH) {
- //
- // Notes: the internal shell can not been connected with device path
- // so we do not check the status here
- //
- BdsLibConnectDevicePath (BootOption->DevicePath);
- }
- //
- // All the driver options should have been processed since
- // now boot will be performed.
- //
- Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
- if (EFI_ERROR (Status)) {
- //
- // Call platform action to indicate the boot fail
- //
- PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);
-
- //
- // Check the next boot option
- //
- Link = Link->ForwardLink;
-
- } else {
- //
- // Call platform action to indicate the boot success
- //
- PlatformBdsBootSuccess (BootOption);
-
- //
- // Boot success, then stop process the boot order, and
- // present the boot manager menu, front page
- //
- Timeout = 0xffff;
- PlatformBdsEnterFrontPage (Timeout, FALSE);
-
- //
- // Rescan the boot option list, avoid pertential risk of the boot
- // option change in front page
- //
- if (BootNextExist) {
- LinkBootNext = BootLists.ForwardLink;
- }
-
- InitializeListHead (&BootLists);
- if (LinkBootNext != NULL) {
- //
- // Reserve the boot next option
- //
- InsertTailList (&BootLists, LinkBootNext);
- }
-
- BdsLibBuildOptionFromVar (&BootLists, L"BootOrder");
- Link = BootLists.ForwardLink;
- }
- }
-
- return ;
-
-}
-
-VOID
-EFIAPI
-BdsEntry (
- IN EFI_BDS_ARCH_PROTOCOL *This
- )
-/*++
-
-Routine Description:
-
- Service routine for BdsInstance->Entry(). Devices are connected, the
- consoles are initialized, and the boot options are tried.
-
-Arguments:
-
- This - Protocol Instance structure.
-
-Returns:
-
- EFI_SUCEESS - BDS->Entry has finished executing.
-
---*/
-{
- EFI_BDS_ARCH_PROTOCOL_INSTANCE *PrivateData;
- LIST_ENTRY DriverOptionList;
- LIST_ENTRY BootOptionList;
- UINTN BootNextSize;
-
- //
- // Insert the performance probe
- //
- PERF_END (0, DXE_TOK, NULL, 0);
- PERF_START (0, BDS_TOK, NULL, 0);
-
- //
- // Initialize the global system boot option and driver option
- //
- InitializeListHead (&DriverOptionList);
- InitializeListHead (&BootOptionList);
-
- //
- // Get the BDS private data
- //
- PrivateData = EFI_BDS_ARCH_PROTOCOL_INSTANCE_FROM_THIS (This);
-
- //
- // Do the platform init, can be customized by OEM/IBV
- //
- PERF_START (0, "PlatformBds", "BDS", 0);
- PlatformBdsInit (PrivateData);
-
- //
- // Initialize the platform specific string and language
- //
- InitializeStringSupport ();
- InitializeLanguage (TRUE);
- InitializeFrontPage (FALSE);
- //
- // Set up the device list based on EFI 1.1 variables
- // process Driver#### and Load the driver's in the
- // driver option list
- //
- BdsLibBuildOptionFromVar (&DriverOptionList, L"DriverOrder");
- if (!IsListEmpty (&DriverOptionList)) {
- BdsLibLoadDrivers (&DriverOptionList);
- }
- //
- // Check if we have the boot next option
- //
- mBootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- //
- // Setup some platform policy here
- //
- PlatformBdsPolicyBehavior (PrivateData, &DriverOptionList, &BootOptionList);
- PERF_END (0, "PlatformBds", "BDS", 0);
-
- //
- // BDS select the boot device to load OS
- //
- BdsBootDeviceSelect ();
-
- //
- // Only assert here since this is the right behavior, we should never
- // return back to DxeCore.
- //
- ASSERT (FALSE);
-}
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c deleted file mode 100644 index 76dd54f0c7..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.c +++ /dev/null @@ -1,1605 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BBSsupport.c
-
-Abstract:
-
- This function deal with the legacy boot option, it create, delete
- and manage the legacy boot option, all legacy boot option is getting from
- the legacy BBS table.
-
---*/
-
-#include "BBSsupport.h"
-
-EFI_DEVICE_PATH_PROTOCOL EndDevicePath[] = {
- {
- END_DEVICE_PATH_TYPE,
- END_ENTIRE_DEVICE_PATH_SUBTYPE,
- {
- END_DEVICE_PATH_LENGTH,
- 0
- }
- }
-};
-
-VOID
-AsciiToUnicodeSize (
- IN UINT8 *a,
- IN UINTN Size,
- OUT UINT16 *u
- )
-/*++
-
- Routine Description:
-
- Translate the first n characters of an Ascii string to
- Unicode characters. The count n is indicated by parameter
- Size. If Size is greater than the length of string, then
- the entire string is translated.
-
- Arguments:
-
- a - Pointer to input Ascii string.
- Size - The number of characters to translate.
- u - Pointer to output Unicode string buffer.
-
- Returns:
-
- None
-
---*/
-{
- UINTN i;
-
- i = 0;
- while (a[i] != 0) {
- u[i] = (CHAR16) a[i];
- if (i == Size) {
- break;
- }
-
- i++;
- }
- u[i] = 0;
-}
-
-VOID
-BdsBuildLegacyDevNameString (
- IN BBS_TABLE *CurBBSEntry,
- IN UINTN Index,
- IN UINTN BufSize,
- OUT CHAR16 *BootString
- )
-{
- CHAR16 *Fmt;
- CHAR16 *Type;
- UINT8 *StringDesc;
- CHAR16 temp[80];
-
- switch (Index) {
- //
- // Primary Master
- //
- case 1:
- Fmt = L"Primary Master %s";
- break;
-
- //
- // Primary Slave
- //
- case 2:
- Fmt = L"Primary Slave %s";
- break;
-
- //
- // Secondary Master
- //
- case 3:
- Fmt = L"Secondary Master %s";
- break;
-
- //
- // Secondary Slave
- //
- case 4:
- Fmt = L"Secondary Slave %s";
- break;
-
- default:
- Fmt = L"%s";
- break;
- }
-
- switch (CurBBSEntry->DeviceType) {
- case BBS_FLOPPY:
- Type = L"Floppy";
- break;
-
- case BBS_HARDDISK:
- Type = L"Harddisk";
- break;
-
- case BBS_CDROM:
- Type = L"CDROM";
- break;
-
- case BBS_PCMCIA:
- Type = L"PCMCIAe";
- break;
-
- case BBS_USB:
- Type = L"USB";
- break;
-
- case BBS_EMBED_NETWORK:
- Type = L"Network";
- break;
-
- case BBS_BEV_DEVICE:
- Type = L"BEVe";
- break;
-
- case BBS_UNKNOWN:
- default:
- Type = L"Unknown";
- break;
- }
- //
- // If current BBS entry has its description then use it.
- //
- StringDesc = (UINT8 *) (UINTN) ((CurBBSEntry->DescStringSegment << 4) + CurBBSEntry->DescStringOffset);
- if (NULL != StringDesc) {
- //
- // Only get fisrt 32 characters, this is suggested by BBS spec
- //
- AsciiToUnicodeSize (StringDesc, 32, temp);
- Fmt = L"%s";
- Type = temp;
- }
-
- UnicodeSPrint (BootString, BufSize, Fmt, Type);
-}
-
-EFI_STATUS
-BdsCreateLegacyBootOption (
- IN BBS_TABLE *CurrentBbsEntry,
- IN EFI_DEVICE_PATH_PROTOCOL *CurrentBbsDevPath,
- IN UINTN Index,
- IN OUT UINT16 **BootOrderList,
- IN OUT UINTN *BootOrderListSize
- )
-/*++
-
- Routine Description:
-
- Create a legacy boot option for the specified entry of
- BBS table, save it as variable, and append it to the boot
- order list.
-
- Arguments:
-
- CurrentBbsEntry - Pointer to current BBS table.
- CurrentBbsDevPath - Pointer to the Device Path Protocol instance of BBS
- Index - Index of the specified entry in BBS table.
- BootOrderList - On input, the original boot order list.
- On output, the new boot order list attached with the
- created node.
- BootOrderListSize - On input, the original size of boot order list.
- - On output, the size of new boot order list.
-
- Returns:
-
- EFI_SUCCESS - Boot Option successfully created.
- EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory.
- Other - Error occurs while setting variable.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 CurrentBootOptionNo;
- UINT16 BootString[10];
- UINT16 BootDesc[100];
- UINT16 *NewBootOrderList;
- UINTN BufferSize;
- VOID *Buffer;
- UINT8 *Ptr;
- UINT16 CurrentBbsDevPathSize;
- UINTN BootOrderIndex;
- UINTN BootOrderLastIndex;
- UINTN ArrayIndex;
- BOOLEAN IndexNotFound;
-
- if (NULL == (*BootOrderList)) {
- CurrentBootOptionNo = 0;
- } else {
- for (ArrayIndex = 0; ArrayIndex < (UINTN) (*BootOrderListSize / sizeof (UINT16)); ArrayIndex++) {
- IndexNotFound = TRUE;
- for (BootOrderIndex = 0; BootOrderIndex < (UINTN) (*BootOrderListSize / sizeof (UINT16)); BootOrderIndex++) {
- if ((*BootOrderList)[BootOrderIndex] == ArrayIndex) {
- IndexNotFound = FALSE;
- break;
- }
- }
-
- if (!IndexNotFound) {
- continue;
- } else {
- break;
- }
- }
-
- CurrentBootOptionNo = (UINT16) ArrayIndex;
- }
-
- UnicodeSPrint (
- BootString,
- sizeof (BootString),
- L"Boot%04x",
- CurrentBootOptionNo
- );
-
- BdsBuildLegacyDevNameString (CurrentBbsEntry, Index, sizeof (BootDesc), BootDesc);
-
- CurrentBbsDevPathSize = (UINT16) (GetDevicePathSize (CurrentBbsDevPath));
-
- BufferSize = sizeof (UINT32) +
- sizeof (UINT16) +
- StrSize (BootDesc) +
- CurrentBbsDevPathSize +
- sizeof (BBS_TABLE) +
- sizeof (UINT16);
-
- Buffer = AllocateZeroPool (BufferSize);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = (UINT8 *) Buffer;
-
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;
- Ptr += sizeof (UINT32);
-
- *((UINT16 *) Ptr) = CurrentBbsDevPathSize;
- Ptr += sizeof (UINT16);
-
- CopyMem (
- Ptr,
- BootDesc,
- StrSize (BootDesc)
- );
- Ptr += StrSize (BootDesc);
-
- CopyMem (
- Ptr,
- CurrentBbsDevPath,
- CurrentBbsDevPathSize
- );
- Ptr += CurrentBbsDevPathSize;
-
- CopyMem (
- Ptr,
- CurrentBbsEntry,
- sizeof (BBS_TABLE)
- );
-
- Ptr += sizeof (BBS_TABLE);
- *((UINT16 *) Ptr) = (UINT16) Index;
-
- Status = gRT->SetVariable (
- BootString,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BufferSize,
- Buffer
- );
-
- SafeFreePool (Buffer);
- Buffer = NULL;
-
- NewBootOrderList = AllocateZeroPool (*BootOrderListSize + sizeof (UINT16));
- if (NULL == NewBootOrderList) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (NULL != *BootOrderList) {
- CopyMem (NewBootOrderList, *BootOrderList, *BootOrderListSize);
- }
-
- SafeFreePool (*BootOrderList);
-
- BootOrderLastIndex = (UINTN) (*BootOrderListSize / sizeof (UINT16));
- NewBootOrderList[BootOrderLastIndex] = CurrentBootOptionNo;
- *BootOrderListSize += sizeof (UINT16);
- *BootOrderList = NewBootOrderList;
-
- return Status;
-}
-
-BOOLEAN
-BdsIsLegacyBootOption (
- IN UINT8 *BootOptionVar,
- OUT BBS_TABLE **BbsEntry,
- OUT UINT16 *BbsIndex
- )
-{
- UINT8 *Ptr;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BOOLEAN Ret;
- UINT16 DevPathLen;
-
- Ptr = BootOptionVar;
- Ptr += sizeof (UINT32);
- DevPathLen = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
- Ptr += StrSize ((UINT16 *) Ptr);
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {
- Ptr += DevPathLen;
- *BbsEntry = (BBS_TABLE *) Ptr;
- Ptr += sizeof (BBS_TABLE);
- *BbsIndex = *(UINT16 *) Ptr;
- Ret = TRUE;
- } else {
- *BbsEntry = NULL;
- Ret = FALSE;
- }
-
- return Ret;
-}
-
-EFI_STATUS
-BdsDeleteBootOption (
- IN UINTN OptionNumber,
- IN OUT UINT16 *BootOrder,
- IN OUT UINTN *BootOrderSize
- )
-{
- UINT16 BootOption[100];
- UINTN Index;
- EFI_STATUS Status;
- UINTN Index2Del;
-
- Status = EFI_SUCCESS;
- Index2Del = 0;
-
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", OptionNumber);
- Status = EfiLibDeleteVariable (BootOption, &gEfiGlobalVariableGuid);
- //
- // adjust boot order array
- //
- for (Index = 0; Index < *BootOrderSize / sizeof (UINT16); Index++) {
- if (BootOrder[Index] == OptionNumber) {
- Index2Del = Index;
- break;
- }
- }
-
- if (Index != *BootOrderSize / sizeof (UINT16)) {
- for (Index = 0; Index < *BootOrderSize / sizeof (UINT16) - 1; Index++) {
- if (Index >= Index2Del) {
- BootOrder[Index] = BootOrder[Index + 1];
- }
- }
-
- *BootOrderSize -= sizeof (UINT16);
- }
-
- return Status;
-
-}
-
-EFI_STATUS
-BdsDeleteAllInvalidLegacyBootOptions (
- VOID
- )
-/*++
-
- Routine Description:
-
- Delete all the invalid legacy boot options.
-
- Arguments:
-
- None.
-
- Returns:
-
- EFI_SUCCESS - All invalide legacy boot options are deleted.
- EFI_OUT_OF_RESOURCES - Fail to allocate necessary memory.
- EFI_NOT_FOUND - Fail to retrive variable of boot order.
- Other - Error occurs while setting variable or locating
- protocol.
-
---*/
-{
- UINT16 *BootOrder;
- UINT8 *BootOptionVar;
- UINTN BootOrderSize;
- UINTN BootOptionSize;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- BBS_TABLE *BbsEntry;
- UINT16 BbsIndex;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Index;
- UINT16 BootOption[10];
- UINT16 BootDesc[100];
- BOOLEAN DescStringMatch;
-
- Status = EFI_SUCCESS;
- BootOrder = NULL;
- BootOrderSize = 0;
- HddCount = 0;
- BbsCount = 0;
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
- BbsEntry = NULL;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- return EFI_NOT_FOUND;
- }
-
- Index = 0;
- while (Index < BootOrderSize / sizeof (UINT16)) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- SafeFreePool (BootOrder);
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, &BbsIndex)) {
- SafeFreePool (BootOptionVar);
- Index++;
- continue;
- }
-
- //
- // Check if BBS Description String is changed
- //
- DescStringMatch = FALSE;
-
- BdsBuildLegacyDevNameString (
- &LocalBbsTable[BbsIndex],
- BbsIndex,
- sizeof(BootDesc),
- BootDesc
- );
-
- if (StrCmp (BootDesc, (UINT16*)(BootOptionVar + sizeof (UINT32) + sizeof (UINT16))) == 0) {
- DescStringMatch = TRUE;
- }
-
- if (!((LocalBbsTable[BbsIndex].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[BbsIndex].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[BbsIndex].BootPriority == BBS_LOWEST_PRIORITY)) &&
- (LocalBbsTable[BbsIndex].DeviceType == BbsEntry->DeviceType) &&
- DescStringMatch) {
- Index++;
- continue;
- }
-
- SafeFreePool (BootOptionVar);
- //
- // should delete
- //
- BdsDeleteBootOption (
- BootOrder[Index],
- BootOrder,
- &BootOrderSize
- );
- }
-
- if (BootOrderSize) {
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderSize,
- BootOrder
- );
- } else {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- SafeFreePool (BootOrder);
-
- return Status;
-}
-
-BOOLEAN
-BdsFindLegacyBootOptionByDevType (
- IN UINT16 *BootOrder,
- IN UINTN BootOptionNum,
- IN UINT16 DevType,
- OUT UINT32 *Attribute,
- OUT UINT16 *BbsIndex,
- OUT UINTN *OptionNumber
- )
-{
- UINTN Index;
- UINTN BootOrderIndex;
- UINT16 BootOption[100];
- UINTN BootOptionSize;
- UINT8 *BootOptionVar;
- BBS_TABLE *BbsEntry;
- BOOLEAN Found;
-
- BbsEntry = NULL;
- Found = FALSE;
-
- if (NULL == BootOrder) {
- return Found;
- }
-
- for (BootOrderIndex = 0; BootOrderIndex < BootOptionNum; BootOrderIndex++) {
- Index = (UINTN) BootOrder[BootOrderIndex];
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", Index);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- continue;
- }
-
- if (!BdsIsLegacyBootOption (BootOptionVar, &BbsEntry, BbsIndex)) {
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- if (BbsEntry->DeviceType != DevType) {
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- *Attribute = *(UINT32 *) BootOptionVar;
- *OptionNumber = Index;
- Found = TRUE;
- SafeFreePool (BootOptionVar);
- break;
- }
-
- return Found;
-}
-
-EFI_STATUS
-BdsCreateOneLegacyBootOption (
- IN BBS_TABLE *BbsItem,
- IN UINTN Index,
- IN OUT UINT16 **BootOrderList,
- IN OUT UINTN *BootOrderListSize
- )
-{
- BBS_BBS_DEVICE_PATH BbsDevPathNode;
- EFI_STATUS Status;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
-
- DevPath = NULL;
-
- BbsDevPathNode.Header.Type = BBS_DEVICE_PATH;
- BbsDevPathNode.Header.SubType = BBS_BBS_DP;
- SetDevicePathNodeLength (&BbsDevPathNode.Header, sizeof (BBS_BBS_DEVICE_PATH));
- BbsDevPathNode.DeviceType = BbsItem->DeviceType;
- CopyMem (&BbsDevPathNode.StatusFlag, &BbsItem->StatusFlags, sizeof (UINT16));
-
- DevPath = AppendDevicePathNode (
- EndDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevPathNode
- );
- if (NULL == DevPath) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = BdsCreateLegacyBootOption (
- BbsItem,
- DevPath,
- Index,
- BootOrderList,
- BootOrderListSize
- );
- BbsItem->BootPriority = 0x00;
-
- gBS->FreePool (DevPath);
-
- return Status;
-}
-
-EFI_STATUS
-BdsAddNonExistingLegacyBootOptions (
- VOID
- )
-/*++
-
-Routine Description:
-
- Add the legacy boot options from BBS table if they do not exist.
-
-Arguments:
-
- None.
-
-Returns:
-
- EFI_SUCCESS - The boot options are added successfully or they are already in boot options.
- others - An error occurred when creating legacy boot options.
-
---*/
-{
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINT16 BbsIndex;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Index;
- UINT32 Attribute;
- UINTN OptionNumber;
- BOOLEAN Ret;
-
- BootOrder = NULL;
- HddCount = 0;
- BbsCount = 0;
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**)&LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
- BootOrder = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- if (NULL == BootOrder) {
- BootOrderSize = 0;
- }
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM)
- ) {
- continue;
- }
-
- Ret = BdsFindLegacyBootOptionByDevType (
- BootOrder,
- BootOrderSize / sizeof (UINT16),
- LocalBbsTable[Index].DeviceType,
- &Attribute,
- &BbsIndex,
- &OptionNumber
- );
- if (Ret && (Attribute & LOAD_OPTION_ACTIVE) != 0) {
- continue;
- }
-
- if (Ret) {
- if (Index != BbsIndex) {
- BdsDeleteBootOption (
- OptionNumber,
- BootOrder,
- &BootOrderSize
- );
- } else {
- continue;
- }
- }
- //
- // Not found such type of legacy device in boot options or we found but it's disabled
- // so we have to create one and put it to the tail of boot order list
- //
- Status = BdsCreateOneLegacyBootOption (
- &LocalBbsTable[Index],
- Index,
- &BootOrder,
- &BootOrderSize
- );
- if (EFI_ERROR (Status)) {
- break;
- }
- }
-
- if (BootOrderSize > 0) {
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderSize,
- BootOrder
- );
- } else {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- if (BootOrder != NULL) {
- SafeFreePool (BootOrder);
- }
-
- return Status;
-}
-
-UINT16 *
-BdsFillDevOrderBuf (
- IN BBS_TABLE *BbsTable,
- IN BBS_TYPE BbsType,
- IN UINTN BbsCount,
- IN UINT16 *Buf
- )
-{
- UINTN Index;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {
- continue;
- }
-
- if (BbsTable[Index].DeviceType != BbsType) {
- continue;
- }
-
- *Buf = (UINT16) (Index & 0xFF);
- Buf++;
- }
-
- return Buf;
-}
-
-EFI_STATUS
-BdsCreateDevOrder (
- IN BBS_TABLE *BbsTable,
- IN UINT16 BbsCount
- )
-{
- UINTN Index;
- UINTN FDCount;
- UINTN HDCount;
- UINTN CDCount;
- UINTN NETCount;
- UINTN BEVCount;
- UINTN TotalSize;
- UINTN HeaderSize;
- UINT8 *DevOrder;
- UINT8 *Ptr;
- EFI_STATUS Status;
-
- FDCount = 0;
- HDCount = 0;
- CDCount = 0;
- NETCount = 0;
- BEVCount = 0;
- TotalSize = 0;
- HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
- DevOrder = NULL;
- Ptr = NULL;
- Status = EFI_SUCCESS;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if (BbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) {
- continue;
- }
-
- switch (BbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- FDCount++;
- break;
-
- case BBS_HARDDISK:
- HDCount++;
- break;
-
- case BBS_CDROM:
- CDCount++;
- break;
-
- case BBS_EMBED_NETWORK:
- NETCount++;
- break;
-
- case BBS_BEV_DEVICE:
- BEVCount++;
- break;
-
- default:
- break;
- }
- }
-
- TotalSize += (HeaderSize + sizeof (UINT16) * FDCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * HDCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * CDCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * NETCount);
- TotalSize += (HeaderSize + sizeof (UINT16) * BEVCount);
-
- DevOrder = AllocateZeroPool (TotalSize);
- if (NULL == DevOrder) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Ptr = DevOrder;
-
- *((BBS_TYPE *) Ptr) = BBS_FLOPPY;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (FDCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_FLOPPY, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_HARDDISK;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (HDCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_HARDDISK, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_CDROM;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (CDCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_CDROM, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_EMBED_NETWORK;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (NETCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_EMBED_NETWORK, BbsCount, (UINT16 *) Ptr);
- }
-
- *((BBS_TYPE *) Ptr) = BBS_BEV_DEVICE;
- Ptr += sizeof (BBS_TYPE);
- *((UINT16 *) Ptr) = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
- if (BEVCount) {
- Ptr = (UINT8 *) BdsFillDevOrderBuf (BbsTable, BBS_BEV_DEVICE, BbsCount, (UINT16 *) Ptr);
- }
-
- Status = gRT->SetVariable (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- VAR_FLAG,
- TotalSize,
- DevOrder
- );
- SafeFreePool (DevOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsUpdateLegacyDevOrder (
- VOID
- )
-/*++
-Format of LegacyDevOrder variable:
-|-----------------------------------------------------------------------------------------------------------------
-| BBS_FLOPPY | Length | Index0 | Index1 | ... | BBS_HARDDISK | Length | Index0 | Index1 | ... | BBS_CDROM | Length | Index0 | ...
-|-----------------------------------------------------------------------------------------------------------------
-
-Length is a 16 bit integer, it indicates how many Indexes follows, including the size of itself.
-Index# is a 16 bit integer, the low byte of it stands for the index in BBS table
- the high byte of it only have two value 0 and 0xFF, 0xFF means this device has been
- disabled by user.
---*/
-{
- UINT8 *DevOrder;
- UINT8 *NewDevOrder;
- UINTN DevOrderSize;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINTN Index;
- UINTN Index2;
- UINTN *Idx;
- UINTN FDCount;
- UINTN HDCount;
- UINTN CDCount;
- UINTN NETCount;
- UINTN BEVCount;
- UINTN TotalSize;
- UINTN HeaderSize;
- UINT8 *Ptr;
- UINT8 *NewPtr;
- UINT16 *NewFDPtr;
- UINT16 *NewHDPtr;
- UINT16 *NewCDPtr;
- UINT16 *NewNETPtr;
- UINT16 *NewBEVPtr;
- UINT16 *NewDevPtr;
- UINT16 Length;
- UINT16 tmp;
- UINTN FDIndex;
- UINTN HDIndex;
- UINTN CDIndex;
- UINTN NETIndex;
- UINTN BEVIndex;
-
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
- Idx = NULL;
- FDCount = 0;
- HDCount = 0;
- CDCount = 0;
- NETCount = 0;
- BEVCount = 0;
- TotalSize = 0;
- HeaderSize = sizeof (BBS_TYPE) + sizeof (UINT16);
- FDIndex = 0;
- HDIndex = 0;
- CDIndex = 0;
- NETIndex = 0;
- BEVIndex = 0;
- NewDevPtr = NULL;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
-
- DevOrder = (UINT8 *) BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &DevOrderSize
- );
- if (NULL == DevOrder) {
- return BdsCreateDevOrder (LocalBbsTable, BbsCount);
- }
- //
- // First we figure out how many boot devices with same device type respectively
- //
- for (Index = 0; Index < BbsCount; Index++) {
- if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[Index].BootPriority == BBS_LOWEST_PRIORITY)
- ) {
- continue;
- }
-
- switch (LocalBbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- FDCount++;
- break;
-
- case BBS_HARDDISK:
- HDCount++;
- break;
-
- case BBS_CDROM:
- CDCount++;
- break;
-
- case BBS_EMBED_NETWORK:
- NETCount++;
- break;
-
- case BBS_BEV_DEVICE:
- BEVCount++;
- break;
-
- default:
- break;
- }
- }
-
- TotalSize += (HeaderSize + FDCount * sizeof (UINT16));
- TotalSize += (HeaderSize + HDCount * sizeof (UINT16));
- TotalSize += (HeaderSize + CDCount * sizeof (UINT16));
- TotalSize += (HeaderSize + NETCount * sizeof (UINT16));
- TotalSize += (HeaderSize + BEVCount * sizeof (UINT16));
-
- NewDevOrder = AllocateZeroPool (TotalSize);
- if (NULL == NewDevOrder) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewFDPtr = (UINT16 *) (NewDevOrder + HeaderSize);
- NewHDPtr = (UINT16 *) ((UINT8 *) NewFDPtr + FDCount * sizeof (UINT16) + HeaderSize);
- NewCDPtr = (UINT16 *) ((UINT8 *) NewHDPtr + HDCount * sizeof (UINT16) + HeaderSize);
- NewNETPtr = (UINT16 *) ((UINT8 *) NewCDPtr + CDCount * sizeof (UINT16) + HeaderSize);
- NewBEVPtr = (UINT16 *) ((UINT8 *) NewNETPtr + NETCount * sizeof (UINT16) + HeaderSize);
-
- //
- // copy FD
- //
- Ptr = DevOrder;
- NewPtr = NewDevOrder;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + FDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_FLOPPY
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewFDPtr[FDIndex] = *(UINT16 *) Ptr;
- FDIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy HD
- //
- NewPtr = (UINT8 *) NewHDPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + HDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_HARDDISK
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewHDPtr[HDIndex] = *(UINT16 *) Ptr;
- HDIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy CD
- //
- NewPtr = (UINT8 *) NewCDPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + CDCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_CDROM
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewCDPtr[CDIndex] = *(UINT16 *) Ptr;
- CDIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy NET
- //
- NewPtr = (UINT8 *) NewNETPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + NETCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_EMBED_NETWORK
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewNETPtr[NETIndex] = *(UINT16 *) Ptr;
- NETIndex++;
- Ptr += sizeof (UINT16);
- }
- //
- // copy BEV
- //
- NewPtr = (UINT8 *) NewBEVPtr - HeaderSize;
- *((BBS_TYPE *) NewPtr) = *((BBS_TYPE *) Ptr);
- Ptr += sizeof (BBS_TYPE);
- NewPtr += sizeof (BBS_TYPE);
- Length = *((UINT16 *) Ptr);
- *((UINT16 *) NewPtr) = (UINT16) (sizeof (UINT16) + BEVCount * sizeof (UINT16));
- Ptr += sizeof (UINT16);
-
- for (Index = 0; Index < Length / sizeof (UINT16) - 1; Index++) {
- if (LocalBbsTable[*Ptr].BootPriority == BBS_IGNORE_ENTRY ||
- LocalBbsTable[*Ptr].BootPriority == BBS_DO_NOT_BOOT_FROM ||
- LocalBbsTable[*Ptr].BootPriority == BBS_LOWEST_PRIORITY ||
- LocalBbsTable[*Ptr].DeviceType != BBS_BEV_DEVICE
- ) {
- Ptr += sizeof (UINT16);
- continue;
- }
-
- NewBEVPtr[BEVIndex] = *(UINT16 *) Ptr;
- BEVIndex++;
- Ptr += sizeof (UINT16);
- }
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((LocalBbsTable[Index].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Index].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[Index].BootPriority == BBS_LOWEST_PRIORITY)
- ) {
- continue;
- }
-
- switch (LocalBbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- Idx = &FDIndex;
- NewDevPtr = NewFDPtr;
- break;
-
- case BBS_HARDDISK:
- Idx = &HDIndex;
- NewDevPtr = NewHDPtr;
- break;
-
- case BBS_CDROM:
- Idx = &CDIndex;
- NewDevPtr = NewCDPtr;
- break;
-
- case BBS_EMBED_NETWORK:
- Idx = &NETIndex;
- NewDevPtr = NewNETPtr;
- break;
-
- case BBS_BEV_DEVICE:
- Idx = &BEVIndex;
- NewDevPtr = NewBEVPtr;
- break;
-
- default:
- Idx = NULL;
- break;
- }
- //
- // at this point we have copied those valid indexes to new buffer
- // and we should check if there is any new appeared boot device
- //
- if (Idx) {
- for (Index2 = 0; Index2 < *Idx; Index2++) {
- if ((NewDevPtr[Index2] & 0xFF) == (UINT16) Index) {
- break;
- }
- }
-
- if (Index2 == *Idx) {
- //
- // Index2 == *Idx means we didn't find Index
- // so Index is a new appeared device's index in BBS table
- // save it.
- //
- NewDevPtr[*Idx] = (UINT16) (Index & 0xFF);
- (*Idx)++;
- }
- }
- }
-
- if (FDCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < FDIndex - 1; Index++) {
- if (0xFF00 != (NewFDPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < FDIndex; Index2++) {
- if (0 == (NewFDPtr[Index2] & 0xFF00)) {
- tmp = NewFDPtr[Index];
- NewFDPtr[Index] = NewFDPtr[Index2];
- NewFDPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (HDCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < HDIndex - 1; Index++) {
- if (0xFF00 != (NewHDPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < HDIndex; Index2++) {
- if (0 == (NewHDPtr[Index2] & 0xFF00)) {
- tmp = NewHDPtr[Index];
- NewHDPtr[Index] = NewHDPtr[Index2];
- NewHDPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (CDCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < CDIndex - 1; Index++) {
- if (0xFF00 != (NewCDPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < CDIndex; Index2++) {
- if (0 == (NewCDPtr[Index2] & 0xFF00)) {
- tmp = NewCDPtr[Index];
- NewCDPtr[Index] = NewCDPtr[Index2];
- NewCDPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (NETCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < NETIndex - 1; Index++) {
- if (0xFF00 != (NewNETPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < NETIndex; Index2++) {
- if (0 == (NewNETPtr[Index2] & 0xFF00)) {
- tmp = NewNETPtr[Index];
- NewNETPtr[Index] = NewNETPtr[Index2];
- NewNETPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- if (BEVCount) {
- //
- // Just to make sure that disabled indexes are all at the end of the array
- //
- for (Index = 0; Index < BEVIndex - 1; Index++) {
- if (0xFF00 != (NewBEVPtr[Index] & 0xFF00)) {
- continue;
- }
-
- for (Index2 = Index + 1; Index2 < BEVIndex; Index2++) {
- if (0 == (NewBEVPtr[Index2] & 0xFF00)) {
- tmp = NewBEVPtr[Index];
- NewBEVPtr[Index] = NewBEVPtr[Index2];
- NewBEVPtr[Index2] = tmp;
- break;
- }
- }
- }
- }
-
- SafeFreePool (DevOrder);
-
- Status = gRT->SetVariable (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- VAR_FLAG,
- TotalSize,
- NewDevOrder
- );
- SafeFreePool (NewDevOrder);
-
- return Status;
-}
-
-EFI_STATUS
-BdsSetBootPriority4SameTypeDev (
- IN UINT16 DeviceType,
- IN OUT BBS_TABLE *LocalBbsTable,
- IN OUT UINT16 *Priority
- )
-/*++
-DeviceType - BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM and so on
-LocalBbsTable - BBS table instance
-Priority - As input arg, it is the start point of boot priority, as output arg, it is the start point of boot
- priority can be used next time.
---*/
-{
- UINT8 *DevOrder;
-
- UINT8 *OrigBuffer;
- UINT16 *DevIndex;
- UINTN DevOrderSize;
- UINTN DevCount;
- UINTN Index;
-
- DevOrder = BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &DevOrderSize
- );
- if (NULL == DevOrder) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- OrigBuffer = DevOrder;
- while (DevOrder < OrigBuffer + DevOrderSize) {
- if (DeviceType == * (BBS_TYPE *) DevOrder) {
- break;
- }
-
- DevOrder += sizeof (BBS_TYPE);
- DevOrder += *(UINT16 *) DevOrder;
- }
-
- if (DevOrder >= OrigBuffer + DevOrderSize) {
- SafeFreePool (OrigBuffer);
- return EFI_NOT_FOUND;
- }
-
- DevOrder += sizeof (BBS_TYPE);
- DevCount = (*((UINT16 *) DevOrder) - sizeof (UINT16)) / sizeof (UINT16);
- DevIndex = (UINT16 *) (DevOrder + sizeof (UINT16));
- //
- // If the high byte of the DevIndex is 0xFF, it indicates that this device has been disabled.
- //
- for (Index = 0; Index < DevCount; Index++) {
- if ((DevIndex[Index] & 0xFF00) == 0xFF00) {
- //
- // LocalBbsTable[DevIndex[Index] & 0xFF].BootPriority = BBS_DISABLED_ENTRY;
- //
- } else {
- LocalBbsTable[DevIndex[Index] & 0xFF].BootPriority = *Priority;
- (*Priority)++;
- }
- }
-
- SafeFreePool (OrigBuffer);
- return EFI_SUCCESS;
-}
-
-VOID
-PrintBbsTable (
- IN BBS_TABLE *LocalBbsTable
- )
-{
- UINT16 Idx;
-
- DEBUG ((EFI_D_ERROR, "\n"));
- DEBUG ((EFI_D_ERROR, " NO Prio bb/dd/ff cl/sc Type Stat segm:offs\n"));
- DEBUG ((EFI_D_ERROR, "=============================================\n"));
- for (Idx = 0; Idx < MAX_BBS_ENTRIES; Idx++) {
- if ((LocalBbsTable[Idx].BootPriority == BBS_IGNORE_ENTRY) ||
- (LocalBbsTable[Idx].BootPriority == BBS_DO_NOT_BOOT_FROM) ||
- (LocalBbsTable[Idx].BootPriority == BBS_LOWEST_PRIORITY)
- ) {
- continue;
- }
-
- DEBUG (
- (EFI_D_ERROR,
- " %02x: %04x %02x/%02x/%02x %02x/02%x %04x %04x %04x:%04x\n",
- (UINTN) Idx,
- (UINTN) LocalBbsTable[Idx].BootPriority,
- (UINTN) LocalBbsTable[Idx].Bus,
- (UINTN) LocalBbsTable[Idx].Device,
- (UINTN) LocalBbsTable[Idx].Function,
- (UINTN) LocalBbsTable[Idx].Class,
- (UINTN) LocalBbsTable[Idx].SubClass,
- (UINTN) LocalBbsTable[Idx].DeviceType,
- (UINTN) * (UINT16 *) &LocalBbsTable[Idx].StatusFlags,
- (UINTN) LocalBbsTable[Idx].BootHandlerSegment,
- (UINTN) LocalBbsTable[Idx].BootHandlerOffset,
- (UINTN) ((LocalBbsTable[Idx].MfgStringSegment << 4) + LocalBbsTable[Idx].MfgStringOffset),
- (UINTN) ((LocalBbsTable[Idx].DescStringSegment << 4) + LocalBbsTable[Idx].DescStringOffset))
- );
- }
-
- DEBUG ((EFI_D_ERROR, "\n"));
-}
-
-EFI_STATUS
-BdsRefreshBbsTableForBoot (
- IN BDS_COMMON_OPTION *Entry
- )
-{
- EFI_STATUS Status;
- UINT16 HddCount;
- UINT16 BbsCount;
- HDD_INFO *LocalHddInfo;
- BBS_TABLE *LocalBbsTable;
- UINT16 DevType;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINTN Index;
- UINT16 Priority;
- UINT16 *BootOrder;
- UINTN BootOrderSize;
- UINT8 *BootOptionVar;
- UINTN BootOptionSize;
- UINT16 BootOption[100];
- UINT8 *Ptr;
- UINT16 DevPathLen;
- EFI_DEVICE_PATH_PROTOCOL *DevPath;
-
- HddCount = 0;
- BbsCount = 0;
- LocalHddInfo = NULL;
- LocalBbsTable = NULL;
- DevType = BBS_UNKNOWN;
-
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &LocalHddInfo,
- &BbsCount,
- &LocalBbsTable
- );
- //
- // First, set all the present devices' boot priority to BBS_UNPRIORITIZED_ENTRY
- // We will set them according to the settings setup by user
- //
- for (Index = 0; Index < BbsCount; Index++) {
- if (!((BBS_IGNORE_ENTRY == LocalBbsTable[Index].BootPriority) ||
- (BBS_DO_NOT_BOOT_FROM == LocalBbsTable[Index].BootPriority) ||
- (BBS_LOWEST_PRIORITY == LocalBbsTable[Index].BootPriority))) {
- LocalBbsTable[Index].BootPriority = BBS_UNPRIORITIZED_ENTRY;
- }
- }
- //
- // boot priority always starts at 0
- //
- Priority = 0;
- if (Entry->LoadOptionsSize == sizeof (BBS_TABLE) + sizeof (UINT16)) {
- //
- // If Entry stands for a legacy boot option, we prioritize the devices with the same type first.
- //
- DevType = ((BBS_TABLE *) Entry->LoadOptions)->DeviceType;
- Status = BdsSetBootPriority4SameTypeDev (
- DevType,
- LocalBbsTable,
- &Priority
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- //
- // we have to set the boot priority for other BBS entries with different device types
- //
- BootOrder = (UINT16 *) BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderSize
- );
- for (Index = 0; BootOrder && Index < BootOrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);
- BootOptionVar = BdsLibGetVariableAndSize (
- BootOption,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (NULL == BootOptionVar) {
- continue;
- }
-
- Ptr = BootOptionVar;
-
- Ptr += sizeof (UINT32);
- DevPathLen = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
- Ptr += StrSize ((UINT16 *) Ptr);
- DevPath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if (BBS_DEVICE_PATH != DevPath->Type || BBS_BBS_DP != DevPath->SubType) {
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- Ptr += DevPathLen;
- if (DevType == ((BBS_TABLE *) Ptr)->DeviceType) {
- //
- // We don't want to process twice for a device type
- //
- SafeFreePool (BootOptionVar);
- continue;
- }
-
- Status = BdsSetBootPriority4SameTypeDev (
- ((BBS_TABLE *) Ptr)->DeviceType,
- LocalBbsTable,
- &Priority
- );
- SafeFreePool (BootOptionVar);
- if (EFI_ERROR (Status)) {
- break;
- }
- }
-
- if (BootOrder) {
- SafeFreePool (BootOrder);
- }
- //
- // For debug
- //
- PrintBbsTable (LocalBbsTable);
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h deleted file mode 100644 index 9a2007cb3e..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BBSsupport.h +++ /dev/null @@ -1,83 +0,0 @@ -/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BBSsupport.h
-
-Abstract:
-
- declares interface functions
-
-Revision History
-
---*/
-
-#ifndef _EFI_BDS_BBS_SUPPORT_H
-#define _EFI_BDS_BBS_SUPPORT_H
-
-#include "BootMaint/BootMaint.h"
-
-#if defined (MDE_CPU_IA32)
-#define REFRESH_LEGACY_BOOT_OPTIONS \
- BdsDeleteAllInvalidLegacyBootOptions ();\
- BdsAddNonExistingLegacyBootOptions (); \
- BdsUpdateLegacyDevOrder ()
-#else
-#define REFRESH_LEGACY_BOOT_OPTIONS
-#endif
-
-VOID
-BdsBuildLegacyDevNameString (
- IN BBS_TABLE *CurBBSEntry,
- IN UINTN Index,
- IN UINTN BufSize,
- OUT CHAR16 *BootString
- );
-
-EFI_STATUS
-BdsDeleteAllInvalidLegacyBootOptions (
- VOID
- );
-
-EFI_STATUS
-BdsAddNonExistingLegacyBootOptions (
- VOID
- )
-/*++
-
-Routine Description:
-
- Add the legacy boot options from BBS table if they do not exist.
-
-Arguments:
-
- None.
-
-Returns:
-
- EFI_SUCCESS - The boot options are added successfully or they are already in boot options.
- others - An error occurred when creating legacy boot options.
-
---*/
-;
-
-EFI_STATUS
-BdsUpdateLegacyDevOrder (
- VOID
- );
-
-EFI_STATUS
-BdsRefreshBbsTableForBoot (
- IN BDS_COMMON_OPTION *Entry
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr deleted file mode 100644 index b5364c34ca..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Bm.vfr +++ /dev/null @@ -1,495 +0,0 @@ -// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// bm.vfr
-//
-// Abstract:
-//
-// Boot Maintenance Utility Formset
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#include "FormGuid.h"
-
-#pragma pack(1)
-
-//
-// This is the structure that will be used to store the
-// question's current value. Use it at initialize time to
-// set default value for each question. When using at run
-// time, this map is returned by the callback function,
-// so dynamically changing the question's value will be
-// possible through this mechanism
-//
-typedef struct {
-
-//
-// Three questions displayed at the main page
-// for Timeout, BootNext Variables respectively
-//
- UINT16 BootTimeOut;
- UINT16 BootNext;
-
-//
-// This is the COM1 Attributes value storage
-//
- UINT8 COM1BaudRate;
- UINT8 COM1DataRate;
- UINT8 COM1StopBits;
- UINT8 COM1Parity;
- UINT8 COM1TerminalType;
-
-//
-// This is the COM2 Attributes value storage
-//
- UINT8 COM2BaudRate;
- UINT8 COM2DataRate;
- UINT8 COM2StopBits;
- UINT8 COM2Parity;
- UINT8 COM2TerminalType;
-
-//
-// Driver Option Add Handle page storage
-//
- UINT16 DriverAddHandleDesc[100];
- UINT16 DriverAddHandleOptionalData[100];
- UINT8 DriverAddActive;
- UINT8 DriverAddForceReconnect;
-
-//
-// Console Input/Output/Errorout using COM port check storage
-//
- UINT8 ConsoleInputCOM1;
- UINT8 ConsoleInputCOM2;
- UINT8 ConsoleOutputCOM1;
- UINT8 ConsoleOutputCOM2;
- UINT8 ConsoleErrorCOM1;
- UINT8 ConsoleErrorCOM2;
-
-//
-// At most 100 input/output/errorout device for console storage
-//
- UINT8 ConsoleCheck[100];
-
-//
-// Boot or Driver Option Order storage
-//
- UINT8 OptionOrder[100];
- UINT8 DriverOptionToBeDeleted[100];
-
-//
-// Boot Option Delete storage
-//
- UINT8 BootOptionDel[100];
- UINT8 DriverOptionDel[100];
-
-//
-// This is the Terminal Attributes value storage
-//
- UINT8 COMBaudRate;
- UINT8 COMDataRate;
- UINT8 COMStopBits;
- UINT8 COMParity;
- UINT8 COMTerminalType;
-
-//
-// Legacy Device Order Selection Storage
-//
- UINT8 LegacyFD[100];
- UINT8 LegacyHD[100];
- UINT8 LegacyCD[100];
- UINT8 LegacyNET[100];
- UINT8 LegacyBEV[100];
-} BMM_FAKE_NV_DATA;
-#pragma pack()
-
-
-#define FORM_MAIN_ID 0x0001
-#define FORM_BOOT_ADD_ID 0x0002
-#define FORM_BOOT_DEL_ID 0x0003
-#define FORM_BOOT_CHG_ID 0x0004
-#define FORM_DRV_ADD_ID 0x0005
-#define FORM_DRV_DEL_ID 0x0006
-#define FORM_DRV_CHG_ID 0x0007
-#define FORM_CON_MAIN_ID 0x0008
-#define FORM_CON_IN_ID 0x0009
-#define FORM_CON_OUT_ID 0x000A
-#define FORM_CON_ERR_ID 0x000B
-#define FORM_FILE_SEEK_ID 0x000C
-#define FORM_FILE_NEW_SEEK_ID 0x000D
-#define FORM_DRV_ADD_FILE_ID 0x000E
-#define FORM_DRV_ADD_HANDLE_ID 0x000F
-#define FORM_DRV_ADD_HANDLE_DESC_ID 0x0010
-#define FORM_BOOT_NEXT_ID 0x0011
-#define FORM_TIME_OUT_ID 0x0012
-#define FORM_RESET 0x0013
-#define FORM_BOOT_SETUP_ID 0x0014
-#define FORM_DRIVER_SETUP_ID 0x0015
-#define FORM_BOOT_LEGACY_DEVICE_ID 0x0016
-#define FORM_CON_COM_ID 0x0017
-#define FORM_CON_COM_SETUP_ID 0x0018
-#define FORM_SET_FD_ORDER_ID 0x0019
-#define FORM_SET_HD_ORDER_ID 0x001A
-#define FORM_SET_CD_ORDER_ID 0x001B
-#define FORM_SET_NET_ORDER_ID 0x001C
-#define FORM_SET_BEV_ORDER_ID 0x001D
-
-#define KEY_VALUE_BOOT_FROM_FILE 0x0092
-
-formset
- guid = MAIN_FORMSET_GUID,
- title = STRING_TOKEN(STR_FORM_MAIN_TITLE), // uint8 opcode, uint8 length, guid Handle, uint16 Title
- help = STRING_TOKEN(STR_NULL_STRING),
- class = 0,
- subclass = 0,
-
- form formid = FORM_MAIN_ID,
- title = STRING_TOKEN(STR_FORM_MAIN_TITLE);
-
- goto FORM_BOOT_SETUP_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_SETUP_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_SETUP_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_DRIVER_SETUP_ID,
- prompt = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE),
- help = STRING_TOKEN(STR_FORM_DRIVER_SETUP_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRIVER_SETUP_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_CON_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_MAIN_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_MAIN_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- text
- help = STRING_TOKEN(STR_BOOT_FROM_FILE_HELP),
- text = STRING_TOKEN(STR_BOOT_FROM_FILE),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_BOOT_FROM_FILE;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
-// label FORM_MAIN_ID;
-
- goto FORM_BOOT_NEXT_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_NEXT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_NEXT_ID;
-
- goto FORM_TIME_OUT_ID,
- prompt = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE),
- help = STRING_TOKEN(STR_FORM_TIME_OUT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_TIME_OUT_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_RESET),
- help = STRING_TOKEN(STR_RESET),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_RESET;
-
- endform;
-
- form formid = FORM_BOOT_SETUP_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_SETUP_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_BOOT_ADD_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_ADD_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_ADD_ID;
-
- goto FORM_BOOT_DEL_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_DEL_ID;
-
- goto FORM_BOOT_CHG_ID,
- prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_BOOT_CHG_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
- //
- // We will add "Select Legacy Boot Floppy Drive" and "Select Legacy Boot Hard Drive"
- // here dynamically
- //
- label FORM_BOOT_LEGACY_DEVICE_ID;
-
- endform;
-
- form formid = FORM_DRIVER_SETUP_ID,
- title = STRING_TOKEN(STR_FORM_DRIVER_SETUP_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_DRV_ADD_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_ADD_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_ADD_ID;
-
- goto FORM_DRV_DEL_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_DEL_ID;
-
- goto FORM_DRV_CHG_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_NEXT_BOOT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_CHG_ID;
- endform;
-
- form formid = FORM_BOOT_ADD_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_BOOT_ADD_ID;
- endform;
-
- form formid = FORM_BOOT_DEL_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_DEL_TITLE);
-
- label FORM_BOOT_DEL_ID;
- endform;
-
- form formid = FORM_BOOT_CHG_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE);
-
- label FORM_BOOT_CHG_ID;
-
- //
- // This tag is added for bypassing issue of setup browser
- // setup browser could not support dynamic form very well.
- //
- checkbox varid = BMM_FAKE_NV_DATA.OptionOrder[0],
- prompt = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_BOOT_CHG_TITLE),
- flags = 1,
- key = 0,
- endcheckbox;
-
- endform;
-
- form formid = FORM_BOOT_NEXT_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_NEXT_TITLE);
-
- label FORM_BOOT_NEXT_ID;
- endform;
-
- form formid = FORM_TIME_OUT_ID,
- title = STRING_TOKEN(STR_FORM_TIME_OUT_TITLE);
-
- label FORM_TIME_OUT_ID;
- endform;
-
- form formid = FORM_DRV_ADD_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_DRV_ADD_FILE_ID,
- prompt = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_DRV_ADD_FILE_ID;
-
- endform;
-
- form formid = FORM_DRV_DEL_ID,
- title = STRING_TOKEN(STR_FORM_DRV_DEL_TITLE);
-
- label FORM_DRV_DEL_ID;
-
- endform;
-
- form formid = FORM_DRV_CHG_ID,
- title = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE);
-
- label FORM_DRV_CHG_ID;
-
- //
- // This tag is added for bypassing issue of setup browser
- // setup browser could not support dynamic form very well.
- //
- checkbox varid = BMM_FAKE_NV_DATA.OptionOrder[0],
- prompt = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- help = STRING_TOKEN(STR_FORM_DRV_CHG_TITLE),
- flags = 1,
- key = 0,
- endcheckbox;
-
- endform;
-
- form formid = FORM_CON_MAIN_ID,
- title = STRING_TOKEN(STR_FORM_CON_MAIN_TITLE);
-
- goto FORM_MAIN_ID,
- prompt = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- help = STRING_TOKEN(STR_FORM_GOTO_MAIN),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_MAIN_ID;
-
- goto FORM_CON_IN_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_IN_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_IN_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_IN_ID;
-
- goto FORM_CON_OUT_ID,
- prompt = STRING_TOKEN(STR_FORM_CON_OUT_TITLE),
- help = STRING_TOKEN(STR_FORM_CON_OUT_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_OUT_ID;
-
- goto FORM_CON_ERR_ID,
- prompt = STRING_TOKEN(STR_FORM_STD_ERR_TITLE),
- help = STRING_TOKEN(STR_FORM_STD_ERR_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_ERR_ID;
-
- goto FORM_CON_COM_ID,
- prompt = STRING_TOKEN(STR_FORM_COM_TITLE),
- help = STRING_TOKEN(STR_FORM_COM_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = FORM_CON_COM_ID;
- endform;
-
- form formid = FORM_CON_COM_ID,
- title = STRING_TOKEN(STR_FORM_COM_TITLE);
-
- label FORM_CON_COM_ID;
- endform;
-
- form formid = FORM_CON_COM_SETUP_ID,
- title = STRING_TOKEN(STR_CON_COM_SETUP);
-
- label FORM_CON_COM_SETUP_ID;
- endform;
-
- form formid = FORM_FILE_SEEK_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_FILE_SEEK_ID;
- endform;
-
- form formid = FORM_FILE_NEW_SEEK_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_TITLE);
-
- label FORM_FILE_NEW_SEEK_ID;
- endform;
-
- form formid = FORM_DRV_ADD_FILE_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_FILE_TITLE);
-
- label FORM_DRV_ADD_FILE_ID;
- endform;
-
- form formid = FORM_DRV_ADD_HANDLE_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_HANDLE_TITLE);
-
- label FORM_DRV_ADD_HANDLE_ID;
- endform;
-
- form formid = FORM_DRV_ADD_HANDLE_DESC_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
-
- label FORM_DRV_ADD_HANDLE_DESC_ID;
-
- endform;
-
- form formid = FORM_CON_IN_ID,
- title = STRING_TOKEN(STR_FORM_CON_IN_TITLE);
-
- label FORM_CON_IN_ID;
-
- endform;
-
- form formid = FORM_CON_OUT_ID,
- title = STRING_TOKEN(STR_FORM_CON_OUT_TITLE);
-
- label FORM_CON_OUT_ID;
-
- endform;
-
- form formid = FORM_CON_ERR_ID,
- title = STRING_TOKEN(STR_FORM_STD_ERR_TITLE);
-
- label FORM_CON_ERR_ID;
-
- endform;
-
- form formid = FORM_SET_FD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_FD_ORDER_TITLE);
-
- label FORM_SET_FD_ORDER_ID;
- endform;
-
- form formid = FORM_SET_HD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_HD_ORDER_TITLE);
-
- label FORM_SET_HD_ORDER_ID;
- endform;
-
- form formid = FORM_SET_CD_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_CD_ORDER_TITLE);
-
- label FORM_SET_CD_ORDER_ID;
- endform;
-
- form formid = FORM_SET_NET_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_NET_ORDER_TITLE);
-
- label FORM_SET_NET_ORDER_ID;
- endform;
-
- form formid = FORM_SET_BEV_ORDER_ID,
- title = STRING_TOKEN(STR_FORM_SET_BEV_ORDER_TITLE);
-
- label FORM_SET_BEV_ORDER_ID;
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c deleted file mode 100644 index e9245d2fb6..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmLib.c +++ /dev/null @@ -1,627 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BmLib.c
-
-AgBStract:
-
- Boot Maintainence Helper functions
-
---*/
-
-#include "BootMaint.h"
-
-EFI_STATUS
-EfiLibLocateProtocol (
- IN EFI_GUID *ProtocolGuid,
- OUT VOID **Interface
- )
-/*++
-
-Routine Description:
-
- Find the first instance of this Protocol
- in the system and return it's interface
-
-Arguments:
-
- ProtocolGuid - Provides the protocol to search for
- Interface - On return, a pointer to the first interface
- that matches ProtocolGuid
-
-Returns:
-
- EFI_SUCCESS - A protocol instance matching ProtocolGuid was found
-
- EFI_NOT_FOUND - No protocol instances were found that match ProtocolGuid
-
---*/
-{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (
- ProtocolGuid,
- NULL,
- Interface
- );
- return Status;
-}
-
-EFI_FILE_HANDLE
-EfiLibOpenRoot (
- IN EFI_HANDLE DeviceHandle
- )
-/*++
-
-Routine Description:
-
- Function opens and returns a file handle to the root directory of a volume.
-
-Arguments:
-
- DeviceHandle - A handle for a device
-
-Returns:
-
- A valid file handle or NULL is returned
-
---*/
-{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume;
- EFI_FILE_HANDLE File;
-
- File = NULL;
-
- //
- // File the file system interface to the device
- //
- Status = gBS->HandleProtocol (
- DeviceHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID *) &Volume
- );
-
- //
- // Open the root directory of the volume
- //
- if (!EFI_ERROR (Status)) {
- Status = Volume->OpenVolume (
- Volume,
- &File
- );
- }
- //
- // Done
- //
- return EFI_ERROR (Status) ? NULL : File;
-}
-
-BOOLEAN
-EfiGrowBuffer (
- IN OUT EFI_STATUS *Status,
- IN OUT VOID **Buffer,
- IN UINTN BufferSize
- )
-/*++
-
-Routine Description:
-
- Helper function called as part of the code needed
- to allocate the proper sized buffer for various
- EFI interfaces.
-
-Arguments:
-
- Status - Current status
-
- Buffer - Current allocated buffer, or NULL
-
- BufferSize - Current buffer size needed
-
-Returns:
-
- TRUE - if the buffer was reallocated and the caller
- should try the API again.
-
---*/
-{
- BOOLEAN TryAgain;
-
- //
- // If this is an initial request, buffer will be null with a new buffer size
- //
- if (!*Buffer && BufferSize) {
- *Status = EFI_BUFFER_TOO_SMALL;
- }
- //
- // If the status code is "buffer too small", resize the buffer
- //
- TryAgain = FALSE;
- if (*Status == EFI_BUFFER_TOO_SMALL) {
-
- SafeFreePool (*Buffer);
-
- *Buffer = AllocateZeroPool (BufferSize);
-
- if (*Buffer) {
- TryAgain = TRUE;
- } else {
- *Status = EFI_OUT_OF_RESOURCES;
- }
- }
- //
- // If there's an error, free the buffer
- //
- if (!TryAgain && EFI_ERROR (*Status) && *Buffer) {
- SafeFreePool (*Buffer);
- *Buffer = NULL;
- }
-
- return TryAgain;
-}
-
-VOID *
-EfiLibGetVariable (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
- Function returns the value of the specified variable.
-
-Arguments:
- Name - A Null-terminated Unicode string that is
- the name of the vendor's variable.
-
- VendorGuid - A unique identifier for the vendor.
-
-Returns:
-
- None
-
---*/
-{
- UINTN VarSize;
-
- return BdsLibGetVariableAndSize (Name, VendorGuid, &VarSize);
-}
-
-EFI_STATUS
-EfiLibDeleteVariable (
- IN CHAR16 *VarName,
- IN EFI_GUID *VarGuid
- )
-/*++
-
-Routine Description:
- Function deletes the variable specified by VarName and VarGuid.
-
-Arguments:
- VarName - A Null-terminated Unicode string that is
- the name of the vendor's variable.
-
- VendorGuid - A unique identifier for the vendor.
-
-Returns:
-
- EFI_SUCCESS - The variable was found and removed
-
- EFI_UNSUPPORTED - The variable store was inaccessible
-
- EFI_OUT_OF_RESOURCES - The temporary buffer was not available
-
- EFI_NOT_FOUND - The variable was not found
-
---*/
-{
- VOID *VarBuf;
- EFI_STATUS Status;
-
- VarBuf = EfiLibGetVariable (VarName, VarGuid);
- Status = EFI_NOT_FOUND;
-
- if (VarBuf) {
- //
- // Delete variable from Storage
- //
- Status = gRT->SetVariable (VarName, VarGuid, VAR_FLAG, 0, NULL);
- ASSERT (!EFI_ERROR (Status));
- SafeFreePool (VarBuf);
- }
-
- return Status;
-}
-
-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
-EfiLibFileSystemVolumeLabelInfo (
- IN EFI_FILE_HANDLE FHand
- )
-/*++
-
-Routine Description:
-
- Function gets the file system information from an open file descriptor,
- and stores it in a buffer allocated from pool.
-
-Arguments:
-
- Fhand - A file handle
-
-Returns:
-
- A pointer to a buffer with file information or NULL is returned
-
---*/
-{
- EFI_STATUS Status;
- EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Buffer;
- UINTN BufferSize;
- //
- // Initialize for GrowBuffer loop
- //
- Buffer = NULL;
- BufferSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + 200;
-
- //
- // Call the real function
- //
- while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
- Status = FHand->GetInfo (
- FHand,
- &gEfiFileSystemVolumeLabelInfoIdGuid,
- &BufferSize,
- Buffer
- );
- }
-
- return Buffer;
-}
-
-CHAR16 *
-EfiStrDuplicate (
- IN CHAR16 *Src
- )
-{
- CHAR16 *Dest;
- UINTN Size;
-
- Size = StrSize (Src);
- Dest = AllocateZeroPool (Size);
- ASSERT (Dest != NULL);
- if (Dest) {
- CopyMem (Dest, Src, Size);
- }
-
- return Dest;
-}
-
-EFI_FILE_INFO *
-EfiLibFileInfo (
- IN EFI_FILE_HANDLE FHand
- )
-/*++
-
-Routine Description:
-
- Function gets the file information from an open file descriptor, and stores it
- in a buffer allocated from pool.
-
-Arguments:
-
- Fhand - A file handle
-
-Returns:
-
- A pointer to a buffer with file information or NULL is returned
-
---*/
-{
- EFI_STATUS Status;
- EFI_FILE_INFO *Buffer;
- UINTN BufferSize;
-
- //
- // Initialize for GrowBuffer loop
- //
- Buffer = NULL;
- BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
-
- //
- // Call the real function
- //
- while (EfiGrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
- Status = FHand->GetInfo (
- FHand,
- &gEfiFileInfoGuid,
- &BufferSize,
- Buffer
- );
- }
-
- return Buffer;
-}
-
-UINTN
-EfiDevicePathInstanceCount (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Function is used to determine the number of device path instances
- that exist in a device path.
-
-Arguments:
- DevicePath - A pointer to a device path data structure.
-
-Returns:
-
- This function counts and returns the number of device path instances
- in DevicePath.
-
---*/
-{
- UINTN Count;
- UINTN Size;
-
- Count = 0;
- while (GetNextDevicePathInstance (&DevicePath, &Size)) {
- Count += 1;
- }
-
- return Count;
-}
-
-VOID *
-EfiReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- )
-/*++
-
-Routine Description:
- Adjusts the size of a previously allocated buffer.
-
-Arguments:
- OldPool - A pointer to the buffer whose size is being adjusted.
- OldSize - The size of the current buffer.
- NewSize - The size of the new buffer.
-
-Returns:
-
- EFI_SUCEESS - The requested number of bytes were allocated.
-
- EFI_OUT_OF_RESOURCES - The pool requested could not be allocated.
-
- EFI_INVALID_PARAMETER - The buffer was invalid.
-
---*/
-{
- VOID *NewPool;
-
- NewPool = NULL;
- if (NewSize) {
- NewPool = AllocateZeroPool (NewSize);
- }
-
- if (OldPool) {
- if (NewPool) {
- CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);
- }
-
- SafeFreePool (OldPool);
- }
-
- return NewPool;
-}
-
-EFI_STATUS
-EfiLibGetStringFromToken (
- IN EFI_GUID *ProducerGuid,
- IN STRING_REF Token,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Acquire the string associated with the ProducerGuid and return it.
-
-Arguments:
-
- ProducerGuid - The Guid to search the HII database for
- Token - The token value of the string to extract
- String - The string that is extracted
-
-Returns:
-
- EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
- was updated.
- EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 HandleBufferLength;
- EFI_HII_HANDLE *HiiHandleBuffer;
- UINTN StringBufferLength;
- UINTN NumberOfHiiHandles;
- UINTN Index;
- UINT16 Length;
- EFI_GUID HiiGuid;
- EFI_HII_PROTOCOL *Hii;
-
- //
- // Initialize params.
- //
- HandleBufferLength = 0;
- HiiHandleBuffer = NULL;
-
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID**) &Hii
- );
- if (EFI_ERROR (Status)) {
- *String = NULL;
- return Status;
- }
- //
- // Get all the Hii handles
- //
- Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get the Hii Handle that matches the StructureNode->ProducerName
- //
- NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
- for (Index = 0; Index < NumberOfHiiHandles; Index++) {
- Length = 0;
- Status = ExtractDataFromHiiHandle (
- HiiHandleBuffer[Index],
- &Length,
- NULL,
- &HiiGuid
- );
- if (CompareGuid (ProducerGuid, &HiiGuid)) {
- break;
- }
- }
- //
- // Find the string based on the current language
- //
- StringBufferLength = 0x100;
- *String = AllocateZeroPool (0x100);
- ASSERT (*String != NULL);
-
- Status = Hii->GetString (
- Hii,
- HiiHandleBuffer[Index],
- Token,
- FALSE,
- NULL,
- &StringBufferLength,
- *String
- );
-
- gBS->FreePool (HiiHandleBuffer);
-
- return Status;
-}
-
-BOOLEAN
-TimeCompare (
- IN EFI_TIME *FirstTime,
- IN EFI_TIME *SecondTime
- )
-/*++
-
-Routine Description:
- Compare two EFI_TIME data.
-
-Arguments:
-
- FirstTime - A pointer to the first EFI_TIME data.
- SecondTime - A pointer to the second EFI_TIME data.
-
-Returns:
- TRUE The FirstTime is not later than the SecondTime.
- FALSE The FirstTime is later than the SecondTime.
-
---*/
-{
- if (FirstTime->Year != SecondTime->Year) {
- return (BOOLEAN) (FirstTime->Year < SecondTime->Year);
- } else if (FirstTime->Month != SecondTime->Month) {
- return (BOOLEAN) (FirstTime->Month < SecondTime->Month);
- } else if (FirstTime->Day != SecondTime->Day) {
- return (BOOLEAN) (FirstTime->Day < SecondTime->Day);
- } else if (FirstTime->Hour != SecondTime->Hour) {
- return (BOOLEAN) (FirstTime->Hour < SecondTime->Hour);
- } else if (FirstTime->Minute != SecondTime->Minute) {
- return (BOOLEAN) (FirstTime->Minute < FirstTime->Minute);
- } else if (FirstTime->Second != SecondTime->Second) {
- return (BOOLEAN) (FirstTime->Second < SecondTime->Second);
- }
-
- return (BOOLEAN) (FirstTime->Nanosecond <= SecondTime->Nanosecond);
-}
-
-UINT16 *
-EfiLibStrFromDatahub (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-{
- EFI_STATUS Status;
- UINT16 *Desc;
- EFI_DATA_HUB_PROTOCOL *Datahub;
- UINT64 Count;
- EFI_DATA_RECORD_HEADER *Record;
- EFI_SUBCLASS_TYPE1_HEADER *DataHdr;
- EFI_GUID MiscGuid = EFI_MISC_SUBCLASS_GUID;
- EFI_MISC_ONBOARD_DEVICE_DATA *ob;
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Port;
- EFI_TIME CurTime;
-
- Status = gBS->LocateProtocol (
- &gEfiDataHubProtocolGuid,
- NULL,
- (VOID**) &Datahub
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- Status = gRT->GetTime (&CurTime, NULL);
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- Count = 0;
- do {
- Status = Datahub->GetNextRecord (Datahub, &Count, NULL, &Record);
-
- if (EFI_ERROR (Status)) {
- break;
- }
-
- if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA && CompareGuid (&Record->DataRecordGuid, &MiscGuid)) {
- //
- // This record is what we need
- //
- DataHdr = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
- if (EFI_MISC_ONBOARD_DEVICE_RECORD_NUMBER == DataHdr->RecordType) {
- ob = (EFI_MISC_ONBOARD_DEVICE_DATA *) (DataHdr + 1);
- if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &ob->OnBoardDevicePath, DevPath)) {
- EfiLibGetStringFromToken (&Record->ProducerName, ob->OnBoardDeviceDescription, &Desc);
- return Desc;
- }
- }
-
- if (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER == DataHdr->RecordType) {
- Port = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) (DataHdr + 1);
- if (BdsLibMatchDevicePaths ((EFI_DEVICE_PATH_PROTOCOL *) &Port->PortPath, DevPath)) {
- EfiLibGetStringFromToken (&Record->ProducerName, Port->PortExternalConnectorDesignator, &Desc);
- return Desc;
- }
- }
- }
-
- } while (TimeCompare (&Record->LogTime, &CurTime) && Count != 0);
-
- return NULL;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.uni Binary files differdeleted file mode 100644 index f646d8b331..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BmString.uni +++ /dev/null diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c deleted file mode 100644 index 0f5087ad98..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.c +++ /dev/null @@ -1,1315 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootMaint.c
-
-Abstract:
-
- Boot Maintainence Main File
-
---*/
-
-#include "Bds.h"
-#include "BootMaint.h"
-#include "FormGuid.h"
-
-//
-// Form binary for Boot Maintenance
-//
-extern UINT8 BmBin[];
-extern UINT8 FEBin[];
-extern EFI_GUID gBdsStringPackGuid;
-extern BOOLEAN gConnectAllHappened;
-
-EFI_GUID EfiLegacyDevOrderGuid = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID;
-
-VOID
-InitAllMenu (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-FreeAllMenu (
- VOID
- );
-
-EFI_STATUS
-CreateMenuStringToken (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN BM_MENU_OPTION *MenuOption
- )
-/*++
-Routine Description:
-
- Create string tokens for a menu from its help strings and display strings
-
-Arguments:
-
- HiiHandle - Hii Handle of the package to be updated.
-
- MenuOption - The Menu whose string tokens need to be created
-
-Returns:
-
- EFI_SUCCESS - string tokens created successfully
-
- others - contain some errors
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
-
- for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->DisplayStringToken,
- NewMenuEntry->DisplayString
- );
-
- if (NULL == NewMenuEntry->HelpString) {
- NewMenuEntry->HelpStringToken = NewMenuEntry->DisplayStringToken;
- } else {
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->HelpStringToken,
- NewMenuEntry->HelpString
- );
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-DriverCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-Routine Description:
-
- Callback Function for boot maintenance utility user interface interaction.
-
-Arguments:
-
- This - File explorer callback protocol pointer.
- KeyValue - Key value to identify the type of data to expect.
- Data - A pointer to the data being sent to the original exporting driver.
- Packet - A pointer to a packet of information which a driver passes back to the browser.
-
-Returns:
-
- EFI_SUCCESS - Callback ended successfully.
- Others - Contain some errors.
-
---*/
-{
- BMM_CALLBACK_DATA *Private;
- BM_MENU_ENTRY *NewMenuEntry;
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- EFI_STATUS Status;
- UINTN OldValue;
- UINTN NewValue;
- UINTN Number;
- UINTN Pos;
- UINTN Bit;
- UINT16 NewValuePos;
- UINT16 Index2;
- UINT16 Index;
- UINT8 *OldLegacyDev;
- UINT8 *NewLegacyDev;
- UINT8 *Location;
- UINT8 *DisMap;
- FORM_ID FormId;
-
- OldValue = 0;
- NewValue = 0;
- Number = 0;
- OldLegacyDev = NULL;
- NewLegacyDev = NULL;
- NewValuePos = 0;
- DisMap = NULL;
-
- Private = BMM_CALLBACK_DATA_FROM_THIS (This);
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->BmmCallbackHandle;
- CurrentFakeNVMap = (BMM_FAKE_NV_DATA *) Data->NvRamMap;
- Private->BmmFakeNvData = CurrentFakeNVMap;
- Location = (UINT8 *) &UpdateData->Data;
-
- UpdatePageId (Private, KeyValue);
-
- //
- // need to be subtituded.
- //
- // Update Select FD/HD/CD/NET/BEV Order Form
- //
- if (FORM_SET_FD_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_HD_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_CD_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_NET_ORDER_ID == Private->BmmPreviousPageId ||
- FORM_SET_BEV_ORDER_ID == Private->BmmPreviousPageId ||
- ((FORM_BOOT_SETUP_ID == Private->BmmPreviousPageId) &&
- (KeyValue >= LEGACY_FD_QUESTION_ID) &&
- (KeyValue < (LEGACY_BEV_QUESTION_ID + 100)) )
- ) {
-
- DisMap = Private->BmmOldFakeNVData.DisableMap;
-
- FormId = Private->BmmPreviousPageId;
- if (FormId == FORM_BOOT_SETUP_ID) {
- FormId = Private->BmmCurrentPageId;
- }
-
- switch (FormId) {
- case FORM_SET_FD_ORDER_ID:
- Number = (UINT16) LegacyFDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD;
- NewLegacyDev = CurrentFakeNVMap->LegacyFD;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- Number = (UINT16) LegacyHDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD;
- NewLegacyDev = CurrentFakeNVMap->LegacyHD;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- Number = (UINT16) LegacyCDMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD;
- NewLegacyDev = CurrentFakeNVMap->LegacyCD;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- Number = (UINT16) LegacyNETMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET;
- NewLegacyDev = CurrentFakeNVMap->LegacyNET;
- break;
-
- case FORM_SET_BEV_ORDER_ID:
- Number = (UINT16) LegacyBEVMenu.MenuNumber;
- OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV;
- NewLegacyDev = CurrentFakeNVMap->LegacyBEV;
- break;
-
- default:
- break;
- }
- //
- // First, find the different position
- // if there is change, it should be only one
- //
- for (Index = 0; Index < Number; Index++) {
- if (OldLegacyDev[Index] != NewLegacyDev[Index]) {
- OldValue = OldLegacyDev[Index];
- NewValue = NewLegacyDev[Index];
- break;
- }
- }
-
- if (Index != Number) {
- //
- // there is change, now process
- //
- if (0xFF == NewValue) {
- //
- // This item will be disable
- // Just move the items behind this forward to overlap it
- //
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] |= (UINT8) (1 << Bit);
- for (Index2 = Index; Index2 < Number - 1; Index2++) {
- NewLegacyDev[Index2] = NewLegacyDev[Index2 + 1];
- }
-
- NewLegacyDev[Index2] = 0xFF;
- } else {
- for (Index2 = 0; Index2 < Number; Index2++) {
- if (Index2 == Index) {
- continue;
- }
-
- if (OldLegacyDev[Index2] == NewValue) {
- //
- // If NewValue is in OldLegacyDev array
- // remember its old position
- //
- NewValuePos = Index2;
- break;
- }
- }
-
- if (Index2 != Number) {
- //
- // We will change current item to an existing item
- // (It's hard to describe here, please read code, it's like a cycle-moving)
- //
- for (Index2 = NewValuePos; Index2 != Index;) {
- if (NewValuePos < Index) {
- NewLegacyDev[Index2] = OldLegacyDev[Index2 + 1];
- Index2++;
- } else {
- NewLegacyDev[Index2] = OldLegacyDev[Index2 - 1];
- Index2--;
- }
- }
- } else {
- //
- // If NewValue is not in OldlegacyDev array, we are changing to a disabled item
- // so we should modify DisMap to reflect the change
- //
- Pos = NewValue / 8;
- Bit = 7 - (NewValue % 8);
- DisMap[Pos] &= ~ (UINT8) (1 << Bit);
- if (0xFF != OldValue) {
- //
- // Because NewValue is a item that was disabled before
- // so after changing the OldValue should be disabled
- // actually we are doing a swap of enable-disable states of two items
- //
- Pos = OldValue / 8;
- Bit = 7 - (OldValue % 8);
- DisMap[Pos] |= (UINT8) (1 << Bit);
- }
- }
- }
- //
- // To prevent DISABLE appears in the middle of the list
- // we should perform a re-ordering
- //
- Index = 0;
- while (Index < Number) {
- if (0xFF != NewLegacyDev[Index]) {
- Index++;
- continue;
- }
-
- Index2 = Index;
- Index2++;
- while (Index2 < Number) {
- if (0xFF != NewLegacyDev[Index2]) {
- break;
- }
-
- Index2++;
- }
-
- if (Index2 < Number) {
- NewLegacyDev[Index] = NewLegacyDev[Index2];
- NewLegacyDev[Index2] = 0xFF;
- }
-
- Index++;
- }
-
- CopyMem (
- OldLegacyDev,
- NewLegacyDev,
- Number
- );
- }
- }
-
- if (KeyValue < FILE_OPTION_OFFSET) {
- if (KeyValue < NORMAL_GOTO_OFFSET) {
- switch (KeyValue) {
- case KEY_VALUE_BOOT_FROM_FILE:
- Private->FeCurrentState = BOOT_FROM_FILE_STATE;
-
- //
- // Exit Bmm main formset to send File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
-
- break;
-
- case FORM_BOOT_ADD_ID:
- Private->FeCurrentState = ADD_BOOT_OPTION_STATE;
-
- //
- // Exit Bmm main formset to send File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
- break;
-
- case FORM_DRV_ADD_FILE_ID:
- Private->FeCurrentState = ADD_DRIVER_OPTION_STATE;
-
- //
- // Exit Bmm main formset to send File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
-
- break;
-
- case FORM_DRV_ADD_HANDLE_ID:
- CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private);
- UpdateDrvAddHandlePage (Private);
- break;
-
- case FORM_BOOT_DEL_ID:
- CleanUpPage (FORM_BOOT_DEL_ID, Private);
- UpdateBootDelPage (Private);
- break;
-
- case FORM_BOOT_CHG_ID:
- case FORM_DRV_CHG_ID:
- UpdatePageBody (KeyValue, Private);
- break;
-
- case FORM_DRV_DEL_ID:
- CleanUpPage (FORM_DRV_DEL_ID, Private);
- UpdateDrvDelPage (Private);
- break;
-
- case FORM_BOOT_NEXT_ID:
- CleanUpPage (FORM_BOOT_NEXT_ID, Private);
- UpdateBootNextPage (Private);
- break;
-
- case FORM_TIME_OUT_ID:
- CleanUpPage (FORM_TIME_OUT_ID, Private);
- UpdateTimeOutPage (Private);
- break;
-
- case FORM_RESET:
- gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
- return EFI_UNSUPPORTED;
-
- case FORM_CON_IN_ID:
- case FORM_CON_OUT_ID:
- case FORM_CON_ERR_ID:
- UpdatePageBody (KeyValue, Private);
- break;
-
- case FORM_CON_COM_ID:
- CleanUpPage (FORM_CON_COM_ID, Private);
- UpdateConCOMPage (Private);
- break;
-
- case FORM_SET_FD_ORDER_ID:
- case FORM_SET_HD_ORDER_ID:
- case FORM_SET_CD_ORDER_ID:
- case FORM_SET_NET_ORDER_ID:
- case FORM_SET_BEV_ORDER_ID:
- CleanUpPage (KeyValue, Private);
- UpdateSetLegacyDeviceOrderPage (KeyValue, Private);
- break;
-
- case KEY_VALUE_SAVE_AND_EXIT:
- case KEY_VALUE_NO_SAVE_AND_EXIT:
-
- if (KeyValue == KEY_VALUE_SAVE_AND_EXIT) {
- Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- } else if (KeyValue == KEY_VALUE_NO_SAVE_AND_EXIT) {
- DiscardChangeHandler (Private, CurrentFakeNVMap);
- }
- //
- // Tell browser not to ask for confirmation of changes,
- // since we have already applied or discarded.
- //
- CreateCallbackPacket (Packet, NV_NOT_CHANGED);
- break;
-
- default:
- break;
- }
- } else if ((KeyValue >= TERMINAL_OPTION_OFFSET) && (KeyValue < CONSOLE_OPTION_OFFSET)) {
- Index2 = (UINT16) (KeyValue - TERMINAL_OPTION_OFFSET);
- Private->CurrentTerminal = Index2;
-
- CleanUpPage (FORM_CON_COM_SETUP_ID, Private);
- UpdateTerminalPage (Private);
-
- } else if (KeyValue >= HANDLE_OPTION_OFFSET) {
- Index2 = (UINT16) (KeyValue - HANDLE_OPTION_OFFSET);
-
- NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index2);
- Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;
-
- CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private);
-
- Private->MenuEntry = NewMenuEntry;
- Private->LoadContext->FilePathList = Private->HandleContext->DevicePath;
-
- UpdateDriverAddHandleDescPage (Private);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-ApplyChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
- IN FORM_ID FormId
- )
-/*++
-
-Routine Description:
-
- Function handling request to apply changes for BMM pages.
-
-Arguments:
-
- Private - Pointer to callback data buffer.
- CurrentFakeNVMap - Pointer to buffer holding data of various values used by BMM
- FormId - ID of the form which has sent the request to apply change.
-
-Returns:
-
- EFI_SUCCESS - Change successfully applied.
- Other - Error occurs while trying to apply changes.
-
---*/
-{
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_LOAD_CONTEXT *NewLoadContext;
- BM_MENU_ENTRY *NewMenuEntry;
- EFI_STATUS Status;
- UINT16 Index;
-
- Status = EFI_SUCCESS;
-
- switch (FormId) {
- case FORM_SET_FD_ORDER_ID:
- case FORM_SET_HD_ORDER_ID:
- case FORM_SET_CD_ORDER_ID:
- case FORM_SET_NET_ORDER_ID:
- case FORM_SET_BEV_ORDER_ID:
- Var_UpdateBBSOption (Private);
- break;
-
- case FORM_BOOT_DEL_ID:
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = CurrentFakeNVMap->BootOptionDel[Index];
- }
-
- Var_DelBootOption ();
- break;
-
- case FORM_DRV_DEL_ID:
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = CurrentFakeNVMap->DriverOptionDel[Index];
- }
-
- Var_DelDriverOption ();
- break;
-
- case FORM_BOOT_CHG_ID:
- Status = Var_UpdateBootOrder (Private);
- break;
-
- case FORM_DRV_CHG_ID:
- Status = Var_UpdateDriverOrder (Private);
- break;
-
- case FORM_TIME_OUT_ID:
- Status = gRT->SetVariable (
- L"Timeout",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- sizeof (UINT16),
- &(CurrentFakeNVMap->BootTimeOut)
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;
- break;
-
- case FORM_BOOT_NEXT_ID:
- Status = Var_UpdateBootNext (Private);
- break;
-
- case FORM_CON_COM_ID:
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Private->CurrentTerminal);
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate;
- NewTerminalContext->BaudRate = BaudRateList[CurrentFakeNVMap->COMBaudRate].Value;
- NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate;
- NewTerminalContext->DataBits = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate].Value;
- NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits;
- NewTerminalContext->StopBits = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits].Value;
- NewTerminalContext->ParityIndex = CurrentFakeNVMap->COMParity;
- NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;
- NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType;
-
- ChangeTerminalDevicePath (
- NewTerminalContext->DevicePath,
- FALSE
- );
-
- Var_UpdateConsoleInpOption ();
- Var_UpdateConsoleOutOption ();
- Var_UpdateErrorOutOption ();
- break;
-
- case FORM_CON_IN_ID:
- for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber];
- }
-
- Var_UpdateConsoleInpOption ();
- break;
-
- case FORM_CON_OUT_ID:
- for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->IsConOut = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber];
- }
-
- Var_UpdateConsoleOutOption ();
- break;
-
- case FORM_CON_ERR_ID:
- for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->IsStdErr = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber];
- }
-
- Var_UpdateErrorOutOption ();
- break;
-
- case FORM_DRV_ADD_HANDLE_DESC_ID:
- Status = Var_UpdateDriverOption (
- Private,
- Private->BmmHiiHandle,
- CurrentFakeNVMap->DriverAddHandleDesc,
- CurrentFakeNVMap->DriverAddHandleOptionalData,
- CurrentFakeNVMap->DriverAddForceReconnect
- );
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- BOpt_GetDriverOptions (Private);
- CreateMenuStringToken (Private, Private->BmmHiiHandle, &DriverOptionMenu);
- break;
-
- default:
- break;
- }
-
-Error:
- return Status;
-}
-
-VOID
-DiscardChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
- )
-{
- UINT16 Index;
-
- switch (Private->BmmPreviousPageId) {
- case FORM_BOOT_CHG_ID:
- case FORM_DRV_CHG_ID:
- CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, 100);
- break;
-
- case FORM_BOOT_DEL_ID:
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->BootOptionDel[Index] = 0x00;
- }
- break;
-
- case FORM_DRV_DEL_ID:
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->DriverOptionDel[Index] = 0x00;
- }
- break;
-
- case FORM_BOOT_NEXT_ID:
- CurrentFakeNVMap->BootNext = Private->BmmOldFakeNVData.BootNext;
- break;
-
- case FORM_TIME_OUT_ID:
- CurrentFakeNVMap->BootTimeOut = Private->BmmOldFakeNVData.BootTimeOut;
- break;
-
- case FORM_DRV_ADD_HANDLE_DESC_ID:
- case FORM_DRV_ADD_FILE_ID:
- case FORM_DRV_ADD_HANDLE_ID:
- CurrentFakeNVMap->DriverAddHandleDesc[0] = 0x0000;
- CurrentFakeNVMap->DriverAddHandleOptionalData[0] = 0x0000;
- break;
-
- default:
- break;
- }
-}
-
-EFI_STATUS
-EFIAPI
-NvWrite (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- OUT UINT32 Attributes OPTIONAL,
- IN OUT UINTN DataSize,
- OUT VOID *Buffer,
- OUT BOOLEAN *ResetRequired
- )
-{
- //
- // Do nothing here. Just to catch the F10, we use "Apply Changes" tag to save.
- //
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeBM (
- VOID
- )
-/*++
-Routine Description:
-
- Initialize the Boot Maintenance Utitliy
-
-Arguments:
-
- ImageHandle - caller provided handle
-
- SystemTable - caller provided system tables
-
-Returns:
-
- EFI_SUCCESS - utility ended successfully
-
- others - contain some errors
-
---*/
-{
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- EFI_HII_PACKAGES *PackageList;
- BMM_CALLBACK_DATA *BmmCallbackInfo;
- EFI_HII_PROTOCOL *Hii;
- EFI_HII_HANDLE HiiHandle;
- EFI_STATUS Status;
- EFI_HANDLE Handle;
- UINT8 *Ptr;
- UINT8 *Location;
-
- Status = EFI_SUCCESS;
- UpdateData = NULL;
- //
- // Initialize EfiUtilityLib and EfiDriverLib
- // Since many functions in UtilityLib must be used and
- // SetupBrowser use DriverLib
- //
- //
- // There should be only one EFI_HII_PROTOCOL Image
- //
- Status = EfiLibLocateProtocol (&gEfiHiiProtocolGuid, (VOID**)&Hii);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- //
- // Create CallbackData structures for Driver Callback
- //
- BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));
- if (!BmmCallbackInfo) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Create LoadOption in BmmCallbackInfo for Driver Callback
- //
- Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
- if (!Ptr) {
- SafeFreePool (BmmCallbackInfo);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize Bmm callback data.
- //
- BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr;
- Ptr += sizeof (BM_LOAD_CONTEXT);
-
- BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_FILE_CONTEXT);
-
- BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_HANDLE_CONTEXT);
-
- BmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
-
- BmmCallbackInfo->BmmFakeNvData = &BmmCallbackInfo->BmmOldFakeNVData;
-
- ZeroMem (BmmCallbackInfo->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA));
-
- BmmCallbackInfo->Signature = BMM_CALLBACK_DATA_SIGNATURE;
- BmmCallbackInfo->Hii = Hii;
- BmmCallbackInfo->BmmDriverCallback.NvRead = NULL;
- BmmCallbackInfo->BmmDriverCallback.NvWrite = NvWrite;
- BmmCallbackInfo->BmmDriverCallback.Callback = DriverCallback;
- BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
- BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
- BmmCallbackInfo->FeDriverCallback.NvRead = NULL;
- BmmCallbackInfo->FeDriverCallback.NvWrite = NvWrite;
- BmmCallbackInfo->FeDriverCallback.Callback = FileExplorerCallback;
- BmmCallbackInfo->FeCurrentState = INACTIVE_STATE;
- BmmCallbackInfo->FeDisplayContext = UNKNOWN_CONTEXT;
-
- //
- // Install bmm callback protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &BmmCallbackInfo->BmmDriverCallback
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BmmCallbackInfo->BmmCallbackHandle = Handle;
-
- //
- // Install file explorer callback protocol interface
- //
- Handle = NULL;
- Status = gBS->InstallProtocolInterface (
- &Handle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &BmmCallbackInfo->FeDriverCallback
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BmmCallbackInfo->FeCallbackHandle = Handle;
-
- //
- // Post our VFR to the HII database.
- //
- PackageList = PreparePackages (1, &gBdsStringPackGuid, BmBin);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- gBS->FreePool (PackageList);
-
- BmmCallbackInfo->BmmHiiHandle = HiiHandle;
-
- PackageList = PreparePackages (1, &gBdsStringPackGuid, FEBin);
- Status = Hii->NewPack (Hii, PackageList, &HiiHandle);
- gBS->FreePool (PackageList);
-
- BmmCallbackInfo->FeHiiHandle = HiiHandle;
-
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (UPDATE_DATA_SIZE);
- if (!UpdateData) {
- SafeFreePool (BmmCallbackInfo->LoadContext);
- SafeFreePool (BmmCallbackInfo);
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Initialize UpdateData structure
- //
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) BmmCallbackInfo->BmmCallbackHandle, FALSE, 0, 0);
-
- Location = (UINT8 *) &UpdateData->Data;
-
- InitializeStringDepository ();
-
- InitAllMenu (BmmCallbackInfo);
-
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleInpMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleOutMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &ConsoleErrMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &BootOptionMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverOptionMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &TerminalMenu);
- CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverMenu);
-
- UpdateBootDelPage (BmmCallbackInfo);
- UpdateDrvDelPage (BmmCallbackInfo);
-
- if (TerminalMenu.MenuNumber > 0) {
- BmmCallbackInfo->CurrentTerminal = 0;
- UpdateTerminalPage (BmmCallbackInfo);
- }
-
- Location = (UINT8 *) &UpdateData->Data;
- Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID**) &LegacyBios);
- if (!EFI_ERROR (Status)) {
- //
- // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
- // in BootOption form: legacy FD/HD/CD/NET/BEV
- //
- UpdateData->DataCount = 5;
- CreateGotoOpCode (
- FORM_SET_FD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_FD_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_HD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_HD_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_CD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_CD_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_NET_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_NET_ORDER_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateGotoOpCode (
- FORM_SET_BEV_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_SET_BEV_ORDER_ID,
- Location
- );
-
- Hii->UpdateForm (
- Hii,
- BmmCallbackInfo->BmmHiiHandle,
- (EFI_FORM_LABEL) FORM_BOOT_LEGACY_DEVICE_ID,
- TRUE,
- UpdateData
- );
- }
- //
- // Dispatch BMM main formset and File Explorer formset.
- //
- FormSetDispatcher (BmmCallbackInfo);
-
- Hii->ResetStrings (Hii, HiiHandle);
-
- CleanUpStringDepository ();
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- FreeAllMenu ();
-
- SafeFreePool (BmmCallbackInfo->LoadContext);
- BmmCallbackInfo->LoadContext = NULL;
- SafeFreePool (BmmCallbackInfo);
- BmmCallbackInfo = NULL;
- SafeFreePool (UpdateData);
- UpdateData = NULL;
-
- return Status;
-}
-
-VOID
-InitAllMenu (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- InitializeListHead (&BootOptionMenu.Head);
- InitializeListHead (&DriverOptionMenu.Head);
- BOpt_GetBootOptions (CallbackData);
- BOpt_GetDriverOptions (CallbackData);
- BOpt_GetLegacyOptions ();
- InitializeListHead (&FsOptionMenu.Head);
- BOpt_FindDrivers ();
- InitializeListHead (&DirectoryMenu.Head);
- InitializeListHead (&ConsoleInpMenu.Head);
- InitializeListHead (&ConsoleOutMenu.Head);
- InitializeListHead (&ConsoleErrMenu.Head);
- InitializeListHead (&TerminalMenu.Head);
- LocateSerialIo ();
- GetAllConsoles ();
-}
-
-VOID
-FreeAllMenu (
- VOID
- )
-{
- BOpt_FreeMenu (&DirectoryMenu);
- BOpt_FreeMenu (&FsOptionMenu);
- BOpt_FreeMenu (&BootOptionMenu);
- BOpt_FreeMenu (&DriverOptionMenu);
- BOpt_FreeMenu (&DriverMenu);
- BOpt_FreeLegacyOptions ();
- FreeAllConsoles ();
-}
-
-VOID
-InitializeStringDepository (
- VOID
- )
-/*++
-Routine Description:
- Intialize all the string depositories.
-
-Arguments:
- None.
-
-Returns:
- None.
---*/
-{
- STRING_DEPOSITORY *StringDepository;
- StringDepository = AllocateZeroPool (sizeof (STRING_DEPOSITORY) * STRING_DEPOSITORY_NUMBER);
- FileOptionStrDepository = StringDepository++;
- ConsoleOptionStrDepository = StringDepository++;
- BootOptionStrDepository = StringDepository++;
- BootOptionHelpStrDepository = StringDepository++;
- DriverOptionStrDepository = StringDepository++;
- DriverOptionHelpStrDepository = StringDepository++;
- TerminalStrDepository = StringDepository;
-}
-
-STRING_REF
-GetStringTokenFromDepository (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN STRING_DEPOSITORY *StringDepository
- )
-/*++
-Routine Description:
- Fetch a usable string node from the string depository and return the string token.
-
-Arguments:
- StringDepository - Pointer of the string depository.
-
-Returns:
- STRING_REF - String token.
---*/
-{
- STRING_LIST_NODE *CurrentListNode;
- STRING_LIST_NODE *NextListNode;
-
- CurrentListNode = StringDepository->CurrentNode;
-
- if ((NULL != CurrentListNode) && (NULL != CurrentListNode->Next)) {
- //
- // Fetch one reclaimed node from the list.
- //
- NextListNode = StringDepository->CurrentNode->Next;
- } else {
- //
- // If there is no usable node in the list, update the list.
- //
- NextListNode = AllocateZeroPool (sizeof (STRING_LIST_NODE));
-
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->BmmHiiHandle,
- &(NextListNode->StringToken),
- L" "
- );
-
- ASSERT (NextListNode->StringToken != 0);
-
- StringDepository->TotalNodeNumber++;
-
- if (NULL == CurrentListNode) {
- StringDepository->ListHead = NextListNode;
- } else {
- CurrentListNode->Next = NextListNode;
- }
- }
-
- StringDepository->CurrentNode = NextListNode;
-
- return StringDepository->CurrentNode->StringToken;
-}
-
-VOID
-ReclaimStringDepository (
- VOID
- )
-/*++
-Routine Description:
- Reclaim string depositories by moving the current node pointer to list head..
-
-Arguments:
- None.
-
-Returns:
- None.
---*/
-{
- UINTN DepositoryIndex;
- STRING_DEPOSITORY *StringDepository;
-
- StringDepository = FileOptionStrDepository;
- for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {
- StringDepository->CurrentNode = StringDepository->ListHead;
- StringDepository++;
- }
-}
-
-VOID
-CleanUpStringDepository (
- VOID
- )
-/*++
-Routine Description:
- Release resource for all the string depositories.
-
-Arguments:
- None.
-
-Returns:
- None.
---*/
-{
- UINTN NodeIndex;
- UINTN DepositoryIndex;
- STRING_LIST_NODE *CurrentListNode;
- STRING_LIST_NODE *NextListNode;
- STRING_DEPOSITORY *StringDepository;
-
- //
- // Release string list nodes.
- //
- StringDepository = FileOptionStrDepository;
- for (DepositoryIndex = 0; DepositoryIndex < STRING_DEPOSITORY_NUMBER; DepositoryIndex++) {
- CurrentListNode = StringDepository->ListHead;
- for (NodeIndex = 0; NodeIndex < StringDepository->TotalNodeNumber; NodeIndex++) {
- NextListNode = CurrentListNode->Next;
- SafeFreePool (CurrentListNode);
- CurrentListNode = NextListNode;
- }
-
- StringDepository++;
- }
- //
- // Release string depository.
- //
- SafeFreePool (FileOptionStrDepository);
-}
-
-EFI_STATUS
-BdsStartBootMaint (
- VOID
- )
-/*++
-
-Routine Description:
- Start boot maintenance manager
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- LIST_ENTRY BdsBootOptionList;
-
- InitializeListHead (&BdsBootOptionList);
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // Have chance to enumerate boot device
- //
- BdsLibEnumerateAllBootOption (&BdsBootOptionList);
-
- //
- // Init the BMM
- //
- Status = InitializeBM ();
-
- return Status;
-}
-
-EFI_STATUS
-FormSetDispatcher (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description:
- Dispatch BMM formset and FileExplorer formset.
-
-Arguments:
-
-Returns:
-
---*/
-{
- EFI_FORM_BROWSER_PROTOCOL *FormConfig;
- UINT8 *Location;
- EFI_STATUS Status;
- UINTN Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- BOOLEAN BootMaintMenuResetRequired;
-
- Location = NULL;
- Index = 0;
- NewMenuEntry = NULL;
- NewFileContext = NULL;
-
- //
- // There should only be one Form Configuration protocol
- //
- Status = EfiLibLocateProtocol (&gEfiFormBrowserProtocolGuid, (VOID**) &FormConfig);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- while (1) {
- UpdatePageId (CallbackData, FORM_MAIN_ID);
-
- BootMaintMenuResetRequired = FALSE;
- Status = FormConfig->SendForm (
- FormConfig,
- TRUE,
- &(CallbackData->BmmHiiHandle),
- 1,
- NULL,
- NULL,
- (UINT8 *) CallbackData->BmmFakeNvData,
- NULL,
- &BootMaintMenuResetRequired
- );
-
- if (BootMaintMenuResetRequired) {
- EnableResetRequired ();
- }
-
- ReclaimStringDepository ();
-
- //
- // When this Formset returns, check if we are going to explore files.
- //
- if (INACTIVE_STATE != CallbackData->FeCurrentState) {
- UpdateFileExplorer (CallbackData, 0);
-
- BootMaintMenuResetRequired = FALSE;
- Status = FormConfig->SendForm (
- FormConfig,
- TRUE,
- &(CallbackData->FeHiiHandle),
- 1,
- NULL,
- NULL,
- NULL,
- NULL,
- &BootMaintMenuResetRequired
- );
-
- if (BootMaintMenuResetRequired) {
- EnableResetRequired ();
- }
-
- CallbackData->FeCurrentState = INACTIVE_STATE;
- CallbackData->FeDisplayContext = UNKNOWN_CONTEXT;
- ReclaimStringDepository ();
- } else {
- break;
- }
- }
-
- return Status;
-}
-
-VOID
-CreateCallbackPacket (
- OUT EFI_HII_CALLBACK_PACKET **Packet,
- IN UINT16 Flags
- )
-{
- *Packet = (EFI_HII_CALLBACK_PACKET *) AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
- ASSERT (*Packet != NULL);
-
- (*Packet)->DataArray.EntryCount = 1;
- (*Packet)->DataArray.NvRamMap = NULL;
- ((EFI_IFR_DATA_ENTRY *) (&((*Packet)->DataArray) + 1))->Flags = Flags;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h deleted file mode 100644 index a5c9f0d920..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootMaint.h +++ /dev/null @@ -1,1159 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootMaint.h
-
-Abstract:
-
-Revision History
-
---*/
-
-#ifndef _BOOT_MAINT_H
-#define _BOOT_MAINT_H
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#include "BootMaint/BBSsupport.h"
-
-//
-// Constants which are variable names used to access variables
-//
-#define VarLegacyDevOrder L"LegacyDevOrder"
-
-//
-// Guid of a NV Variable which store the information about the
-// FD/HD/CD/NET/BEV order
-//
-#define EFI_LEGACY_DEV_ORDER_VARIABLE_GUID \
- { \
- 0xa56074db, 0x65fe, 0x45f7, {0xbd, 0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52 } \
- }
-
-//
-// String Contant
-//
-#define StrFloppy L"Floppy Drive #%02x"
-#define StrHardDisk L"HardDisk Drive #%02x"
-#define StrCDROM L"ATAPI CDROM Drive #%02x"
-#define StrNET L"NET Drive #%02x"
-#define StrBEV L"BEV Drive #%02x"
-#define StrFloppyHelp L"Select Floppy Drive #%02x"
-#define StrHardDiskHelp L"Select HardDisk Drive #%02x"
-#define StrCDROMHelp L"Select ATAPI CDROM Drive #%02x"
-#define StrNETHelp L"NET Drive #%02x"
-#define StrBEVHelp L"BEV Drive #%02x"
-
-//
-// Constant will be used in display and file system navigation
-//
-#define UPDATE_DATA_SIZE 0x100000
-#define MAX_BBS_OFFSET 0xE000
-#define NET_OPTION_OFFSET 0xD800
-#define BEV_OPTION_OFFSET 0xD000
-#define FD_OPTION_OFFSET 0xC000
-#define HD_OPTION_OFFSET 0xB000
-#define CD_OPTION_OFFSET 0xA000
-#define FILE_OPTION_OFFSET 0x8000
-#define FILE_OPTION_MASK 0x7FFF
-#define HANDLE_OPTION_OFFSET 0x7000
-#define CONSOLE_OPTION_OFFSET 0x0A00
-#define TERMINAL_OPTION_OFFSET 0x0700
-#define NORMAL_GOTO_OFFSET 0x0100
-#define MAX_STRING_TOKEN_COUNT 0x00FF
-//
-// Variable created with this flag will be "Efi:...."
-//
-#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
-
-//
-// Define Maxmim characters that will be accepted
-//
-#define MAX_CHAR 480
-#define MAX_CHAR_SIZE (MAX_CHAR * 2)
-
-//
-// Check to see if current build support option active feature of
-// some driver option
-//
-#define LOAD_OPTION_ACTIVE 0x00000001
-
-//
-// Check to see if current build support force reconnect feature of
-// some driver option
-//
-#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
-
-//
-// Below are the form ids for display, form id is used as callback key value,
-// some key value definitions are also defined here. By defining this enum type,
-// We can easy know where we are. The int to UINT16 convertion should be ok because
-// there is a MAXIMUM_FORM_ID which in within the range of UINT16.
-//
-typedef enum {
- IplRelative,
- BcvRelative
-} BBS_TYPE;
-
-typedef enum {
- FORM_RESERVED_ID = 0,
- FORM_MAIN_ID, // 0x0001
- FORM_BOOT_ADD_ID, // 0x0002
- FORM_BOOT_DEL_ID, // 0x0003
- FORM_BOOT_CHG_ID, // 0x0004
- FORM_DRV_ADD_ID, // 0x0005
- FORM_DRV_DEL_ID, // 0x0006
- FORM_DRV_CHG_ID, // 0x0007
- FORM_CON_MAIN_ID, // 0x0008
- FORM_CON_IN_ID, // 0x0009
- FORM_CON_OUT_ID, // 0x000A
- FORM_CON_ERR_ID, // 0x000B
- FORM_FILE_SEEK_ID, // 0x000C
- FORM_FILE_NEW_SEEK_ID, // 0x000D
- FORM_DRV_ADD_FILE_ID, // 0x000E
- FORM_DRV_ADD_HANDLE_ID, // 0x000F
- FORM_DRV_ADD_HANDLE_DESC_ID, // 0x0010
- FORM_BOOT_NEXT_ID, // 0x0011
- FORM_TIME_OUT_ID, // 0x0012
- FORM_RESET, // 0x0013
- FORM_BOOT_SETUP_ID, // 0x0014
- FORM_DRIVER_SETUP_ID, // 0x0015
- FORM_BOOT_LEGACY_DEVICE_ID, // 0x0016
- FORM_CON_COM_ID, // 0x0017
- FORM_CON_COM_SETUP_ID, // 0x0018
- FORM_SET_FD_ORDER_ID, // 0x0019
- FORM_SET_HD_ORDER_ID, // 0x001A
- FORM_SET_CD_ORDER_ID, // 0x001B
- FORM_SET_NET_ORDER_ID, // 0x001C
- FORM_SET_BEV_ORDER_ID, // 0x001D
- FORM_FILE_EXPLORER_ID, // 0x001E
- FORM_BOOT_ADD_DESCRIPTION_ID, // 0x001F
- FORM_DRIVER_ADD_FILE_DESCRIPTION_ID, // 0x0020
-} FORM_ID;
-
-#define MAXIMUM_FORM_ID 0x007F
-
-#define KEY_VALUE_COM_SET_BAUD_RATE 0x0080
-#define KEY_VALUE_COM_SET_DATA_BITS 0x0081
-#define KEY_VALUE_COM_SET_STOP_BITS 0x0082
-#define KEY_VALUE_COM_SET_PARITY 0x0083
-#define KEY_VALUE_COM_SET_TERMI_TYPE 0x0084
-#define KEY_VALUE_MAIN_BOOT_NEXT 0x0085
-#define KEY_VALUE_BOOT_ADD_DESC_DATA 0x0086
-#define KEY_VALUE_BOOT_ADD_OPT_DATA 0x0087
-#define KEY_VALUE_DRIVER_ADD_DESC_DATA 0x0088
-#define KEY_VALUE_DRIVER_ADD_OPT_DATA 0x0089
-#define KEY_VALUE_SAVE_AND_EXIT 0x0090
-#define KEY_VALUE_NO_SAVE_AND_EXIT 0x0091
-#define KEY_VALUE_BOOT_FROM_FILE 0x0092
-
-#define MAXIMUM_NORMAL_KEY_VALUE NORMAL_GOTO_OFFSET
-//
-// Below are the number of options in Baudrate, Databits,
-// Parity and Stopbits selection for serial ports.
-//
-#define BM_COM_ATTR_BUADRATE 19
-#define BM_COM_ATTR_DATABITS 4
-#define BM_COM_ATTR_PARITY 5
-#define BM_COM_ATTR_STOPBITS 3
-
-//
-// Callback function helper
-//
-#define BMM_CALLBACK_DATA_SIGNATURE EFI_SIGNATURE_32 ('C', 'b', 'c', 'k')
-#define BMM_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, BmmDriverCallback, BMM_CALLBACK_DATA_SIGNATURE)
-
-#define FE_CALLBACK_DATA_FROM_THIS(a) CR (a, BMM_CALLBACK_DATA, FeDriverCallback, BMM_CALLBACK_DATA_SIGNATURE)
-
-//
-// Enumeration type definition
-//
-typedef enum {
- PC_ANSI = 0,
- VT_100,
- VT_100_PLUS,
- VT_UTF8
-} TYPE_OF_TERMINAL;
-
-typedef enum {
- COM1 = 0,
- COM2,
- UNKNOW_COM
-} TYPE_OF_COM;
-
-typedef enum {
- CONIN = 0,
- CONOUT,
- CONERR,
- UNKNOWN_CON
-} TYPE_OF_CON;
-
-typedef enum {
- BAUDRATE = 0,
- DATABITS,
- PARITY,
- STOPBITS,
- UNKNOW_ATTR
-} TYPE_OF_ATTRIBUTE;
-
-typedef enum {
- MANNER_GOTO = 0,
- MANNER_CHECK,
- MANNER_ONEOF,
- MANNER_USER_DEFINE
-} TYPE_OF_UPATE_MANNER;
-
-typedef enum {
- INACTIVE_STATE = 0,
- BOOT_FROM_FILE_STATE,
- ADD_BOOT_OPTION_STATE,
- ADD_DRIVER_OPTION_STATE,
- UNKNOWN_STATE
-} FILE_EXPLORER_STATE;
-
-typedef enum {
- FILE_SYSTEM,
- DIRECTORY,
- UNKNOWN_CONTEXT
-} FILE_EXPLORER_DISPLAY_CONTEXT;
-
-//
-// All of the signatures that will be used in list structure
-//
-#define BM_MENU_OPTION_SIGNATURE EFI_SIGNATURE_32 ('m', 'e', 'n', 'u')
-#define BM_LOAD_OPTION_SIGNATURE EFI_SIGNATURE_32 ('l', 'o', 'a', 'd')
-#define BM_CONSOLE_OPTION_SIGNATURE EFI_SIGNATURE_32 ('c', 'n', 's', 'l')
-#define BM_FILE_OPTION_SIGNATURE EFI_SIGNATURE_32 ('f', 'i', 'l', 'e')
-#define BM_HANDLE_OPTION_SIGNATURE EFI_SIGNATURE_32 ('h', 'n', 'd', 'l')
-#define BM_TERMINAL_OPTION_SIGNATURE EFI_SIGNATURE_32 ('t', 'r', 'm', 'l')
-#define BM_MENU_ENTRY_SIGNATURE EFI_SIGNATURE_32 ('e', 'n', 't', 'r')
-
-#define BM_LOAD_CONTEXT_SELECT 0x0
-#define BM_CONSOLE_CONTEXT_SELECT 0x1
-#define BM_FILE_CONTEXT_SELECT 0x2
-#define BM_HANDLE_CONTEXT_SELECT 0x3
-#define BM_TERMINAL_CONTEXT_SELECT 0x5
-
-#define BM_CONSOLE_IN_CONTEXT_SELECT 0x6
-#define BM_CONSOLE_OUT_CONTEXT_SELECT 0x7
-#define BM_CONSOLE_ERR_CONTEXT_SELECT 0x8
-#define BM_LEGACY_DEV_CONTEXT_SELECT 0x9
-
-//
-// Question Id that will be used to create question
-// all these values are computed from the structure
-// defined below
-//
-#define QUESTION_ID(Field) ((UINTN) &(((BMM_FAKE_NV_DATA *) 0)->Field))
-
-#define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
-#define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
-#define COM1_BAUD_RATE_QUESTION_ID QUESTION_ID (COM1BaudRate)
-#define COM1_DATA_RATE_QUESTION_ID QUESTION_ID (COM1DataRate)
-#define COM1_STOP_BITS_QUESTION_ID QUESTION_ID (COM1StopBits)
-#define COM1_PARITY_QUESTION_ID QUESTION_ID (COM1Parity)
-#define COM1_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
-#define COM2_BAUD_RATE_QUESTION_ID QUESTION_ID (COM2BaudRate)
-#define COM2_DATA_RATE_QUESTION_ID QUESTION_ID (COM2DataRate)
-#define COM2_STOP_BITS_QUESTION_ID QUESTION_ID (COM2StopBits)
-#define COM2_PARITY_QUESTION_ID QUESTION_ID (COM2Parity)
-#define COM2_TERMINAL_QUESTION_ID QUESTION_ID (COM2TerminalType)
-#define DRV_ADD_HANDLE_DESC_QUESTION_ID QUESTION_ID (DriverAddHandleDesc)
-#define DRV_ADD_ACTIVE_QUESTION_ID QUESTION_ID (DriverAddActive)
-#define DRV_ADD_RECON_QUESTION_ID QUESTION_ID (DriverAddForceReconnect)
-#define CON_IN_COM1_QUESTION_ID QUESTION_ID (ConsoleInputCOM1)
-#define CON_IN_COM2_QUESTION_ID QUESTION_ID (ConsoleInputCOM2)
-#define CON_OUT_COM1_QUESTION_ID QUESTION_ID (ConsoleOutputCOM1)
-#define CON_OUT_COM2_QUESTION_ID QUESTION_ID (ConsoleOutputCOM2)
-#define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
-#define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
-#define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
-#define OPTION_ORDER_QUESTION_ID QUESTION_ID (OptionOrder)
-#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionToBeDeleted)
-#define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
-#define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
-#define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
-#define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
-#define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
-#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
-#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
-#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
-#define LEGACY_FD_QUESTION_ID QUESTION_ID (LegacyFD)
-#define LEGACY_HD_QUESTION_ID QUESTION_ID (LegacyHD)
-#define LEGACY_CD_QUESTION_ID QUESTION_ID (LegacyCD)
-#define LEGACY_NET_QUESTION_ID QUESTION_ID (LegacyNET)
-#define LEGACY_BEV_QUESTION_ID QUESTION_ID (LegacyBEV)
-
-#define STRING_DEPOSITORY_NUMBER 8
-
-//
-// #pragma pack(1)
-//
-// Serial Ports attributes, first one is the value for
-// return from callback function, stringtoken is used to
-// display the value properly
-//
-typedef struct {
- UINTN Value;
- UINT16 StringToken;
-} COM_ATTR;
-
-//
-// This is the structure that will be used to store the
-// question's current value. Use it at initialize time to
-// set default value for each question. When using at run
-// time, this map is returned by the callback function,
-// so dynamically changing the question's value will be
-// possible through this mechanism
-//
-typedef struct {
- //
- // Three questions displayed at the main page
- // for Timeout, BootNext Variables respectively
- //
- UINT16 BootTimeOut;
- UINT16 BootNext;
-
- //
- // This is the COM1 Attributes value storage
- //
- UINT8 COM1BaudRate;
- UINT8 COM1DataRate;
- UINT8 COM1StopBits;
- UINT8 COM1Parity;
- UINT8 COM1TerminalType;
-
- //
- // This is the COM2 Attributes value storage
- //
- UINT8 COM2BaudRate;
- UINT8 COM2DataRate;
- UINT8 COM2StopBits;
- UINT8 COM2Parity;
- UINT8 COM2TerminalType;
-
- //
- // Driver Option Add Handle page storage
- //
- UINT16 DriverAddHandleDesc[100];
- UINT16 DriverAddHandleOptionalData[100];
- UINT8 DriverAddActive;
- UINT8 DriverAddForceReconnect;
-
- //
- // Console Input/Output/Errorout using COM port check storage
- //
- UINT8 ConsoleInputCOM1;
- UINT8 ConsoleInputCOM2;
- UINT8 ConsoleOutputCOM1;
- UINT8 ConsoleOutputCOM2;
- UINT8 ConsoleErrorCOM1;
- UINT8 ConsoleErrorCOM2;
-
- //
- // At most 100 input/output/errorout device for console storage
- //
- UINT8 ConsoleCheck[100];
-
- //
- // Boot or Driver Option Order storage
- //
- UINT8 OptionOrder[100];
- UINT8 DriverOptionToBeDeleted[100];
-
- //
- // Boot Option Delete storage
- //
- UINT8 BootOptionDel[100];
- UINT8 DriverOptionDel[100];
-
- //
- // This is the Terminal Attributes value storage
- //
- UINT8 COMBaudRate;
- UINT8 COMDataRate;
- UINT8 COMStopBits;
- UINT8 COMParity;
- UINT8 COMTerminalType;
-
- //
- // Legacy Device Order Selection Storage
- //
- UINT8 LegacyFD[100];
- UINT8 LegacyHD[100];
- UINT8 LegacyCD[100];
- UINT8 LegacyNET[100];
- UINT8 LegacyBEV[100];
-
- //
- // We use DisableMap array to record the enable/disable state of each boot device
- // It should be taken as a bit array, from left to right there are totally 256 bits
- // the most left one stands for BBS table item 0, and the most right one stands for item 256
- // If the bit is 1, it means the boot device has been disabled.
- //
- UINT8 DisableMap[32];
-
- //
- // UINT16 PadArea[10];
- //
-} BMM_FAKE_NV_DATA;
-
-typedef struct {
- UINT16 DescriptionData[75];
- UINT16 OptionalData[127];
- UINT8 Active;
- UINT8 ForceReconnect;
-} FILE_EXPLORER_NV_DATA;
-
-typedef struct {
- BBS_TYPE BbsType;
- //
- // Length = sizeof (UINT16) + SIZEOF (Data)
- //
- UINT16 Length;
- UINT16 *Data;
-} BM_LEGACY_DEV_ORDER_CONTEXT;
-
-typedef struct {
- UINT64 BaudRate;
- UINT8 DataBits;
- UINT8 Parity;
- UINT8 StopBits;
-
- UINT8 BaudRateIndex;
- UINT8 DataBitsIndex;
- UINT8 ParityIndex;
- UINT8 StopBitsIndex;
-
- UINT8 IsConIn;
- UINT8 IsConOut;
- UINT8 IsStdErr;
- UINT8 TerminalType;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_TERMINAL_CONTEXT;
-
-typedef struct {
- BOOLEAN IsBootNext;
- BOOLEAN LoadOptionModified;
- BOOLEAN Deleted;
-
- BOOLEAN IsLegacy;
- BOOLEAN IsActive;
- BOOLEAN ForceReconnect;
- UINTN OptionalDataSize;
-
- UINTN LoadOptionSize;
- UINT8 *LoadOption;
-
- UINT32 Attributes;
- UINT16 FilePathListLength;
- UINT16 *Description;
- EFI_DEVICE_PATH_PROTOCOL *FilePathList;
- UINT8 *OptionalData;
-
- UINT16 BbsIndex;
-} BM_LOAD_CONTEXT;
-
-typedef struct {
- BBS_TABLE *BbsTable;
- UINTN Index;
- UINTN BbsCount;
- UINT16 *Description;
-} BM_LEGACY_DEVICE_CONTEXT;
-
-typedef struct {
-
- BOOLEAN IsActive;
-
- BOOLEAN IsTerminal;
-
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_CONSOLE_CONTEXT;
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_FILE_HANDLE FHandle;
- UINT16 *FileName;
- EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *Info;
-
- BOOLEAN IsRoot;
- BOOLEAN IsDir;
- BOOLEAN IsRemovableMedia;
- BOOLEAN IsLoadFile;
- BOOLEAN IsBootLegacy;
-} BM_FILE_CONTEXT;
-
-typedef struct {
- EFI_HANDLE Handle;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
-} BM_HANDLE_CONTEXT;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Head;
- UINTN MenuNumber;
-} BM_MENU_OPTION;
-
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- UINTN OptionNumber;
- UINT16 *DisplayString;
- UINT16 *HelpString;
- STRING_REF DisplayStringToken;
- STRING_REF HelpStringToken;
- UINTN ContextSelection;
- VOID *VariableContext;
-} BM_MENU_ENTRY;
-
-typedef struct {
- //
- // Shared callback data.
- //
- UINTN Signature;
- EFI_HII_PROTOCOL *Hii;
- BM_MENU_ENTRY *MenuEntry;
- BM_HANDLE_CONTEXT *HandleContext;
- BM_FILE_CONTEXT *FileContext;
- BM_LOAD_CONTEXT *LoadContext;
- BM_TERMINAL_CONTEXT *TerminalContext;
- UINTN CurrentTerminal;
- BBS_TYPE BbsType;
-
- //
- // BMM main formset callback data.
- //
- EFI_HII_HANDLE BmmHiiHandle;
- EFI_HANDLE BmmCallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL BmmDriverCallback;
- FORM_ID BmmCurrentPageId;
- FORM_ID BmmPreviousPageId;
- BOOLEAN BmmAskSaveOrNot;
- BMM_FAKE_NV_DATA *BmmFakeNvData;
- BMM_FAKE_NV_DATA BmmOldFakeNVData;
-
- //
- // File explorer formset callback data.
- //
- EFI_HII_HANDLE FeHiiHandle;
- EFI_HANDLE FeCallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL FeDriverCallback;
- FILE_EXPLORER_STATE FeCurrentState;
- FILE_EXPLORER_DISPLAY_CONTEXT FeDisplayContext;
-} BMM_CALLBACK_DATA;
-
-typedef struct _STRING_LIST_NODE {
- STRING_REF StringToken;
- struct _STRING_LIST_NODE *Next;
-} STRING_LIST_NODE;
-
-typedef struct _STRING_DEPOSITORY {
- UINTN TotalNodeNumber;
- STRING_LIST_NODE *CurrentNode;
- STRING_LIST_NODE *ListHead;
-} STRING_DEPOSITORY;
-
-//
-// #pragma pack()
-//
-// For initializing File System menu
-//
-EFI_STATUS
-BOpt_FindFileSystem (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-;
-
-//
-// For cleaning up File System menu
-//
-VOID
-BOpt_FreeFileSystem (
- VOID
- )
-;
-
-//
-// For initializing File Navigation menu
-//
-EFI_STATUS
-BOpt_FindFiles (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_ENTRY *MenuEntry
- )
-;
-
-//
-// For cleaning up File Navigation menu
-//
-VOID
-BOpt_FreeFiles (
- VOID
- )
-;
-
-//
-// For Initializing handle navigation menu
-//
-EFI_STATUS
-BOpt_FindDrivers (
- VOID
- )
-;
-
-//
-// For Cleaning up handle navigation menu
-//
-VOID
-BOpt_FreeDrivers();
-
-//
-// For initializing Boot Option menu
-//
-EFI_STATUS
-BOpt_GetBootOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// For Initializing Driver option menu
-//
-EFI_STATUS
-BOpt_GetDriverOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// For Cleaning up boot option menu
-//
-VOID
-BOpt_FreeBootOptions ();
-
-//
-// For cleaning up driver option menu
-//
-VOID
-BOpt_FreeDriverOptions();
-
-//
-// For Initializing HD/FD/CD/NET/BEV option menu
-//
-EFI_STATUS
-BOpt_GetLegacyOptions();
-
-//
-// For cleaning up driver option menu
-//
-VOID
-BOpt_FreeLegacyOptions();
-
-//
-// this function is used to take place of all other free menu actions
-//
-VOID
-BOpt_FreeMenu (
- BM_MENU_OPTION *FreeMenu
- );
-
-
-//
-// Following are the helper functions used
-//
-CHAR16 *
-BOpt_AppendFileName (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- );
-
-BOOLEAN
-BOpt_IsEfiImageName (
- IN UINT16 *FileName
- );
-
-BOOLEAN
-BOpt_IsEfiApp (
- IN EFI_FILE_HANDLE Dir,
- IN UINT16 *FileName
- );
-
-//
-// Get current unused boot option number
-//
-UINT16
-BOpt_GetBootOptionNumber ();
-
-//
-// Get current unused driver option number
-//
-UINT16
-BOpt_GetDriverOptionNumber ();
-
-BM_MENU_ENTRY *
-BOpt_CreateMenuEntry (
- UINTN MenuType
- );
-
-VOID
-BOpt_DestroyMenuEntry (
- BM_MENU_ENTRY *MenuEntry
- );
-
-BM_MENU_ENTRY *
-BOpt_GetMenuEntry (
- BM_MENU_OPTION *MenuOption,
- UINTN MenuNumber
- );
-
-//
-// a helper function used to free pool type memory
-//
-VOID
-SafeFreePool (
- IN VOID *Buffer
- );
-
-//
-// Locate all serial io devices for console
-//
-EFI_STATUS
-LocateSerialIo ();
-
-//
-// Initializing Console menu
-//
-EFI_STATUS
-GetAllConsoles();
-
-//
-// Cleaning up console menu
-//
-EFI_STATUS
-FreeAllConsoles();
-
-VOID
-ChangeVariableDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
-);
-
-EFI_STATUS
-ChangeTerminalDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- BOOLEAN ChangeTerminal
-);
-//
-// Variable operation by menu selection
-//
-EFI_STATUS
-Var_UpdateBootOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN FILE_EXPLORER_NV_DATA *NvRamMap
- );
-
-EFI_STATUS
-Var_DelBootOption ();
-
-EFI_STATUS
-Var_ChangeBootOrder ();
-
-EFI_STATUS
-Var_UpdateDriverOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN UINT16 *DescriptionData,
- IN UINT16 *OptionalData,
- IN UINT8 ForceReconnect
- );
-
-EFI_STATUS
-Var_DelDriverOption ();
-
-EFI_STATUS
-Var_ChangeDriverOrder ();
-
-EFI_STATUS
-Var_UpdateConsoleInpOption ();
-
-EFI_STATUS
-Var_UpdateConsoleOutOption ();
-
-EFI_STATUS
-Var_UpdateErrorOutOption ();
-
-VOID
-Var_UpdateAllConsoleOption ();
-
-EFI_STATUS
-Var_UpdateBootNext (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-Var_UpdateBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-Var_UpdateDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-//
-// Following are page create and refresh functions
-//
-VOID
-RefreshUpdateData (
- IN BOOLEAN FormSetUpdate,
- IN EFI_PHYSICAL_ADDRESS FormCallbackHandle,
- IN BOOLEAN FormUpdate,
- IN STRING_REF FormTitle,
- IN UINT16 DataCount
- );
-
-VOID
-CleanUpPage (
- IN EFI_FORM_LABEL LabelId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-EFI_STATUS
-UpdatePage (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_OPTION *UpdatingMenu,
- IN UINT16 UpdatingPage,
- IN UINT16 UpdatingManner,
- IN UINT16 QuestionIdStart,
- IN UINT16 GotoForm,
- IN UINT16 GotoAlternateForm,
- IN STRING_REF DisplayTokenStart,
- IN STRING_REF HelpTokenStart,
- IN UINT16 KeyValueStart
- );
-
-VOID
-UpdateBootAddPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDrvAddFilePage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDrvAddHandlePage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDrvDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDriverAddHandleDescPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootTimeOut (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateConInPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateConOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateStdErrPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdatePageBody (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateCOM1Page (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateCOM2Page (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootOrderPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateDriverOrderPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateBootNextPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateTimeOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateTerminalPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateConCOMPage (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID
-UpdateSetLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
-);
-
-EFI_STATUS
-BootLegacy (
- IN UINT16 BbsType,
- IN UINT16 BbsFlag
-);
-
-BM_MENU_ENTRY *
-GetCurrentTerminal (
- UINTN TerminalNumber
-);
-
-EFI_FILE_HANDLE
-EfiLibOpenRoot (
- IN EFI_HANDLE DeviceHandle
- );
-
-EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *
-EfiLibFileSystemVolumeLabelInfo (
- IN EFI_FILE_HANDLE FHand
- );
-
-EFI_FILE_INFO *
-EfiLibFileInfo (
- IN EFI_FILE_HANDLE FHand
- );
-
-CHAR16 *
-DevicePathToStr (
- EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-EFI_STATUS
-EfiLibLocateProtocol (
- IN EFI_GUID *ProtocolGuid,
- OUT VOID **Interface
- );
-
-VOID *
-EfiReallocatePool (
- IN VOID *OldPool,
- IN UINTN OldSize,
- IN UINTN NewSize
- );
-
-CHAR16 *
-DevicePathToStr (
- EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-VOID *
-BdsLibGetVariableAndSize (
- IN CHAR16 *Name,
- IN EFI_GUID *VendorGuid,
- OUT UINTN *VarSize
- );
-
-EFI_STATUS
-EfiLibDeleteVariable (
- IN CHAR16 *VarName,
- IN EFI_GUID *VarGuid
- );
-
-CHAR16 *
-EfiStrDuplicate (
- IN CHAR16 *Src
- );
-
-BOOLEAN
-EfiLibMatchDevicePaths (
- IN EFI_DEVICE_PATH_PROTOCOL *Multi,
- IN EFI_DEVICE_PATH_PROTOCOL *Single
- );
-
-UINTN
-EfiDevicePathInstanceCount (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-EFI_STATUS
-CreateMenuStringToken (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN BM_MENU_OPTION *MenuOption
- );
-
-UINT16 *
-EfiLibStrFromDatahub (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-VOID *
-GetLegacyBootOptionVar (
- IN UINTN DeviceType,
- OUT UINTN *OptionIndex,
- OUT UINTN *OptionSize
- );
-
-EFI_STATUS
-InitializeBM (
- VOID
- );
-
-EFI_STATUS
-BdsStartBootMaint (
- VOID
- );
-
-VOID
-InitializeStringDepository ();
-
-STRING_REF
-GetStringTokenFromDepository (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN STRING_DEPOSITORY *StringDepository
- ) ;
-
-VOID
-ReclaimStringDepository (
- VOID
- );
-
-VOID
-CleanUpStringDepository (
- VOID
- );
-
-EFI_STATUS
-ApplyChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
- IN FORM_ID FormId
- );
-
-VOID
-DiscardChangeHandler (
- IN BMM_CALLBACK_DATA *Private,
- IN BMM_FAKE_NV_DATA *CurrentFakeNVMap
- );
-
-VOID
-UpdatePageId (
- BMM_CALLBACK_DATA *Private,
- UINT16 NewPageId
- );
-
-EFI_STATUS
-BootThisFile (
- IN BM_FILE_CONTEXT *FileContext
- );
-
-BOOLEAN
-UpdateFileExplorer (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT16 KeyValue
- );
-
-EFI_STATUS
-EFIAPI
-FileExplorerCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- );
-
-EFI_STATUS
-FormSetDispatcher (
- IN BMM_CALLBACK_DATA *CallbackData
- );
-
-VOID CreateCallbackPacket (
- OUT EFI_HII_CALLBACK_PACKET **Packet,
- IN UINT16 Flags
- );
-
-//
-// Global variable in this program (defined in data.c)
-//
-extern BM_MENU_OPTION BootOptionMenu;
-extern BM_MENU_OPTION DriverOptionMenu;
-extern BM_MENU_OPTION FsOptionMenu;
-extern BM_MENU_OPTION ConsoleInpMenu;
-extern BM_MENU_OPTION ConsoleOutMenu;
-extern BM_MENU_OPTION ConsoleErrMenu;
-extern BM_MENU_OPTION DirectoryMenu;
-extern BM_MENU_OPTION DriverMenu;
-extern BM_MENU_OPTION TerminalMenu;
-extern BM_MENU_OPTION LegacyFDMenu;
-extern BM_MENU_OPTION LegacyHDMenu;
-extern BM_MENU_OPTION LegacyCDMenu;
-extern BM_MENU_OPTION LegacyNETMenu;
-extern BM_MENU_OPTION LegacyBEVMenu;
-extern UINT16 TerminalType[];
-extern COM_ATTR BaudRateList[19];
-extern COM_ATTR DataBitsList[4];
-extern COM_ATTR ParityList[5];
-extern COM_ATTR StopBitsList[3];
-extern EFI_GUID Guid[4];
-extern EFI_HII_UPDATE_DATA *UpdateData;
-extern STRING_DEPOSITORY *FileOptionStrDepository;
-extern STRING_DEPOSITORY *ConsoleOptionStrDepository;
-extern STRING_DEPOSITORY *BootOptionStrDepository;
-extern STRING_DEPOSITORY *BootOptionHelpStrDepository;
-extern STRING_DEPOSITORY *DriverOptionStrDepository;
-extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
-extern STRING_DEPOSITORY *TerminalStrDepository;
-extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
-extern EFI_GUID EfiLegacyDevOrderGuid;
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c deleted file mode 100644 index 2d67e0b94a..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/BootOption.c +++ /dev/null @@ -1,1685 +0,0 @@ -/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootOption.c
-
-Abstract:
-
- Provide boot option support for Application "BootMaint"
-
- Include file system navigation, system handle selection
-
- Boot option manipulation
-
-Revision History
-
---*/
-
-#include "BootMaint.h"
-#include "BBSsupport.h"
-
-BM_MENU_ENTRY *
-BOpt_CreateMenuEntry (
- UINTN MenuType
- )
-/*++
-
-Routine Description
- Create Menu Entry for future use, make all types together
- in order to reduce code size
-
-Arguments:
- MenuType Use this parameter to identify current
- Menu type
-
-Returns:
- NULL Cannot allocate memory for current menu
- entry
- Others A valid pointer pointing to the allocated
- memory pool for current menu entry
-
---*/
-{
- BM_MENU_ENTRY *MenuEntry;
- UINTN ContextSize;
-
- switch (MenuType) {
- case BM_LOAD_CONTEXT_SELECT:
- ContextSize = sizeof (BM_LOAD_CONTEXT);
- break;
-
- case BM_FILE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_FILE_CONTEXT);
- break;
-
- case BM_CONSOLE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_CONSOLE_CONTEXT);
- break;
-
- case BM_TERMINAL_CONTEXT_SELECT:
- ContextSize = sizeof (BM_TERMINAL_CONTEXT);
- break;
-
- case BM_HANDLE_CONTEXT_SELECT:
- ContextSize = sizeof (BM_HANDLE_CONTEXT);
- break;
-
- case BM_LEGACY_DEV_CONTEXT_SELECT:
- ContextSize = sizeof (BM_LEGACY_DEVICE_CONTEXT);
- break;
-
- default:
- ContextSize = 0;
- break;
-
- }
-
- if (0 == ContextSize) {
- return NULL;
- }
-
- MenuEntry = AllocateZeroPool (sizeof (BM_MENU_ENTRY));
- if (NULL == MenuEntry) {
- return MenuEntry;
- }
-
- MenuEntry->VariableContext = AllocateZeroPool (ContextSize);
- if (NULL == MenuEntry->VariableContext) {
- SafeFreePool (MenuEntry);
- MenuEntry = NULL;
- return MenuEntry;
- }
-
- MenuEntry->Signature = BM_MENU_ENTRY_SIGNATURE;
- MenuEntry->ContextSelection = MenuType;
- return MenuEntry;
-}
-
-VOID
-BOpt_DestroyMenuEntry (
- BM_MENU_ENTRY *MenuEntry
- )
-/*++
- Routine Description :
- Destroy the menu entry passed in
-
- Arguments :
- The menu entry need to be destroyed
-
- Returns :
- None
-
---*/
-{
- BM_LOAD_CONTEXT *LoadContext;
- BM_FILE_CONTEXT *FileContext;
- BM_CONSOLE_CONTEXT *ConsoleContext;
- BM_TERMINAL_CONTEXT *TerminalContext;
- BM_HANDLE_CONTEXT *HandleContext;
- BM_LEGACY_DEVICE_CONTEXT *LegacyDevContext;
-
- //
- // Select by the type in Menu entry for current context type
- //
- switch (MenuEntry->ContextSelection) {
- case BM_LOAD_CONTEXT_SELECT:
- LoadContext = (BM_LOAD_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (LoadContext->FilePathList);
- SafeFreePool (LoadContext->LoadOption);
- SafeFreePool (LoadContext->OptionalData);
- SafeFreePool (LoadContext);
- break;
-
- case BM_FILE_CONTEXT_SELECT:
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- if (!FileContext->IsRoot) {
- SafeFreePool (FileContext->DevicePath);
- } else {
- if (FileContext->FHandle != NULL) {
- FileContext->FHandle->Close (FileContext->FHandle);
- }
- }
-
- SafeFreePool (FileContext->FileName);
- SafeFreePool (FileContext->Info);
- SafeFreePool (FileContext);
- break;
-
- case BM_CONSOLE_CONTEXT_SELECT:
- ConsoleContext = (BM_CONSOLE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (ConsoleContext->DevicePath);
- SafeFreePool (ConsoleContext);
- break;
-
- case BM_TERMINAL_CONTEXT_SELECT:
- TerminalContext = (BM_TERMINAL_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (TerminalContext->DevicePath);
- SafeFreePool (TerminalContext);
- break;
-
- case BM_HANDLE_CONTEXT_SELECT:
- HandleContext = (BM_HANDLE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (HandleContext);
- break;
-
- case BM_LEGACY_DEV_CONTEXT_SELECT:
- LegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) MenuEntry->VariableContext;
- SafeFreePool (LegacyDevContext);
-
- default:
- break;
- }
-
- SafeFreePool (MenuEntry->DisplayString);
- if (NULL != MenuEntry->HelpString) {
- SafeFreePool (MenuEntry->HelpString);
- }
-
- SafeFreePool (MenuEntry);
-}
-
-BM_MENU_ENTRY *
-BOpt_GetMenuEntry (
- BM_MENU_OPTION *MenuOption,
- UINTN MenuNumber
- )
-/*++
- Rountine Description :
- Use this routine to get one particular menu entry in specified
- menu
-
- Arguments :
- MenuOption The menu that we will search
-
- MenuNumber The menunubmer that we want
-
- Returns :
- The desired menu entry
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINTN Index;
- LIST_ENTRY *List;
-
- if (MenuNumber >= MenuOption->MenuNumber) {
- return NULL;
- }
-
- List = MenuOption->Head.ForwardLink;
- for (Index = 0; Index < MenuNumber; Index++) {
- List = List->ForwardLink;
- }
-
- NewMenuEntry = CR (List, BM_MENU_ENTRY, Link, BM_MENU_ENTRY_SIGNATURE);
-
- return NewMenuEntry;
-}
-
-EFI_STATUS
-BOpt_FindFileSystem (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description
- Find file systems for current Extensible Firmware
- Including Handles that support Simple File System
- protocol, Load File protocol.
-
- Building up the FileSystem Menu for user selection
- All file system will be stored in FsOptionMenu
- for future use.
-
-Arguments:
- CallbackData - BMM context data
-
-Returns:
- EFI_SUCCESS - Success find the file system
- EFI_OUT_OF_RESOURCES - Can not create menu entry
-
---*/
-{
- UINTN NoSimpleFsHandles;
- UINTN NoLoadFileHandles;
- EFI_HANDLE *SimpleFsHandle;
- EFI_HANDLE *LoadFileHandle;
- UINT16 *VolumeLabel;
- EFI_BLOCK_IO_PROTOCOL *BlkIo;
- UINTN Index;
- EFI_STATUS Status;
- BM_MENU_ENTRY *MenuEntry;
- BM_FILE_CONTEXT *FileContext;
- UINT16 *TempStr;
- UINTN OptionNumber;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINT16 DeviceType;
- BBS_BBS_DEVICE_PATH BbsDevicePathNode;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- BOOLEAN RemovableMedia;
-
-
- NoSimpleFsHandles = 0;
- NoLoadFileHandles = 0;
- OptionNumber = 0;
- InitializeListHead (&FsOptionMenu.Head);
-
- //
- // Locate Handles that support Simple File System protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSimpleFileSystemProtocolGuid,
- NULL,
- &NoSimpleFsHandles,
- &SimpleFsHandle
- );
- if (!EFI_ERROR (Status)) {
- //
- // Find all the instances of the File System prototocol
- //
- for (Index = 0; Index < NoSimpleFsHandles; Index++) {
- Status = gBS->HandleProtocol (
- SimpleFsHandle[Index],
- &gEfiBlockIoProtocolGuid,
- (VOID**) &BlkIo
- );
- if (EFI_ERROR (Status)) {
- //
- // If no block IO exists assume it's NOT a removable media
- //
- RemovableMedia = FALSE;
- } else {
- //
- // If block IO exists check to see if it's remobable media
- //
- RemovableMedia = BlkIo->Media->RemovableMedia;
- }
-
- //
- // Allocate pool for this load option
- //
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- SafeFreePool (SimpleFsHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- FileContext->Handle = SimpleFsHandle[Index];
- MenuEntry->OptionNumber = Index;
- FileContext->FHandle = EfiLibOpenRoot (FileContext->Handle);
- if (!FileContext->FHandle) {
- BOpt_DestroyMenuEntry (MenuEntry);
- continue;
- }
-
- MenuEntry->HelpString = DevicePathToStr (DevicePathFromHandle (FileContext->Handle));
- FileContext->Info = EfiLibFileSystemVolumeLabelInfo (FileContext->FHandle);
- FileContext->FileName = EfiStrDuplicate (L"\\");
- FileContext->DevicePath = FileDevicePath (
- FileContext->Handle,
- FileContext->FileName
- );
- FileContext->IsDir = TRUE;
- FileContext->IsRoot = TRUE;
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = FALSE;
-
- //
- // Get current file system's Volume Label
- //
- if (FileContext->Info == NULL) {
- VolumeLabel = L"NO FILE SYSTEM INFO";
- } else {
- if (FileContext->Info->VolumeLabel == NULL) {
- VolumeLabel = L"NULL VOLUME LABEL";
- } else {
- VolumeLabel = FileContext->Info->VolumeLabel;
- if (*VolumeLabel == 0x0000) {
- VolumeLabel = L"NO VOLUME LABEL";
- }
- }
- }
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"%s, [%s]",
- VolumeLabel,
- TempStr
- );
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
-
- if (NoSimpleFsHandles != 0) {
- SafeFreePool (SimpleFsHandle);
- }
- //
- // Searching for handles that support Load File protocol
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiLoadFileProtocolGuid,
- NULL,
- &NoLoadFileHandles,
- &LoadFileHandle
- );
-
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < NoLoadFileHandles; Index++) {
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- SafeFreePool (LoadFileHandle);
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = TRUE;
- FileContext->Handle = LoadFileHandle[Index];
- FileContext->IsRoot = TRUE;
-
- FileContext->DevicePath = DevicePathFromHandle (FileContext->Handle);
-
- MenuEntry->HelpString = DevicePathToStr (FileContext->DevicePath);
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"Load File [%s]",
- TempStr
- );
-
- MenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
-
- if (NoLoadFileHandles != 0) {
- SafeFreePool (LoadFileHandle);
- }
-
- //
- // Add Legacy Boot Option Support Here
- //
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID**) &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
-
- for (Index = BBS_TYPE_FLOPPY; Index <= BBS_TYPE_EMBEDDED_NETWORK; Index++) {
- MenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == MenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
-
- FileContext->IsRemovableMedia = FALSE;
- FileContext->IsLoadFile = TRUE;
- FileContext->IsBootLegacy = TRUE;
- DeviceType = (UINT16) Index;
- BbsDevicePathNode.Header.Type = BBS_DEVICE_PATH;
- BbsDevicePathNode.Header.SubType = BBS_BBS_DP;
- SetDevicePathNodeLength (
- &BbsDevicePathNode.Header,
- sizeof (BBS_BBS_DEVICE_PATH)
- );
- BbsDevicePathNode.DeviceType = DeviceType;
- BbsDevicePathNode.StatusFlag = 0;
- BbsDevicePathNode.String[0] = 0;
- DevicePath = AppendDevicePathNode (
- EndDevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &BbsDevicePathNode
- );
-
- FileContext->DevicePath = DevicePath;
- MenuEntry->HelpString = DevicePathToStr (FileContext->DevicePath);
-
- TempStr = MenuEntry->HelpString;
- MenuEntry->DisplayString = AllocateZeroPool (MAX_CHAR);
- ASSERT (MenuEntry->DisplayString != NULL);
- UnicodeSPrint (
- MenuEntry->DisplayString,
- MAX_CHAR,
- L"Boot Legacy [%s]",
- TempStr
- );
- MenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&FsOptionMenu.Head, &MenuEntry->Link);
- }
- }
- //
- // Remember how many file system options are here
- //
- FsOptionMenu.MenuNumber = OptionNumber;
- return EFI_SUCCESS;
-}
-
-VOID
-BOpt_FreeMenu (
- BM_MENU_OPTION *FreeMenu
- )
-/*++
-
-Routine Description
- Free resources allocated in Allocate Rountine
-
-Arguments:
- FreeMenu Menu to be freed
-
-Returns:
- VOID
-
---*/
-{
- BM_MENU_ENTRY *MenuEntry;
- while (!IsListEmpty (&FreeMenu->Head)) {
- MenuEntry = CR (
- FreeMenu->Head.ForwardLink,
- BM_MENU_ENTRY,
- Link,
- BM_MENU_ENTRY_SIGNATURE
- );
- RemoveEntryList (&MenuEntry->Link);
- BOpt_DestroyMenuEntry (MenuEntry);
- }
-}
-
-EFI_STATUS
-BOpt_FindFiles (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN BM_MENU_ENTRY *MenuEntry
- )
-/*++
-
-Routine Description
- Find files under current directory
- All files and sub-directories in current directory
- will be stored in DirectoryMenu for future use.
-
-Arguments:
- FileOption -- Pointer for Dir to explore
-
-Returns:
- TRUE -- Get files from current dir successfully
- FALSE -- Can't get files from current dir
-
---*/
-{
- EFI_FILE_HANDLE NewDir;
- EFI_FILE_HANDLE Dir;
- EFI_FILE_INFO *DirInfo;
- UINTN BufferSize;
- UINTN DirBufferSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *FileContext;
- BM_FILE_CONTEXT *NewFileContext;
- UINTN Pass;
- EFI_STATUS Status;
- UINTN OptionNumber;
-
- FileContext = (BM_FILE_CONTEXT *) MenuEntry->VariableContext;
- Dir = FileContext->FHandle;
- OptionNumber = 0;
- //
- // Open current directory to get files from it
- //
- Status = Dir->Open (
- Dir,
- &NewDir,
- FileContext->FileName,
- EFI_FILE_READ_ONLY,
- 0
- );
- if (!FileContext->IsRoot) {
- Dir->Close (Dir);
- }
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- DirInfo = EfiLibFileInfo (NewDir);
- if (!DirInfo) {
- return EFI_NOT_FOUND;
- }
-
- if (!(DirInfo->Attribute & EFI_FILE_DIRECTORY)) {
- return EFI_INVALID_PARAMETER;
- }
-
- FileContext->DevicePath = FileDevicePath (
- FileContext->Handle,
- FileContext->FileName
- );
-
- DirBufferSize = sizeof (EFI_FILE_INFO) + 1024;
- DirInfo = AllocateZeroPool (DirBufferSize);
- if (!DirInfo) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Get all files in current directory
- // Pass 1 to get Directories
- // Pass 2 to get files that are EFI images
- //
- for (Pass = 1; Pass <= 2; Pass++) {
- NewDir->SetPosition (NewDir, 0);
- for (;;) {
- BufferSize = DirBufferSize;
- Status = NewDir->Read (NewDir, &BufferSize, DirInfo);
- if (EFI_ERROR (Status) || BufferSize == 0) {
- break;
- }
-
- if ((DirInfo->Attribute & EFI_FILE_DIRECTORY && Pass == 2) ||
- (!(DirInfo->Attribute & EFI_FILE_DIRECTORY) && Pass == 1)
- ) {
- //
- // Pass 1 is for Directories
- // Pass 2 is for file names
- //
- continue;
- }
-
- if (!(BOpt_IsEfiImageName (DirInfo->FileName) || DirInfo->Attribute & EFI_FILE_DIRECTORY)) {
- //
- // Slip file unless it is a directory entry or a .EFI file
- //
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_FILE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
- NewFileContext->Handle = FileContext->Handle;
- NewFileContext->FileName = BOpt_AppendFileName (
- FileContext->FileName,
- DirInfo->FileName
- );
- NewFileContext->FHandle = NewDir;
- NewFileContext->DevicePath = FileDevicePath (
- NewFileContext->Handle,
- NewFileContext->FileName
- );
- NewMenuEntry->HelpString = NULL;
-
- MenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- FileOptionStrDepository
- );
-
- NewFileContext->IsDir = (BOOLEAN) ((DirInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY);
-
- if (NewFileContext->IsDir) {
- BufferSize = StrLen (DirInfo->FileName) * 2 + 6;
- NewMenuEntry->DisplayString = AllocateZeroPool (BufferSize);
-
- UnicodeSPrint (
- NewMenuEntry->DisplayString,
- BufferSize,
- L"<%s>",
- DirInfo->FileName
- );
-
- } else {
- NewMenuEntry->DisplayString = EfiStrDuplicate (DirInfo->FileName);
- }
-
- NewFileContext->IsRoot = FALSE;
- NewFileContext->IsLoadFile = FALSE;
- NewFileContext->IsRemovableMedia = FALSE;
-
- NewMenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&DirectoryMenu.Head, &NewMenuEntry->Link);
- }
- }
-
- DirectoryMenu.MenuNumber = OptionNumber;
- SafeFreePool (DirInfo);
- return TRUE;
-}
-
-EFI_STATUS
-BOpt_GetLegacyOptions (
- VOID
- )
-/*++
-Routine Description:
-
- Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().
-
-Arguments:
- None
-
-Returns:
- The device info of legacy device.
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LEGACY_DEVICE_CONTEXT *NewLegacyDevContext;
- EFI_STATUS Status;
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
- UINT16 HddCount;
- HDD_INFO *HddInfo;
- UINT16 BbsCount;
- BBS_TABLE *BbsTable;
- UINTN Index;
- CHAR16 DescString[100];
- UINTN FDNum;
- UINTN HDNum;
- UINTN CDNum;
- UINTN NETNum;
- UINTN BEVNum;
-
- NewMenuEntry = NULL;
- HddInfo = NULL;
- BbsTable = NULL;
- BbsCount = 0;
-
- //
- // Initialize Bbs Table Context from BBS info data
- //
- InitializeListHead (&LegacyFDMenu.Head);
- InitializeListHead (&LegacyHDMenu.Head);
- InitializeListHead (&LegacyCDMenu.Head);
- InitializeListHead (&LegacyNETMenu.Head);
- InitializeListHead (&LegacyBEVMenu.Head);
-
- Status = gBS->LocateProtocol (
- &gEfiLegacyBiosProtocolGuid,
- NULL,
- (VOID**) &LegacyBios
- );
- if (!EFI_ERROR (Status)) {
- Status = LegacyBios->GetBbsInfo (
- LegacyBios,
- &HddCount,
- &HddInfo,
- &BbsCount,
- &BbsTable
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- FDNum = 0;
- HDNum = 0;
- CDNum = 0;
- NETNum = 0;
- BEVNum = 0;
-
- for (Index = 0; Index < BbsCount; Index++) {
- if ((BBS_IGNORE_ENTRY == BbsTable[Index].BootPriority) ||
- (BBS_DO_NOT_BOOT_FROM == BbsTable[Index].BootPriority) ||
- (BBS_LOWEST_PRIORITY == BbsTable[Index].BootPriority)
- ) {
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LEGACY_DEV_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- break;
- }
-
- NewLegacyDevContext = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;
- NewLegacyDevContext->BbsTable = &BbsTable[Index];
- NewLegacyDevContext->Index = Index;
- NewLegacyDevContext->BbsCount = BbsCount;
- BdsBuildLegacyDevNameString (
- &BbsTable[Index],
- Index,
- sizeof (DescString),
- DescString
- );
- NewLegacyDevContext->Description = AllocateZeroPool (StrSize (DescString));
- if (NULL == NewLegacyDevContext->Description) {
- break;
- }
-
- CopyMem (NewLegacyDevContext->Description, DescString, StrSize (DescString));
- NewMenuEntry->DisplayString = NewLegacyDevContext->Description;
- NewMenuEntry->HelpString = NULL;
-
- switch (BbsTable[Index].DeviceType) {
- case BBS_FLOPPY:
- InsertTailList (&LegacyFDMenu.Head, &NewMenuEntry->Link);
- FDNum++;
- break;
-
- case BBS_HARDDISK:
- InsertTailList (&LegacyHDMenu.Head, &NewMenuEntry->Link);
- HDNum++;
- break;
-
- case BBS_CDROM:
- InsertTailList (&LegacyCDMenu.Head, &NewMenuEntry->Link);
- CDNum++;
- break;
-
- case BBS_EMBED_NETWORK:
- InsertTailList (&LegacyNETMenu.Head, &NewMenuEntry->Link);
- NETNum++;
- break;
-
- case BBS_BEV_DEVICE:
- InsertTailList (&LegacyBEVMenu.Head, &NewMenuEntry->Link);
- BEVNum++;
- break;
- }
- }
-
- if (Index != BbsCount) {
- BOpt_FreeLegacyOptions ();
- return EFI_OUT_OF_RESOURCES;
- }
-
- LegacyFDMenu.MenuNumber = FDNum;
- LegacyHDMenu.MenuNumber = HDNum;
- LegacyCDMenu.MenuNumber = CDNum;
- LegacyNETMenu.MenuNumber = NETNum;
- LegacyBEVMenu.MenuNumber = BEVNum;
- return EFI_SUCCESS;
-}
-
-VOID
-BOpt_FreeLegacyOptions (
- VOID
- )
-{
- BOpt_FreeMenu (&LegacyFDMenu);
- BOpt_FreeMenu (&LegacyHDMenu);
- BOpt_FreeMenu (&LegacyCDMenu);
- BOpt_FreeMenu (&LegacyNETMenu);
- BOpt_FreeMenu (&LegacyBEVMenu);
-}
-
-EFI_STATUS
-BOpt_GetBootOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description:
-
- Build the BootOptionMenu according to BootOrder Variable.
- This Routine will access the Boot#### to get EFI_LOAD_OPTION
-
-Arguments:
- None
-
-Returns:
- The number of the Var Boot####
-
---*/
-{
- UINTN Index;
- UINT16 BootString[10];
- UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
- UINTN BootOptionSize;
- BOOLEAN BootNextFlag;
- UINT16 *BootOrderList;
- UINTN BootOrderListSize;
- UINT16 *BootNext;
- UINTN BootNextSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT8 *LoadOptionPtr;
- UINTN StringSize;
- UINTN OptionalDataSize;
- UINT8 *LoadOptionEnd;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINTN MenuCount;
- UINT8 *Ptr;
-
- MenuCount = 0;
- BootOrderListSize = 0;
- BootNextSize = 0;
- BootOrderList = NULL;
- BootNext = NULL;
- LoadOptionFromVar = NULL;
- BOpt_FreeMenu (&BootOptionMenu);
- InitializeListHead (&BootOptionMenu.Head);
-
- //
- // Get the BootOrder from the Var
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- //
- // Get the BootNext from the Var
- //
- BootNext = BdsLibGetVariableAndSize (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- &BootNextSize
- );
-
- if (BootNext) {
- if (BootNextSize != sizeof (UINT16)) {
- SafeFreePool (BootNext);
- BootNext = NULL;
- }
- }
-
- for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", BootOrderList[Index]);
- //
- // Get all loadoptions from the VAR
- //
- LoadOptionFromVar = BdsLibGetVariableAndSize (
- BootString,
- &gEfiGlobalVariableGuid,
- &BootOptionSize
- );
- if (!LoadOptionFromVar) {
- continue;
- }
-
- LoadOption = AllocateZeroPool (BootOptionSize);
- if (!LoadOption) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, BootOptionSize);
- SafeFreePool (LoadOptionFromVar);
-
- if (BootNext) {
- BootNextFlag = (BOOLEAN) (*BootNext == BootOrderList[Index]);
- } else {
- BootNextFlag = FALSE;
- }
-
- if (0 == (*((UINT32 *) LoadOption) & LOAD_OPTION_ACTIVE)) {
- SafeFreePool (LoadOption);
- continue;
- }
- //
- // BUGBUG: could not return EFI_OUT_OF_RESOURCES here directly.
- // the buffer allocated already should be freed before returning.
- //
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + BootOptionSize;
-
- NewMenuEntry->OptionNumber = BootOrderList[Index];
- NewLoadContext->LoadOptionModified = FALSE;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->IsBootNext = BootNextFlag;
-
- //
- // Is a Legacy Device?
- //
- Ptr = (UINT8 *) LoadOption;
-
- //
- // Attribute = *(UINT32 *)Ptr;
- //
- Ptr += sizeof (UINT32);
-
- //
- // FilePathSize = *(UINT16 *)Ptr;
- //
- Ptr += sizeof (UINT16);
-
- //
- // Description = (CHAR16 *)Ptr;
- //
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- //
- // Now Ptr point to Device Path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- if ((BBS_DEVICE_PATH == DevicePath->Type) && (BBS_BBS_DP == DevicePath->SubType)) {
- NewLoadContext->IsLegacy = TRUE;
- } else {
- NewLoadContext->IsLegacy = FALSE;
- }
- //
- // LoadOption is a pointer type of UINT8
- // for easy use with following LOAD_OPTION
- // embedded in this struct
- //
- NewLoadContext->LoadOption = LoadOption;
- NewLoadContext->LoadOptionSize = BootOptionSize;
-
- NewLoadContext->Attributes = *(UINT32 *) LoadOptionPtr;
- NewLoadContext->IsActive = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);
-
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- LoadOptionPtr += sizeof (UINT32);
-
- NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
- LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize ((UINT16 *) LoadOptionPtr);
- NewLoadContext->Description = AllocateZeroPool (StringSize);
- ASSERT (NewLoadContext->Description != NULL);
- CopyMem (
- NewLoadContext->Description,
- (UINT16 *) LoadOptionPtr,
- StringSize
- );
- NewMenuEntry->DisplayString = NewLoadContext->Description;
-
- LoadOptionPtr += StringSize;
-
- NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);
- ASSERT (NewLoadContext->FilePathList != NULL);
- CopyMem (
- NewLoadContext->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,
- NewLoadContext->FilePathListLength
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionStrDepository
- );
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionHelpStrDepository
- );
- LoadOptionPtr += NewLoadContext->FilePathListLength;
-
- if (LoadOptionPtr < LoadOptionEnd) {
- OptionalDataSize = BootOptionSize -
- sizeof (UINT32) -
- sizeof (UINT16) -
- StringSize -
- NewLoadContext->FilePathListLength;
-
- NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);
- ASSERT (NewLoadContext->OptionalData != NULL);
- CopyMem (
- NewLoadContext->OptionalData,
- LoadOptionPtr,
- OptionalDataSize
- );
-
- NewLoadContext->OptionalDataSize = OptionalDataSize;
- }
-
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
- MenuCount++;
- }
-
- SafeFreePool (BootNext);
- SafeFreePool (BootOrderList);
- BootOptionMenu.MenuNumber = MenuCount;
- return MenuCount;
-}
-
-CHAR16 *
-BdsStrCpy (
- OUT CHAR16 *Destination,
- IN CONST CHAR16 *Source
- )
-{
- CHAR16 *ReturnValue;
-
- //
- // Destination cannot be NULL
- //
- ASSERT (Destination != NULL);
-
- ReturnValue = Destination;
- while (*Source) {
- *(Destination++) = *(Source++);
- }
- *Destination = 0;
- return ReturnValue;
-}
-
-CHAR16 *
-BOpt_AppendFileName (
- IN CHAR16 *Str1,
- IN CHAR16 *Str2
- )
-/*++
-
-Routine Description
- Append file name to existing file name.
-
-Arguments:
- Str1 - existing file name
- Str2 - file name to be appended
-
-Returns:
- Allocate a new string to hold the appended result.
- Caller is responsible to free the returned string.
-
---*/
-{
- UINTN Size1;
- UINTN Size2;
- CHAR16 *Str;
- CHAR16 *Ptr;
- CHAR16 *LastSlash;
-
- Size1 = StrSize (Str1);
- Size2 = StrSize (Str2);
- Str = AllocateZeroPool (Size1 + Size2 + sizeof (CHAR16));
- ASSERT (Str != NULL);
-
- StrCat (Str, Str1);
- if (!((*Str == '\\') && (*(Str + 1) == 0))) {
- StrCat (Str, L"\\");
- }
-
- StrCat (Str, Str2);
-
- Ptr = Str;
- LastSlash = Str;
- while (*Ptr != 0) {
- if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '.' && *(Ptr + 3) != 0) {
- //
- // Convert "\Name\..\" to "\"
- // DO NOT convert the .. if it is at the end of the string. This will
- // break the .. behavior in changing directories.
- //
- BdsStrCpy (LastSlash, Ptr + 3);
- Ptr = LastSlash;
- } else if (*Ptr == '\\' && *(Ptr + 1) == '.' && *(Ptr + 2) == '\\') {
- //
- // Convert a "\.\" to a "\"
- //
- BdsStrCpy (Ptr, Ptr + 2);
- Ptr = LastSlash;
- } else if (*Ptr == '\\') {
- LastSlash = Ptr;
- }
-
- Ptr++;
- }
-
- return Str;
-}
-
-BOOLEAN
-BOpt_IsEfiImageName (
- IN UINT16 *FileName
- )
-/*++
-
-Routine Description
- Check whether current FileName point to a valid
- Efi Image File.
-
-Arguments:
- FileName - File need to be checked.
-
-Returns:
- TRUE - Is Efi Image
- FALSE - Not a valid Efi Image
-
---*/
-{
- //
- // Search for ".efi" extension
- //
- while (*FileName) {
- if (FileName[0] == '.') {
- if (FileName[1] == 'e' || FileName[1] == 'E') {
- if (FileName[2] == 'f' || FileName[2] == 'F') {
- if (FileName[3] == 'i' || FileName[3] == 'I') {
- return TRUE;
- } else if (FileName[3] == 0x0000) {
- return FALSE;
- }
- } else if (FileName[2] == 0x0000) {
- return FALSE;
- }
- } else if (FileName[1] == 0x0000) {
- return FALSE;
- }
- }
-
- FileName += 1;
- }
-
- return FALSE;
-}
-
-
-RETURN_STATUS
-EFIAPI
-IsEfiAppReadFromFile (
- IN VOID *FileHandle,
- IN UINTN FileOffset,
- IN OUT UINTN *ReadSize,
- OUT VOID *Buffer
- )
-{
- EFI_STATUS Status;
- EFI_FILE_HANDLE File;
-
- File = (EFI_FILE_HANDLE)FileHandle;
- Status = File->SetPosition (File, FileOffset);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return File->Read (File, ReadSize, Buffer);
-}
-
-
-
-BOOLEAN
-BOpt_IsEfiApp (
- IN EFI_FILE_HANDLE Dir,
- IN UINT16 *FileName
- )
-/*++
-
-Routine Description:
- Check whether current FileName point to a valid Efi Application
-
-Arguments:
- Dir - Pointer to current Directory
- FileName - Pointer to current File name.
-
-Returns:
- TRUE - Is a valid Efi Application
- FALSE - not a valid Efi Application
-
---*/
-{
- EFI_STATUS Status;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
- EFI_FILE_HANDLE File;
-
- Status = Dir->Open (Dir, &File, FileName, EFI_FILE_MODE_READ, 0);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- ZeroMem (&ImageContext, sizeof (ImageContext));
- ImageContext.Handle = (VOID *)File;
- ImageContext.ImageRead = IsEfiAppReadFromFile;
-
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
- File->Close (File);
- if (EFI_ERROR (Status)) {
- return FALSE;
- }
-
- if (ImageContext.ImageType == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
- return TRUE;
- } else {
- return FALSE;
- }
- }
-
-
-EFI_STATUS
-BOpt_FindDrivers (
- VOID
- )
-/*++
-
-Routine Description
- Find drivers that will be added as Driver#### variables from handles
- in current system environment
- All valid handles in the system except those consume SimpleFs, LoadFile
- are stored in DriverMenu for future use.
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- UINTN NoDevicePathHandles;
- EFI_HANDLE *DevicePathHandle;
- UINTN Index;
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_HANDLE_CONTEXT *NewHandleContext;
- EFI_HANDLE CurHandle;
- UINTN OptionNumber;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;
- EFI_LOAD_FILE_PROTOCOL *LoadFile;
-
- SimpleFs = NULL;
- LoadFile = NULL;
-
- InitializeListHead (&DriverMenu.Head);
-
- //
- // At first, get all handles that support Device Path
- // protocol which is the basic requirement for
- // Driver####
- //
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiDevicePathProtocolGuid,
- NULL,
- &NoDevicePathHandles,
- &DevicePathHandle
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OptionNumber = 0;
- for (Index = 0; Index < NoDevicePathHandles; Index++) {
- CurHandle = DevicePathHandle[Index];
-
- //
- // Check whether this handle support
- // driver binding
- //
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiSimpleFileSystemProtocolGuid,
- (VOID**) &SimpleFs
- );
- if (Status == EFI_SUCCESS) {
- continue;
- }
-
- Status = gBS->HandleProtocol (
- CurHandle,
- &gEfiLoadFileProtocolGuid,
- (VOID**) &LoadFile
- );
- if (Status == EFI_SUCCESS) {
- continue;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_HANDLE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewHandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewHandleContext->Handle = CurHandle;
- NewHandleContext->DevicePath = DevicePathFromHandle (CurHandle);
- NewMenuEntry->DisplayString = DevicePathToStr (NewHandleContext->DevicePath);
- NewMenuEntry->HelpString = NULL;
- NewMenuEntry->OptionNumber = OptionNumber;
- OptionNumber++;
- InsertTailList (&DriverMenu.Head, &NewMenuEntry->Link);
-
- }
-
- DriverMenu.MenuNumber = OptionNumber;
- return EFI_SUCCESS;
-}
-
-UINT16
-BOpt_GetBootOptionNumber (
- VOID
- )
-/*++
-
-Routine Description:
- Get the Option Number that does not used
-
-Arguments:
-
-Returns:
- The Option Number
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *BootOrderList;
- UINTN BootOrderListSize;
- UINT16 Number;
- UINTN Index;
- UINTN Index2;
- BOOLEAN Found;
- CHAR16 StrTemp[100];
- UINT16 *OptionBuffer;
- UINTN OptionSize;
-
- BootOrderListSize = 0;
- BootOrderList = NULL;
-
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
- if (BootOrderList) {
- //
- // already have Boot####
- //
- // AlreadyBootNumbers = BootOrderListSize / sizeof(UINT16);
- //
- for (Index = 0; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- Found = TRUE;
- for (Index2 = 0; Index2 < BootOptionMenu.MenuNumber; Index2++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index2);
- if (Index == NewMenuEntry->OptionNumber) {
- Found = FALSE;
- break;
- }
- }
-
- if (Found) {
- UnicodeSPrint (StrTemp, 100, L"Boot%04x", Index);
- DEBUG((EFI_D_ERROR,"INdex= %s\n", StrTemp));
- OptionBuffer = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- &OptionSize
- );
- if (NULL == OptionBuffer)
- break;
- }
- }
- //
- // end for Index
- //
- Number = (UINT16) Index;
- } else {
- //
- // No Boot####
- //
- Number = 0;
- }
-
- return Number;
-}
-
-UINT16
-BOpt_GetDriverOptionNumber (
- VOID
- )
-/*++
-
-Routine Description:
- Get the Option Number that does not used
-
-Arguments:
-
-Returns:
- The Option Number
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *DriverOrderList;
- UINTN DriverOrderListSize;
- UINT16 Number;
- UINTN Index;
- UINTN Index2;
- BOOLEAN Found;
-
- DriverOrderListSize = 0;
- DriverOrderList = NULL;
-
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
- if (DriverOrderList) {
- //
- // already have Driver####
- //
- // AlreadyDriverNumbers = DriverOrderListSize / sizeof(UINT16);
- //
- for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {
- Found = TRUE;
- for (Index2 = 0; Index2 < DriverOptionMenu.MenuNumber; Index2++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index2);
- if (Index == NewMenuEntry->OptionNumber) {
- Found = FALSE;
- break;
- }
- }
-
- if (Found) {
- break;
- }
- }
- //
- // end for Index
- //
- Number = (UINT16) Index;
- } else {
- //
- // No Driver####
- //
- Number = 0;
- }
-
- return Number;
-}
-
-EFI_STATUS
-BOpt_GetDriverOptions (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-/*++
-
-Routine Description:
- Build up all DriverOptionMenu
-
-Arguments:
-
-Returns:
- The Option Number
-
---*/
-{
- UINTN Index;
- UINT16 DriverString[12];
- UINT8 *LoadOptionFromVar;
- UINT8 *LoadOption;
- UINTN DriverOptionSize;
-
- UINT16 *DriverOrderList;
- UINTN DriverOrderListSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT8 *LoadOptionPtr;
- UINTN StringSize;
- UINTN OptionalDataSize;
- UINT8 *LoadOptionEnd;
-
- DriverOrderListSize = 0;
- DriverOrderList = NULL;
- DriverOptionSize = 0;
- LoadOptionFromVar = NULL;
- BOpt_FreeMenu (&DriverOptionMenu);
- InitializeListHead (&DriverOptionMenu.Head);
- //
- // Get the DriverOrder from the Var
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- for (Index = 0; Index < DriverOrderListSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- DriverOrderList[Index]
- );
- //
- // Get all loadoptions from the VAR
- //
- LoadOptionFromVar = BdsLibGetVariableAndSize (
- DriverString,
- &gEfiGlobalVariableGuid,
- &DriverOptionSize
- );
- if (!LoadOptionFromVar) {
- continue;
- }
-
- LoadOption = AllocateZeroPool (DriverOptionSize);
- if (!LoadOption) {
- continue;
- }
-
- CopyMem (LoadOption, LoadOptionFromVar, DriverOptionSize);
- SafeFreePool (LoadOptionFromVar);
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- LoadOptionPtr = LoadOption;
- LoadOptionEnd = LoadOption + DriverOptionSize;
- NewMenuEntry->OptionNumber = DriverOrderList[Index];
- NewLoadContext->LoadOptionModified = FALSE;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->IsLegacy = FALSE;
-
- //
- // LoadOption is a pointer type of UINT8
- // for easy use with following LOAD_OPTION
- // embedded in this struct
- //
- NewLoadContext->LoadOption = LoadOption;
- NewLoadContext->LoadOptionSize = DriverOptionSize;
-
- NewLoadContext->Attributes = *(UINT32 *) LoadOptionPtr;
- NewLoadContext->IsActive = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_ACTIVE);
-
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- LoadOptionPtr += sizeof (UINT32);
-
- NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
- LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize ((UINT16 *) LoadOptionPtr);
- NewLoadContext->Description = AllocateZeroPool (StringSize);
- ASSERT (NewLoadContext->Description != NULL);
- CopyMem (
- NewLoadContext->Description,
- (UINT16 *) LoadOptionPtr,
- StringSize
- );
- NewMenuEntry->DisplayString = NewLoadContext->Description;
-
- LoadOptionPtr += StringSize;
-
- NewLoadContext->FilePathList = AllocateZeroPool (NewLoadContext->FilePathListLength);
- ASSERT (NewLoadContext->FilePathList != NULL);
- CopyMem (
- NewLoadContext->FilePathList,
- (EFI_DEVICE_PATH_PROTOCOL *) LoadOptionPtr,
- NewLoadContext->FilePathListLength
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionStrDepository
- );
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionHelpStrDepository
- );
- LoadOptionPtr += NewLoadContext->FilePathListLength;
-
- if (LoadOptionPtr < LoadOptionEnd) {
- OptionalDataSize = DriverOptionSize -
- sizeof (UINT32) -
- sizeof (UINT16) -
- StringSize -
- NewLoadContext->FilePathListLength;
-
- NewLoadContext->OptionalData = AllocateZeroPool (OptionalDataSize);
- ASSERT (NewLoadContext->OptionalData != NULL);
- CopyMem (
- NewLoadContext->OptionalData,
- LoadOptionPtr,
- OptionalDataSize
- );
-
- NewLoadContext->OptionalDataSize = OptionalDataSize;
- }
-
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
-
- }
-
- SafeFreePool (DriverOrderList);
- DriverOptionMenu.MenuNumber = Index;
- return EFI_SUCCESS;
-
-}
-
-VOID
-SafeFreePool (
- IN VOID *Buffer
- )
-/*++
-
-Routine Description:
- Wrap original FreePool gBS call
- in order to decrease code length
-
-Arguments:
-
-Returns:
-
---*/
-{
- if (Buffer != NULL) {
- gBS->FreePool (Buffer);
- Buffer = NULL;
- }
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c deleted file mode 100644 index 297c2cfc55..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/ConsoleOption.c +++ /dev/null @@ -1,840 +0,0 @@ -/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ConsoleOption.c
-
-Abstract:
-
- handles console redirection from boot manager
-
-
-Revision History
-
---*/
-
-#include "BootMaint.h"
-
-EFI_DEVICE_PATH_PROTOCOL *
-DevicePathInstanceDup (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- );
-
-EFI_STATUS
-UpdateComAttributeFromVariable (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
-EFI_STATUS
-ChangeTerminalDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- BOOLEAN ChangeTerminal
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *Node1;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UART_DEVICE_PATH *Uart1;
- UINTN Com;
- UINT32 Match;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
-
- Match = EISA_PNP_ID (0x0501);
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- Com = 0;
- while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Com);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- CopyMem (
- &Uart->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- //
- // Change the device path in the ComPort
- //
- if (ChangeTerminal) {
- Node1 = NewTerminalContext->DevicePath;
- Node1 = NextDevicePathNode (Node1);
- while (!IsDevicePathEnd (Node1)) {
- if ((DevicePathType (Node1) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node1) == MSG_UART_DP)) {
- Uart1 = (UART_DEVICE_PATH *) Node1;
- CopyMem (
- &Uart1->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart1->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart1->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart1->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- break;
- }
- //
- // end if
- //
- Node1 = NextDevicePathNode (Node1);
- }
- //
- // end while
- //
- break;
- }
- }
-
- Node = NextDevicePathNode (Node);
- }
-
- return EFI_SUCCESS;
-
-}
-
-VOID
-ChangeVariableDevicePath (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UINTN Com;
- UINT32 Match;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- BM_MENU_ENTRY *NewMenuEntry;
-
- Match = EISA_PNP_ID (0x0501);
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- Com = 0;
- while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&Com, &Acpi->UID, sizeof (UINT32));
- }
- }
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- NewMenuEntry = BOpt_GetMenuEntry (
- &TerminalMenu,
- Com
- );
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- Uart = (UART_DEVICE_PATH *) Node;
- CopyMem (
- &Uart->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &Uart->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
- }
-
- Node = NextDevicePathNode (Node);
- }
-
- return ;
-}
-
-BOOLEAN
-IsTerminalDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT TYPE_OF_TERMINAL *Termi,
- OUT UINTN *Com
- );
-
-EFI_STATUS
-LocateSerialIo (
- VOID
- )
-/*++
-
-Routine Description:
- Build a list containing all serial devices
-
-Arguments:
-
-Returns:
-
---*/
-{
- UINT8 *Ptr;
- UINTN Index;
- UINTN Index2;
- UINTN NoHandles;
- EFI_HANDLE *Handles;
- EFI_STATUS Status;
- ACPI_HID_DEVICE_PATH *Acpi;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- UINT32 Match;
- EFI_SERIAL_IO_PROTOCOL *SerialIo;
- EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
- VENDOR_DEVICE_PATH Vendor;
- //
- // Get all handles that have SerialIo protocol installed
- //
- InitializeListHead (&TerminalMenu.Head);
- TerminalMenu.MenuNumber = 0;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiSerialIoProtocolGuid,
- NULL,
- &NoHandles,
- &Handles
- );
- if (EFI_ERROR (Status)) {
- //
- // No serial ports present
- //
- return EFI_UNSUPPORTED;
- }
-
- for (Index = 0; Index < NoHandles; Index++) {
- //
- // Check to see whether the handle has DevicePath Protocol installed
- //
- gBS->HandleProtocol (
- Handles[Index],
- &gEfiDevicePathProtocolGuid,
- (VOID**) &DevicePath
- );
- Ptr = (UINT8 *) DevicePath;
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
- }
-
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
-
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- NewMenuEntry = BOpt_CreateMenuEntry (BM_TERMINAL_CONTEXT_SELECT);
- if (!NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- CopyMem (&NewMenuEntry->OptionNumber, &Acpi->UID, sizeof (UINT32));
- NewTerminalContext->DevicePath = DevicePathInstanceDup (DevicePath);
- //
- // BugBug: I have no choice, calling EfiLibStrFromDatahub will hang the system!
- // coz' the misc data for each platform is not correct, actually it's the device path stored in
- // datahub which is not completed, so a searching for end of device path will enter a
- // dead-loop.
- //
- NewMenuEntry->DisplayString = EfiLibStrFromDatahub (DevicePath);
- if (NULL == NewMenuEntry->DisplayString) {
- NewMenuEntry->DisplayString = DevicePathToStr (DevicePath);
- }
-
- NewMenuEntry->HelpString = NULL;
-
- gBS->HandleProtocol (
- Handles[Index],
- &gEfiSerialIoProtocolGuid,
- (VOID**) &SerialIo
- );
-
- CopyMem (
- &NewTerminalContext->BaudRate,
- &SerialIo->Mode->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &NewTerminalContext->DataBits,
- &SerialIo->Mode->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->Parity,
- &SerialIo->Mode->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->StopBits,
- &SerialIo->Mode->StopBits,
- sizeof (UINT8)
- );
- InsertTailList (&TerminalMenu.Head, &NewMenuEntry->Link);
- TerminalMenu.MenuNumber++;
- }
- }
- //
- // Get L"ConOut", L"ConIn" and L"ErrOut" from the Var
- //
- OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
- InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
- ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
- if (OutDevicePath) {
- UpdateComAttributeFromVariable (OutDevicePath);
- }
-
- if (InpDevicePath) {
- UpdateComAttributeFromVariable (InpDevicePath);
- }
-
- if (ErrDevicePath) {
- UpdateComAttributeFromVariable (ErrDevicePath);
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- NewTerminalContext->TerminalType = 0;
- NewTerminalContext->IsConIn = FALSE;
- NewTerminalContext->IsConOut = FALSE;
- NewTerminalContext->IsStdErr = FALSE;
-
- Vendor.Header.Type = MESSAGING_DEVICE_PATH;
- Vendor.Header.SubType = MSG_VENDOR_DP;
-
- for (Index2 = 0; Index2 < 4; Index2++) {
- CopyMem (&Vendor.Guid, &Guid[Index2], sizeof (EFI_GUID));
- SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
- NewDevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
- );
- SafeFreePool (NewMenuEntry->HelpString);
- //
- // NewMenuEntry->HelpString = DevicePathToStr (NewDevicePath);
- // NewMenuEntry->DisplayString = NewMenuEntry->HelpString;
- //
- NewMenuEntry->HelpString = NULL;
-
- if (BdsLibMatchDevicePaths (OutDevicePath, NewDevicePath)) {
- NewTerminalContext->IsConOut = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
-
- if (BdsLibMatchDevicePaths (InpDevicePath, NewDevicePath)) {
- NewTerminalContext->IsConIn = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
-
- if (BdsLibMatchDevicePaths (ErrDevicePath, NewDevicePath)) {
- NewTerminalContext->IsStdErr = TRUE;
- NewTerminalContext->TerminalType = (UINT8) Index2;
- }
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-UpdateComAttributeFromVariable (
- EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-/*++
-
-Routine Description:
- Update Com Ports attributes from DevicePath
-
-Arguments:
- DevicePath - DevicePath that contains Com ports
-
-Returns:
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *Node;
- EFI_DEVICE_PATH_PROTOCOL *SerialNode;
- ACPI_HID_DEVICE_PATH *Acpi;
- UART_DEVICE_PATH *Uart;
- UART_DEVICE_PATH *Uart1;
- UINT32 Match;
- UINTN TerminalNumber;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- UINTN Index;
-
- Match = EISA_PNP_ID (0x0501);
- Node = DevicePath;
- Node = NextDevicePathNode (Node);
- TerminalNumber = 0;
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- while (!IsDevicePathEnd (Node)) {
- if ((DevicePathType (Node) == ACPI_DEVICE_PATH) && (DevicePathSubType (Node) == ACPI_DP)) {
- Acpi = (ACPI_HID_DEVICE_PATH *) Node;
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (&TerminalNumber, &Acpi->UID, sizeof (UINT32));
- }
- }
-
- if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (Node) == MSG_UART_DP)) {
- Uart = (UART_DEVICE_PATH *) Node;
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, TerminalNumber);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- CopyMem (
- &NewTerminalContext->BaudRate,
- &Uart->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &NewTerminalContext->DataBits,
- &Uart->DataBits,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->Parity,
- &Uart->Parity,
- sizeof (UINT8)
- );
-
- CopyMem (
- &NewTerminalContext->StopBits,
- &Uart->StopBits,
- sizeof (UINT8)
- );
-
- SerialNode = NewTerminalContext->DevicePath;
- SerialNode = NextDevicePathNode (SerialNode);
- while (!IsDevicePathEnd (SerialNode)) {
- if ((DevicePathType (SerialNode) == MESSAGING_DEVICE_PATH) && (DevicePathSubType (SerialNode) == MSG_UART_DP)) {
- //
- // Update following device paths according to
- // previous acquired uart attributes
- //
- Uart1 = (UART_DEVICE_PATH *) SerialNode;
- CopyMem (
- &Uart1->BaudRate,
- &NewTerminalContext->BaudRate,
- sizeof (UINT64)
- );
-
- CopyMem (
- &Uart1->DataBits,
- &NewTerminalContext->DataBits,
- sizeof (UINT8)
- );
- CopyMem (
- &Uart1->Parity,
- &NewTerminalContext->Parity,
- sizeof (UINT8)
- );
- CopyMem (
- &Uart1->StopBits,
- &NewTerminalContext->StopBits,
- sizeof (UINT8)
- );
-
- break;
- }
-
- SerialNode = NextDevicePathNode (SerialNode);
- }
- //
- // end while
- //
- }
-
- Node = NextDevicePathNode (Node);
- }
- //
- // end while
- //
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_DEVICE_PATH_PROTOCOL *
-DevicePathInstanceDup (
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath
- )
-/*++
-
-Routine Description:
- Function creates a device path data structure that identically matches the
- device path passed in.
-
-Arguments:
- DevPath - A pointer to a device path data structure.
-
-Returns:
-
- The new copy of DevPath is created to identically match the input.
- Otherwise, NULL is returned.
-
---*/
-{
- EFI_DEVICE_PATH_PROTOCOL *NewDevPath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- EFI_DEVICE_PATH_PROTOCOL *Temp;
- UINT8 *Ptr;
- UINTN Size;
-
- //
- // get the size of an instance from the input
- //
- Temp = DevPath;
- DevicePathInst = GetNextDevicePathInstance (&Temp, &Size);
-
- //
- // Make a copy and set proper end type
- //
- NewDevPath = NULL;
- if (Size) {
- NewDevPath = AllocateZeroPool (Size);
- ASSERT (NewDevPath != NULL);
- }
-
- if (NewDevPath) {
- CopyMem (NewDevPath, DevicePathInst, Size);
- Ptr = (UINT8 *) NewDevPath;
- Ptr += Size - sizeof (EFI_DEVICE_PATH_PROTOCOL);
- Temp = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- SetDevicePathEndNode (Temp);
- }
-
- return NewDevPath;
-}
-
-EFI_STATUS
-GetConsoleMenu (
- IN UINTN ConsoleMenuType
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- EFI_DEVICE_PATH_PROTOCOL *AllDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *MultiDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
- UINTN Size;
- UINTN AllCount;
- UINTN Index;
- UINTN Index2;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- TYPE_OF_TERMINAL Terminal;
- BM_MENU_ENTRY *NewTerminalMenuEntry;
- UINTN Com;
- BM_MENU_OPTION *ConsoleMenu;
-
- DevicePath = NULL;
- AllDevicePath = NULL;
- AllCount = 0;
- switch (ConsoleMenuType) {
- case BM_CONSOLE_IN_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleInpMenu;
- DevicePath = EfiLibGetVariable (
- L"ConIn",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ConInDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- case BM_CONSOLE_OUT_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleOutMenu;
- DevicePath = EfiLibGetVariable (
- L"ConOut",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ConOutDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- case BM_CONSOLE_ERR_CONTEXT_SELECT:
- ConsoleMenu = &ConsoleErrMenu;
- DevicePath = EfiLibGetVariable (
- L"ErrOut",
- &gEfiGlobalVariableGuid
- );
-
- AllDevicePath = EfiLibGetVariable (
- L"ErrOutDev",
- &gEfiGlobalVariableGuid
- );
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
-
- if (NULL == AllDevicePath) {
- return EFI_NOT_FOUND;
- }
-
- InitializeListHead (&ConsoleMenu->Head);
-
- AllCount = EfiDevicePathInstanceCount (AllDevicePath);
- ConsoleMenu->MenuNumber = 0;
- //
- // Following is menu building up for Console Out Devices
- //
- MultiDevicePath = AllDevicePath;
- Index2 = 0;
- for (Index = 0; Index < AllCount; Index++) {
- DevicePathInst = GetNextDevicePathInstance (&MultiDevicePath, &Size);
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_CONSOLE_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- NewMenuEntry->OptionNumber = Index2;
-
- NewConsoleContext->DevicePath = DevicePathInstanceDup (DevicePathInst);
- NewMenuEntry->DisplayString = EfiLibStrFromDatahub (NewConsoleContext->DevicePath);
- if (NULL == NewMenuEntry->DisplayString) {
- NewMenuEntry->DisplayString = DevicePathToStr (NewConsoleContext->DevicePath);
- }
-
- NewConsoleContext->IsTerminal = IsTerminalDevicePath (
- NewConsoleContext->DevicePath,
- &Terminal,
- &Com
- );
-
- NewConsoleContext->IsActive = BdsLibMatchDevicePaths (
- DevicePath,
- NewConsoleContext->DevicePath
- );
- NewTerminalMenuEntry = NULL;
- NewTerminalContext = NULL;
-
- if (NewConsoleContext->IsTerminal) {
- BOpt_DestroyMenuEntry (NewMenuEntry);
- } else {
- Index2++;
- ConsoleMenu->MenuNumber++;
- InsertTailList (&ConsoleMenu->Head, &NewMenuEntry->Link);
- }
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetAllConsoles (
- VOID
- )
-/*++
-
-Routine Description:
- Build up ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- GetConsoleMenu (BM_CONSOLE_IN_CONTEXT_SELECT);
- GetConsoleMenu (BM_CONSOLE_OUT_CONTEXT_SELECT);
- GetConsoleMenu (BM_CONSOLE_ERR_CONTEXT_SELECT);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-FreeAllConsoles (
- VOID
- )
-/*++
-
-Routine Description:
- Free ConsoleOutMenu, ConsoleInpMenu and ConsoleErrMenu
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- BOpt_FreeMenu (&ConsoleOutMenu);
- BOpt_FreeMenu (&ConsoleInpMenu);
- BOpt_FreeMenu (&ConsoleErrMenu);
- BOpt_FreeMenu (&TerminalMenu);
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-IsTerminalDevicePath (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT TYPE_OF_TERMINAL *Termi,
- OUT UINTN *Com
- )
-/*++
-
-Routine Description:
- Test whether DevicePath is a valid Terminal
-
-Arguments:
- DevicePath - DevicePath to be checked
- Termi - If is terminal, give its type
- Com - If is Com Port, give its type
-
-Returns:
- TRUE - If DevicePath point to a Terminal
- FALSE
-
---*/
-{
- UINT8 *Ptr;
- BOOLEAN IsTerminal;
- VENDOR_DEVICE_PATH *Vendor;
- ACPI_HID_DEVICE_PATH *Acpi;
- UINT32 Match;
- EFI_GUID TempGuid;
-
- IsTerminal = FALSE;
-
- //
- // Parse the Device Path, should be change later!!!
- //
- Ptr = (UINT8 *) DevicePath;
- while (*Ptr != END_DEVICE_PATH_TYPE) {
- Ptr++;
- }
-
- Ptr = Ptr - sizeof (VENDOR_DEVICE_PATH);
- Vendor = (VENDOR_DEVICE_PATH *) Ptr;
-
- //
- // There are four kinds of Terminal types
- // check to see whether this devicepath
- // is one of that type
- //
- CopyMem (&TempGuid, &Vendor->Guid, sizeof (EFI_GUID));
-
- if (CompareGuid (&TempGuid, &Guid[0])) {
- *Termi = PC_ANSI;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&TempGuid, &Guid[1])) {
- *Termi = VT_100;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&TempGuid, &Guid[2])) {
- *Termi = VT_100_PLUS;
- IsTerminal = TRUE;
- } else {
- if (CompareGuid (&TempGuid, &Guid[3])) {
- *Termi = VT_UTF8;
- IsTerminal = TRUE;
- } else {
- IsTerminal = FALSE;
- }
- }
- }
- }
-
- if (!IsTerminal) {
- return FALSE;
- }
-
- Ptr = Ptr - sizeof (UART_DEVICE_PATH) - sizeof (ACPI_HID_DEVICE_PATH);
- Acpi = (ACPI_HID_DEVICE_PATH *) Ptr;
- Match = EISA_PNP_ID (0x0501);
- if (CompareMem (&Acpi->HID, &Match, sizeof (UINT32)) == 0) {
- CopyMem (Com, &Acpi->UID, sizeof (UINT32));
- } else {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c deleted file mode 100644 index 196bbe2385..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Data.c +++ /dev/null @@ -1,324 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Data.c
-
-Abstract:
-
- Define some data used for Boot Maint
-
-Revision History
-
---*/
-
-#include "BootMaint.h"
-
-EFI_HII_UPDATE_DATA *UpdateData;
-STRING_DEPOSITORY *FileOptionStrDepository;
-STRING_DEPOSITORY *ConsoleOptionStrDepository;
-STRING_DEPOSITORY *BootOptionStrDepository;
-STRING_DEPOSITORY *BootOptionHelpStrDepository;
-STRING_DEPOSITORY *DriverOptionStrDepository;
-STRING_DEPOSITORY *DriverOptionHelpStrDepository;
-STRING_DEPOSITORY *TerminalStrDepository;
-
-//
-// Terminal type string token storage
-//
-UINT16 TerminalType[] = {
- STRING_TOKEN(STR_COM_TYPE_0),
- STRING_TOKEN(STR_COM_TYPE_1),
- STRING_TOKEN(STR_COM_TYPE_2),
- STRING_TOKEN(STR_COM_TYPE_3),
-};
-
-//
-// File system selection menu
-//
-BM_MENU_OPTION FsOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Console Input Device Selection Menu
-//
-BM_MENU_OPTION ConsoleInpMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Console Output Device Selection Menu
-//
-BM_MENU_OPTION ConsoleOutMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Error Output Device Selection Menu
-//
-BM_MENU_OPTION ConsoleErrMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Boot Option from variable Menu
-//
-BM_MENU_OPTION BootOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Driver Option from variable menu
-//
-BM_MENU_OPTION DriverOptionMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy FD Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyFDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy HD Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyHDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy CD Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyCDMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy NET Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyNETMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Legacy NET Info from LegacyBios.GetBbsInfo()
-//
-BM_MENU_OPTION LegacyBEVMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Files and sub-directories in current directory menu
-//
-BM_MENU_OPTION DirectoryMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Handles in current system selection menu
-//
-BM_MENU_OPTION DriverMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-BM_MENU_OPTION TerminalMenu = {
- BM_MENU_OPTION_SIGNATURE,
- { NULL, NULL},
- 0
-};
-
-//
-// Value and string token correspondency for BaudRate
-//
-COM_ATTR BaudRateList[19] = {
- {
- 115200,
- STRING_TOKEN(STR_COM_BAUD_RATE_0)
- },
- {
- 57600,
- STRING_TOKEN(STR_COM_BAUD_RATE_1)
- },
- {
- 38400,
- STRING_TOKEN(STR_COM_BAUD_RATE_2)
- },
- {
- 19200,
- STRING_TOKEN(STR_COM_BAUD_RATE_3)
- },
- {
- 9600,
- STRING_TOKEN(STR_COM_BAUD_RATE_4)
- },
- {
- 7200,
- STRING_TOKEN(STR_COM_BAUD_RATE_5)
- },
- {
- 4800,
- STRING_TOKEN(STR_COM_BAUD_RATE_6)
- },
- {
- 3600,
- STRING_TOKEN(STR_COM_BAUD_RATE_7)
- },
- {
- 2400,
- STRING_TOKEN(STR_COM_BAUD_RATE_8)
- },
- {
- 2000,
- STRING_TOKEN(STR_COM_BAUD_RATE_9)
- },
- {
- 1800,
- STRING_TOKEN(STR_COM_BAUD_RATE_10)
- },
- {
- 1200,
- STRING_TOKEN(STR_COM_BAUD_RATE_11)
- },
- {
- 600,
- STRING_TOKEN(STR_COM_BAUD_RATE_12)
- },
- {
- 300,
- STRING_TOKEN(STR_COM_BAUD_RATE_13)
- },
- {
- 150,
- STRING_TOKEN(STR_COM_BAUD_RATE_14)
- },
- {
- 134,
- STRING_TOKEN(STR_COM_BAUD_RATE_15)
- },
- {
- 110,
- STRING_TOKEN(STR_COM_BAUD_RATE_16)
- },
- {
- 75,
- STRING_TOKEN(STR_COM_BAUD_RATE_17)
- },
- {
- 50,
- STRING_TOKEN(STR_COM_BAUD_RATE_18)
- }
-};
-
-//
-// Value and string token correspondency for DataBits
-//
-COM_ATTR DataBitsList[4] = {
- {
- 5,
- STRING_TOKEN(STR_COM_DATA_BITS_0)
- },
- {
- 6,
- STRING_TOKEN(STR_COM_DATA_BITS_1)
- },
- {
- 7,
- STRING_TOKEN(STR_COM_DATA_BITS_2)
- },
- {
- 8,
- STRING_TOKEN(STR_COM_DATA_BITS_3)
- }
-};
-
-//
-// Value and string token correspondency for Parity
-//
-COM_ATTR ParityList[5] = {
- {
- NoParity,
- STRING_TOKEN(STR_COM_PAR_0)
- },
- {
- EvenParity,
- STRING_TOKEN(STR_COM_PAR_1)
- },
- {
- OddParity,
- STRING_TOKEN(STR_COM_PAR_2)
- },
- {
- MarkParity,
- STRING_TOKEN(STR_COM_PAR_3)
- },
- {
- SpaceParity,
- STRING_TOKEN(STR_COM_PAR_4)
- }
-};
-
-//
-// Value and string token correspondency for Baudreate
-//
-COM_ATTR StopBitsList[3] = {
- {
- OneStopBit,
- STRING_TOKEN(STR_COM_STOP_BITS_0)
- },
- {
- OneFiveStopBits,
- STRING_TOKEN(STR_COM_STOP_BITS_1)
- },
- {
- TwoStopBits,
- STRING_TOKEN(STR_COM_STOP_BITS_2)
- }
-};
-
-//
-// Guid for messaging path, used in Serial port setting.
-//
-EFI_GUID Guid[4] = {
- DEVICE_PATH_MESSAGING_PC_ANSI,
- DEVICE_PATH_MESSAGING_VT_100,
- DEVICE_PATH_MESSAGING_VT_100_PLUS,
- DEVICE_PATH_MESSAGING_VT_UTF8
-};
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr deleted file mode 100644 index b9c5bb36a8..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FE.vfr +++ /dev/null @@ -1,138 +0,0 @@ -// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// FE.vfr
-//
-// Abstract:
-//
-// File Explorer Formset
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#include "FormGuid.h"
-
-#pragma pack(1)
-typedef struct {
- UINT16 DescriptionData[75];
- UINT16 OptionalData[127];
- UINT8 Active;
- UINT8 ForceReconnect;
-} FILE_EXPLORER_NV_DATA;
-#pragma pack()
-
-#define FORM_FILE_EXPLORER_ID 0x001E
-#define FORM_BOOT_ADD_DESCRIPTION_ID 0x001F
-#define FORM_DRIVER_ADD_FILE_DESCRIPTION_ID 0x0020
-#define KEY_VALUE_SAVE_AND_EXIT 0x0090
-#define KEY_VALUE_NO_SAVE_AND_EXIT 0x0091
-
-
-
-formset
- guid = FILE_EXPLORE_FORMSET_GUID,
- title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- class = 0,
- subclass = 0,
-
- form formid = FORM_FILE_EXPLORER_ID,
- title = STRING_TOKEN(STR_FILE_EXPLORER_TITLE);
-
- label FORM_FILE_EXPLORER_ID;
- endform;
-
- form formid = FORM_BOOT_ADD_DESCRIPTION_ID,
- title = STRING_TOKEN(STR_FORM_BOOT_ADD_DESC_TITLE);
-
- label FORM_BOOT_ADD_DESCRIPTION_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- string varid = FILE_EXPLORER_NV_DATA.DescriptionData,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 6,
- maxsize = 75,
- endstring;
-
- string varid = FILE_EXPLORER_NV_DATA.OptionalData,
- prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 0,
- maxsize = 120,
- endstring;
-
- text
- help = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_SAVE_AND_EXIT;
-
- text
- help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_NO_SAVE_AND_EXIT;
-
- endform;
-
- form formid = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID,
- title = STRING_TOKEN(STR_FORM_DRV_ADD_DESC_TITLE);
-
- label FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
-
- subtitle text = STRING_TOKEN(STR_NULL_STRING);
-
- string varid = FILE_EXPLORER_NV_DATA.DescriptionData,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 6,
- maxsize = 75,
- endstring;
-
- string varid = FILE_EXPLORER_NV_DATA.OptionalData,
- prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
- help = STRING_TOKEN(STR_NULL_STRING),
- minsize = 0,
- maxsize = 120,
- endstring;
-
- checkbox varid = FILE_EXPLORER_NV_DATA.ForceReconnect,
- prompt = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
- help = STRING_TOKEN(STR_LOAD_OPTION_FORCE_RECON),
- flags = 1,
- key = 0,
- endcheckbox;
-
- text
- help = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_SAVE_AND_EXIT;
-
- text
- help = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NO_SAVE_AND_EXIT),
- text = STRING_TOKEN(STR_NULL_STRING),
- flags = INTERACTIVE | NV_ACCESS,
- key = KEY_VALUE_NO_SAVE_AND_EXIT;
-
- endform;
-
-endformset; diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c deleted file mode 100644 index 2c8ec5208c..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FileExplorer.c +++ /dev/null @@ -1,339 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FileExplorer.c
-
-AgBStract:
-
- File explorer related functions.
-
---*/
-
-#include "Bds.h"
-#include "BootMaint.h"
-
-VOID
-UpdateFileExplorePage (
- IN BMM_CALLBACK_DATA *CallbackData,
- BM_MENU_OPTION *MenuOption
- )
-/*++
-Routine Description:
- Update the File Explore page.
-
-Arguments:
- MenuOption - Pointer to menu options to display.
-
-Returns:
- None.
-
---*/
-{
- UINT8 *Location;
- UINTN Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- FORM_ID FormId;
-
- NewMenuEntry = NULL;
- NewFileContext = NULL;
- FormId = 0;
-
- //
- // Clean up file explore page.
- //
- RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);
-
- //
- // Remove all op-codes from dynamic page
- //
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FORM_FILE_EXPLORER_ID,
- FALSE,
- UpdateData
- );
-
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 0);
-
- Location = (UINT8 *) &UpdateData->Data;
-
- for (Index = 0; Index < MenuOption->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (MenuOption, Index);
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewFileContext->IsBootLegacy) {
- continue;
- }
-
- if ((NewFileContext->IsDir) || (BOOT_FROM_FILE_STATE == CallbackData->FeCurrentState)) {
- //
- // Create Text opcode for directory, also create Text opcode for file in BOOT_FROM_FILE_STATE.
- //
- CreateTextOpCode (
- NewMenuEntry->DisplayStringToken,
- STR_NULL_STRING,
- STR_NULL_STRING,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (FILE_OPTION_OFFSET + Index),
- Location
- );
- } else {
- //
- // Create Goto opcode for file in ADD_BOOT_OPTION_STATE or ADD_DRIVER_OPTION_STATE.
- //
- if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
- FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
- } else if (ADD_DRIVER_OPTION_STATE == CallbackData->FeCurrentState) {
- FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- }
-
- CreateGotoOpCode (
- FormId,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (FILE_OPTION_OFFSET + Index),
- Location
- );
- }
-
- UpdateData->DataCount++;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- }
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FORM_FILE_EXPLORER_ID,
- TRUE,
- UpdateData
- );
-}
-
-BOOLEAN
-UpdateFileExplorer (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT16 KeyValue
- )
-/*++
-
-Routine Description:
- Update the file explower page with the refershed file system.
-
-Arguments:
- CallbackData - BMM context data
- KeyValue - Key value to identify the type of data to expect.
-
-Returns:
- TRUE - Inform the caller to create a callback packet to exit file explorer.
- FALSE - Indicate that there is no need to exit file explorer.
-
---*/
-{
- UINT16 FileOptionMask;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_FILE_CONTEXT *NewFileContext;
- FORM_ID FormId;
- BOOLEAN ExitFileExplorer;
- EFI_STATUS Status;
-
- NewMenuEntry = NULL;
- NewFileContext = NULL;
- ExitFileExplorer = FALSE;
-
- FileOptionMask = (UINT16) (FILE_OPTION_MASK & KeyValue);
-
- if (UNKNOWN_CONTEXT == CallbackData->FeDisplayContext) {
- //
- // First in, display file system.
- //
- BOpt_FreeMenu (&FsOptionMenu);
- BOpt_FindFileSystem (CallbackData);
- CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &FsOptionMenu);
-
- UpdateFileExplorePage (CallbackData, &FsOptionMenu);
-
- CallbackData->FeDisplayContext = FILE_SYSTEM;
- } else {
- if (FILE_SYSTEM == CallbackData->FeDisplayContext) {
- NewMenuEntry = BOpt_GetMenuEntry (&FsOptionMenu, FileOptionMask);
- } else if (DIRECTORY == CallbackData->FeDisplayContext) {
- NewMenuEntry = BOpt_GetMenuEntry (&DirectoryMenu, FileOptionMask);
- }
-
- CallbackData->FeDisplayContext = DIRECTORY;
-
- NewFileContext = (BM_FILE_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewFileContext->IsDir ) {
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_FreeMenu (&DirectoryMenu);
- Status = BOpt_FindFiles (CallbackData, NewMenuEntry);
- if (EFI_ERROR (Status)) {
- ExitFileExplorer = TRUE;
- goto exit;
- }
- CreateMenuStringToken (CallbackData, CallbackData->FeHiiHandle, &DirectoryMenu);
- BOpt_DestroyMenuEntry (NewMenuEntry);
-
- UpdateFileExplorePage (CallbackData, &DirectoryMenu);
-
- } else {
- switch (CallbackData->FeCurrentState) {
- case BOOT_FROM_FILE_STATE:
- //
- // Here boot from file
- //
- BootThisFile (NewFileContext);
- ExitFileExplorer = TRUE;
- break;
-
- case ADD_BOOT_OPTION_STATE:
- case ADD_DRIVER_OPTION_STATE:
- if (ADD_BOOT_OPTION_STATE == CallbackData->FeCurrentState) {
- FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
- } else {
- FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
- }
-
- CallbackData->MenuEntry = NewMenuEntry;
- CallbackData->LoadContext->FilePathList = ((BM_FILE_CONTEXT *) (CallbackData->MenuEntry->VariableContext))->DevicePath;
-
- //
- // Clean up file explore page.
- //
- RefreshUpdateData (FALSE, 0, FALSE, 0, 1);
-
- //
- // Remove the Subtitle op-code.
- //
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FormId,
- FALSE,
- UpdateData
- );
-
- //
- // Create Subtitle op-code for the display string of the option.
- //
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->FeCallbackHandle, FALSE, 0, 1);
-
- CreateSubTitleOpCode (
- NewMenuEntry->DisplayStringToken,
- &UpdateData->Data
- );
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->FeHiiHandle,
- FormId,
- TRUE,
- UpdateData
- );
- break;
-
- default:
- break;
- }
- }
- }
-exit:
- return ExitFileExplorer;
-}
-
-EFI_STATUS
-EFIAPI
-FileExplorerCallback (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *Data,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-Routine Description:
- Callback Function for file exploration and file interaction.
-
-Arguments:
- This - File explorer callback protocol pointer.
- KeyValue - Key value to identify the type of data to expect.
- Data - A pointer to the data being sent to the original exporting driver.
- Packet - A pointer to a packet of information which a driver passes back to the browser.
-
-Returns:
- EFI_SUCCESS - Callback ended successfully.
- Others - Contain some errors.
-
---*/
-{
- BMM_CALLBACK_DATA *Private;
- FILE_EXPLORER_NV_DATA *NvRamMap;
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
- Private = FE_CALLBACK_DATA_FROM_THIS (This);
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) Private->FeCallbackHandle;
- NvRamMap = (FILE_EXPLORER_NV_DATA *) Data->NvRamMap;
-
- if (KEY_VALUE_SAVE_AND_EXIT == KeyValue) {
- //
- // Apply changes and exit formset.
- //
- if (ADD_BOOT_OPTION_STATE == Private->FeCurrentState) {
- Status = Var_UpdateBootOption (Private, NvRamMap);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_GetBootOptions (Private);
- CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
- } else if (ADD_DRIVER_OPTION_STATE == Private->FeCurrentState) {
- Status = Var_UpdateDriverOption (
- Private,
- Private->FeHiiHandle,
- NvRamMap->DescriptionData,
- NvRamMap->OptionalData,
- NvRamMap->ForceReconnect
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_GetDriverOptions (Private);
- CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
- }
-
- CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);
- } else if (KEY_VALUE_NO_SAVE_AND_EXIT == KeyValue) {
- //
- // Discard changes and exit formset.
- //
- NvRamMap->OptionalData[0] = 0x0000;
- NvRamMap->DescriptionData[0] = 0x0000;
- CreateCallbackPacket (Packet, EXIT_REQUIRED | NV_NOT_CHANGED);
- } else if (KeyValue < FILE_OPTION_OFFSET) {
- //
- // Exit File Explorer formset.
- //
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
- } else {
- if (UpdateFileExplorer (Private, KeyValue)) {
- CreateCallbackPacket (Packet, EXIT_REQUIRED);
- }
- }
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h deleted file mode 100644 index 8b55159f8b..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/FormGuid.h +++ /dev/null @@ -1,32 +0,0 @@ -// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// FormGuid.h
-//
-// Abstract:
-//
-// Formset guids for Boot Maintenance Manager
-//
-// Revision History:
-//
-// --*/
-//
-#define MAIN_FORMSET_GUID \
- { \
- 0x642237c7, 0x35d4, 0x472d, { 0x83, 0x65, 0x12, 0xe0, 0xcc, 0xf2, 0x7a, 0x22 } \
- }
-
-#define FILE_EXPLORE_FORMSET_GUID \
- { \
- 0x1f2d63e1, 0xfebd, 0x4dc7, { 0x9c, 0xc5, 0xba, 0x2b, 0x1c, 0xef, 0x9c, 0x5b } \
- }
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c deleted file mode 100644 index 05b912c300..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/UpdatePage.c +++ /dev/null @@ -1,1267 +0,0 @@ -/**@file
- Dynamically Update the pages.
-
-Copyright (c) 2006 - 2007 Intel Corporation.
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include "Bds.h"
-#include "BootMaint.h"
-
-EFI_GUID gTerminalDriverGuid = {
- 0x9E863906, 0xA40F, 0x4875, {0x97, 0x7F, 0x5B, 0x93, 0xFF, 0x23, 0x7F, 0xC6}
-};
-
-VOID
-RefreshUpdateData (
- IN BOOLEAN FormSetUpdate,
- IN EFI_PHYSICAL_ADDRESS FormCallbackHandle,
- IN BOOLEAN FormUpdate,
- IN STRING_REF FormTitle,
- IN UINT16 DataCount
- )
-/*++
-Routine Description:
- Refresh the global UpdateData structure.
-
-Arguments:
- FormSetUpdate - If TRUE, next variable is significant
- FormCallbackHandle - If not 0, will update FormSet with this info
- FormUpdate - If TRUE, next variable is significant
- FormTitle - If not 0, will update Form with this info
- DataCount - The number of Data entries in this structure
-
-Returns:
- None.
---*/
-{
- UpdateData->FormSetUpdate = FormSetUpdate;
- if (FormSetUpdate) {
- ASSERT (0 != FormCallbackHandle);
- UpdateData->FormCallbackHandle = FormCallbackHandle;
- }
-
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = FormTitle;
- UpdateData->DataCount = DataCount;
-}
-
-VOID
-UpdatePageStart (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN OUT UINT8 **CurrentLocation
- )
-{
- RefreshUpdateData (TRUE, (EFI_PHYSICAL_ADDRESS) (UINTN) CallbackData->BmmCallbackHandle, FALSE, 0, 0);
-
- if (!(CallbackData->BmmAskSaveOrNot)) {
- //
- // Add a "Go back to main page" tag in front of the form when there are no
- // "Apply changes" and "Discard changes" tags in the end of the form.
- //
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_FORM_GOTO_MAIN),
- STRING_TOKEN (STR_FORM_GOTO_MAIN),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- FORM_MAIN_ID,
- *CurrentLocation
- );
-
- UpdateData->DataCount++;
-
- *CurrentLocation = *CurrentLocation + ((EFI_IFR_OP_HEADER *) (*CurrentLocation))->Length;
- }
-
-}
-
-VOID
-UpdatePageEnd (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN UINT8 *CurrentLocation
- )
-{
- //
- // Create the "Apply changes" and "Discard changes" tags.
- //
- if (CallbackData->BmmAskSaveOrNot) {
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_SAVE_AND_EXIT,
- CurrentLocation
- );
-
- UpdateData->DataCount++;
-
- CurrentLocation = CurrentLocation + ((EFI_IFR_OP_HEADER *) CurrentLocation)->Length;
-
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- CurrentLocation
- );
-
- UpdateData->DataCount++;
- }
- //
- // Ensure user can return to the main page.
- //
- if (0 == UpdateData->DataCount) {
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- CurrentLocation
- );
-
- UpdateData->DataCount++;
- }
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->BmmHiiHandle,
- CallbackData->BmmCurrentPageId,
- TRUE,
- UpdateData
- );
-}
-
-VOID
-CleanUpPage (
- IN EFI_FORM_LABEL LabelId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- RefreshUpdateData (FALSE, 0, FALSE, 0, 0xff);
-
- //
- // Remove all op-codes from dynamic page
- //
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->BmmHiiHandle,
- LabelId,
- FALSE,
- UpdateData
- );
-}
-
-EFI_STATUS
-BootThisFile (
- IN BM_FILE_CONTEXT *FileContext
- )
-{
- EFI_STATUS Status;
- UINTN ExitDataSize;
- CHAR16 *ExitData;
- BDS_COMMON_OPTION *Option;
-
- Status = gBS->AllocatePool (EfiBootServicesData, sizeof (BDS_COMMON_OPTION), (VOID**) &Option);
- Option->Description = FileContext->FileName;
- Option->DevicePath = FileContext->DevicePath;
- Option->LoadOptionsSize = 0;
- Option->LoadOptions = NULL;
-
- //
- // Since current no boot from removable media directly is allowed */
- //
- gST->ConOut->ClearScreen (gST->ConOut);
-
- ExitDataSize = 0;
-
- Status = BdsLibBootViaBootOption (Option, Option->DevicePath, &ExitDataSize, &ExitData);
-
- return Status;
-
-}
-
-VOID
-UpdateConCOMPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 *Location;
- EFI_STATUS Status;
- VOID *Interface;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = FALSE;
-
- UpdatePageStart (CallbackData, &Location);
-
- Status = EfiLibLocateProtocol (&gTerminalDriverGuid, &Interface);
- if (!EFI_ERROR (Status)) {
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
-
- CreateGotoOpCode (
- FORM_CON_COM_SETUP_ID,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (TERMINAL_OPTION_OFFSET + Index),
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateBootDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewLoadContext->IsLegacy) {
- continue;
- }
-
- NewLoadContext->Deleted = FALSE;
- CallbackData->BmmFakeNvData->BootOptionDel[Index] = 0x00;
-
- CreateCheckBoxOpCode (
- (UINT16) (BOOT_OPTION_DEL_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) BOOT_OPTION_DEL_QUESTION_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateDrvAddHandlePage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = FALSE;
-
- UpdatePageStart (CallbackData, &Location);
-
- for (Index = 0; Index < DriverMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index);
-
- CreateGotoOpCode (
- FORM_DRV_ADD_HANDLE_DESC_ID,
- NewMenuEntry->DisplayStringToken,
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) (HANDLE_OPTION_OFFSET + Index),
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateDrvDelPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- UINT16 Index;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu);
-
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- CallbackData->BmmFakeNvData->DriverOptionDel[Index] = 0x00;
-
- CreateCheckBoxOpCode (
- (UINT16) (DRIVER_OPTION_DEL_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- (UINT16) DRIVER_OPTION_DEL_QUESTION_ID,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateDriverAddHandleDescPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT8 *Location;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmFakeNvData->DriverAddActive = 0x01;
- CallbackData->BmmFakeNvData->DriverAddForceReconnect = 0x00;
- CallbackData->BmmAskSaveOrNot = TRUE;
- NewMenuEntry = CallbackData->MenuEntry;
-
- UpdatePageStart (CallbackData, &Location);
-
- UpdateData->DataCount += (UINT16) 4;
-
- CreateSubTitleOpCode (
- NewMenuEntry->DisplayStringToken,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateStringOpCode (
- DRV_ADD_HANDLE_DESC_QUESTION_ID,
- (UINT8) 150,
- STRING_TOKEN (STR_LOAD_OPTION_DESC),
- STRING_TOKEN (STR_NULL_STRING),
- 6,
- 75,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_DRIVER_ADD_DESC_DATA,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateCheckBoxOpCode (
- DRV_ADD_RECON_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),
- STRING_TOKEN (STR_LOAD_OPTION_FORCE_RECON),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- DRV_ADD_RECON_QUESTION_ID,
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- CreateStringOpCode (
- DRIVER_ADD_OPTION_QUESTION_ID,
- (UINT8) 150,
- STRING_TOKEN (STR_OPTIONAL_DATA),
- STRING_TOKEN (STR_NULL_STRING),
- 6,
- 75,
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_DRIVER_ADD_OPT_DATA,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateConsolePage (
- IN UINT16 UpdatePageId,
- IN BM_MENU_OPTION *ConsoleMenu,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- UINT16 Index;
- UINT16 Index2;
- UINT8 *Location;
- UINT8 CheckFlags;
- EFI_STATUS Status;
- VOID *Interface;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewConsoleContext->IsActive) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = TRUE;
- } else {
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = FALSE;
- }
-
- CreateCheckBoxOpCode (
- (UINT16) (CON_DEVICE_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- CheckFlags,
- (UINT16) (CONSOLE_OPTION_OFFSET + Index),
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- }
-
- Status = EfiLibLocateProtocol (&gTerminalDriverGuid, &Interface);
- if (!EFI_ERROR (Status)) {
- for (Index2 = 0; Index2 < TerminalMenu.MenuNumber; Index2++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- if ((NewTerminalContext->IsConIn && (UpdatePageId == FORM_CON_IN_ID)) ||
- (NewTerminalContext->IsConOut && (UpdatePageId == FORM_CON_OUT_ID)) ||
- (NewTerminalContext->IsStdErr && (UpdatePageId == FORM_CON_ERR_ID))
- ) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = TRUE;
- } else {
- CallbackData->BmmFakeNvData->ConsoleCheck[Index] = FALSE;
- }
-
- CreateCheckBoxOpCode (
- (UINT16) (CON_DEVICE_QUESTION_ID + Index),
- (UINT8) 1,
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- CheckFlags,
- (UINT16) (CONSOLE_OPTION_OFFSET + Index),
- Location
- );
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
- Index++;
- }
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateOrderPage (
- IN UINT16 UpdatePageId,
- IN BM_MENU_OPTION *OptionMenu,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT8 *Location;
- IFR_OPTION *IfrOptionList;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
-
- ZeroMem (CallbackData->BmmFakeNvData->OptionOrder, 100);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * OptionMenu->MenuNumber);
- if (NULL == IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
- IfrOptionList[Index].Value = (UINT16) (NewMenuEntry->OptionNumber + 1);
- IfrOptionList[Index].OptionString = NULL;
- CallbackData->BmmFakeNvData->OptionOrder[Index] = (UINT8) (IfrOptionList[Index].Value);
- }
-
- if (OptionMenu->MenuNumber > 0) {
- CreateOrderedListOpCode (
- (UINT16) OPTION_ORDER_QUESTION_ID,
- (UINT8) 100,
- STRING_TOKEN (STR_CHANGE_ORDER),
- STRING_TOKEN (STR_CHANGE_ORDER),
- IfrOptionList,
- OptionMenu->MenuNumber,
- Location
- );
-
- for (Index = 0; Index < OptionMenu->MenuNumber + 2; Index++) {
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- }
-
- UpdateData->DataCount = (UINT16) (UpdateData->DataCount + OptionMenu->MenuNumber + 2);
- }
-
- SafeFreePool (IfrOptionList);
-
- UpdatePageEnd (CallbackData, Location);
-
- CopyMem (
- CallbackData->BmmOldFakeNVData.OptionOrder,
- CallbackData->BmmFakeNvData->OptionOrder,
- 100
- );
-}
-
-VOID
-UpdateBootNextPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT8 *Location;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- IFR_OPTION *IfrOptionList;
- UINTN NumberOfOptions;
- UINT16 Index;
-
- Location = (UINT8 *) &UpdateData->Data;
- IfrOptionList = NULL;
- NumberOfOptions = BootOptionMenu.MenuNumber;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
-
- if (NumberOfOptions > 0) {
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + NumberOfOptions);
- IfrOptionList = AllocateZeroPool ((NumberOfOptions + 1) * sizeof (IFR_OPTION));
-
- ASSERT (IfrOptionList);
-
- CallbackData->BmmFakeNvData->BootNext = (UINT16) (BootOptionMenu.MenuNumber);
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewLoadContext->IsBootNext) {
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_DEFAULT | EFI_IFR_FLAG_INTERACTIVE;
- CallbackData->BmmFakeNvData->BootNext = Index;
- } else {
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- }
-
- IfrOptionList[Index].Key = (UINT16) KEY_VALUE_MAIN_BOOT_NEXT;
- IfrOptionList[Index].Value = Index;
- IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
- IfrOptionList[Index].OptionString = NULL;
- }
-
- IfrOptionList[Index].Key = (UINT16) KEY_VALUE_MAIN_BOOT_NEXT;
- IfrOptionList[Index].Value = Index;
- IfrOptionList[Index].StringToken = STRING_TOKEN (STR_NONE);
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- if (CallbackData->BmmFakeNvData->BootNext == Index) {
- IfrOptionList[Index].Flags |= EFI_IFR_FLAG_DEFAULT;
- }
-
- IfrOptionList[Index].OptionString = NULL;
-
- CreateOneOfOpCode (
- (UINT16) BOOT_NEXT_QUESTION_ID,
- (UINT8) 2,
- STRING_TOKEN (STR_BOOT_NEXT),
- STRING_TOKEN (STR_BOOT_NEXT_HELP),
- IfrOptionList,
- (UINTN) (NumberOfOptions + 1),
- Location
- );
- Location = Location + (NumberOfOptions + 2) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- UpdateData->DataCount += 3;
- SafeFreePool (IfrOptionList);
- IfrOptionList = NULL;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateTimeOutPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT8 *Location;
- UINT16 BootTimeOut;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- BootTimeOut = BdsLibGetTimeout ();
-
- CreateNumericOpCode (
- (UINT16) BOOT_TIME_OUT_QUESTION_ID,
- (UINT8) 2,
- STRING_TOKEN (STR_NUM_AUTO_BOOT),
- STRING_TOKEN (STR_HLP_AUTO_BOOT),
- 0,
- 65535,
- 0,
- 10,
- 0,
- 0,
- Location
- );
-
- CallbackData->BmmFakeNvData->BootTimeOut = (UINT16) BootTimeOut;
- UpdateData->DataCount++;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdateTerminalPage (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINT16 Index;
- UINT8 *Location;
- UINT8 CheckFlags;
- IFR_OPTION *IfrOptionList;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
-
- ZeroMem (UpdateData, UPDATE_DATA_SIZE);
- Location = (UINT8 *) &UpdateData->Data;
- UpdatePageStart (CallbackData, &Location);
-
- NewMenuEntry = BOpt_GetMenuEntry (
- &TerminalMenu,
- CallbackData->CurrentTerminal
- );
-
- if (!NewMenuEntry) {
- return ;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 19);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 19; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[Index].Value)) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- NewTerminalContext->BaudRateIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMBaudRate = NewTerminalContext->BaudRateIndex;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_BAUD_RATE;
- IfrOptionList[Index].StringToken = BaudRateList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_BAUD_RATE_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_BAUD_RATE),
- STRING_TOKEN (STR_COM_BAUD_RATE),
- IfrOptionList,
- 19,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 4);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 4; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
-
- if (NewTerminalContext->DataBits == DataBitsList[Index].Value) {
- NewTerminalContext->DataBitsIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMDataRate = NewTerminalContext->DataBitsIndex;
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_DATA_BITS;
- IfrOptionList[Index].StringToken = DataBitsList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_DATA_RATE_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_DATA_BITS),
- STRING_TOKEN (STR_COM_DATA_BITS),
- IfrOptionList,
- 4,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 5);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 5; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->Parity == ParityList[Index].Value) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- NewTerminalContext->ParityIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMParity = NewTerminalContext->ParityIndex;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_PARITY;
- IfrOptionList[Index].StringToken = ParityList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_PARITY_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_PARITY),
- STRING_TOKEN (STR_COM_PARITY),
- IfrOptionList,
- 5,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 3);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 3; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->StopBits == StopBitsList[Index].Value) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- NewTerminalContext->StopBitsIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData->COMStopBits = NewTerminalContext->StopBitsIndex;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_STOP_BITS;
- IfrOptionList[Index].StringToken = StopBitsList[Index].StringToken;
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_STOP_BITS_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_STOP_BITS),
- STRING_TOKEN (STR_COM_STOP_BITS),
- IfrOptionList,
- 3,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * 4);
- if (!IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < 4; Index++) {
- CheckFlags = EFI_IFR_FLAG_INTERACTIVE;
- if (NewTerminalContext->TerminalType == Index) {
- CheckFlags |= EFI_IFR_FLAG_DEFAULT;
- CallbackData->BmmFakeNvData->COMTerminalType = NewTerminalContext->TerminalType;
- }
-
- IfrOptionList[Index].Flags = CheckFlags;
- IfrOptionList[Index].Key = KEY_VALUE_COM_SET_TERMI_TYPE;
- IfrOptionList[Index].StringToken = (STRING_REF) TerminalType[Index];
- IfrOptionList[Index].Value = Index;
- }
-
- CreateOneOfOpCode (
- (UINT16) COM_TERMINAL_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_COM_TERMI_TYPE),
- STRING_TOKEN (STR_COM_TERMI_TYPE),
- IfrOptionList,
- 4,
- Location
- );
-
- Location = Location + (Index + 1) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT8) (UpdateData->DataCount + Index);
- UpdateData->DataCount += 2;
-
- SafeFreePool (IfrOptionList);
-
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_SAVE_AND_EXIT,
- Location
- );
-
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount++;
-
- CreateGotoOpCode (
- FORM_MAIN_ID,
- STRING_TOKEN (STR_NO_SAVE_AND_EXIT),
- STRING_TOKEN (STR_NULL_STRING),
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS,
- KEY_VALUE_NO_SAVE_AND_EXIT,
- Location
- );
-
- UpdateData->DataCount++;
-
- CallbackData->Hii->UpdateForm (
- CallbackData->Hii,
- CallbackData->BmmHiiHandle,
- (EFI_FORM_LABEL) FORM_CON_COM_SETUP_ID,
- TRUE,
- UpdateData
- );
-
-}
-
-VOID
-UpdatePageBody (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- CleanUpPage (UpdatePageId, CallbackData);
- switch (UpdatePageId) {
- case FORM_CON_IN_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleInpMenu, CallbackData);
- break;
-
- case FORM_CON_OUT_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleOutMenu, CallbackData);
- break;
-
- case FORM_CON_ERR_ID:
- UpdateConsolePage (UpdatePageId, &ConsoleErrMenu, CallbackData);
- break;
-
- case FORM_BOOT_CHG_ID:
- UpdateOrderPage (UpdatePageId, &BootOptionMenu, CallbackData);
- break;
-
- case FORM_DRV_CHG_ID:
- UpdateOrderPage (UpdatePageId, &DriverOptionMenu, CallbackData);
- break;
-
- default:
- break;
- }
-}
-
-VOID *
-GetLegacyBootOptionVar (
- IN UINTN DeviceType,
- OUT UINTN *OptionIndex,
- OUT UINTN *OptionSize
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- VOID *OptionBuffer;
- UINTN OrderSize;
- UINTN Index;
- UINT32 Attribute;
- UINT16 *OrderBuffer;
- CHAR16 StrTemp[100];
- UINT16 FilePathSize;
- CHAR16 *Description;
- UINT8 *Ptr;
- UINT8 *OptionalData;
-
- //
- // Get Boot Option number from the size of BootOrder
- //
- OrderBuffer = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &OrderSize
- );
-
- for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]);
- OptionBuffer = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- OptionSize
- );
- if (NULL == OptionBuffer) {
- continue;
- }
-
- Ptr = (UINT8 *) OptionBuffer;
- Attribute = *(UINT32 *) Ptr;
- Ptr += sizeof (UINT32);
-
- FilePathSize = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
-
- Description = (CHAR16 *) Ptr;
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- //
- // Now Ptr point to Device Path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- Ptr += FilePathSize;
-
- //
- // Now Ptr point to Optional Data
- //
- OptionalData = Ptr;
-
- if ((DeviceType == ((BBS_TABLE *) OptionalData)->DeviceType) &&
- (BBS_DEVICE_PATH == DevicePath->Type) &&
- (BBS_BBS_DP == DevicePath->SubType)
- ) {
- *OptionIndex = OrderBuffer[Index];
- SafeFreePool (OrderBuffer);
- return OptionBuffer;
- } else {
- SafeFreePool (OptionBuffer);
- }
- }
-
- SafeFreePool (OrderBuffer);
- return NULL;
-}
-
-VOID
-UpdateSetLegacyDeviceOrderPage (
- IN UINT16 UpdatePageId,
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_LEGACY_DEV_ORDER_CONTEXT *DevOrder;
- BM_MENU_OPTION *OptionMenu;
- BM_MENU_ENTRY *NewMenuEntry;
- IFR_OPTION *IfrOptionList;
- STRING_REF StrRef;
- STRING_REF StrRefHelp;
- BBS_TYPE BbsType;
- UINTN VarSize;
- UINTN Pos;
- UINTN Bit;
- UINT16 Index;
- UINT16 Index2;
- UINT16 Key;
- CHAR16 String[100];
- CHAR16 *TypeStr;
- CHAR16 *TypeStrHelp;
- UINT16 VarDevOrder;
- UINT8 *Location;
- UINT8 *VarData;
- UINT8 *OriginalPtr;
- UINT8 *LegacyOrder;
- UINT8 *OldData;
- UINT8 *DisMap;
-
- OptionMenu = NULL;
- Key = 0;
- StrRef = 0;
- StrRefHelp = 0;
- TypeStr = NULL;
- TypeStrHelp = NULL;
- BbsType = BBS_FLOPPY;
- LegacyOrder = NULL;
- OldData = NULL;
- DisMap = NULL;
-
- Location = (UINT8 *) &UpdateData->Data;
- CallbackData->BmmAskSaveOrNot = TRUE;
-
- UpdatePageStart (CallbackData, &Location);
-
- DisMap = CallbackData->BmmOldFakeNVData.DisableMap;
-
- SetMem (DisMap, 32, 0);
- //
- // Create oneof option list
- //
- switch (UpdatePageId) {
- case FORM_SET_FD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- Key = LEGACY_FD_QUESTION_ID;
- TypeStr = StrFloppy;
- TypeStrHelp = StrFloppyHelp;
- BbsType = BBS_FLOPPY;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyFD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyFD;
- break;
-
- case FORM_SET_HD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- Key = LEGACY_HD_QUESTION_ID;
- TypeStr = StrHardDisk;
- TypeStrHelp = StrHardDiskHelp;
- BbsType = BBS_HARDDISK;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyHD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyHD;
- break;
-
- case FORM_SET_CD_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- Key = LEGACY_CD_QUESTION_ID;
- TypeStr = StrCDROM;
- TypeStrHelp = StrCDROMHelp;
- BbsType = BBS_CDROM;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyCD;
- OldData = CallbackData->BmmOldFakeNVData.LegacyCD;
- break;
-
- case FORM_SET_NET_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- Key = LEGACY_NET_QUESTION_ID;
- TypeStr = StrNET;
- TypeStrHelp = StrNETHelp;
- BbsType = BBS_EMBED_NETWORK;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyNET;
- OldData = CallbackData->BmmOldFakeNVData.LegacyNET;
- break;
-
- case FORM_SET_BEV_ORDER_ID:
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- Key = LEGACY_BEV_QUESTION_ID;
- TypeStr = StrBEV;
- TypeStrHelp = StrBEVHelp;
- BbsType = BBS_BEV_DEVICE;
- LegacyOrder = CallbackData->BmmFakeNvData->LegacyBEV;
- OldData = CallbackData->BmmOldFakeNVData.LegacyBEV;
- break;
-
- }
-
- CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
-
- IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * (OptionMenu->MenuNumber + 1));
- if (NULL == IfrOptionList) {
- return ;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- if (0 == Index) {
- IfrOptionList[Index].Flags |= EFI_IFR_FLAG_DEFAULT;
- }
-
- IfrOptionList[Index].Key = Key;
- IfrOptionList[Index].StringToken = NewMenuEntry->DisplayStringToken;
- IfrOptionList[Index].Value = (UINT16) ((BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext)->Index;
- IfrOptionList[Index].OptionString = NULL;
- }
- //
- // for item "Disabled"
- //
- IfrOptionList[Index].Flags = EFI_IFR_FLAG_INTERACTIVE;
- IfrOptionList[Index].Key = Key;
- IfrOptionList[Index].StringToken = STRING_TOKEN (STR_DISABLE_LEGACY_DEVICE);
- IfrOptionList[Index].Value = 0xFF;
- IfrOptionList[Index].OptionString = NULL;
-
- //
- // Get Device Order from variable
- //
- VarData = BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &VarSize
- );
-
- if (NULL != VarData) {
- OriginalPtr = VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
- while (VarData < VarData + VarSize) {
- if (DevOrder->BbsType == BbsType) {
- break;
- }
-
- VarData += sizeof (BBS_TYPE);
- VarData += *(UINT16 *) VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
- }
- //
- // Create oneof tag here for FD/HD/CD #1 #2
- //
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- for (Index2 = 0; Index2 <= OptionMenu->MenuNumber; Index2++) {
- IfrOptionList[Index2].Key = (UINT16) (Key + Index);
- }
- //
- // Create the string for oneof tag
- //
- UnicodeSPrint (String, sizeof (String), TypeStr, Index);
- StrRef = 0;
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->BmmHiiHandle,
- &StrRef,
- String
- );
-
- UnicodeSPrint (String, sizeof (String), TypeStrHelp, Index);
- StrRefHelp = 0;
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->BmmHiiHandle,
- &StrRefHelp,
- String
- );
-
- CreateOneOfOpCode (
- (UINT16) (Key + Index),
- (UINT8) 1,
- StrRef,
- StrRefHelp,
- IfrOptionList,
- OptionMenu->MenuNumber + 1,
- Location
- );
-
- VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index * sizeof (UINT16));
-
- if (0xFF00 == (VarDevOrder & 0xFF00)) {
- LegacyOrder[Index] = 0xFF;
- Pos = (VarDevOrder & 0xFF) / 8;
- Bit = 7 - ((VarDevOrder & 0xFF) % 8);
- DisMap[Pos] |= (UINT8) (1 << Bit);
- } else {
- LegacyOrder[Index] = (UINT8) (VarDevOrder & 0xFF);
- }
-
- Location = Location + (OptionMenu->MenuNumber + 2) * ((EFI_IFR_OP_HEADER *) Location)->Length;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
- UpdateData->DataCount = (UINT16) (UpdateData->DataCount + (OptionMenu->MenuNumber + 3));
- }
- }
-
- CopyMem (
- OldData,
- LegacyOrder,
- 100
- );
-
- if (IfrOptionList != NULL) {
- SafeFreePool (IfrOptionList);
- IfrOptionList = NULL;
- }
-
- UpdatePageEnd (CallbackData, Location);
-}
-
-VOID
-UpdatePageId (
- BMM_CALLBACK_DATA *Private,
- UINT16 NewPageId
- )
-{
- UINT16 FileOptionMask;
-
- FileOptionMask = (UINT16) (FILE_OPTION_MASK & NewPageId);
-
- if ((NewPageId < FILE_OPTION_OFFSET) && (NewPageId >= HANDLE_OPTION_OFFSET)) {
- //
- // If we select a handle to add driver option, advance to the add handle description page.
- //
- NewPageId = FORM_DRV_ADD_HANDLE_DESC_ID;
- } else if ((NewPageId == KEY_VALUE_SAVE_AND_EXIT) || (NewPageId == KEY_VALUE_NO_SAVE_AND_EXIT)) {
- //
- // Return to main page after "Save Changes" or "Discard Changes".
- //
- NewPageId = FORM_MAIN_ID;
- }
-
- if ((NewPageId > 0) && (NewPageId < MAXIMUM_FORM_ID)) {
- Private->BmmPreviousPageId = Private->BmmCurrentPageId;
- Private->BmmCurrentPageId = NewPageId;
- }
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c deleted file mode 100644 index c65f841b42..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMaint/Variable.c +++ /dev/null @@ -1,1278 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Variable.c
-
-Abstract:
-
- Variable operation that will be used by BootMaint
-
---*/
-
-#include "Bds.h"
-#include "BootMaint.h"
-
-EFI_STATUS
-Var_DelBootOption (
- VOID
- )
-/*++
-
-Routine Description:
- Delete Boot Option that represent a Deleted state in BootOptionMenu.
- After deleting this boot option, call Var_ChangeBootOrder to
- make sure BootOrder is in valid state.
-
-Arguments:
- LoadOption -- Pointer to the boot option that to be deleted
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
-
- UINT16 BootString[10];
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
-
- Status = EFI_SUCCESS;
- Index2 = 0;
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, (Index - Index2));
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (!NewLoadContext->Deleted) {
- continue;
- }
-
- UnicodeSPrint (
- BootString,
- sizeof (BootString),
- L"Boot%04x",
- NewMenuEntry->OptionNumber
- );
-
- EfiLibDeleteVariable (BootString, &gEfiGlobalVariableGuid);
- Index2++;
- //
- // If current Load Option is the same as BootNext,
- // must delete BootNext in order to make sure
- // there will be no panic on next boot
- //
- if (NewLoadContext->IsBootNext) {
- EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
- }
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_DestroyMenuEntry (NewMenuEntry);
- NewMenuEntry = NULL;
- }
-
- BootOptionMenu.MenuNumber -= Index2;
-
- Status = Var_ChangeBootOrder ();
- return Status;
-}
-
-EFI_STATUS
-Var_ChangeBootOrder (
- VOID
- )
-/*++
-
-Routine Description:
- After any operation on Boot####, there will be a discrepancy in BootOrder.
- Since some are missing but in BootOrder, while some are present but are
- not reflected by BootOrder. Then a function rebuild BootOrder from
- scratch by content from BootOptionMenu is needed.
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
-
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *BootOrderList;
- UINT16 *BootOrderListPtr;
- UINTN BootOrderListSize;
- UINTN Index;
-
- BootOrderList = NULL;
- BootOrderListSize = 0;
-
- //
- // First check whether BootOrder is present in current configuration
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- //
- // If exists, delete it to hold new BootOrder
- //
- if (BootOrderList) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- SafeFreePool (BootOrderList);
- BootOrderList = NULL;
- }
- //
- // Maybe here should be some check method to ensure that
- // no new added boot options will be added
- // but the setup engine now will give only one callback
- // that is to say, user are granted only one chance to
- // decide whether the boot option will be added or not
- // there should be no indictor to show whether this
- // is a "new" boot option
- //
- BootOrderListSize = BootOptionMenu.MenuNumber;
-
- if (BootOrderListSize > 0) {
- BootOrderList = AllocateZeroPool (BootOrderListSize * sizeof (UINT16));
- ASSERT (BootOrderList != NULL);
- BootOrderListPtr = BootOrderList;
-
- //
- // Get all current used Boot#### from BootOptionMenu.
- // OptionNumber in each BM_LOAD_OPTION is really its
- // #### value.
- //
- for (Index = 0; Index < BootOrderListSize; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- *BootOrderList = (UINT16) NewMenuEntry->OptionNumber;
- BootOrderList++;
- }
-
- BootOrderList = BootOrderListPtr;
-
- //
- // After building the BootOrderList, write it back
- //
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderListSize * sizeof (UINT16),
- BootOrderList
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_DelDriverOption (
- VOID
- )
-/*++
-
-Routine Description:
- Delete Load Option that represent a Deleted state in BootOptionMenu.
- After deleting this Driver option, call Var_ChangeDriverOrder to
- make sure DriverOrder is in valid state.
-
-Arguments:
- LoadOption -- Pointer to the Driver option that to be deleted
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
-
- UINT16 DriverString[12];
- EFI_STATUS Status;
- UINTN Index;
- UINTN Index2;
-
- Status = EFI_SUCCESS;
- Index2 = 0;
- for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, (Index - Index2));
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- if (!NewLoadContext->Deleted) {
- continue;
- }
-
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- NewMenuEntry->OptionNumber
- );
-
- EfiLibDeleteVariable (DriverString, &gEfiGlobalVariableGuid);
- Index2++;
-
- RemoveEntryList (&NewMenuEntry->Link);
- BOpt_DestroyMenuEntry (NewMenuEntry);
- NewMenuEntry = NULL;
- }
-
- DriverOptionMenu.MenuNumber -= Index2;
-
- Status = Var_ChangeDriverOrder ();
- return Status;
-}
-
-EFI_STATUS
-Var_ChangeDriverOrder (
- VOID
- )
-/*++
-
-Routine Description:
- After any operation on Driver####, there will be a discrepancy in
- DriverOrder. Since some are missing but in DriverOrder, while some
- are present but are not reflected by DriverOrder. Then a function
- rebuild DriverOrder from scratch by content from DriverOptionMenu is
- needed.
-
-Arguments:
-
-Returns:
- EFI_SUCCESS
- Others
-
---*/
-{
- EFI_STATUS Status;
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 *DriverOrderList;
- UINT16 *DriverOrderListPtr;
- UINTN DriverOrderListSize;
- UINTN Index;
-
- DriverOrderList = NULL;
- DriverOrderListSize = 0;
-
- //
- // First check whether DriverOrder is present in current configuration
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- //
- // If exists, delete it to hold new DriverOrder
- //
- if (DriverOrderList) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- SafeFreePool (DriverOrderList);
- DriverOrderList = NULL;
- }
-
- DriverOrderListSize = DriverOptionMenu.MenuNumber;
-
- if (DriverOrderListSize > 0) {
- DriverOrderList = AllocateZeroPool (DriverOrderListSize * sizeof (UINT16));
- ASSERT (DriverOrderList != NULL);
- DriverOrderListPtr = DriverOrderList;
-
- //
- // Get all current used Driver#### from DriverOptionMenu.
- // OptionNumber in each BM_LOAD_OPTION is really its
- // #### value.
- //
- for (Index = 0; Index < DriverOrderListSize; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
- *DriverOrderList = (UINT16) NewMenuEntry->OptionNumber;
- DriverOrderList++;
- }
-
- DriverOrderList = DriverOrderListPtr;
-
- //
- // After building the DriverOrderList, write it back
- //
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- DriverOrderListSize * sizeof (UINT16),
- DriverOrderList
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
- return EFI_SUCCESS;
-}
-
-VOID
-Var_UpdateAllConsoleOption (
- VOID
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *OutDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *InpDevicePath;
- EFI_DEVICE_PATH_PROTOCOL *ErrDevicePath;
- EFI_STATUS Status;
-
- OutDevicePath = EfiLibGetVariable (L"ConOut", &gEfiGlobalVariableGuid);
- InpDevicePath = EfiLibGetVariable (L"ConIn", &gEfiGlobalVariableGuid);
- ErrDevicePath = EfiLibGetVariable (L"ErrOut", &gEfiGlobalVariableGuid);
- if (OutDevicePath) {
- ChangeVariableDevicePath (OutDevicePath);
- Status = gRT->SetVariable (
- L"ConOut",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (OutDevicePath),
- OutDevicePath
- );
- ASSERT (!EFI_ERROR (Status));
- }
-
- if (InpDevicePath) {
- ChangeVariableDevicePath (InpDevicePath);
- Status = gRT->SetVariable (
- L"ConIn",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (InpDevicePath),
- InpDevicePath
- );
- ASSERT (!EFI_ERROR (Status));
- }
-
- if (ErrDevicePath) {
- ChangeVariableDevicePath (ErrDevicePath);
- Status = gRT->SetVariable (
- L"ErrOut",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (ErrDevicePath),
- ErrDevicePath
- );
- ASSERT (!EFI_ERROR (Status));
- }
-}
-
-EFI_STATUS
-Var_UpdateConsoleOption (
- IN UINT16 *ConsoleName,
- IN BM_MENU_OPTION *ConsoleMenu,
- IN UINT16 UpdatePageId
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *ConDevicePath;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
- EFI_STATUS Status;
- VENDOR_DEVICE_PATH Vendor;
- EFI_DEVICE_PATH_PROTOCOL *TerminalDevicePath;
- UINTN Index;
- UINT16 *Temp;
-
- ConDevicePath = EfiLibGetVariable (ConsoleName, &gEfiGlobalVariableGuid);
- if (ConDevicePath != NULL) {
- EfiLibDeleteVariable (ConsoleName, &gEfiGlobalVariableGuid);
- SafeFreePool (ConDevicePath);
- ConDevicePath = NULL;
- };
-
- //
- // First add all console input device to it from console input menu
- //
- for (Index = 0; Index < ConsoleMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- if (NewConsoleContext->IsActive) {
- ConDevicePath = AppendDevicePathInstance (
- ConDevicePath,
- NewConsoleContext->DevicePath
- );
- }
- }
-
- for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- if ((NewTerminalContext->IsConIn && (UpdatePageId == FORM_CON_IN_ID)) ||
- (NewTerminalContext->IsConOut && (UpdatePageId == FORM_CON_OUT_ID)) ||
- (NewTerminalContext->IsStdErr && (UpdatePageId == FORM_CON_ERR_ID))
- ) {
- Vendor.Header.Type = MESSAGING_DEVICE_PATH;
- Vendor.Header.SubType = MSG_VENDOR_DP;
- CopyMem (
- &Vendor.Guid,
- &Guid[NewTerminalContext->TerminalType],
- sizeof (EFI_GUID)
- );
- SetDevicePathNodeLength (&Vendor.Header, sizeof (VENDOR_DEVICE_PATH));
- TerminalDevicePath = AppendDevicePathNode (
- NewTerminalContext->DevicePath,
- (EFI_DEVICE_PATH_PROTOCOL *) &Vendor
- );
- ChangeTerminalDevicePath (TerminalDevicePath, TRUE);
- Temp = DevicePathToStr (TerminalDevicePath);
- ConDevicePath = AppendDevicePathInstance (
- ConDevicePath,
- TerminalDevicePath
- );
- }
- }
-
- if (ConDevicePath) {
- Status = gRT->SetVariable (
- ConsoleName,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- GetDevicePathSize (ConDevicePath),
- ConDevicePath
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-Var_UpdateConsoleInpOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ConIn", &ConsoleInpMenu, FORM_CON_IN_ID);
-}
-
-EFI_STATUS
-Var_UpdateConsoleOutOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ConOut", &ConsoleOutMenu, FORM_CON_OUT_ID);
-}
-
-EFI_STATUS
-Var_UpdateErrorOutOption (
- VOID
- )
-{
- return Var_UpdateConsoleOption (L"ErrOut", &ConsoleErrMenu, FORM_CON_ERR_ID);
-}
-
-EFI_STATUS
-Var_UpdateDriverOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN EFI_HII_HANDLE HiiHandle,
- IN UINT16 *DescriptionData,
- IN UINT16 *OptionalData,
- IN UINT8 ForceReconnect
- )
-{
- UINT16 Index;
- UINT16 *DriverOrderList;
- UINT16 *NewDriverOrderList;
- UINT16 DriverString[12];
- UINTN DriverOrderListSize;
- VOID *Buffer;
- UINTN BufferSize;
- UINT8 *Ptr;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BOOLEAN OptionalDataExist;
- EFI_STATUS Status;
-
- OptionalDataExist = FALSE;
-
- Index = BOpt_GetDriverOptionNumber ();
- UnicodeSPrint (
- DriverString,
- sizeof (DriverString),
- L"Driver%04x",
- Index
- );
-
- if (*DescriptionData == 0x0000) {
- StrCpy (DescriptionData, DriverString);
- }
-
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescriptionData) + GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- if (*OptionalData != 0x0000) {
- OptionalDataExist = TRUE;
- BufferSize += StrSize (OptionalData);
- }
-
- Buffer = AllocateZeroPool (BufferSize);
- if (NULL == Buffer) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->LoadOptionSize = BufferSize;
- Ptr = (UINT8 *) Buffer;
- NewLoadContext->LoadOption = Ptr;
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE | (ForceReconnect << 1);
- NewLoadContext->Attributes = *((UINT32 *) Ptr);
- NewLoadContext->IsActive = TRUE;
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- Ptr += sizeof (UINT32);
- *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);
-
- Ptr += sizeof (UINT16);
- CopyMem (
- Ptr,
- DescriptionData,
- StrSize (DescriptionData)
- );
-
- NewLoadContext->Description = AllocateZeroPool (StrSize (DescriptionData));
- ASSERT (NewLoadContext->Description != NULL);
- NewMenuEntry->DisplayString = NewLoadContext->Description;
- CopyMem (
- NewLoadContext->Description,
- (VOID *) Ptr,
- StrSize (DescriptionData)
- );
-
- Ptr += StrSize (DescriptionData);
- CopyMem (
- Ptr,
- CallbackData->LoadContext->FilePathList,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
- ASSERT (NewLoadContext->FilePathList != NULL);
-
- CopyMem (
- NewLoadContext->FilePathList,
- (VOID *) Ptr,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->OptionNumber = Index;
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionStrDepository
- );
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->DisplayStringToken,
- NewMenuEntry->DisplayString
- );
-
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- DriverOptionHelpStrDepository
- );
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- HiiHandle,
- &NewMenuEntry->HelpStringToken,
- NewMenuEntry->HelpString
- );
-
- if (OptionalDataExist) {
- Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- CopyMem (
- Ptr,
- OptionalData,
- StrSize (OptionalData)
- );
- }
-
- Status = gRT->SetVariable (
- DriverString,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BufferSize,
- Buffer
- );
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
- ASSERT (NewDriverOrderList != NULL);
- CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
- NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
- if (DriverOrderList != NULL) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- }
-
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- DriverOrderListSize + sizeof (UINT16),
- NewDriverOrderList
- );
- SafeFreePool (DriverOrderList);
- DriverOrderList = NULL;
- SafeFreePool (NewDriverOrderList);
- NewDriverOrderList = NULL;
- InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
- DriverOptionMenu.MenuNumber++;
-
- *DescriptionData = 0x0000;
- *OptionalData = 0x0000;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_UpdateBootOption (
- IN BMM_CALLBACK_DATA *CallbackData,
- IN FILE_EXPLORER_NV_DATA *NvRamMap
- )
-{
- UINT16 *BootOrderList;
- UINT16 *NewBootOrderList;
- UINTN BootOrderListSize;
- UINT16 BootString[10];
- VOID *Buffer;
- UINTN BufferSize;
- UINT8 *Ptr;
- UINT16 Index;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BOOLEAN OptionalDataExist;
- EFI_STATUS Status;
-
- OptionalDataExist = FALSE;
-
- Index = BOpt_GetBootOptionNumber ();
- UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);
-
- if (NvRamMap->DescriptionData[0] == 0x0000) {
- StrCpy (NvRamMap->DescriptionData, BootString);
- }
-
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->DescriptionData) + GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- if (NvRamMap->OptionalData[0] != 0x0000) {
- OptionalDataExist = TRUE;
- BufferSize += StrSize (NvRamMap->OptionalData);
- }
-
- Buffer = AllocateZeroPool (BufferSize);
- if (NULL == Buffer) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewMenuEntry = BOpt_CreateMenuEntry (BM_LOAD_CONTEXT_SELECT);
- if (NULL == NewMenuEntry) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = FALSE;
- NewLoadContext->LoadOptionSize = BufferSize;
- Ptr = (UINT8 *) Buffer;
- NewLoadContext->LoadOption = Ptr;
- *((UINT32 *) Ptr) = LOAD_OPTION_ACTIVE;
- NewLoadContext->Attributes = *((UINT32 *) Ptr);
- NewLoadContext->IsActive = TRUE;
- NewLoadContext->ForceReconnect = (BOOLEAN) (NewLoadContext->Attributes & LOAD_OPTION_FORCE_RECONNECT);
-
- Ptr += sizeof (UINT32);
- *((UINT16 *) Ptr) = (UINT16) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- NewLoadContext->FilePathListLength = *((UINT16 *) Ptr);
- Ptr += sizeof (UINT16);
-
- CopyMem (
- Ptr,
- NvRamMap->DescriptionData,
- StrSize (NvRamMap->DescriptionData)
- );
-
- NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->DescriptionData));
- ASSERT (NewLoadContext->Description != NULL);
-
- NewMenuEntry->DisplayString = NewLoadContext->Description;
- CopyMem (
- NewLoadContext->Description,
- (VOID *) Ptr,
- StrSize (NvRamMap->DescriptionData)
- );
-
- Ptr += StrSize (NvRamMap->DescriptionData);
- CopyMem (
- Ptr,
- CallbackData->LoadContext->FilePathList,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewLoadContext->FilePathList = AllocateZeroPool (GetDevicePathSize (CallbackData->LoadContext->FilePathList));
- ASSERT (NewLoadContext->FilePathList != NULL);
-
- CopyMem (
- NewLoadContext->FilePathList,
- (VOID *) Ptr,
- GetDevicePathSize (CallbackData->LoadContext->FilePathList)
- );
-
- NewMenuEntry->HelpString = DevicePathToStr (NewLoadContext->FilePathList);
- NewMenuEntry->OptionNumber = Index;
- NewMenuEntry->DisplayStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionStrDepository
- );
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->FeHiiHandle,
- &NewMenuEntry->DisplayStringToken,
- NewMenuEntry->DisplayString
- );
-
- NewMenuEntry->HelpStringToken = GetStringTokenFromDepository (
- CallbackData,
- BootOptionHelpStrDepository
- );
-
- CallbackData->Hii->NewString (
- CallbackData->Hii,
- NULL,
- CallbackData->FeHiiHandle,
- &NewMenuEntry->HelpStringToken,
- NewMenuEntry->HelpString
- );
-
- if (OptionalDataExist) {
- Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
-
- CopyMem (Ptr, NvRamMap->OptionalData, StrSize (NvRamMap->OptionalData));
- }
-
- Status = gRT->SetVariable (
- BootString,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BufferSize,
- Buffer
- );
-
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
- ASSERT (NewBootOrderList != NULL);
- CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
- NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
-
- if (BootOrderList != NULL) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderListSize + sizeof (UINT16),
- NewBootOrderList
- );
-
- SafeFreePool (BootOrderList);
- BootOrderList = NULL;
- SafeFreePool (NewBootOrderList);
- NewBootOrderList = NULL;
- InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
- BootOptionMenu.MenuNumber++;
-
- NvRamMap->DescriptionData[0] = 0x0000;
- NvRamMap->OptionalData[0] = 0x0000;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_UpdateBootNext (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LOAD_CONTEXT *NewLoadContext;
- BMM_FAKE_NV_DATA *CurrentFakeNVMap;
- UINT16 Index;
- EFI_STATUS Status;
-
- Status = EFI_SUCCESS;
- CurrentFakeNVMap = CallbackData->BmmFakeNvData;
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->IsBootNext = FALSE;
- }
-
- if (CurrentFakeNVMap->BootNext == BootOptionMenu.MenuNumber) {
- EfiLibDeleteVariable (L"BootNext", &gEfiGlobalVariableGuid);
- return EFI_SUCCESS;
- }
-
- NewMenuEntry = BOpt_GetMenuEntry (
- &BootOptionMenu,
- CurrentFakeNVMap->BootNext
- );
- if (NULL == NewMenuEntry) {
- return EFI_NOT_FOUND;
- }
-
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- Status = gRT->SetVariable (
- L"BootNext",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- sizeof (UINT16),
- &NewMenuEntry->OptionNumber
- );
- NewLoadContext->IsBootNext = TRUE;
- CallbackData->BmmOldFakeNVData.BootNext = CurrentFakeNVMap->BootNext;
- return Status;
-}
-
-EFI_STATUS
-Var_UpdateBootOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 *BootOrderList;
- UINT16 *NewBootOrderList;
- UINTN BootOrderListSize;
- UINT8 *Map;
-
- BootOrderList = NULL;
- BootOrderListSize = 0;
-
- //
- // First check whether BootOrder is present in current configuration
- //
- BootOrderList = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &BootOrderListSize
- );
-
- NewBootOrderList = AllocateZeroPool (BootOrderListSize);
- if (!NewBootOrderList) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Map = AllocateZeroPool (BootOrderListSize / sizeof (UINT16));
- if (!Map) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // If exists, delete it to hold new BootOrder
- //
- if (BootOrderList) {
- EfiLibDeleteVariable (L"BootOrder", &gEfiGlobalVariableGuid);
- }
-
- for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- NewBootOrderList[Index] = CallbackData->BmmFakeNvData->OptionOrder[Index] - 1;
- }
-
- Status = gRT->SetVariable (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- BootOrderListSize,
- NewBootOrderList
- );
- SafeFreePool (BootOrderList);
- SafeFreePool (NewBootOrderList);
- SafeFreePool (Map);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- BOpt_FreeMenu (&BootOptionMenu);
- BOpt_GetBootOptions (CallbackData);
-
- return EFI_SUCCESS;
-
-}
-
-EFI_STATUS
-Var_UpdateDriverOrder (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- EFI_STATUS Status;
- UINT16 Index;
- UINT16 *DriverOrderList;
- UINT16 *NewDriverOrderList;
- UINTN DriverOrderListSize;
-
- DriverOrderList = NULL;
- DriverOrderListSize = 0;
-
- //
- // First check whether DriverOrder is present in current configuration
- //
- DriverOrderList = BdsLibGetVariableAndSize (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- &DriverOrderListSize
- );
-
- NewDriverOrderList = AllocateZeroPool (DriverOrderListSize);
-
- if (!NewDriverOrderList) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // If exists, delete it to hold new DriverOrder
- //
- if (DriverOrderList) {
- EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
- }
-
- for (Index = 0; Index < DriverOrderListSize; Index++) {
- NewDriverOrderList[Index] = CallbackData->BmmFakeNvData->OptionOrder[Index] - 1;
- }
-
- Status = gRT->SetVariable (
- L"DriverOrder",
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- DriverOrderListSize,
- NewDriverOrderList
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- SafeFreePool (DriverOrderList);
-
- BOpt_FreeMenu (&DriverOptionMenu);
- BOpt_GetDriverOptions (CallbackData);
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData
- )
-{
- UINTN Index;
- UINTN Index2;
- VOID *BootOptionVar;
- CHAR16 VarName[100];
- UINTN OptionSize;
- UINT16 FilePathSize;
- UINT8 *Ptr;
- EFI_STATUS Status;
- CHAR16 DescString[100];
- UINTN NewOptionSize;
- UINT8 *NewOptionPtr;
- UINT8 *TempPtr;
- UINT32 *Attribute;
-
- BM_MENU_OPTION *OptionMenu;
- BM_LEGACY_DEVICE_CONTEXT *LegacyDeviceContext;
- UINT8 *LegacyDev;
- UINT8 *VarData;
- UINTN VarSize;
- BM_MENU_ENTRY *NewMenuEntry;
- BM_LEGACY_DEV_ORDER_CONTEXT *DevOrder;
- UINT8 *OriginalPtr;
- UINT8 *DisMap;
- UINTN Pos;
- UINTN Bit;
- UINT16 *NewOrder;
- UINT16 Tmp;
-
- LegacyDeviceContext = NULL;
- DisMap = NULL;
- NewOrder = NULL;
-
- if (FORM_SET_FD_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyFD;
- CallbackData->BbsType = BBS_FLOPPY;
- } else {
- if (FORM_SET_HD_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyHD;
- CallbackData->BbsType = BBS_HARDDISK;
- } else {
- if (FORM_SET_CD_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyCD;
- CallbackData->BbsType = BBS_CDROM;
- } else {
- if (FORM_SET_NET_ORDER_ID == CallbackData->BmmPreviousPageId) {
- OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyNET;
- CallbackData->BbsType = BBS_EMBED_NETWORK;
- } else {
- OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
- LegacyDev = CallbackData->BmmFakeNvData->LegacyBEV;
- CallbackData->BbsType = BBS_BEV_DEVICE;
- }
- }
- }
- }
-
- DisMap = CallbackData->BmmOldFakeNVData.DisableMap;
- Status = EFI_SUCCESS;
-
- //
- // Find the first device's context
- // If all devices are disabled( 0xFF == LegacyDev[0]), LegacyDeviceContext can be set to any VariableContext
- // because we just use it to fill the desc string, and user can not see the string in UI
- //
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- LegacyDeviceContext = (BM_LEGACY_DEVICE_CONTEXT *) NewMenuEntry->VariableContext;
- if (0xFF != LegacyDev[0] && LegacyDev[0] == LegacyDeviceContext->Index) {
- DEBUG ((EFI_D_ERROR, "DescStr: %s\n", LegacyDeviceContext->Description));
- break;
- }
- }
- //
- // Update the Variable "LegacyDevOrder"
- //
- VarData = (UINT8 *) BdsLibGetVariableAndSize (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- &VarSize
- );
-
- if (NULL == VarData) {
- return EFI_NOT_FOUND;
- }
-
- OriginalPtr = VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
-
- while (VarData < VarData + VarSize) {
- if (DevOrder->BbsType == CallbackData->BbsType) {
- break;
- }
-
- VarData += sizeof (BBS_TYPE);
- VarData += *(UINT16 *) VarData;
- DevOrder = (BM_LEGACY_DEV_ORDER_CONTEXT *) VarData;
- }
-
- if (VarData >= VarData + VarSize) {
- SafeFreePool (OriginalPtr);
- return EFI_NOT_FOUND;
- }
-
- NewOrder = (UINT16 *) AllocateZeroPool (DevOrder->Length - sizeof (UINT16));
- if (NULL == NewOrder) {
- SafeFreePool (VarData);
- return EFI_OUT_OF_RESOURCES;
- }
-
- for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
- if (0xFF == LegacyDev[Index]) {
- break;
- }
-
- NewOrder[Index] = LegacyDev[Index];
- }
- //
- // Only the enable/disable state of each boot device with same device type can be changed,
- // so we can count on the index information in DevOrder.
- // DisMap bit array is the only reliable source to check a device's en/dis state,
- // so we use DisMap to set en/dis state of each item in NewOrder array
- //
- for (Index2 = 0; Index2 < OptionMenu->MenuNumber; Index2++) {
- Tmp = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + Index2 * sizeof (UINT16));
- Tmp &= 0xFF;
- Pos = Tmp / 8;
- Bit = 7 - (Tmp % 8);
- if (DisMap[Pos] & (1 << Bit)) {
- NewOrder[Index] = (UINT16) (0xFF00 | Tmp);
- Index++;
- }
- }
-
- CopyMem (
- (UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16),
- NewOrder,
- DevOrder->Length - sizeof (UINT16)
- );
- SafeFreePool (NewOrder);
-
- Status = gRT->SetVariable (
- VarLegacyDevOrder,
- &EfiLegacyDevOrderGuid,
- VAR_FLAG,
- VarSize,
- OriginalPtr
- );
-
- SafeFreePool (OriginalPtr);
-
- //
- // Update Optional Data of Boot####
- //
- BootOptionVar = GetLegacyBootOptionVar (CallbackData->BbsType, &Index, &OptionSize);
-
- if (NULL != BootOptionVar) {
- CopyMem (
- DescString,
- LegacyDeviceContext->Description,
- StrSize (LegacyDeviceContext->Description)
- );
-
- NewOptionSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (DescString) + sizeof (BBS_TABLE) + sizeof (UINT16);
-
- UnicodeSPrint (VarName, 100, L"Boot%04x", Index);
-
- Ptr = BootOptionVar;
-
- Attribute = (UINT32 *) Ptr;
- *Attribute |= LOAD_OPTION_ACTIVE;
- if (0xFF == LegacyDev[0]) {
- //
- // Disable this legacy boot option
- //
- *Attribute &= ~LOAD_OPTION_ACTIVE;
- }
-
- Ptr += sizeof (UINT32);
-
- FilePathSize = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
-
- NewOptionSize += FilePathSize;
-
- NewOptionPtr = AllocateZeroPool (NewOptionSize);
- if (NULL == NewOptionPtr) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- TempPtr = NewOptionPtr;
-
- //
- // Copy previous option data to new option except the description string
- //
- CopyMem (
- TempPtr,
- BootOptionVar,
- sizeof (UINT32) + sizeof (UINT16)
- );
-
- TempPtr += (sizeof (UINT32) + sizeof (UINT16));
-
- CopyMem (
- TempPtr,
- DescString,
- StrSize (DescString)
- );
-
- TempPtr += StrSize (DescString);
-
- //
- // Description = (CHAR16 *)Ptr;
- //
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- CopyMem (
- TempPtr,
- Ptr,
- FilePathSize
- );
-
- TempPtr += FilePathSize;
-
- //
- // DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)Ptr;
- //
- Ptr += FilePathSize;
-
- //
- // Now Ptr point to optional data, i.e. Bbs Table
- //
- CopyMem (
- TempPtr,
- LegacyDeviceContext->BbsTable,
- sizeof (BBS_TABLE)
- );
-
- TempPtr += sizeof (BBS_TABLE);
- *((UINT16 *) TempPtr) = (UINT16) LegacyDeviceContext->Index;
-
- Status = gRT->SetVariable (
- VarName,
- &gEfiGlobalVariableGuid,
- VAR_FLAG,
- NewOptionSize,
- NewOptionPtr
- );
-
- SafeFreePool (NewOptionPtr);
- SafeFreePool (BootOptionVar);
- }
-
- BOpt_GetBootOptions (CallbackData);
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c deleted file mode 100644 index 4cdad1c03a..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.c +++ /dev/null @@ -1,355 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootManager.c
-
-Abstract:
-
- The platform boot manager reference implement
-
---*/
-#include "BootManager.h"
-
-UINT16 mKeyInput;
-LIST_ENTRY *mBootOptionsList;
-BDS_COMMON_OPTION *gOption;
-EFI_HII_HANDLE gBootManagerHandle;
-EFI_HANDLE BootManagerCallbackHandle;
-EFI_FORM_CALLBACK_PROTOCOL BootManagerCallback;
-EFI_GUID gBmGuid = BOOT_MANAGER_GUID;
-
-extern EFI_FORM_BROWSER_PROTOCOL *gBrowser;
-extern UINT8 BootManagerVfrBin[];
-extern UINT8 EdkGenericPlatformBdsLibStrings[];
-extern BOOLEAN gConnectAllHappened;
-
-EFI_STATUS
-EFIAPI
-BootManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- BDS_COMMON_OPTION *Option;
- LIST_ENTRY *Link;
- UINT16 KeyCount;
- EFI_HII_CALLBACK_PACKET *DataPacket;
-
- //
- // Initialize the key count
- //
- KeyCount = 0;
-
- for (Link = mBootOptionsList->ForwardLink; Link != mBootOptionsList; Link = Link->ForwardLink) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- KeyCount++;
-
- gOption = Option;
-
- //
- // Is this device the one chosen?
- //
- if (KeyCount == KeyValue) {
- //
- // Assigning the returned Key to a global allows the original routine to know what was chosen
- //
- mKeyInput = KeyValue;
-
- *Packet = AllocateZeroPool (sizeof (EFI_HII_CALLBACK_PACKET) + 2);
- ASSERT (*Packet != NULL);
-
- //
- // Assign the buffer address to DataPacket
- //
- DataPacket = *Packet;
-
- DataPacket->DataArray.EntryCount = 1;
- DataPacket->DataArray.NvRamMap = NULL;
- ((EFI_IFR_DATA_ENTRY *) (((EFI_IFR_DATA_ARRAY *)DataPacket) + 1))->Flags = EXIT_REQUIRED | NV_NOT_CHANGED;
- return EFI_SUCCESS;
- } else {
- continue;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-VOID
-CallBootManager (
- VOID
- )
-/*++
-
-Routine Description:
- Hook to enable UI timeout override behavior.
-
-Arguments:
- BdsDeviceList - Device List that BDS needs to connect.
-
- Entry - Pointer to current Boot Entry.
-
-Returns:
- NONE
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- BDS_COMMON_OPTION *Option;
- LIST_ENTRY *Link;
- EFI_HII_UPDATE_DATA *UpdateData;
- CHAR16 *ExitData;
- UINTN ExitDataSize;
- STRING_REF Token;
- STRING_REF LastToken;
- EFI_INPUT_KEY Key;
- UINT8 *Location;
- EFI_GUID BmGuid;
- LIST_ENTRY BdsBootOptionList;
- BOOLEAN BootMngrMenuResetRequired;
-
- gOption = NULL;
- InitializeListHead (&BdsBootOptionList);
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // BugBug: Here we can not remove the legacy refresh macro, so we need
- // get the boot order every time from "BootOrder" variable.
- // Recreate the boot option list base on the BootOrder variable
- //
- BdsLibEnumerateAllBootOption (&BdsBootOptionList);
-
- //
- // This GUID must be the same as what is defined in BootManagerVfr.vfr
- //
- BmGuid = gBmGuid;
-
- mBootOptionsList = &BdsBootOptionList;
-
- //
- // Post our VFR to the HII database
- //
- PackageList = PreparePackages (2, &BmGuid, BootManagerVfrBin, EdkGenericPlatformBdsLibStrings);
- Status = Hii->NewPack (Hii, PackageList, &gBootManagerHandle);
- gBS->FreePool (PackageList);
-
- //
- // This example does not implement worker functions
- // for the NV accessor functions. Only a callback evaluator
- //
- BootManagerCallback.NvRead = NULL;
- BootManagerCallback.NvWrite = NULL;
- BootManagerCallback.Callback = BootManagerCallbackRoutine;
-
- //
- // Install protocol interface
- //
- BootManagerCallbackHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &BootManagerCallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &BootManagerCallback
- );
- ASSERT_EFI_ERROR (Status);
-
- LastToken = 0;
- Hii->NewString (Hii, NULL, gBootManagerHandle, &LastToken, L" ");
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) BootManagerCallbackHandle;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- //
- // Create blank space. Since when we update the contents of IFR data at a label, it is
- // inserted at the location of the label. So if you want to add a string with an empty
- // space afterwards, you need to add the space first and then the string like below.
- //
- Status = CreateSubTitleOpCode (
- LastToken, // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
-
- //
- // Create "Boot Option Menu" title
- //
- Status = CreateSubTitleOpCode (
- STRING_TOKEN (STR_BOOT_OPTION_BANNER), // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
-
- Token = LastToken;
- mKeyInput = 0;
-
- UpdateData->DataCount = 0;
- Location = (UINT8 *) &UpdateData->Data;
-
- for (Link = BdsBootOptionList.ForwardLink; Link != &BdsBootOptionList; Link = Link->ForwardLink) {
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);
-
- //
- // At this stage we are creating a menu entry, thus the Keys are reproduceable
- //
- mKeyInput++;
- Token++;
-
- Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);
-
- //
- // If we got an error it is almost certainly due to the token value being invalid.
- // Therefore we will set the Token to 0 to automatically add a token.
- //
- if (EFI_ERROR (Status)) {
- Token = 0;
- Status = Hii->NewString (Hii, NULL, gBootManagerHandle, &Token, Option->Description);
- }
-
- Status = CreateGotoOpCode (
- 0x1000, // Form ID
- Token, // Token Value for the string
- 0, // Help String (none)
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS, // The Op-Code flags
- mKeyInput, // The Key to get a callback on
- Location // Buffer containing created op-code
- );
-
- UpdateData->DataCount++;
- Location = Location + ((EFI_IFR_OP_HEADER *) Location)->Length;
-
- }
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0001, TRUE, UpdateData);
-
- UpdateData->DataCount = 1;
-
- //
- // Create "Boot Option Menu" title
- //
- Status = CreateSubTitleOpCode (
- STRING_TOKEN (STR_HELP_FOOTER), // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
-
- Status = CreateSubTitleOpCode (
- LastToken, // Token Value for the string
- &UpdateData->Data // Buffer containing created op-code
- );
-
- Hii->UpdateForm (Hii, gBootManagerHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
-
- gBS->FreePool (UpdateData);
-
- ASSERT (gBrowser);
-
- BootMngrMenuResetRequired = FALSE;
- gBrowser->SendForm (
- gBrowser,
- TRUE,
- &gBootManagerHandle,
- 1,
- NULL,
- NULL,
- NULL,
- NULL,
- &BootMngrMenuResetRequired
- );
-
- if (BootMngrMenuResetRequired) {
- EnableResetRequired ();
- }
-
- Hii->ResetStrings (Hii, gBootManagerHandle);
-
- if (gOption == NULL) {
- return ;
- }
-
- //
- //Will leave browser, check any reset required change is applied? if yes, reset system
- //
- SetupResetReminder ();
-
- //
- // BugBug: This code looks repeated from the BDS. Need to save code space.
- //
-
- //
- // parse the selected option
- //
- Status = BdsLibBootViaBootOption (gOption, gOption->DevicePath, &ExitDataSize, &ExitData);
-
- if (!EFI_ERROR (Status)) {
- PlatformBdsBootSuccess (gOption);
- } else {
- PlatformBdsBootFail (gOption, Status, ExitData, ExitDataSize);
- gST->ConOut->OutputString (
- gST->ConOut,
- GetStringById (STRING_TOKEN (STR_ANY_KEY_CONTINUE))
- );
-
- //
- // BdsLibUiWaitForSingleEvent (gST->ConIn->WaitForKey, 0);
- //
-
- gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- }
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h deleted file mode 100644 index f9b6bbafb0..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManager.h +++ /dev/null @@ -1,50 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- BootManager.h
-
-Abstract:
-
- The platform boot manager reference implement
-
-Revision History
-
---*/
-
-#ifndef _EFI_BOOT_MANAGER_H
-#define _EFI_BOOT_MANAGER_H
-
-#include "Bds.h"
-//#include "EdkGenericPlatformBdsLib.h"
-#include "String.h"
-
-EFI_STATUS
-EFIAPI
-BootManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- );
-
-VOID
-CallBootManager (
- VOID
-);
-
-#define BOOT_MANAGER_GUID \
- { \
- 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } \
- }
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.uni Binary files differdeleted file mode 100644 index 684ac2f348..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerStrings.uni +++ /dev/null diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr deleted file mode 100644 index 9daf7b8226..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/BootMngr/BootManagerVfr.Vfr +++ /dev/null @@ -1,55 +0,0 @@ -// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// BootManager.vfr
-//
-// Abstract:
-//
-// Browser formset.
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, { 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b } }
-
-#define BOOT_MANAGER_HEADER 0x00
-#define BOOT_MANAGER_LABEL 0x01
-#define BOOT_MANAGER_TAIL 0x02
-
-
-#define BOOT_MANAGER_CLASS 0x00
-#define BOOT_MANAGER_SUBCLASS 0x01
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_BM_BANNER),
- help = STRING_TOKEN(STR_LAST_STRING),
- class = BOOT_MANAGER_CLASS,
- subclass = BOOT_MANAGER_SUBCLASS,
-
- form formid = 0x1000,
- title = STRING_TOKEN(STR_BM_BANNER);
-
- label BOOT_MANAGER_HEADER;
- label BOOT_MANAGER_LABEL;
- //
- // This is where we will dynamically add choices for the Boot Manager
- //
-
- label BOOT_MANAGER_TAIL;
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c deleted file mode 100644 index 23b83a3c44..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Capsules.c +++ /dev/null @@ -1,213 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Capsules.c
-
-Abstract:
-
- BDS routines to handle capsules.
-
---*/
-
-
-#include <Common/FlashMap.h>
-
-VOID
-BdsLockFv (
- IN EFI_CPU_IO_PROTOCOL *CpuIo,
- IN EFI_FLASH_SUBAREA_ENTRY *FlashEntry
- );
-
-VOID
-BdsLockFv (
- IN EFI_CPU_IO_PROTOCOL *CpuIo,
- IN EFI_FLASH_SUBAREA_ENTRY *FlashEntry
- )
-{
- EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
- EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
- UINT64 BaseAddress;
- UINT8 Data;
- UINT32 BlockLength;
- UINTN Index;
-
- BaseAddress = FlashEntry->Base - 0x400000 + 2;
- FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINTN) (FlashEntry->Base));
- BlockMap = &(FvHeader->FvBlockMap[0]);
-
- while ((BlockMap->NumBlocks != 0) && (BlockMap->BlockLength != 0)) {
- BlockLength = BlockMap->BlockLength;
- for (Index = 0; Index < BlockMap->NumBlocks; Index++) {
- CpuIo->Mem.Read (
- CpuIo,
- EfiCpuIoWidthUint8,
- BaseAddress,
- 1,
- &Data
- );
- Data = (UINT8) (Data | 0x3);
- CpuIo->Mem.Write (
- CpuIo,
- EfiCpuIoWidthUint8,
- BaseAddress,
- 1,
- &Data
- );
- BaseAddress += BlockLength;
- }
-
- BlockMap++;
- }
-}
-
-VOID
-BdsLockNonUpdatableFlash (
- VOID
- )
-{
- EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntryData;
- EFI_PEI_HOB_POINTERS GuidHob;
- EFI_STATUS Status;
- EFI_CPU_IO_PROTOCOL *CpuIo;
-
- Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID**)&CpuIo);
- ASSERT_EFI_ERROR (Status);
-
- GuidHob.Raw = GetHobList ();
- while ((GuidHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, GuidHob.Raw)) != NULL) {
- FlashMapEntryData = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (GuidHob.Guid);
-
- //
- // Get the variable store area
- //
- if ((FlashMapEntryData->AreaType == EFI_FLASH_AREA_RECOVERY_BIOS) ||
- (FlashMapEntryData->AreaType == EFI_FLASH_AREA_MAIN_BIOS)
- ) {
- BdsLockFv (CpuIo, &(FlashMapEntryData->Entries[0]));
- }
- GuidHob.Raw = GET_NEXT_HOB (GuidHob);
- }
-
- return ;
-}
-
-EFI_STATUS
-ProcessCapsules (
- EFI_BOOT_MODE BootMode
- )
-/*++
-
-Routine Description:
-
- This routine is called to see if there are any capsules we need to process.
- If the boot mode is not UPDATE, then we do nothing. Otherwise find the
- capsule HOBS and produce firmware volumes for them via the DXE service.
- Then call the dispatcher to dispatch drivers from them. Finally, check
- the status of the updates.
-
-Arguments:
-
- BootMode - the current boot mode
-
-Returns:
-
- EFI_INVALID_PARAMETER - boot mode is not correct for an update
-
-Note:
-
- This function should be called by BDS in case we need to do some
- sort of processing even if there is no capsule to process. We
- need to do this if an earlier update went awry and we need to
- clear the capsule variable so on the next reset PEI does not see it and
- think there is a capsule available.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HOB_CAPSULE_VOLUME *CvHob;
- EFI_PHYSICAL_ADDRESS BaseAddress;
- UINT64 Length;
- EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
- EFI_HANDLE FvProtocolHandle;
-
- //
- // We don't do anything else if the boot mode is not flash-update
- //
- if (BootMode != BOOT_ON_FLASH_UPDATE) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Only one capsule HOB allowed.
- //
- CvHob = GetFirstHob (EFI_HOB_TYPE_CV);
- if (CvHob == NULL) {
- //
- // We didn't find a hob, so had no errors.
- //
- BdsLockNonUpdatableFlash ();
- return EFI_SUCCESS;
- }
-
- BaseAddress = CvHob->BaseAddress;
- Length = CvHob->Length;
-
- Status = EFI_SUCCESS;
- //
- // Now walk the capsule and call the core to process each
- // firmware volume in it.
- //
- while (Length != 0) {
- //
- // Point to the next firmware volume header, and then
- // call the DXE service to process it.
- //
- FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
- if (FwVolHeader->FvLength > Length) {
- //
- // Notes: need to stuff this status somewhere so that the
- // error can be detected at OS runtime
- //
- Status = EFI_VOLUME_CORRUPTED;
- break;
- }
-
- Status = gDS->ProcessFirmwareVolume (
- (VOID *) (UINTN) BaseAddress,
- (UINTN) FwVolHeader->FvLength,
- &FvProtocolHandle
- );
- if (EFI_ERROR (Status)) {
- break;
- }
- //
- // Call the dispatcher to dispatch any drivers from the produced firmware volume
- //
- gDS->Dispatch ();
- //
- // On to the next FV in the capsule
- //
- Length -= FwVolHeader->FvLength;
- BaseAddress = (EFI_PHYSICAL_ADDRESS) ((UINTN) BaseAddress + FwVolHeader->FvLength);
- //
- // Notes: when capsule spec is finalized, if the requirement is made to
- // have each FV in a capsule aligned, then we will need to align the
- // BaseAddress and Length here.
- //
- }
-
-
- BdsLockNonUpdatableFlash ();
-
- return Status;
-}
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c deleted file mode 100644 index 3de404ba7c..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.c +++ /dev/null @@ -1,497 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DeviceManager.c
-
-Abstract:
-
- The platform device manager reference implement
-
---*/
-#include "DeviceManager.h"
-
-STATIC UINT16 mTokenCount;
-EFI_FRONTPAGE_CALLBACK_INFO FPCallbackInfo;
-extern UINTN gCallbackKey;
-extern EFI_FORM_BROWSER_PROTOCOL *gBrowser;
-extern EFI_GUID gBdsStringPackGuid;
-extern BOOLEAN gConnectAllHappened;
-
-STRING_REF gStringTokenTable[] = {
- STR_VIDEO_DEVICE,
- STR_NETWORK_DEVICE,
- STR_INPUT_DEVICE,
- STR_ON_BOARD_DEVICE,
- STR_OTHER_DEVICE,
- STR_EMPTY_STRING,
- 0xFFFF
-};
-
-EFI_STATUS
-EFIAPI
-DeviceManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- //
- // The KeyValue corresponds in this case to the handle which was requested to be displayed
- //
- EFI_FRONTPAGE_CALLBACK_INFO *CallbackInfo;
-
- CallbackInfo = EFI_FP_CALLBACK_DATA_FROM_THIS (This);
- switch (KeyValue) {
- case 0x2000:
- CallbackInfo->Data.VideoBIOS = (UINT8) (UINTN) (((EFI_IFR_DATA_ENTRY *)(DataArray + 1))->Data);
- gRT->SetVariable (
- L"VBIOS",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (UINT8),
- &CallbackInfo->Data.VideoBIOS
- );
- break;
-
- default:
- break;
- }
-
- gCallbackKey = KeyValue;
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeDeviceManager (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize HII information for the FrontPage
-
-Arguments:
- None
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- EFI_HII_UPDATE_DATA *UpdateData;
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- PackageList = PreparePackages (1, &gBdsStringPackGuid, DeviceManagerVfrBin);
- Status = Hii->NewPack (Hii, PackageList, &FPCallbackInfo.DevMgrHiiHandle);
- gBS->FreePool (PackageList);
-
- //
- // This example does not implement worker functions for the NV accessor functions. Only a callback evaluator
- //
- FPCallbackInfo.Signature = EFI_FP_CALLBACK_DATA_SIGNATURE;
- FPCallbackInfo.DevMgrCallback.NvRead = NULL;
- FPCallbackInfo.DevMgrCallback.NvWrite = NULL;
- FPCallbackInfo.DevMgrCallback.Callback = DeviceManagerCallbackRoutine;
-
- //
- // Install protocol interface
- //
- FPCallbackInfo.CallbackHandle = NULL;
-
- Status = gBS->InstallProtocolInterface (
- &FPCallbackInfo.CallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FPCallbackInfo.DevMgrCallback
- );
-
- ASSERT_EFI_ERROR (Status);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FPCallbackInfo.CallbackHandle;
- //
- // Simply registering the callback handle
- //
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) 0x0000, TRUE, UpdateData);
-
- gBS->FreePool (UpdateData);
- return Status;
-}
-
-EFI_STATUS
-CallDeviceManager (
- VOID
- )
-/*++
-
-Routine Description:
-
- Call the browser and display the device manager
-
-Arguments:
-
- None
-
-Returns:
- EFI_SUCCESS - Operation is successful.
- EFI_INVALID_PARAMETER - If the inputs to SendForm function is not valid.
-
---*/
-{
- EFI_STATUS Status;
- UINTN BufferSize;
- UINTN Count;
- EFI_HII_HANDLE Index;
- UINT8 *Buffer;
- EFI_IFR_FORM_SET *FormSetData;
- CHAR16 *String;
- UINTN StringLength;
- EFI_HII_UPDATE_DATA *UpdateData;
- STRING_REF Token;
- STRING_REF TokenHelp;
- IFR_OPTION *IfrOptionList;
- UINT8 *VideoOption;
- UINTN VideoOptionSize;
- EFI_HII_HANDLE *HiiHandles;
- UINT16 HandleBufferLength;
- BOOLEAN BootDeviceMngrMenuResetRequired;
-
- IfrOptionList = NULL;
- VideoOption = NULL;
- HiiHandles = NULL;
- HandleBufferLength = 0;
-
- //
- // Connect all prior to entering the platform setup menu.
- //
- if (!gConnectAllHappened) {
- BdsLibConnectAllDriversToAllControllers ();
- gConnectAllHappened = TRUE;
- }
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- Status = EFI_SUCCESS;
- Buffer = NULL;
- FormSetData = NULL;
- gCallbackKey = 0;
- if (mTokenCount == 0) {
- Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &mTokenCount, L" ");
- }
-
- Token = mTokenCount;
- TokenHelp = (UINT16) (Token + 1);
-
- //
- // Reset the menu
- //
- for (Index = 0, Count = 1; Count < 0x10000; Count <<= 1, Index++) {
- //
- // We will strip off all previous menu entries
- //
- UpdateData->DataCount = 0xFF;
-
- //
- // Erase entries on this label
- //
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, FALSE, UpdateData);
-
- //
- // Did we reach the end of the Token Table?
- //
- if (gStringTokenTable[Index] == 0xFFFF) {
- break;
- }
-
- CreateSubTitleOpCode (gStringTokenTable[Index], &UpdateData->Data);
- //
- // Add a single menu item - in this case a subtitle for the device type
- //
- UpdateData->DataCount = 1;
-
- //
- // Add default title for this label
- //
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
- }
- //
- // Add a space and an exit string. Remember since we add things at the label and push other things beyond the
- // label down, we add this in reverse order
- //
- CreateSubTitleOpCode (STRING_TOKEN (STR_EXIT_STRING), &UpdateData->Data);
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
- CreateSubTitleOpCode (STR_EMPTY_STRING, &UpdateData->Data);
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) Count, TRUE, UpdateData);
-
- //
- // Get all the Hii handles
- //
- Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandles);
- ASSERT_EFI_ERROR (Status);
-
- for (Index = 1, BufferSize = 0; Index < HandleBufferLength; Index++) {
- //
- // Am not initializing Buffer since the first thing checked is the size
- // this way I can get the real buffersize in the smallest code size
- //
- Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);
-
- if (Status != EFI_NOT_FOUND) {
- //
- // BufferSize should have the real size of the forms now
- //
- Buffer = AllocateZeroPool (BufferSize);
- ASSERT (Buffer != NULL);
-
- //
- // Am not initializing Buffer since the first thing checked is the size
- // this way I can get the real buffersize in the smallest code size
- //
- Status = Hii->GetForms (Hii, Index, 0, &BufferSize, Buffer);
-
- //
- // Skip EFI_HII_PACK_HEADER, advance to EFI_IFR_FORM_SET data.
- //
- FormSetData = (EFI_IFR_FORM_SET *) (Buffer + sizeof (EFI_HII_PACK_HEADER));
-
- //
- // If this formset belongs in the device manager, add it to the menu
- //
- if (FormSetData->Class != EFI_NON_DEVICE_CLASS) {
-
- StringLength = 0x1000;
- String = AllocateZeroPool (StringLength);
- ASSERT (String != NULL);
-
- Status = Hii->GetString (Hii, Index, FormSetData->FormSetTitle, TRUE, NULL, &StringLength, String);
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);
-
- //
- // If token value exceeded real token value - we need to add a new token values
- //
- if (Status == EFI_INVALID_PARAMETER) {
- Token = 0;
- TokenHelp = 0;
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &Token, String);
- }
-
- StringLength = 0x1000;
- if (FormSetData->Help == 0) {
- TokenHelp = 0;
- } else {
- Status = Hii->GetString (Hii, Index, FormSetData->Help, TRUE, NULL, &StringLength, String);
- if (StringLength == 0x02) {
- TokenHelp = 0;
- } else {
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);
- if (Status == EFI_INVALID_PARAMETER) {
- TokenHelp = 0;
- Status = Hii->NewString (Hii, NULL, FPCallbackInfo.DevMgrHiiHandle, &TokenHelp, String);
- }
- }
- }
-
- gBS->FreePool (String);
-
- CreateGotoOpCode (
- 0x1000, // Device Manager Page
- Token, // Description String Token
- TokenHelp, // Description Help String Token
- EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS, // Flag designating callback is active
- (UINT16) Index, // Callback key value
- &UpdateData->Data // Buffer to fill with op-code
- );
-
- //
- // In the off-chance that we have lots of extra tokens allocated to the DeviceManager
- // this ensures we are fairly re-using the tokens instead of constantly growing the token
- // storage for this one handle. If we incremented the token value beyond what it normally
- // would use, we will fall back into the error path which seeds the token value with a 0
- // so that we can correctly add a token value.
- //
- if (TokenHelp == 0) {
- //
- // Since we didn't add help, only advance Token by 1
- //
- Token++;
- } else {
- Token = (UINT16) (Token + 2);
- TokenHelp = (UINT16) (TokenHelp + 2);
- }
- //
- // This for loop basically will take the Class value which is a bitmask and
- // update the form for every active bit. There will be a label at each bit
- // location. So if someone had a device which a class of EFI_DISK_DEVICE_CLASS |
- // EFI_ON_BOARD_DEVICE_CLASS, this routine will unwind that mask and drop the menu entry
- // on each corresponding label.
- //
- for (Count = 1; Count < 0x10000; Count <<= 1) {
- //
- // This is an active bit, so update the form
- //
- if (FormSetData->Class & Count) {
- Hii->UpdateForm (
- Hii,
- FPCallbackInfo.DevMgrHiiHandle,
- (EFI_FORM_LABEL) (FormSetData->Class & Count),
- TRUE,
- UpdateData
- );
- }
- }
- }
-
- BufferSize = 0;
- //
- // Reset Buffer pointer to original location
- //
- gBS->FreePool (Buffer);
- }
- }
- //
- // Add oneof for video BIOS selection
- //
- VideoOption = BdsLibGetVariableAndSize (
- L"VBIOS",
- &gEfiGlobalVariableGuid,
- &VideoOptionSize
- );
- if (NULL == VideoOption) {
- FPCallbackInfo.Data.VideoBIOS = 0;
- } else {
- FPCallbackInfo.Data.VideoBIOS = VideoOption[0];
- gBS->FreePool (VideoOption);
- }
-
- ASSERT (FPCallbackInfo.Data.VideoBIOS <= 1);
-
- Status = gBS->AllocatePool (EfiBootServicesData, 2 * sizeof (IFR_OPTION), (VOID**) &IfrOptionList);
- if (IfrOptionList != NULL) {
- IfrOptionList[0].Flags = EFI_IFR_FLAG_INTERACTIVE;
- IfrOptionList[0].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;
- IfrOptionList[0].StringToken = STRING_TOKEN (STR_ONE_OF_PCI);
- IfrOptionList[0].Value = 0;
- IfrOptionList[0].OptionString = NULL;
- IfrOptionList[1].Flags = EFI_IFR_FLAG_INTERACTIVE;
- IfrOptionList[1].Key = SET_VIDEO_BIOS_TYPE_QUESTION_ID + 0x2000;
- IfrOptionList[1].StringToken = STRING_TOKEN (STR_ONE_OF_AGP);
- IfrOptionList[1].Value = 1;
- IfrOptionList[1].OptionString = NULL;
- IfrOptionList[FPCallbackInfo.Data.VideoBIOS].Flags |= EFI_IFR_FLAG_DEFAULT;
-
- CreateOneOfOpCode (
- SET_VIDEO_BIOS_TYPE_QUESTION_ID,
- (UINT8) 1,
- STRING_TOKEN (STR_ONE_OF_VBIOS),
- STRING_TOKEN (STR_ONE_OF_VBIOS_HELP),
- IfrOptionList,
- 2,
- &UpdateData->Data
- );
-
- UpdateData->DataCount = 4;
- Hii->UpdateForm (Hii, FPCallbackInfo.DevMgrHiiHandle, (EFI_FORM_LABEL) EFI_VBIOS_CLASS, TRUE, UpdateData);
- gBS->FreePool (IfrOptionList);
- }
-
- BootDeviceMngrMenuResetRequired = FALSE;
- Status = gBrowser->SendForm (
- gBrowser,
- TRUE, // Use the database
- &FPCallbackInfo.DevMgrHiiHandle, // The HII Handle
- 1,
- NULL,
- FPCallbackInfo.CallbackHandle,
- (UINT8 *) &FPCallbackInfo.Data,
- NULL,
- &BootDeviceMngrMenuResetRequired
- );
-
- if (BootDeviceMngrMenuResetRequired) {
- EnableResetRequired ();
- }
-
- Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);
-
- //
- // We will have returned from processing a callback - user either hit ESC to exit, or selected
- // a target to display
- //
- if (gCallbackKey != 0 && gCallbackKey < 0x2000) {
- BootDeviceMngrMenuResetRequired = FALSE;
- Status = gBrowser->SendForm (
- gBrowser,
- TRUE, // Use the database
- (EFI_HII_HANDLE *) &gCallbackKey, // The HII Handle
- 1,
- NULL,
- NULL, // This is the handle that the interface to the callback was installed on
- NULL,
- NULL,
- &BootDeviceMngrMenuResetRequired
- );
-
- if (BootDeviceMngrMenuResetRequired) {
- EnableResetRequired ();
- }
- //
- // Force return to Device Manager
- //
- gCallbackKey = 4;
- }
-
- if (gCallbackKey >= 0x2000) {
- gCallbackKey = 4;
- }
-
- gBS->FreePool (UpdateData);
- gBS->FreePool (HiiHandles);
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h deleted file mode 100644 index 54aeb4508d..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManager.h +++ /dev/null @@ -1,59 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- DeviceManager.c
-
-Abstract:
-
- The platform device manager reference implement
-
-Revision History
-
---*/
-
-#ifndef _DEVICE_MANAGER_H
-#define _DEVICE_MANAGER_H
-
-#include "FrontPage.h"
-
-#define EFI_NON_DEVICE_CLASS 0x00 // Useful when you do not want something in the Device Manager
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-
-EFI_STATUS
-EFIAPI
-DeviceManagerCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-;
-
-EFI_STATUS
-InitializeDeviceManager (
- VOID
- )
-;
-
-EFI_STATUS
-CallDeviceManager (
- VOID
- )
-;
-
-#endif
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.uni Binary files differdeleted file mode 100644 index f549ff28ac..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerStrings.uni +++ /dev/null diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr deleted file mode 100644 index 34195831a8..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/DeviceMngr/DeviceManagerVfr.Vfr +++ /dev/null @@ -1,75 +0,0 @@ -// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// DeviceManagerVfr.vfr
-//
-// Abstract:
-//
-// Device Manager formset.
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-#define FORMSET_GUID { 0x3ebfa8e6, 0x511d, 0x4b5b, { 0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27 } }
-
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-#define EFI_VBIOS_CLASS 0x40
-
-#define DEVICE_MANAGER_CLASS 0x0000
-#define FRONT_PAGE_SUBCLASS 0x0003
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),
- help = STRING_TOKEN(STR_EMPTY_STRING),
- class = DEVICE_MANAGER_CLASS,
- subclass = FRONT_PAGE_SUBCLASS,
-
- form formid = 0x1000,
- title = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE);
-
- //
- // This is where devices get added to the device manager hierarchy
- //
- subtitle text = STRING_TOKEN(STR_DISK_DEVICE);
- label EFI_DISK_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_VIDEO_DEVICE);
- label EFI_VIDEO_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_NETWORK_DEVICE);
- label EFI_NETWORK_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_INPUT_DEVICE);
- label EFI_INPUT_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_ON_BOARD_DEVICE);
- label EFI_ON_BOARD_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_OTHER_DEVICE);
- label EFI_OTHER_DEVICE_CLASS;
-
- subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
- label EFI_VBIOS_CLASS;
-
- endform;
-endformset;
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa deleted file mode 100644 index 828ab8d100..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/EdkGenericPlatformBdsLib.msa +++ /dev/null @@ -1,230 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <MsaHeader> - <ModuleName>EdkPlatformGenericBdsLib</ModuleName> - <ModuleType>DXE_DRIVER</ModuleType> - <GuidValue>f392b762-8985-11db-be87-0040d02b1835</GuidValue> - <Version>1.0</Version> - <Abstract>Generic BDS library</Abstract> - <Description>Do generic action.</Description> - <Copyright>Copyright (c) 2006, Intel Corporation</Copyright> - <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License> - <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification> - </MsaHeader> - <ModuleDefinitions> - <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures> - <BinaryModule>false</BinaryModule> - <OutputFileBasename>EdkGenericPlatformBdsLib</OutputFileBasename> - </ModuleDefinitions> - <LibraryClassDefinitions> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>DebugLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>UefiLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>UefiDriverEntryPoint</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>BaseLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>EdkGraphicsLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>DxeServicesTableLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>PerformanceLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>PrintLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>EdkIfrSupportLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>ReportStatusCodeLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>HobLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>EdkGenericBdsLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>MemoryAllocationLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>BaseMemoryLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>UefiBootServicesTableLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>UefiRuntimeServicesTableLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>DevicePathLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>HiiLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_PRODUCED"> - <Keyword>EdkGenericPlatformBdsLib</Keyword> - </LibraryClass> - <LibraryClass Usage="ALWAYS_CONSUMED"> - <Keyword>PeCoffLib</Keyword> - </LibraryClass> - </LibraryClassDefinitions> - <SourceFiles> - <Filename>Bds.h</Filename> - <Filename>BdsEntry.c</Filename> - <Filename>BdsBoot.c</Filename> - <Filename>FrontPage.h</Filename> - <Filename>FrontPage.c</Filename> - <Filename>FrontPageStrings.uni</Filename> - <Filename>FrontPageVfr.Vfr</Filename> - <Filename>Language.h</Filename> - <Filename>Language.c</Filename> - <Filename>String.h</Filename> - <Filename>String.c</Filename> - <Filename>Strings.uni</Filename> - <Filename>Capsules.c</Filename> - <Filename>MemoryTest.c</Filename> - <Filename>BootMaint/BmString.uni</Filename> - <Filename>BootMaint/Bm.vfr</Filename> - <Filename>BootMaint/BBSsupport.h</Filename> - <Filename>BootMaint/BootMaint.h</Filename> - <Filename>BootMaint/FormGuid.h</Filename> - <Filename>BootMaint/BmLib.c</Filename> - <Filename>BootMaint/BootOption.c</Filename> - <Filename>BootMaint/ConsoleOption.c</Filename> - <Filename>BootMaint/Data.c</Filename> - <Filename>BootMaint/Variable.c</Filename> - <Filename>BootMaint/UpdatePage.c</Filename> - <Filename>BootMaint/BBSsupport.c</Filename> - <Filename>BootMaint/BootMaint.c</Filename> - <Filename>BootMaint/FileExplorer.c</Filename> - <Filename>BootMaint/FE.vfr</Filename> - <Filename>BootMngr/BootManager.h</Filename> - <Filename>BootMngr/BootManager.c</Filename> - <Filename>BootMngr/BootManagerStrings.uni</Filename> - <Filename>BootMngr/BootManagerVfr.Vfr</Filename> - <Filename>DeviceMngr/DeviceManager.h</Filename> - <Filename>DeviceMngr/DeviceManager.c</Filename> - <Filename>DeviceMngr/DeviceManagerStrings.uni</Filename> - <Filename>DeviceMngr/DeviceManagerVfr.Vfr</Filename> - <!--<Filename>Bds.dxs</Filename>--> - </SourceFiles> - <PackageDependencies> - <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/> - <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/> - </PackageDependencies> - <Protocols> - <Protocol Usage="ALWAYS_PRODUCED"> - <ProtocolCName>gEfiBdsArchProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiUgaSplashProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiFormCallbackProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiDataHubProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiCpuIoProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiSerialIoProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="ALWAYS_CONSUMED"> - <ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="SOMETIMES_CONSUMED"> - <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName> - </Protocol> - <Protocol Usage="SOMETIMES_CONSUMED"> - <ProtocolCName>gEfiDriverBindingProtocolGuid</ProtocolCName> - </Protocol> - </Protocols> - <DataHubs> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>BiosVendor</DataHubCName> - </DataHubRecord> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>SystemManufacturer</DataHubCName> - </DataHubRecord> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>ProcessorVersion</DataHubCName> - </DataHubRecord> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>ProcessorFrequency</DataHubCName> - </DataHubRecord> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>MemoryArray</DataHubCName> - </DataHubRecord> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>SerialIoDevice</DataHubCName> - </DataHubRecord> - <DataHubRecord Usage="SOMETIMES_CONSUMED"> - <DataHubCName>SerialIoPort</DataHubCName> - </DataHubRecord> - </DataHubs> - <Guids> - <GuidCNames Usage="ALWAYS_CONSUMED"> - <GuidCName>gEfiBootStateGuid</GuidCName> - </GuidCNames> - <GuidCNames Usage="ALWAYS_CONSUMED"> - <GuidCName>gEfiGlobalVariableGuid</GuidCName> - </GuidCNames> - <GuidCNames Usage="ALWAYS_CONSUMED"> - <GuidCName>gEfiFlashMapHobGuid</GuidCName> - </GuidCNames> - <GuidCNames Usage="ALWAYS_CONSUMED"> - <GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName> - </GuidCNames> - <GuidCNames Usage="ALWAYS_CONSUMED"> - <GuidCName>gEfiFileInfoGuid</GuidCName> - </GuidCNames> - </Guids> - <Externs> - <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification> - <Specification>EDK_RELEASE_VERSION 0x00020000</Specification> - </Externs> -</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c deleted file mode 100644 index bcbde1a793..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.c +++ /dev/null @@ -1,901 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FrontPage.c
-
-Abstract:
-
- FrontPage routines to handle the callbacks and browser calls
-
---*/
-
-#include "Bds.h"
-#include "FrontPage.h"
-#include "String.h"
-
-EFI_GUID mProcessorSubClass = EFI_PROCESSOR_SUBCLASS_GUID;
-EFI_GUID mMemorySubClass = EFI_MEMORY_SUBCLASS_GUID;
-EFI_GUID mMiscSubClass = EFI_MISC_SUBCLASS_GUID;
-
-UINT16 mLastSelection;
-EFI_HII_HANDLE gFrontPageHandle;
-EFI_HANDLE FrontPageCallbackHandle;
-EFI_FORM_CALLBACK_PROTOCOL FrontPageCallback;
-EFI_FORM_BROWSER_PROTOCOL *gBrowser;
-UINTN gCallbackKey;
-BOOLEAN gConnectAllHappened = FALSE;
-
-extern EFI_HII_HANDLE gFrontPageHandle;
-extern EFI_GUID gBdsStringPackGuid;
-
-EFI_STATUS
-EFIAPI
-FrontPageCallbackRoutine (
- IN EFI_FORM_CALLBACK_PROTOCOL *This,
- IN UINT16 KeyValue,
- IN EFI_IFR_DATA_ARRAY *DataArray,
- OUT EFI_HII_CALLBACK_PACKET **Packet
- )
-/*++
-
-Routine Description:
-
- This is the function that is called to provide results data to the driver. This data
- consists of a unique key which is used to identify what data is either being passed back
- or being asked for.
-
-Arguments:
-
- KeyValue - A unique value which is sent to the original exporting driver so that it
- can identify the type of data to expect. The format of the data tends to
- vary based on the op-code that geerated the callback.
-
- Data - A pointer to the data being sent to the original exporting driver.
-
-Returns:
-
---*/
-{
- CHAR16 *LanguageString;
- UINTN Count;
- CHAR16 UnicodeLang[3];
- CHAR8 Lang[3];
- EFI_STATUS Status;
- UINTN Index;
- CHAR16 *TmpStr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- Count = 0;
-
- //
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
- // describe to their customers in documentation how to find their setup information (namely
- // under the device manager and specific buckets)
- //
- switch (KeyValue) {
- case 0x0001:
- //
- // This is the continue - clear the screen and return an error to get out of FrontPage loop
- //
- gCallbackKey = 1;
- break;
-
- case 0x1234:
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);
-
- //
- // Based on the DataArray->Data->Data value, we can determine
- // which language was chosen by the user
- //
- for (Index = 0; Count != (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray + 1))->Data); Index += 3) {
- Count++;
- }
- //
- // Preserve the choice the user made
- //
- mLastSelection = (UINT16) Count;
-
- //
- // The Language (in Unicode format) the user chose
- //
- CopyMem (UnicodeLang, &LanguageString[Index], 6);
-
- //
- // Convert Unicode to ASCII (Since the ISO standard assumes ASCII equivalent abbreviations
- // we can be safe in converting this Unicode stream to ASCII without any loss in meaning.
- //
- for (Index = 0; Index < 3; Index++) {
- Lang[Index] = (CHAR8) UnicodeLang[Index];
- }
-
- Status = gRT->SetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- 3,
- Lang
- );
-
- gBS->FreePool (LanguageString);
- gCallbackKey = 2;
- break;
-
- case 0x1064:
- //
- // Boot Manager
- //
- gCallbackKey = 3;
- break;
-
- case 0x8567:
- //
- // Device Manager
- //
- gCallbackKey = 4;
- break;
-
- case 0x9876:
- //
- // Boot Maintenance Manager
- //
- gCallbackKey = 5;
- break;
-
- case 0xFFFE:
-
- break;
-
- case 0xFFFF:
- //
- // FrontPage TimeOut Callback
- //
- TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- (UINTN) (((EFI_IFR_DATA_ENTRY *) (DataArray+1))->Data),
- 0
- );
- gBS->FreePool (TmpStr);
- }
- break;
-
- default:
- gCallbackKey = 0;
- break;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-InitializeFrontPage (
- BOOLEAN ReInitializeStrings
- )
-/*++
-
-Routine Description:
-
- Initialize HII information for the FrontPage
-
-Arguments:
- None
-
-Returns:
- EFI_SUCCESS - The operation is successful.
- EFI_DEVICE_ERROR - If the dynamic opcode creation failed.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- EFI_HII_UPDATE_DATA *UpdateData;
- IFR_OPTION *OptionList;
- CHAR16 *LanguageString;
- UINTN OptionCount;
- UINTN Index;
- STRING_REF Token;
- UINT16 Key;
- CHAR8 AsciiLang[4];
- CHAR16 UnicodeLang[4];
- CHAR16 Lang[4];
- CHAR16 *StringBuffer;
- UINTN BufferSize;
- UINT8 *TempBuffer;
-
- UpdateData = NULL;
- OptionList = NULL;
-
- if (ReInitializeStrings) {
- //
- // BugBug: Dont' use a goto
- //
- goto ReInitStrings;
- }
- //
- // Go ahead and initialize the Device Manager
- //
- InitializeDeviceManager ();
-
- //
- // BugBug: if FrontPageVfrBin is generated by a tool, why are we patching it here
- //
- TempBuffer = (UINT8 *) FrontPageVfrBin;
- TempBuffer = TempBuffer + sizeof (EFI_HII_PACK_HEADER);
- TempBuffer = (UINT8 *) &((EFI_IFR_FORM_SET *) TempBuffer)->NvDataSize;
- *TempBuffer = 1;
-
- gCallbackKey = 0;
-
- PackageList = PreparePackages (1, &gBdsStringPackGuid, FrontPageVfrBin);
-
- Status = Hii->NewPack (Hii, PackageList, &gFrontPageHandle);
-
- gBS->FreePool (PackageList);
-
- //
- // There will be only one FormConfig in the system
- // If there is another out there, someone is trying to install us
- // again. Fail that scenario.
- //
- Status = gBS->LocateProtocol (
- &gEfiFormBrowserProtocolGuid,
- NULL,
- (VOID**)&gBrowser
- );
-
- //
- // This example does not implement worker functions
- // for the NV accessor functions. Only a callback evaluator
- //
- FrontPageCallback.NvRead = NULL;
- FrontPageCallback.NvWrite = NULL;
- FrontPageCallback.Callback = FrontPageCallbackRoutine;
-
- //
- // Install protocol interface
- //
- FrontPageCallbackHandle = NULL;
- Status = gBS->InstallProtocolInterface (
- &FrontPageCallbackHandle,
- &gEfiFormCallbackProtocolGuid,
- EFI_NATIVE_INTERFACE,
- &FrontPageCallback
- );
- ASSERT_EFI_ERROR (Status);
-
-ReInitStrings:
- //
- // BugBug: This logic is in BdsInitLanguage. It should not be in two places!
- //
- BufferSize = 4;
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &BufferSize,
- AsciiLang
- );
-
- for (Index = 0; Index < 3; Index++) {
- UnicodeLang[Index] = (CHAR16) AsciiLang[Index];
- }
-
- UnicodeLang[3] = 0;
-
- //
- // Allocate space for creation of UpdateData Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- OptionList = AllocateZeroPool (0x1000);
- ASSERT (OptionList != NULL);
-
- //
- // Flag update pending in FormSet
- //
- UpdateData->FormSetUpdate = TRUE;
- //
- // Register CallbackHandle data for FormSet
- //
- UpdateData->FormCallbackHandle = (EFI_PHYSICAL_ADDRESS) (UINTN) FrontPageCallbackHandle;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- Hii->GetPrimaryLanguages (Hii, gFrontPageHandle, &LanguageString);
-
- OptionCount = 0;
-
- //
- // Try for a 512 byte Buffer
- //
- BufferSize = 0x200;
-
- //
- // Allocate memory for our Form binary
- //
- StringBuffer = AllocateZeroPool (BufferSize);
- ASSERT (StringBuffer != NULL);
-
- for (Index = 0; LanguageString[Index] != 0; Index += 3) {
- Token = 0;
- CopyMem (Lang, &LanguageString[Index], 6);
- Lang[3] = 0;
-
- if (!StrCmp (Lang, UnicodeLang)) {
- mLastSelection = (UINT16) OptionCount;
- }
-
- Status = Hii->GetString (Hii, gStringPackHandle, 1, TRUE, Lang, &BufferSize, StringBuffer);
- Hii->NewString (Hii, NULL, gStringPackHandle, &Token, StringBuffer);
- CopyMem (&OptionList[OptionCount].StringToken, &Token, sizeof (UINT16));
- CopyMem (&OptionList[OptionCount].Value, &OptionCount, sizeof (UINT16));
- Key = 0x1234;
- CopyMem (&OptionList[OptionCount].Key, &Key, sizeof (UINT16));
- OptionList[OptionCount].Flags = EFI_IFR_FLAG_INTERACTIVE | EFI_IFR_FLAG_NV_ACCESS;
- OptionCount++;
- }
-
- gBS->FreePool (LanguageString);
-
- if (ReInitializeStrings) {
- gBS->FreePool (StringBuffer);
- gBS->FreePool (OptionList);
- return EFI_SUCCESS;
- }
-
- Status = CreateOneOfOpCode (
- FRONT_PAGE_QUESTION_ID, // Question ID
- FRONT_PAGE_DATA_WIDTH, // Data Width
- (STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT), // Prompt Token
- (STRING_REF) STRING_TOKEN (STR_LANGUAGE_SELECT_HELP), // Help Token
- OptionList, // List of Options
- OptionCount, // Number of Options
- &UpdateData->Data // Data Buffer
- );
-
- //
- // Assign the number of options and the oneof and endoneof op-codes to count
- //
- UpdateData->DataCount = (UINT8) (OptionCount + 2);
-
- Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0x0002, TRUE, UpdateData);
-
- gBS->FreePool (UpdateData);
- //
- // gBS->FreePool (OptionList);
- //
- gBS->FreePool (StringBuffer);
- return Status;
-}
-
-EFI_STATUS
-CallFrontPage (
- VOID
- )
-/*++
-
-Routine Description:
-
- Call the browser and display the front page
-
-Arguments:
-
- None
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- UINT8 FakeNvRamMap[1];
- BOOLEAN FrontPageMenuResetRequired;
-
- //
- // Begin waiting for USER INPUT
- //
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_INPUT_WAIT)
- );
-
- FakeNvRamMap[0] = (UINT8) mLastSelection;
- FrontPageMenuResetRequired = FALSE;
- Status = gBrowser->SendForm (
- gBrowser,
- TRUE, // Use the database
- &gFrontPageHandle, // The HII Handle
- 1,
- NULL,
- FrontPageCallbackHandle, // This is the handle that the interface to the callback was installed on
- FakeNvRamMap,
- NULL,
- &FrontPageMenuResetRequired
- );
- //
- // Check whether user change any option setting which needs a reset to be effective
- //
- if (FrontPageMenuResetRequired) {
- EnableResetRequired ();
- }
-
- Hii->ResetStrings (Hii, gFrontPageHandle);
-
- return Status;
-}
-
-EFI_STATUS
-GetStringFromToken (
- IN EFI_GUID *ProducerGuid,
- IN STRING_REF Token,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Acquire the string associated with the ProducerGuid and return it.
-
-Arguments:
-
- ProducerGuid - The Guid to search the HII database for
- Token - The token value of the string to extract
- String - The string that is extracted
-
-Returns:
-
- EFI_SUCCESS - The function returns EFI_SUCCESS always.
-
---*/
-{
- EFI_STATUS Status;
- UINT16 HandleBufferLength;
- EFI_HII_HANDLE *HiiHandleBuffer;
- UINTN StringBufferLength;
- UINTN NumberOfHiiHandles;
- UINTN Index;
- UINT16 Length;
- EFI_GUID HiiGuid;
-
- //
- // Initialize params.
- //
- HandleBufferLength = 0;
- HiiHandleBuffer = NULL;
-
- //
- // Get all the Hii handles
- //
- Status = BdsLibGetHiiHandles (Hii, &HandleBufferLength, &HiiHandleBuffer);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Get the Hii Handle that matches the StructureNode->ProducerName
- //
- NumberOfHiiHandles = HandleBufferLength / sizeof (EFI_HII_HANDLE);
- for (Index = 0; Index < NumberOfHiiHandles; Index++) {
- Length = 0;
- Status = ExtractDataFromHiiHandle (
- HiiHandleBuffer[Index],
- &Length,
- NULL,
- &HiiGuid
- );
- if (CompareGuid (ProducerGuid, &HiiGuid)) {
- break;
- }
- }
- //
- // Find the string based on the current language
- //
- StringBufferLength = 0x100;
- *String = AllocateZeroPool (0x100);
- Status = Hii->GetString (
- Hii,
- HiiHandleBuffer[Index],
- Token,
- FALSE,
- NULL,
- &StringBufferLength,
- *String
- );
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (*String);
- *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
- }
-
- gBS->FreePool (HiiHandleBuffer);
- return EFI_SUCCESS;
-}
-
-VOID
-ConvertProcessorToString (
- IN EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Convert Processor Frequency Data to a string
-
-Arguments:
-
- ProcessorFrequency - The frequency data to process
- String - The string that is created
-
-Returns:
-
---*/
-{
- CHAR16 *StringBuffer;
- UINTN Index;
- UINT32 FreqMhz;
-
- if (ProcessorFrequency->Exponent >= 6) {
- FreqMhz = ProcessorFrequency->Value;
- for (Index = 0; Index < (UINTN) (ProcessorFrequency->Exponent - 6); Index++) {
- FreqMhz *= 10;
- }
- } else {
- FreqMhz = 0;
- }
-
- StringBuffer = AllocateZeroPool (0x20);
- ASSERT (StringBuffer != NULL);
- Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);
- StrCat (StringBuffer, L".");
- UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);
- StrCat (StringBuffer, L" GHz");
-
- *String = (CHAR16 *) StringBuffer;
-
- return ;
-}
-
-VOID
-ConvertMemorySizeToString (
- IN UINT32 MemorySize,
- OUT CHAR16 **String
- )
-/*++
-
-Routine Description:
-
- Convert Memory Size to a string
-
-Arguments:
-
- MemorySize - The size of the memory to process
- String - The string that is created
-
-Returns:
-
---*/
-{
- CHAR16 *StringBuffer;
-
- StringBuffer = AllocateZeroPool (0x20);
- ASSERT (StringBuffer != NULL);
- UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);
- StrCat (StringBuffer, L" MB RAM");
-
- *String = (CHAR16 *) StringBuffer;
-
- return ;
-}
-
-VOID
-UpdateFrontPageStrings (
- VOID
- )
-/*++
-
-Routine Description:
-
- Update the banner information for the Front Page based on DataHub information
-
-Arguments:
-
- None
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- STRING_REF TokenToUpdate;
- CHAR16 *NewString;
- UINT64 MonotonicCount;
- EFI_DATA_HUB_PROTOCOL *DataHub;
- EFI_DATA_RECORD_HEADER *Record;
- EFI_SUBCLASS_TYPE1_HEADER *DataHeader;
- EFI_MISC_BIOS_VENDOR_DATA *BiosVendor;
- EFI_MISC_SYSTEM_MANUFACTURER_DATA *SystemManufacturer;
- EFI_PROCESSOR_VERSION_DATA *ProcessorVersion;
- EFI_PROCESSOR_CORE_FREQUENCY_DATA *ProcessorFrequency;
- EFI_MEMORY_ARRAY_START_ADDRESS_DATA *MemoryArray;
- CHAR8 LangCode[3];
- CHAR16 Lang[3];
- UINTN Size;
- UINTN Index;
- BOOLEAN Find[5];
-
- ZeroMem (Find, sizeof (Find));
-
- //
- // Update Front Page strings
- //
- Status = gBS->LocateProtocol (
- &gEfiDataHubProtocolGuid,
- NULL,
- (VOID**)&DataHub
- );
- ASSERT_EFI_ERROR (Status);
-
- Size = 3;
-
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- LangCode
- );
-
- for (Index = 0; Index < 3; Index++) {
- Lang[Index] = (CHAR16) LangCode[Index];
- }
-
- MonotonicCount = 0;
- Record = NULL;
- do {
- Status = DataHub->GetNextRecord (DataHub, &MonotonicCount, NULL, &Record);
- if (Record->DataRecordClass == EFI_DATA_RECORD_CLASS_DATA) {
- DataHeader = (EFI_SUBCLASS_TYPE1_HEADER *) (Record + 1);
- if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
- (DataHeader->RecordType == EFI_MISC_BIOS_VENDOR_RECORD_NUMBER)
- ) {
- BiosVendor = (EFI_MISC_BIOS_VENDOR_DATA *) (DataHeader + 1);
- GetStringFromToken (&Record->ProducerName, BiosVendor->BiosVersion, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_BIOS_VERSION;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[0] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mMiscSubClass) &&
- (DataHeader->RecordType == EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER)
- ) {
- SystemManufacturer = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) (DataHeader + 1);
- GetStringFromToken (&Record->ProducerName, SystemManufacturer->SystemProductName, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_COMPUTER_MODEL;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[1] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&
- (DataHeader->RecordType == ProcessorVersionRecordType)
- ) {
- ProcessorVersion = (EFI_PROCESSOR_VERSION_DATA *) (DataHeader + 1);
- GetStringFromToken (&Record->ProducerName, *ProcessorVersion, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_MODEL;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[2] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mProcessorSubClass) &&
- (DataHeader->RecordType == ProcessorCoreFrequencyRecordType)
- ) {
- ProcessorFrequency = (EFI_PROCESSOR_CORE_FREQUENCY_DATA *) (DataHeader + 1);
- ConvertProcessorToString (ProcessorFrequency, &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_CPU_SPEED;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[3] = TRUE;
- }
-
- if (CompareGuid (&Record->DataRecordGuid, &mMemorySubClass) &&
- (DataHeader->RecordType == EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER)
- ) {
- MemoryArray = (EFI_MEMORY_ARRAY_START_ADDRESS_DATA *) (DataHeader + 1);
- ConvertMemorySizeToString((UINT32)(RShiftU64((MemoryArray->MemoryArrayEndAddress -
- MemoryArray->MemoryArrayStartAddress + 1), 20)),
- &NewString);
- TokenToUpdate = (STRING_REF) STR_FRONT_PAGE_MEMORY_SIZE;
- Hii->NewString (Hii, Lang, gFrontPageHandle, &TokenToUpdate, NewString);
- gBS->FreePool (NewString);
- Find[4] = TRUE;
- }
- }
- } while (!EFI_ERROR (Status) && (MonotonicCount != 0) && !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4]));
-
- return ;
-}
-
-VOID
-PlatformBdsEnterFrontPage (
- IN UINT16 TimeoutDefault,
- IN BOOLEAN ConnectAllHappened
- )
-/*++
-
-Routine Description:
- This function is the main entry of the platform setup entry.
- The function will present the main menu of the system setup,
- this is the platform reference part and can be customize.
-
-Arguments:
- TimeoutDefault - The fault time out value before the system
- continue to boot.
- ConnectAllHappened - The indicater to check if the connect all have
- already happended.
-
-Returns:
- None
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_UPDATE_DATA *UpdateData;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
-
- //
- // Indicate if we need connect all in the platform setup
- //
- if (ConnectAllHappened) {
- gConnectAllHappened = TRUE;
- }
- //
- // Allocate space for creation of Buffer
- //
- UpdateData = AllocateZeroPool (0x1000);
- ASSERT (UpdateData != NULL);
-
- UpdateData->FormSetUpdate = FALSE;
- UpdateData->FormCallbackHandle = 0;
- UpdateData->FormUpdate = FALSE;
- UpdateData->FormTitle = 0;
- UpdateData->DataCount = 1;
-
- //
- // Remove Banner Op-code if any at this label
- //
- Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, FALSE, UpdateData);
-
- //
- // Create Banner Op-code which reflects correct timeout value
- //
- CreateBannerOpCode (
- STRING_TOKEN (STR_TIME_OUT_PROMPT),
- TimeoutDefault,
- (UINT8) EFI_IFR_BANNER_TIMEOUT,
- &UpdateData->Data
- );
-
- //
- // Add Banner Op-code at this label
- //
- Hii->UpdateForm (Hii, gFrontPageHandle, (EFI_FORM_LABEL) 0xFFFF, TRUE, UpdateData);
-
- do {
-
- InitializeFrontPage (TRUE);
-
- //
- // Update Front Page strings
- //
- UpdateFrontPageStrings ();
-
- gCallbackKey = 0;
- PERF_START (0, "BdsTimeOut", "BDS", 0);
- Status = CallFrontPage ();
- PERF_END (0, "BdsTimeOut", "BDS", 0);
-
- //
- // If gCallbackKey is greater than 1 and less or equal to 5,
- // it will lauch configuration utilities.
- // 2 = set language
- // 3 = boot manager
- // 4 = device manager
- // 5 = boot maintainenance manager
- //
- if ((gCallbackKey > 0x0001) && (gCallbackKey <= 0x0005)) {
- REPORT_STATUS_CODE (
- EFI_PROGRESS_CODE,
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_PC_USER_SETUP)
- );
- }
- //
- // Based on the key that was set, we can determine what to do
- //
- switch (gCallbackKey) {
- //
- // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can
- // describe to their customers in documentation how to find their setup information (namely
- // under the device manager and specific buckets)
- //
- // These entries consist of the Continue, Select language, Boot Manager, and Device Manager
- //
- case 0x0001:
- //
- // User hit continue
- //
- break;
-
- case 0x0002:
- //
- // User made a language setting change - display front page again
- //
- break;
-
- case 0x0003:
- //
- // User chose to run the Boot Manager
- //
- CallBootManager ();
- break;
-
- case 0x0004:
- //
- // Display the Device Manager
- //
- do {
- CallDeviceManager();
- } while (gCallbackKey == 4);
- break;
-
- case 0x0005:
- //
- // Display the Boot Maintenance Manager
- //
- BdsStartBootMaint ();
- break;
- }
-
- } while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));
-
- //
- //Will leave browser, check any reset required change is applied? if yes, reset system
- //
- SetupResetReminder ();
-
- //
- // Automatically load current entry
- // Note: The following lines of code only execute when Auto boot
- // takes affect
- //
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID**)&ConsoleControl);
- ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h deleted file mode 100644 index 2899125428..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPage.h +++ /dev/null @@ -1,94 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- FrontPage.h
-
-Abstract:
-
- FrontPage routines to handle the callbacks and browser calls
-
-Revision History
-
---*/
-
-#ifndef _FRONT_PAGE_H
-#define _FRONT_PAGE_H
-
-#include "DeviceMngr/DeviceManager.h"
-#include "BootMaint/BootMaint.h"
-#include "BootMngr/BootManager.h"
-
-//
-// This is the VFR compiler generated header file which defines the
-// string identifiers.
-//
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-#define EFI_DISK_DEVICE_CLASS 0x01
-#define EFI_VIDEO_DEVICE_CLASS 0x02
-#define EFI_NETWORK_DEVICE_CLASS 0x04
-#define EFI_INPUT_DEVICE_CLASS 0x08
-#define EFI_ON_BOARD_DEVICE_CLASS 0x10
-#define EFI_OTHER_DEVICE_CLASS 0x20
-#define EFI_VBIOS_CLASS 0x40
-
-#define SET_VIDEO_BIOS_TYPE_QUESTION_ID 0x00
-
-#pragma pack(1)
-typedef struct {
- UINT8 VideoBIOS;
-} MyDevMgrIfrNVData;
-#pragma pack()
-
-#define EFI_FP_CALLBACK_DATA_SIGNATURE EFI_SIGNATURE_32 ('F', 'P', 'C', 'B')
-#define EFI_FP_CALLBACK_DATA_FROM_THIS(a) \
- CR (a, \
- EFI_FRONTPAGE_CALLBACK_INFO, \
- DevMgrCallback, \
- EFI_FP_CALLBACK_DATA_SIGNATURE \
- )
-
-typedef struct {
- UINTN Signature;
- MyDevMgrIfrNVData Data;
- EFI_HII_HANDLE DevMgrHiiHandle;
- EFI_HANDLE CallbackHandle;
- EFI_FORM_CALLBACK_PROTOCOL DevMgrCallback;
-} EFI_FRONTPAGE_CALLBACK_INFO;
-
-//
-// These are the VFR compiler generated data representing our VFR data.
-//
-// BugBug: we should put g in front of these tool generated globals.
-// maybe even gVrf would be a better prefix
-//
-extern UINT8 FrontPageVfrBin[];
-extern UINT8 FrontPageStringsStr[];
-extern UINT8 DeviceManagerVfrBin[];
-extern UINT8 DeviceManagerStringsStr[];
-
-#define FRONT_PAGE_QUESTION_ID 0x0000
-#define FRONT_PAGE_DATA_WIDTH 0x01
-
-EFI_STATUS
-InitializeFrontPage (
- IN BOOLEAN ReInitializeStrings
- );
-
-BOOLEAN
-TimeCompare (
- IN EFI_TIME *FirstTime,
- IN EFI_TIME *SecondTime
- );
-
-#endif // _FRONT_PAGE_H_
-
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.uni Binary files differdeleted file mode 100644 index 76dbdcfd4f..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageStrings.uni +++ /dev/null diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr deleted file mode 100644 index 8457784cc0..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/FrontPageVfr.Vfr +++ /dev/null @@ -1,159 +0,0 @@ -// *++
-//
-// Copyright (c) 2006, Intel Corporation
-// All rights reserved. This program and the accompanying materials
-// are licensed and made available under the terms and conditions of the BSD License
-// which accompanies this distribution. The full text of the license may be found at
-// http://opensource.org/licenses/bsd-license.php
-//
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-//
-// Module Name:
-//
-// FrontPageVfr.vfr
-//
-// Abstract:
-//
-// Browser formset.
-//
-// Revision History:
-//
-// --*/
-
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-#define FORMSET_GUID { 0x9e0c30bc, 0x3f06, 0x4ba6, { 0x82, 0x88, 0x9, 0x17, 0x9b, 0x85, 0x5d, 0xbe } }
-
-#define FRONT_PAGE_ITEM_ONE 0x0001
-#define FRONT_PAGE_ITEM_TWO 0x0002
-#define FRONT_PAGE_ITEM_THREE 0x0003
-#define FRONT_PAGE_ITEM_FOUR 0x0004
-#define FRONT_PAGE_ITEM_FIVE 0x0005
-
-#define FRONT_PAGE_TIMEOUT 0xFFFF
-#define FRONT_PAGE_CLASS 0x0000
-#define FRONT_PAGE_SUBCLASS 0x0002
-
-formset
- guid = FORMSET_GUID,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE),
- help = STRING_TOKEN(STR_NULL_STRING),
- class = FRONT_PAGE_CLASS,
- subclass = FRONT_PAGE_SUBCLASS,
-
- form formid = 0x1000,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_COMPUTER_MODEL),
- line 0,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_CPU_MODEL),
- line 1,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_CPU_SPEED),
- line 1,
- align right;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_BIOS_VERSION),
- line 2,
- align left;
-
- banner
- title = STRING_TOKEN(STR_FRONT_PAGE_MEMORY_SIZE),
- line 2,
- align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_LEFT),
-// line 0,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_0_RIGHT),
-// line 0,
-// align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_LEFT),
-// line 1,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_1_RIGHT),
-// line 1,
-// align right;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_2_LEFT),
-// line 2,
-// align left;
-
-// banner
-// title = STRING_TOKEN(STR_FRONT_PAGE_BANNER_3_LEFT),
-// line 3,
-// align left;
-
- goto FRONT_PAGE_ITEM_ONE,
- prompt = STRING_TOKEN(STR_CONTINUE_PROMPT),
- help = STRING_TOKEN(STR_CONTINUE_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x0001;
-
- label FRONT_PAGE_ITEM_TWO;
- //
- // This is where we will dynamically add a OneOf type op-code to select Languages from the
- // currently available choices
- //
-
- goto FRONT_PAGE_ITEM_THREE,
- prompt = STRING_TOKEN(STR_BOOT_MANAGER),
- help = STRING_TOKEN(STR_BOOT_MANAGER_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x1064;
-
- goto FRONT_PAGE_ITEM_FOUR,
- prompt = STRING_TOKEN(STR_DEVICE_MANAGER),
- help = STRING_TOKEN(STR_DEVICE_MANAGER_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x8567;
-
- goto FRONT_PAGE_ITEM_FIVE,
- prompt = STRING_TOKEN(STR_BOOT_MAINT_MANAGER),
- help = STRING_TOKEN(STR_BOOT_MAINT_MANAGER_HELP),
- flags = INTERACTIVE | NV_ACCESS,
- key = 0x9876;
-
- label FRONT_PAGE_TIMEOUT;
-// If one wanted to hard-code a value one could do it below, but our implementation follows EFI architecture
-// and honors the TimeOut NV variable
-//
-// banner
-// title = STRING_TOKEN(STR_TIME_OUT_PROMPT),
-// timeout = 0x000A;
-
- endform;
-
- form formid = FRONT_PAGE_ITEM_ONE,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
- form formid = FRONT_PAGE_ITEM_THREE,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
- form formid = FRONT_PAGE_ITEM_FOUR,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
- form formid = FRONT_PAGE_ITEM_FIVE,
- title = STRING_TOKEN(STR_FRONT_PAGE_TITLE);
- endform;
-
-endformset;
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c deleted file mode 100644 index 5091f20ac0..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.c +++ /dev/null @@ -1,435 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- language.c
-
-Abstract:
-
- Language settings
-
-Revision History
-
---*/
-
-#include "String.h"
-#include "Language.h"
-
-#define NARROW_GLYPH_NUMBER 8
-#define WIDE_GLYPH_NUMBER 75
-
-//
-// Default language code, currently is English
-//
-CHAR8 *mDefaultLangCode = "eng";
-
-typedef struct {
- EFI_HII_FONT_PACK FixedLength;
- EFI_NARROW_GLYPH NarrowArray[NARROW_GLYPH_NUMBER];
- EFI_WIDE_GLYPH WideArray[WIDE_GLYPH_NUMBER];
-} FONT_PACK;
-
-FONT_PACK mFontPack = {
- {
- {
- sizeof (EFI_HII_FONT_PACK) + (NARROW_GLYPH_NUMBER * sizeof (EFI_NARROW_GLYPH)) + (WIDE_GLYPH_NUMBER * sizeof (EFI_WIDE_GLYPH)),
- EFI_HII_FONT
- },
- NARROW_GLYPH_NUMBER,
- WIDE_GLYPH_NUMBER
- },
- { // Narrow Glyphs
- {
- 0x05d0,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x4E,
- 0x6E,
- 0x62,
- 0x32,
- 0x32,
- 0x3C,
- 0x68,
- 0x4C,
- 0x4C,
- 0x46,
- 0x76,
- 0x72,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d1,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x78,
- 0x7C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x7E,
- 0x7E,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d2,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x78,
- 0x7C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x1C,
- 0x3E,
- 0x66,
- 0x66,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d3,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x7E,
- 0x7E,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d4,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x7C,
- 0x7E,
- 0x06,
- 0x06,
- 0x06,
- 0x06,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x66,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d5,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x3C,
- 0x3C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x0C,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x05d6,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x38,
- 0x38,
- 0x1E,
- 0x1E,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x18,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- },
- {
- 0x0000,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- }
- }
- },
- { // Wide Glyphs
- {
- 0x0020,
- 0x00,
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- },
- {
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- },
- {
- 0x00,
- 0x00,
- 0x00
- }
- }, //
- }
-};
-
-VOID
-ExportFonts (
- VOID
- )
-/*++
-
-Routine Description:
- Routine to export glyphs to the HII database. This is in addition to whatever is defined in the Graphics Console driver.
-
-Arguments:
- None
-
-Returns:
-
---*/
-{
- EFI_HII_HANDLE HiiHandle;
- EFI_HII_PACKAGES *PackageList;
-
- PackageList = PreparePackages (1, NULL, &mFontPack);
- //
- // Register our Fonts into the global database
- //
- HiiHandle = 0;
- Hii->NewPack (Hii, PackageList, &HiiHandle);
-
- gBS->FreePool (PackageList);
-}
-
-VOID
-InitializeLanguage (
- BOOLEAN LangCodesSettingRequired
- )
-/*++
-
-Routine Description:
- Determine the current language that will be used
- based on language related EFI Variables
-
-Arguments:
- LangCodesSettingRequired - If required to set LangCode variable
-
-Returns:
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- UINTN Size;
- CHAR8 LangCode[ISO_639_2_ENTRY_SIZE];
- CHAR8 *LangCodes;
- CHAR16 *LanguageString;
-
- LanguageString = NULL;
- LangCodes = NULL;
-
- ExportFonts ();
-
- //
- // Collect the languages from what our current Language support is based on our VFR
- //
- Hii->GetPrimaryLanguages (Hii, gStringPackHandle, &LanguageString);
-
- LangCodes = AllocatePool (StrLen (LanguageString));
- ASSERT (LangCodes);
-
- //
- // Convert LanguageString from Unicode to EFI defined ASCII LangCodes
- //
- for (Index = 0; LanguageString[Index] != 0x0000; Index++) {
- LangCodes[Index] = (CHAR8) LanguageString[Index];
- }
-
- LangCodes[Index] = 0;
-
- if (LangCodesSettingRequired) {
- Status = gRT->SetVariable (
- L"LangCodes",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- AsciiStrLen (LangCodes),
- LangCodes
- );
- }
- //
- // Find current LangCode from Lang NV Variable
- //
- Size = ISO_639_2_ENTRY_SIZE;
- Status = gRT->GetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- &LangCode
- );
-
- if (!EFI_ERROR (Status)) {
- Status = EFI_NOT_FOUND;
- for (Index = 0; LangCodes[Index] != 0; Index += ISO_639_2_ENTRY_SIZE) {
- if (CompareMem (&LangCodes[Index], LangCode, ISO_639_2_ENTRY_SIZE) == 0) {
- Status = EFI_SUCCESS;
- break;
- }
- }
- }
- //
- // If we cannot get language code from Lang variable,
- // or LangCode cannot be found from language table,
- // set the mDefaultLangCode to Lang variable.
- //
- if (EFI_ERROR (Status)) {
- Status = gRT->SetVariable (
- L"Lang",
- &gEfiGlobalVariableGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
- ISO_639_2_ENTRY_SIZE,
- mDefaultLangCode
- );
- }
-
- if (LangCodes) {
- gBS->FreePool (LangCodes);
- }
-
- if (LanguageString != NULL) {
- gBS->FreePool (LanguageString);
- }
-
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h deleted file mode 100644 index a7c32ece0e..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Language.h +++ /dev/null @@ -1,34 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Language.h
-
-Abstract:
-
- Language setting
-
-Revision History
-
---*/
-
-#ifndef _LANGUAGE_H
-#define _LANGUAGE_H
-
-#define ISO_639_2_ENTRY_SIZE 3
-
-VOID
-InitializeLanguage (
- BOOLEAN LangCodesSettingRequired
- );
-
-#endif // _LANGUAGE_H_
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c deleted file mode 100644 index f4046b518a..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/MemoryTest.c +++ /dev/null @@ -1,430 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- MemoryTest.c
-
-Abstract:
-
- Perform the platform memory test
-
---*/
-
-#include "Bds.h"
-#include "String.h"
-
-//
-// BDS Platform Functions
-//
-EFI_STATUS
-PlatformBdsShowProgress (
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
- IN CHAR16 *Title,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
- IN UINTN Progress,
- IN UINTN PreviousValue
- )
-/*++
-
-Routine Description:
-
- Show progress bar with title above it. It only works in UGA mode.
-
-Arguments:
-
- TitleForeground - Foreground color for Title.
- TitleBackground - Background color for Title.
- Title - Title above progress bar.
- ProgressColor - Progress bar color.
- Progress - Progress (0-100)
-
-Returns:
-
- EFI_STATUS - Success update the progress bar
-
---*/
-{
- EFI_STATUS Status;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- UINTN BlockHeight;
- UINTN BlockWidth;
- UINTN BlockNum;
- UINTN PosX;
- UINTN PosY;
- UINTN Index;
-
- if (Progress > 100) {
- return EFI_INVALID_PARAMETER;
- }
-
- UgaDraw = NULL;
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID**)&GraphicsOutput
- );
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- gST->ConsoleOutHandle,
- &gEfiUgaDrawProtocolGuid,
- (VOID**)&UgaDraw
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (GraphicsOutput != NULL) {
- SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
- SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- Status = UgaDraw->GetMode (
- UgaDraw,
- &SizeOfX,
- &SizeOfY,
- &ColorDepth,
- &RefreshRate
- );
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- BlockWidth = SizeOfX / 100;
- BlockHeight = SizeOfY / 50;
-
- BlockNum = Progress;
-
- PosX = 0;
- PosY = SizeOfY * 48 / 50;
-
- if (BlockNum == 0) {
- //
- // Clear progress area
- //
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
-
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &Color,
- EfiBltVideoFill,
- 0,
- 0,
- 0,
- PosY - GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &Color,
- EfiUgaVideoFill,
- 0,
- 0,
- 0,
- PosY - GLYPH_HEIGHT - 1,
- SizeOfX,
- SizeOfY - (PosY - GLYPH_HEIGHT - 1),
- SizeOfX * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
- //
- // Show progress by drawing blocks
- //
- for (Index = PreviousValue; Index < BlockNum; Index++) {
- PosX = Index * BlockWidth;
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- &ProgressColor,
- EfiBltVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) &ProgressColor,
- EfiUgaVideoFill,
- 0,
- 0,
- PosX,
- PosY,
- BlockWidth - 1,
- BlockHeight,
- (BlockWidth) * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
-
- PrintXY (
- (SizeOfX - StrLen (Title) * GLYPH_WIDTH) / 2,
- PosY - GLYPH_HEIGHT - 1,
- &TitleForeground,
- &TitleBackground,
- Title
- );
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-BdsMemoryTest (
- IN EXTENDMEM_COVERAGE_LEVEL Level
- )
-/*++
-
-Routine Description:
-
- Perform the memory test base on the memory test intensive level,
- and update the memory resource.
-
-Arguments:
-
- Level - The memory test intensive level.
-
-Returns:
-
- EFI_STATUS - Success test all the system memory and update
- the memory resource
-
---*/
-{
- EFI_STATUS Status;
- EFI_STATUS InitStatus;
- EFI_STATUS KeyStatus;
- EFI_STATUS ReturnStatus;
- BOOLEAN RequireSoftECCInit;
- EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;
- UINT64 TestedMemorySize;
- UINT64 TotalMemorySize;
- UINTN TestPercent;
- UINT64 PreviousValue;
- BOOLEAN ErrorOut;
- BOOLEAN TestAbort;
- EFI_INPUT_KEY Key;
- CHAR16 StrPercent[16];
- CHAR16 *StrTotalMemory;
- CHAR16 *Pos;
- CHAR16 *TmpStr;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;
- UINT8 Value;
- UINTN DataSize;
-
- ReturnStatus = EFI_SUCCESS;
- ZeroMem (&Key, sizeof (EFI_INPUT_KEY));
-
- Pos = AllocatePool (128);
-
- if (Pos == NULL) {
- return ReturnStatus;
- }
-
- StrTotalMemory = Pos;
-
- TestedMemorySize = 0;
- TotalMemorySize = 0;
- PreviousValue = 0;
- ErrorOut = FALSE;
- TestAbort = FALSE;
-
- SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
- SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);
- SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);
-
- RequireSoftECCInit = FALSE;
-
- gST->ConOut->ClearScreen (gST->ConOut);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
- gST->ConOut->EnableCursor (gST->ConOut, FALSE);
-
- Status = gBS->LocateProtocol (
- &gEfiGenericMemTestProtocolGuid,
- NULL,
- (VOID**)&GenMemoryTest
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (Pos);
- return EFI_SUCCESS;
- }
-
- InitStatus = GenMemoryTest->MemoryTestInit (
- GenMemoryTest,
- Level,
- &RequireSoftECCInit
- );
- if (InitStatus == EFI_NO_MEDIA) {
- //
- // The PEI codes also have the relevant memory test code to check the memory,
- // it can select to test some range of the memory or all of them. If PEI code
- // checks all the memory, this BDS memory test will has no not-test memory to
- // do the test, and then the status of EFI_NO_MEDIA will be returned by
- // "MemoryTestInit". So it does not need to test memory again, just return.
- //
- gBS->FreePool (Pos);
- return EFI_SUCCESS;
- }
-
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);
- TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));
-
- if (TmpStr != NULL) {
- gST->ConOut->OutputString (gST->ConOut, TmpStr);
- gBS->FreePool (TmpStr);
- }
-
- do {
- Status = GenMemoryTest->PerformMemoryTest (
- GenMemoryTest,
- &TestedMemorySize,
- &TotalMemorySize,
- &ErrorOut,
- TestAbort
- );
- if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {
- TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));
- if (TmpStr != NULL) {
- PrintXY (10, 10, NULL, NULL, TmpStr);
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);
- gST->ConOut->OutputString (gST->ConOut, TmpStr);
- gBS->FreePool (TmpStr);
- }
-
- ASSERT (0);
- }
-
- TestPercent = (UINTN) DivU64x32 (
- DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),
- (UINTN)DivU64x32 (TotalMemorySize, 16)
- );
- if (TestPercent != PreviousValue) {
- UnicodeValueToString (StrPercent, 0, TestPercent, 0);
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
- TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));
- if (TmpStr != NULL) {
- BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL);
- gBS->FreePool (TmpStr);
- }
-
- TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- TestPercent,
- (UINTN) PreviousValue
- );
- gBS->FreePool (TmpStr);
- }
- }
-
- PreviousValue = TestPercent;
-
- KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if (Key.ScanCode == SCAN_ESC) {
- if (!RequireSoftECCInit) {
- TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));
- if (TmpStr != NULL) {
- PlatformBdsShowProgress (
- Foreground,
- Background,
- TmpStr,
- Color,
- 100,
- (UINTN) PreviousValue
- );
- gBS->FreePool (TmpStr);
- }
-
- gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);
- gST->ConOut->OutputString (gST->ConOut, L"100");
- Status = GenMemoryTest->Finished (GenMemoryTest);
- goto Done;
- }
-
- TestAbort = TRUE;
- }
- } while (Status != EFI_NOT_FOUND);
-
- Status = GenMemoryTest->Finished (GenMemoryTest);
-
-Done:
- UnicodeValueToString (StrTotalMemory, COMMA_TYPE, (UINTN) TotalMemorySize, 0);
- if (StrTotalMemory[0] == L',') {
- StrTotalMemory++;
- }
-
- TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));
- if (TmpStr != NULL) {
- StrCat (StrTotalMemory, TmpStr);
- gBS->FreePool (TmpStr);
- }
-
- gST->ConOut->ClearScreen (gST->ConOut);
- gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);
- gST->ConOut->EnableCursor (gST->ConOut, FALSE);
- gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);
- PlatformBdsShowProgress (
- Foreground,
- Background,
- StrTotalMemory,
- Color,
- 100,
- (UINTN) PreviousValue
- );
-
- gBS->FreePool (Pos);
-
- DataSize = sizeof (Value);
- Status = gRT->GetVariable (
- L"BootState",
- &gEfiBootStateGuid,
- NULL,
- &DataSize,
- &Value
- );
-
- if (EFI_ERROR (Status)) {
- Value = 1;
- gRT->SetVariable (
- L"BootState",
- &gEfiBootStateGuid,
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof (Value),
- &Value
- );
- }
-
- return ReturnStatus;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c deleted file mode 100644 index 1b04f02e17..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.c +++ /dev/null @@ -1,136 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- string.c
-
-Abstract:
-
- String support
-
-Revision History
-
---*/
-
-#include "Bds.h"
-#include "String.h"
-#include "Language.h"
-
-extern UINT8 EdkGenericPlatformBdsLibStrings[];
-
-EFI_GUID gBdsStringPackGuid = { 0x7bac95d3, 0xddf, 0x42f3, {0x9e, 0x24, 0x7c, 0x64, 0x49, 0x40, 0x37, 0x9a} };
-
-EFI_HII_HANDLE gStringPackHandle;
-EFI_HII_PROTOCOL *Hii;
-
-EFI_STATUS
-InitializeStringSupport (
- VOID
- )
-/*++
-
-Routine Description:
-
- Initialize HII global accessor for string support
-
-Arguments:
- None
-
-Returns:
- String from ID.
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PACKAGES *PackageList;
- //
- // There should only ever be one HII protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID**)&Hii
- );
- if (!EFI_ERROR (Status)) {
- PackageList = PreparePackages (1, &gBdsStringPackGuid, EdkGenericPlatformBdsLibStrings);
- Status = Hii->NewPack (Hii, PackageList, &gStringPackHandle);
- gBS->FreePool (PackageList);
- }
-
- return Status;
-}
-
-CHAR16 *
-GetStringById (
- IN STRING_REF Id
- )
-/*++
-
-Routine Description:
-
- Get string by string id from HII Interface
-
-Arguments:
-
- Id - String ID.
-
-Returns:
-
- CHAR16 * - String from ID.
- NULL - If error occurs.
-
---*/
-{
- CHAR16 *String;
- UINTN StringLength;
- EFI_STATUS Status;
-
- //
- // Set default string size assumption at no more than 256 bytes
- //
- StringLength = 0x100;
-
- String = AllocateZeroPool (StringLength);
- if (String == NULL) {
- //
- // If this happens, we are oh-so-dead, but return a NULL in any case.
- //
- return NULL;
- }
- //
- // Get the current string for the current Language
- //
- Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);
- if (EFI_ERROR (Status)) {
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Free the old pool
- //
- gBS->FreePool (String);
-
- //
- // Allocate new pool with correct value
- //
- String = AllocatePool (StringLength);
- ASSERT (String != NULL);
-
- Status = Hii->GetString (Hii, gStringPackHandle, Id, FALSE, NULL, &StringLength, String);
- if (!EFI_ERROR (Status)) {
- return String;
- }
- }
-
- return NULL;
- }
-
- return String;
-}
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h deleted file mode 100644 index da6a912d0b..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/String.h +++ /dev/null @@ -1,59 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- string.h
-
-Abstract:
-
- String support
-
-Revision History
-
---*/
-
-#ifndef _STRING_H_
-#define _STRING_H_
-
-//
-// This is the VFR compiler generated header file which defines the
-// string identifiers.
-//
-#include "EdkGenericPlatformBdsLibStrDefs.h"
-
-//
-// String Definition Guid for BDS Platform
-//
-#define EFI_BDS_PLATFORM_GUID \
- { \
- 0x7777E939, 0xD57E, 0x4DCB, {0xA0, 0x8E, 0x64, 0xD7, 0x98, 0x57, 0x1E, 0x0F } \
- }
-
-extern EFI_HII_HANDLE gStringPackHandle;
-extern EFI_HII_PROTOCOL *Hii;
-
-CHAR16 *
-GetStringById (
- IN STRING_REF Id
- );
-
-EFI_STATUS
-InitializeStringSupport (
- VOID
- );
-
-EFI_STATUS
-CallFrontPage (
- VOID
- );
-
-#endif // _STRING_H_
diff --git a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.uni b/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.uni Binary files differdeleted file mode 100644 index 41a6b9acde..0000000000 --- a/EdkModulePkg/Library/EdkGenericPlatformBdsLib/Strings.uni +++ /dev/null diff --git a/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa b/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa deleted file mode 100644 index 7bab91228a..0000000000 --- a/EdkModulePkg/Library/EdkGraphicsLib/EdkGraphicsLib.msa +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkGraphicsLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>08c1a0e4-1208-47f8-a2c5-f42eabee653a</GuidValue>
- <Version>1.0</Version>
- <Abstract>Graphics Library for UEFI drivers</Abstract>
- <Description>This library provides supports for basic graphic functions.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkGraphicsLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkGraphicsLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PrintLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>Graphics.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiOEMBadgingProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiConsoleControlProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiUgaDrawProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>
- </Protocol>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c b/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c deleted file mode 100644 index e718ad395f..0000000000 --- a/EdkModulePkg/Library/EdkGraphicsLib/Graphics.c +++ /dev/null @@ -1,865 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- Graphics.c
-
-Abstract:
-
- Support for Basic Graphics operations.
-
- BugBug: Currently *.BMP files are supported. This will be replaced
- when Tiano graphics format is supported.
-
---*/
-
-
-EFI_STATUS
-GetGraphicsBitMapFromFV (
- IN EFI_GUID *FileNameGuid,
- OUT VOID **Image,
- OUT UINTN *ImageSize
- )
-/*++
-
-Routine Description:
-
- Return the graphics image file named FileNameGuid into Image and return it's
- size in ImageSize. All Firmware Volumes (FV) in the system are searched for the
- file name.
-
-Arguments:
-
- FileNameGuid - File Name of graphics file in the FV(s).
-
- Image - Pointer to pointer to return graphics image. If NULL, a
- buffer will be allocated.
-
- ImageSize - Size of the graphics Image in bytes. Zero if no image found.
-
-
-Returns:
-
- EFI_SUCCESS - Image and ImageSize are valid.
- EFI_BUFFER_TOO_SMALL - Image not big enough. ImageSize has required size
- EFI_NOT_FOUND - FileNameGuid not found
-
---*/
-{
- EFI_STATUS Status;
- UINTN FvProtocolCount;
- EFI_HANDLE *FvHandles;
- EFI_FIRMWARE_VOLUME_PROTOCOL *Fv;
- UINTN Index;
- UINT32 AuthenticationStatus;
-
-
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolumeProtocolGuid,
- NULL,
- &FvProtocolCount,
- &FvHandles
- );
- if (EFI_ERROR (Status)) {
- return EFI_NOT_FOUND;
- }
-
- for (Index = 0; Index < FvProtocolCount; Index++) {
- Status = gBS->HandleProtocol (
- FvHandles[Index],
- &gEfiFirmwareVolumeProtocolGuid,
- (VOID **) &Fv
- );
-
- //
- // Assuming Image and ImageSize are correct on input.
- //
- Status = Fv->ReadSection (
- Fv,
- FileNameGuid,
- EFI_SECTION_RAW,
- 0,
- Image,
- ImageSize,
- &AuthenticationStatus
- );
- if (!EFI_ERROR (Status)) {
- return EFI_SUCCESS;
- } else if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // ImageSize updated to needed size so return
- //
- return EFI_BUFFER_TOO_SMALL;
- }
- }
-
- return EFI_NOT_FOUND;
-}
-
-STATIC
-EFI_STATUS
-ConvertBmpToGopBlt (
- IN VOID *BmpImage,
- IN UINTN BmpImageSize,
- IN OUT VOID **GopBlt,
- IN OUT UINTN *GopBltSize,
- OUT UINTN *PixelHeight,
- OUT UINTN *PixelWidth
- )
-/*++
-
-Routine Description:
-
- Convert a *.BMP graphics image to a UGA blt buffer. If a NULL UgaBlt buffer
- is passed in a UgaBlt buffer will be allocated by this routine. If a UgaBlt
- buffer is passed in it will be used if it is big enough.
-
-Arguments:
-
- BmpImage - Pointer to BMP file
-
- BmpImageSize - Number of bytes in BmpImage
-
- UgaBlt - Buffer containing UGA version of BmpImage.
-
- UgaBltSize - Size of UgaBlt in bytes.
-
- PixelHeight - Height of UgaBlt/BmpImage in pixels
-
- PixelWidth - Width of UgaBlt/BmpImage in pixels
-
-
-Returns:
-
- EFI_SUCCESS - UgaBlt and UgaBltSize are returned.
- EFI_UNSUPPORTED - BmpImage is not a valid *.BMP image
- EFI_BUFFER_TOO_SMALL - The passed in UgaBlt buffer is not big enough.
- UgaBltSize will contain the required size.
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
---*/
-{
- UINT8 *Image;
- UINT8 *ImageHeader;
- BMP_IMAGE_HEADER *BmpHeader;
- BMP_COLOR_MAP *BmpColorMap;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
- UINTN BltBufferSize;
- UINTN Index;
- UINTN Height;
- UINTN Width;
- UINTN ImageIndex;
- BOOLEAN IsAllocated;
-
- BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;
- if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
- return EFI_UNSUPPORTED;
- }
-
- if (BmpHeader->CompressionType != 0) {
- return EFI_UNSUPPORTED;
- }
-
- //
- // Calculate Color Map offset in the image.
- //
- Image = BmpImage;
- BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));
-
- //
- // Calculate graphics image data address in the image
- //
- Image = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
- ImageHeader = Image;
-
- BltBufferSize = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
- IsAllocated = FALSE;
- if (*GopBlt == NULL) {
- *GopBltSize = BltBufferSize;
- *GopBlt = AllocatePool (*GopBltSize);
- IsAllocated = TRUE;
- if (*GopBlt == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
- } else {
- if (*GopBltSize < BltBufferSize) {
- *GopBltSize = BltBufferSize;
- return EFI_BUFFER_TOO_SMALL;
- }
- }
-
- *PixelWidth = BmpHeader->PixelWidth;
- *PixelHeight = BmpHeader->PixelHeight;
-
- //
- // Convert image from BMP to Blt buffer format
- //
- BltBuffer = *GopBlt;
- for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
- Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
- for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
- switch (BmpHeader->BitPerPixel) {
- case 1:
- //
- // Convert 1bit BMP to 24-bit color
- //
- for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
- Blt->Red = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
- Blt->Green = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
- Blt->Blue = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
- Blt++;
- Width++;
- }
-
- Blt --;
- Width --;
- break;
-
- case 4:
- //
- // Convert BMP Palette to 24-bit color
- //
- Index = (*Image) >> 4;
- Blt->Red = BmpColorMap[Index].Red;
- Blt->Green = BmpColorMap[Index].Green;
- Blt->Blue = BmpColorMap[Index].Blue;
- if (Width < (BmpHeader->PixelWidth - 1)) {
- Blt++;
- Width++;
- Index = (*Image) & 0x0f;
- Blt->Red = BmpColorMap[Index].Red;
- Blt->Green = BmpColorMap[Index].Green;
- Blt->Blue = BmpColorMap[Index].Blue;
- }
- break;
-
- case 8:
- //
- // Convert BMP Palette to 24-bit color
- //
- Blt->Red = BmpColorMap[*Image].Red;
- Blt->Green = BmpColorMap[*Image].Green;
- Blt->Blue = BmpColorMap[*Image].Blue;
- break;
-
- case 24:
- Blt->Blue = *Image++;
- Blt->Green = *Image++;
- Blt->Red = *Image;
- break;
-
- default:
- if (IsAllocated) {
- gBS->FreePool (*GopBlt);
- *GopBlt = NULL;
- }
- return EFI_UNSUPPORTED;
- break;
- };
-
- }
-
- ImageIndex = (UINTN) (Image - ImageHeader);
- if ((ImageIndex % 4) != 0) {
- //
- // Bmp Image starts each row on a 32-bit boundary!
- //
- Image = Image + (4 - (ImageIndex % 4));
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-LockKeyboards (
- IN CHAR16 *Password
- )
-/*++
-
-Routine Description:
- Use Console Control Protocol to lock the Console In Spliter virtual handle.
- This is the ConInHandle and ConIn handle in the EFI system table. All key
- presses will be ignored until the Password is typed in. The only way to
- disable the password is to type it in to a ConIn device.
-
-Arguments:
- Password - Password used to lock ConIn device
-
-
-Returns:
-
- EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
- displayed.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
-
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- Status = ConsoleControl->LockStdIn (ConsoleControl, Password);
- return Status;
-}
-
-
-EFI_STATUS
-EnableQuietBoot (
- IN EFI_GUID *LogoFile
- )
-/*++
-
-Routine Description:
-
- Use Console Control to turn off UGA based Simple Text Out consoles from going
- to the UGA device. Put up LogoFile on every UGA device that is a console
-
-Arguments:
-
- LogoFile - File name of logo to display on the center of the screen.
-
-
-Returns:
-
- EFI_SUCCESS - ConsoleControl has been flipped to graphics and logo
- displayed.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
- EFI_OEM_BADGING_PROTOCOL *Badging;
- UINT32 SizeOfX;
- UINT32 SizeOfY;
- INTN DestX;
- INTN DestY;
- UINT8 *ImageData;
- UINTN ImageSize;
- UINTN BltSize;
- UINT32 Instance;
- EFI_BADGING_FORMAT Format;
- EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;
- UINTN CoordinateX;
- UINTN CoordinateY;
- UINTN Height;
- UINTN Width;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
-
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- UgaDraw = NULL;
- //
- // Try to open GOP first
- //
- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
- if (EFI_ERROR(Status)) {
- GraphicsOutput = NULL;
- //
- // Open GOP failed, try to open UGA
- //
- Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- Badging = NULL;
- Status = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);
-
- ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);
-
- if (GraphicsOutput != NULL) {
- SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
- SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
- }
-
- Instance = 0;
- while (1) {
- ImageData = NULL;
- ImageSize = 0;
-
- if (Badging != NULL) {
- Status = Badging->GetImage (
- Badging,
- &Instance,
- &Format,
- &ImageData,
- &ImageSize,
- &Attribute,
- &CoordinateX,
- &CoordinateY
- );
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Currently only support BMP format
- //
- if (Format != EfiBadgingFormatBMP) {
- gBS->FreePool (ImageData);
- continue;
- }
- } else {
- Status = GetGraphicsBitMapFromFV (LogoFile, (VOID **) &ImageData, &ImageSize);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- CoordinateX = 0;
- CoordinateY = 0;
- Attribute = EfiBadgingDisplayAttributeCenter;
- }
-
- Blt = NULL;
- BltSize = 0;
- Status = ConvertBmpToGopBlt (
- ImageData,
- ImageSize,
- (VOID**)&Blt,
- &BltSize,
- &Height,
- &Width
- );
- if (EFI_ERROR (Status)) {
- gBS->FreePool (ImageData);
- if (Badging == NULL) {
- return Status;
- } else {
- continue;
- }
- }
-
- switch (Attribute) {
- case EfiBadgingDisplayAttributeLeftTop:
- DestX = CoordinateX;
- DestY = CoordinateY;
- break;
-
- case EfiBadgingDisplayAttributeCenterTop:
- DestX = (SizeOfX - Width) / 2;
- DestY = CoordinateY;
- break;
-
- case EfiBadgingDisplayAttributeRightTop:
- DestX = (SizeOfX - Width - CoordinateX);
- DestY = CoordinateY;;
- break;
-
- case EfiBadgingDisplayAttributeCenterRight:
- DestX = (SizeOfX - Width - CoordinateX);
- DestY = (SizeOfY - Height) / 2;
- break;
-
- case EfiBadgingDisplayAttributeRightBottom:
- DestX = (SizeOfX - Width - CoordinateX);
- DestY = (SizeOfY - Height - CoordinateY);
- break;
-
- case EfiBadgingDisplayAttributeCenterBottom:
- DestX = (SizeOfX - Width) / 2;
- DestY = (SizeOfY - Height - CoordinateY);
- break;
-
- case EfiBadgingDisplayAttributeLeftBottom:
- DestX = CoordinateX;
- DestY = (SizeOfY - Height - CoordinateY);
- break;
-
- case EfiBadgingDisplayAttributeCenterLeft:
- DestX = CoordinateX;
- DestY = (SizeOfY - Height) / 2;
- break;
-
- case EfiBadgingDisplayAttributeCenter:
- DestX = (SizeOfX - Width) / 2;
- DestY = (SizeOfY - Height) / 2;
- break;
-
- default:
- DestX = CoordinateX;
- DestY = CoordinateY;
- break;
- }
-
- if ((DestX >= 0) && (DestY >= 0)) {
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- Blt,
- EfiBltBufferToVideo,
- 0,
- 0,
- (UINTN) DestX,
- (UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) Blt,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- (UINTN) DestX,
- (UINTN) DestY,
- Width,
- Height,
- Width * sizeof (EFI_UGA_PIXEL)
- );
- }
- }
-
- gBS->FreePool (ImageData);
- gBS->FreePool (Blt);
-
- if (Badging == NULL) {
- break;
- }
- }
-
- return Status;
-}
-
-
-EFI_STATUS
-DisableQuietBoot (
- VOID
- )
-/*++
-
-Routine Description:
-
- Use Console Control to turn on UGA based Simple Text Out consoles. The UGA
- Simple Text Out screens will now be synced up with all non UGA output devices
-
-Arguments:
-
- NONE
-
-Returns:
-
- EFI_SUCCESS - UGA devices are back in text mode and synced up.
- EFI_UNSUPPORTED - Logo not found
-
---*/
-{
- EFI_STATUS Status;
- EFI_CONSOLE_CONTROL_PROTOCOL *ConsoleControl;
-
- Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);
- if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
- }
-
- return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);
-}
-
-static EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
- { 0x00, 0x00, 0x00, 0x00 },
- { 0x98, 0x00, 0x00, 0x00 },
- { 0x00, 0x98, 0x00, 0x00 },
- { 0x98, 0x98, 0x00, 0x00 },
- { 0x00, 0x00, 0x98, 0x00 },
- { 0x98, 0x00, 0x98, 0x00 },
- { 0x00, 0x98, 0x98, 0x00 },
- { 0x98, 0x98, 0x98, 0x00 },
- { 0x10, 0x10, 0x10, 0x00 },
- { 0xff, 0x10, 0x10, 0x00 },
- { 0x10, 0xff, 0x10, 0x00 },
- { 0xff, 0xff, 0x10, 0x00 },
- { 0x10, 0x10, 0xff, 0x00 },
- { 0xf0, 0x10, 0xff, 0x00 },
- { 0x10, 0xff, 0xff, 0x00 },
- { 0xff, 0xff, 0xff, 0x00 }
-};
-
-STATIC
-UINTN
-_IPrint (
- IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
- IN EFI_UGA_DRAW_PROTOCOL *UgaDraw,
- IN EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto,
- IN UINTN X,
- IN UINTN Y,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
- IN CHAR16 *fmt,
- IN VA_LIST args
- )
-/*++
-
-Routine Description:
-
- Display string worker for: Print, PrintAt, IPrint, IPrintAt
-
-Arguments:
-
- GraphicsOutput - Graphics output protocol interface
-
- UgaDraw - UGA draw protocol interface
-
- Sto - Simple text out protocol interface
-
- X - X coordinate to start printing
-
- Y - Y coordinate to start printing
-
- Foreground - Foreground color
-
- Background - Background color
-
- fmt - Format string
-
- args - Print arguments
-
-Returns:
-
- EFI_SUCCESS - success
- EFI_OUT_OF_RESOURCES - out of resources
-
---*/
-{
- VOID *Buffer;
- EFI_STATUS Status;
- UINT16 GlyphWidth;
- UINT32 GlyphStatus;
- UINT16 StringIndex;
- UINTN Index;
- CHAR16 *UnicodeWeight;
- EFI_NARROW_GLYPH *Glyph;
- EFI_HII_PROTOCOL *Hii;
- EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
- UINT32 HorizontalResolution;
- UINT32 VerticalResolution;
- UINT32 ColorDepth;
- UINT32 RefreshRate;
- UINTN BufferGlyphWidth;
-
- GlyphStatus = 0;
-
- //
- // For now, allocate an arbitrarily long buffer
- //
- Buffer = AllocateZeroPool (0x10000);
- if (Buffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- if (GraphicsOutput != NULL) {
- HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
- VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
- } else {
- //
- // Get the current mode information from the UGA Draw Protocol
- //
- UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
- }
-
- LineBuffer = AllocatePool (sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_WIDTH * GLYPH_HEIGHT);
- if (LineBuffer == NULL) {
- gBS->FreePool (Buffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gBS->LocateProtocol (&gEfiHiiProtocolGuid, NULL, (VOID **) &Hii);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- UnicodeVSPrint (Buffer, 0x10000, fmt, args);
-
- UnicodeWeight = (CHAR16 *) Buffer;
-
- for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
- if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
- UnicodeWeight[Index] == CHAR_LINEFEED ||
- UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
- UnicodeWeight[Index] = 0;
- }
- }
-
- for (Index = 0; Index < StrLen (Buffer); Index++) {
- StringIndex = (UINT16) Index;
- Status = Hii->GetGlyph (Hii, UnicodeWeight, &StringIndex, (UINT8 **) &Glyph, &GlyphWidth, &GlyphStatus);
- if (EFI_ERROR (Status)) {
- goto Error;
- }
-
- if (Foreground == NULL || Background == NULL) {
- Status = Hii->GlyphToBlt (
- Hii,
- (UINT8 *) Glyph,
- mEfiColors[Sto->Mode->Attribute & 0x0f],
- mEfiColors[Sto->Mode->Attribute >> 4],
- StrLen (Buffer),
- GlyphWidth,
- GLYPH_HEIGHT,
- &LineBuffer[Index * GLYPH_WIDTH]
- );
- } else {
- Status = Hii->GlyphToBlt (
- Hii,
- (UINT8 *) Glyph,
- *Foreground,
- *Background,
- StrLen (Buffer),
- GlyphWidth,
- GLYPH_HEIGHT,
- &LineBuffer[Index * GLYPH_WIDTH]
- );
- }
- }
-
- //
- // Blt a character to the screen
- //
- BufferGlyphWidth = GLYPH_WIDTH * StrLen (Buffer);
- if (GraphicsOutput != NULL) {
- Status = GraphicsOutput->Blt (
- GraphicsOutput,
- LineBuffer,
- EfiBltBufferToVideo,
- 0,
- 0,
- X,
- Y,
- BufferGlyphWidth,
- GLYPH_HEIGHT,
- BufferGlyphWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
- );
- } else {
- Status = UgaDraw->Blt (
- UgaDraw,
- (EFI_UGA_PIXEL *) (UINTN) LineBuffer,
- EfiUgaBltBufferToVideo,
- 0,
- 0,
- X,
- Y,
- BufferGlyphWidth,
- GLYPH_HEIGHT,
- BufferGlyphWidth * sizeof (EFI_UGA_PIXEL)
- );
- }
-
-Error:
- gBS->FreePool (LineBuffer);
- gBS->FreePool (Buffer);
- return Status;
-}
-
-
-UINTN
-PrintXY (
- IN UINTN X,
- IN UINTN Y,
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround, OPTIONAL
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround, OPTIONAL
- IN CHAR16 *Fmt,
- ...
- )
-/*++
-
-Routine Description:
-
- Prints a formatted unicode string to the default console
-
-Arguments:
-
- X - X coordinate to start printing
-
- Y - Y coordinate to start printing
-
- ForeGround - Foreground color
-
- BackGround - Background color
-
- Fmt - Format string
-
- ... - Print arguments
-
-Returns:
-
- Length of string printed to the console
-
---*/
-{
- EFI_HANDLE Handle;
-
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
- EFI_UGA_DRAW_PROTOCOL *UgaDraw;
- EFI_SIMPLE_TEXT_OUT_PROTOCOL *Sto;
- EFI_STATUS Status;
- VA_LIST Args;
-
- VA_START (Args, Fmt);
-
- UgaDraw = NULL;
-
- Handle = gST->ConsoleOutHandle;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiGraphicsOutputProtocolGuid,
- (VOID **) &GraphicsOutput
- );
-
- if (EFI_ERROR (Status)) {
- GraphicsOutput = NULL;
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiUgaDrawProtocolGuid,
- (VOID **) &UgaDraw
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- Status = gBS->HandleProtocol (
- Handle,
- &gEfiSimpleTextOutProtocolGuid,
- (VOID **) &Sto
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return _IPrint (GraphicsOutput, UgaDraw, Sto, X, Y, ForeGround, BackGround, Fmt, Args);
-}
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa b/EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa deleted file mode 100644 index 87f4f7411a..0000000000 --- a/EdkModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.msa +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkIfrSupportLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>ea55bada-d488-427b-9d2d-227e0aaa3707</GuidValue>
- <Version>1.0</Version>
- <Abstract>EDK Internal Form Refresentation Support Library Instance.</Abstract>
- <Description>The library instance provides common library routines help in - IFR creation on-the-fly, HII variable access, HII database access, multi language supports.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkIfrSupportLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkIfrSupportLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiRuntimeServicesTableLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>IfrCommon.c</Filename>
- <Filename>IfrOnTheFly.c</Filename>
- <Filename>IfrOpCodeCreation.c</Filename>
- <Filename>IfrVariable.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Protocols>
- <Protocol Usage="ALWAYS_CONSUMED">
- <ProtocolCName>gEfiHiiProtocolGuid</ProtocolCName>
- </Protocol>
- </Protocols>
- <Variables>
- <Variable Usage="ALWAYS_CONSUMED">
- <VariableName>0x004C 0x0061 0x006E</VariableName>
- <GuidC_Name>gLanGuid</GuidC_Name>
- </Variable>
- </Variables>
- <Guids>
- <GuidCNames Usage="ALWAYS_CONSUMED">
- <GuidCName>gEfiGlobalVariableGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>IfrLibConstruct</Constructor>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c deleted file mode 100644 index b2c906476d..0000000000 --- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrCommon.c +++ /dev/null @@ -1,1000 +0,0 @@ -/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrCommon.c
-
-Abstract:
-
- Common Library Routines to assist in IFR creation on-the-fly
-
-Revision History:
-
---*/
-
-EFI_STATUS
-EFIAPI
-IfrLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-GetCurrentLanguage (
- OUT CHAR16 *Lang
- )
-/*++
-
-Routine Description:
-
- Determine what is the current language setting
-
-Arguments:
-
- Lang - Pointer of system language
-
-Returns:
-
- Status code
-
---*/
-{
- EFI_STATUS Status;
- UINTN Size;
- UINTN Index;
- CHAR8 Language[4];
-
- //
- // Getting the system language and placing it into our Global Data
- //
- Size = sizeof (Language);
-
- Status = gRT->GetVariable (
- (CHAR16 *) L"Lang",
- &gEfiGlobalVariableGuid,
- NULL,
- &Size,
- Language
- );
-
- if (EFI_ERROR (Status)) {
- AsciiStrCpy (Language, "eng");
- }
-
- for (Index = 0; Index < 3; Index++) {
- //
- // Bitwise AND ascii value with 0xDF yields an uppercase value.
- // Sign extend into a unicode value
- //
- Lang[Index] = (CHAR16) (Language[Index] & 0xDF);
- }
-
- //
- // Null-terminate the value
- //
- Lang[3] = (CHAR16) 0;
-
- return Status;
-}
-
-
-EFI_STATUS
-AddString (
- IN VOID *StringBuffer,
- IN CHAR16 *Language,
- IN CHAR16 *String,
- IN OUT STRING_REF *StringToken
- )
-/*++
-
-Routine Description:
-
- Add a string to the incoming buffer and return the token and offset data
-
-Arguments:
-
- StringBuffer - The incoming buffer
-
- Language - Currrent language
-
- String - The string to be added
-
- StringToken - The index where the string placed
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - String successfully added to the incoming buffer
-
---*/
-{
- EFI_HII_STRING_PACK *StringPack;
- EFI_HII_STRING_PACK *StringPackBuffer;
- VOID *NewBuffer;
- RELOFST *PackSource;
- RELOFST *PackDestination;
- UINT8 *Source;
- UINT8 *Destination;
- UINTN Index;
- BOOLEAN Finished;
- UINTN SizeofLanguage;
- UINTN SizeofString;
-
- StringPack = (EFI_HII_STRING_PACK *) StringBuffer;
- Finished = FALSE;
-
- //
- // Pre-allocate a buffer sufficient for us to work on.
- // We will use it as a destination scratch pad to build data on
- // and when complete shift the data back to the original buffer
- //
- NewBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);
- if (NewBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- StringPackBuffer = (EFI_HII_STRING_PACK *) NewBuffer;
-
- //
- // StringPack is terminated with a length 0 entry
- //
- for (; StringPack->Header.Length != 0;) {
- //
- // If this stringpack's language is same as CurrentLanguage, use it
- //
- if (CompareMem ((VOID *) ((CHAR8 *) (StringPack) + StringPack->LanguageNameString), Language, 3) == 0) {
- //
- // We have some data in this string pack, copy the string package up to the string data
- //
- CopyMem (&StringPackBuffer->Header, &StringPack->Header, sizeof (StringPack));
-
- //
- // These are references in the structure to tokens, need to increase them by the space occupied by an additional StringPointer
- //
- StringPackBuffer->LanguageNameString = (UINT16) (StringPackBuffer->LanguageNameString + (UINT16) sizeof (RELOFST));
- StringPackBuffer->PrintableLanguageName = (UINT16) (StringPackBuffer->PrintableLanguageName + (UINT16) sizeof (RELOFST));
-
- PackSource = (RELOFST *) (StringPack + 1);
- PackDestination = (RELOFST *) (StringPackBuffer + 1);
- for (Index = 0; PackSource[Index] != 0x0000; Index++) {
- //
- // Copy the stringpointers from old to new buffer
- // remember that we are adding a string, so the string offsets will all go up by sizeof (RELOFST)
- //
- PackDestination[Index] = (UINT16) (PackDestination[Index] + sizeof (RELOFST));
- }
-
- //
- // Add a new stringpointer in the new buffer since we are adding a string. Null terminate it
- //
- PackDestination[Index] = (UINT16)(PackDestination[Index-1] +
- StrSize((CHAR16 *)((CHAR8 *)(StringPack) + PackSource[Index-1])));
- PackDestination[Index + 1] = (UINT16) 0;
-
- //
- // Index is the token value for the new string
- //
- *StringToken = (UINT16) Index;
-
- //
- // Source now points to the beginning of the old buffer strings
- // Destination now points to the beginning of the new buffer strings
- //
- Source = (UINT8 *) &PackSource[Index + 1];
- Destination = (UINT8 *) &PackDestination[Index + 2];
-
- //
- // This should copy all the strings from the old buffer to the new buffer
- //
- for (; Index != 0; Index--) {
- //
- // Copy Source string to destination buffer
- //
- StrCpy ((CHAR16 *) Destination, (CHAR16 *) Source);
-
- //
- // Adjust the source/destination to the next string location
- //
- Destination = Destination + StrSize ((CHAR16 *) Source);
- Source = Source + StrSize ((CHAR16 *) Source);
- }
-
- //
- // This copies the new string to the destination buffer
- //
- StrCpy ((CHAR16 *) Destination, (CHAR16 *) String);
-
- //
- // Adjust the size of the changed string pack by adding the size of the new string
- // along with the size of the additional offset entry for the new string
- //
- StringPackBuffer->Header.Length = (UINT32) ((UINTN) StringPackBuffer->Header.Length + StrSize (String) + sizeof (RELOFST));
-
- //
- // Advance the buffers to point to the next spots.
- //
- StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPackBuffer->Header.Length);
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);
- Finished = TRUE;
- continue;
- }
- //
- // This isn't the language of the stringpack we were asked to add a string to
- // so we need to copy it to the new buffer.
- //
- CopyMem (&StringPackBuffer->Header, &StringPack->Header, StringPack->Header.Length);
-
- //
- // Advance the buffers to point to the next spots.
- //
- StringPackBuffer = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPackBuffer) + StringPack->Header.Length);
- StringPack = (EFI_HII_STRING_PACK *) ((CHAR8 *) (StringPack) + StringPack->Header.Length);
- }
-
- //
- // If we didn't copy the new data to a stringpack yet
- //
- if (!Finished) {
- PackDestination = (RELOFST *) (StringPackBuffer + 1);
- //
- // Pointing to a new string pack location
- //
- SizeofLanguage = StrSize (Language);
- SizeofString = StrSize (String);
- StringPackBuffer->Header.Length = (UINT32)
- (
- sizeof (EFI_HII_STRING_PACK) -
- sizeof (EFI_STRING) +
- sizeof (RELOFST) +
- sizeof (RELOFST) +
- SizeofLanguage +
- SizeofString
- );
- StringPackBuffer->Header.Type = EFI_HII_STRING;
- StringPackBuffer->LanguageNameString = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
- StringPackBuffer->PrintableLanguageName = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
- StringPackBuffer->Attributes = 0;
- PackDestination[0] = (UINT16) ((UINTN) &PackDestination[3] - (UINTN) StringPackBuffer);
- PackDestination[1] = (UINT16) (PackDestination[0] + StrSize (Language));
- PackDestination[2] = (UINT16) 0;
-
- //
- // The first string location will be set to destination. The minimum number of strings
- // associated with a stringpack will always be token 0 stored as the languagename (e.g. ENG, SPA, etc)
- // and token 1 as the new string being added and and null entry for the stringpointers
- //
- Destination = (UINT8 *) &PackDestination[3];
-
- //
- // Copy the language name string to the new buffer
- //
- StrCpy ((CHAR16 *) Destination, Language);
-
- //
- // Advance the destination to the new empty spot
- //
- Destination = Destination + StrSize (Language);
-
- //
- // Copy the string to the new buffer
- //
- StrCpy ((CHAR16 *) Destination, String);
-
- //
- // Since we are starting with a new string pack - we know the new string is token 1
- //
- *StringToken = (UINT16) 1;
- }
-
- //
- // Zero out the original buffer and copy the updated data in the new buffer to the old buffer
- //
- ZeroMem (StringBuffer, DEFAULT_STRING_BUFFER_SIZE);
- CopyMem (StringBuffer, NewBuffer, DEFAULT_STRING_BUFFER_SIZE);
-
- //
- // Free the newly created buffer since we don't need it anymore
- //
- gBS->FreePool (NewBuffer);
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-AddOpCode (
- IN VOID *FormBuffer,
- IN OUT VOID *OpCodeData
- )
-/*++
-
-Routine Description:
-
- Add op-code data to the FormBuffer
-
-Arguments:
-
- FormBuffer - Form buffer to be inserted to
-
- OpCodeData - Op-code data to be inserted
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Op-code data successfully inserted
-
---*/
-{
- EFI_HII_PACK_HEADER *NewBuffer;
- UINT8 *Source;
- UINT8 *Destination;
-
- //
- // Pre-allocate a buffer sufficient for us to work on.
- // We will use it as a destination scratch pad to build data on
- // and when complete shift the data back to the original buffer
- //
- NewBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE);
- if (NewBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Source = (UINT8 *) FormBuffer;
- Destination = (UINT8 *) NewBuffer;
-
- //
- // Copy the IFR Package header to the new buffer
- //
- CopyMem (Destination, Source, sizeof (EFI_HII_PACK_HEADER));
-
- //
- // Advance Source and Destination to next op-code
- //
- Source = Source + sizeof (EFI_HII_PACK_HEADER);
- Destination = Destination + sizeof (EFI_HII_PACK_HEADER);
-
- //
- // Copy data to the new buffer until we run into the end_form
- //
- for (; ((EFI_IFR_OP_HEADER *) Source)->OpCode != EFI_IFR_END_FORM_OP;) {
- //
- // If the this opcode is an end_form_set we better be creating and endform
- // Nonetheless, we will add data before the end_form_set. This also provides
- // for interesting behavior in the code we will run, but has no bad side-effects
- // since we will possibly do a 0 byte copy in this particular end-case.
- //
- if (((EFI_IFR_OP_HEADER *) Source)->OpCode == EFI_IFR_END_FORM_SET_OP) {
- break;
- }
-
- //
- // Copy data to new buffer
- //
- CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);
-
- //
- // Adjust Source/Destination to next op-code location
- //
- Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
- Source = Source + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
- }
-
- //
- // Prior to the end_form is where we insert the new op-code data
- //
- CopyMem (Destination, OpCodeData, ((EFI_IFR_OP_HEADER *) OpCodeData)->Length);
- Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) OpCodeData)->Length;
-
- NewBuffer->Length = (UINT32) (NewBuffer->Length + (UINT32) (((EFI_IFR_OP_HEADER *) OpCodeData)->Length));
-
- //
- // Copy end-form data to new buffer
- //
- CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);
-
- //
- // Adjust Source/Destination to next op-code location
- //
- Destination = Destination + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
- Source = Source + (UINTN) ((EFI_IFR_OP_HEADER *) Source)->Length;
-
- //
- // Copy end-formset data to new buffer
- //
- CopyMem (Destination, Source, ((EFI_IFR_OP_HEADER *) Source)->Length);
-
- //
- // Zero out the original buffer and copy the updated data in the new buffer to the old buffer
- //
- ZeroMem (FormBuffer, DEFAULT_FORM_BUFFER_SIZE);
- CopyMem (FormBuffer, NewBuffer, DEFAULT_FORM_BUFFER_SIZE);
-
- //
- // Free the newly created buffer since we don't need it anymore
- //
- gBS->FreePool (NewBuffer);
- return EFI_SUCCESS;
-}
-
-STATIC
-EFI_STATUS
-GetHiiInterface (
- OUT EFI_HII_PROTOCOL **Hii
- )
-/*++
-
-Routine Description:
-
- Get the HII protocol interface
-
-Arguments:
-
- Hii - HII protocol interface
-
-Returns:
-
- Status code
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // There should only be one HII protocol
- //
- Status = gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID **) Hii
- );
-
- return Status;;
-}
-
-
-EFI_STATUS
-ExtractDataFromHiiHandle (
- IN EFI_HII_HANDLE HiiHandle,
- IN OUT UINT16 *ImageLength,
- OUT UINT8 *DefaultImage,
- OUT EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
-
- Extract information pertaining to the HiiHandle
-
-Arguments:
-
- HiiHandle - Hii handle
-
- ImageLength - For input, length of DefaultImage;
- For output, length of actually required
-
- DefaultImage - Image buffer prepared by caller
-
- Guid - Guid information about the form
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_BUFFER_TOO_SMALL - DefualtImage has no enough ImageLength
-
- EFI_SUCCESS - Successfully extract data from Hii database.
-
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PROTOCOL *Hii;
- UINTN DataLength;
- UINT8 *RawData;
- UINT8 *OldData;
- UINTN Index;
- UINTN Temp;
- UINTN SizeOfNvStore;
- UINTN CachedStart;
-
- DataLength = DEFAULT_FORM_BUFFER_SIZE;
- SizeOfNvStore = 0;
- CachedStart = 0;
-
- Status = GetHiiInterface (&Hii);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (DataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (RawData);
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (DataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &DataLength, RawData);
- }
-
- OldData = RawData;
-
- //
- // Point RawData to the beginning of the form data
- //
- RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER));
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_FORM_SET_OP:
- //
- // Copy the GUID information from this handle
- //
- CopyMem (Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
- break;
-
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_CHECKBOX_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_DATE_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- //
- // Remember, multiple op-codes may reference the same item, so let's keep a running
- // marker of what the highest QuestionId that wasn't zero length. This will accurately
- // maintain the Size of the NvStore
- //
- if (((EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) {
- Temp = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- if (SizeOfNvStore < Temp) {
- SizeOfNvStore = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- }
- }
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- //
- // Return an error if buffer is too small
- //
- if (SizeOfNvStore > *ImageLength) {
- gBS->FreePool (OldData);
- *ImageLength = (UINT16) SizeOfNvStore;
- return EFI_BUFFER_TOO_SMALL;
- }
-
- if (DefaultImage != NULL) {
- ZeroMem (DefaultImage, SizeOfNvStore);
- }
-
- //
- // Copy the default image information to the user's buffer
- //
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_ONE_OF_OP:
- CachedStart = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- if (((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Flags & EFI_IFR_FLAG_DEFAULT) {
- CopyMem (&DefaultImage[CachedStart], &((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value, 2);
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- DefaultImage[((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId] = ((EFI_IFR_CHECKBOX *) &RawData[Index])->Flags;
- break;
-
- case EFI_IFR_NUMERIC_OP:
- CopyMem (
- &DefaultImage[((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId],
- &((EFI_IFR_NUMERIC *) &RawData[Index])->Default,
- 2
- );
- break;
-
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- *ImageLength = (UINT16) SizeOfNvStore;
-
- //
- // Free our temporary repository of form data
- //
- gBS->FreePool (OldData);
-
- return EFI_SUCCESS;
-}
-
-
-EFI_HII_HANDLE
-FindHiiHandle (
- IN OUT EFI_HII_PROTOCOL **HiiProtocol, OPTIONAL
- IN EFI_GUID *Guid
- )
-/*++
-
-Routine Description:
- Finds HII handle for given pack GUID previously registered with the HII.
-
-Arguments:
- HiiProtocol - pointer to pointer to HII protocol interface.
- If NULL, the interface will be found but not returned.
- If it points to NULL, the interface will be found and
- written back to the pointer that is pointed to.
- Guid - The GUID of the pack that registered with the HII.
-
-Returns:
- Handle to the HII pack previously registered by the memory driver.
-
---*/
-{
- EFI_STATUS Status;
-
- EFI_HII_HANDLE *HiiHandleBuffer;
- EFI_HII_HANDLE HiiHandle;
- UINT16 HiiHandleBufferLength;
- UINT32 NumberOfHiiHandles;
- EFI_GUID HiiGuid;
- EFI_HII_PROTOCOL *HiiProt;
- UINT32 Index;
- UINT16 Length;
-
- HiiHandle = 0;
- if ((HiiProtocol != NULL) && (*HiiProtocol != NULL)) {
- //
- // The protocol has been passed in
- //
- HiiProt = *HiiProtocol;
- } else {
- gBS->LocateProtocol (
- &gEfiHiiProtocolGuid,
- NULL,
- (VOID **) &HiiProt
- );
- if (HiiProt == NULL) {
- return HiiHandle;
- }
-
- if (HiiProtocol != NULL) {
- //
- // Return back the HII protocol for the caller as promissed
- //
- *HiiProtocol = HiiProt;
- }
- }
- //
- // Allocate buffer
- //
- HiiHandleBufferLength = 10;
- HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);
- ASSERT (HiiHandleBuffer != NULL);
-
- //
- // Get the Handles of the packages that were registered with Hii
- //
- Status = HiiProt->FindHandles (
- HiiProt,
- &HiiHandleBufferLength,
- HiiHandleBuffer
- );
-
- //
- // Get a bigger bugffer if this one is to small, and try again
- //
- if (Status == EFI_BUFFER_TOO_SMALL) {
-
- gBS->FreePool (HiiHandleBuffer);
-
- HiiHandleBuffer = AllocatePool (HiiHandleBufferLength);
- ASSERT (HiiHandleBuffer != NULL);
-
- Status = HiiProt->FindHandles (
- HiiProt,
- &HiiHandleBufferLength,
- HiiHandleBuffer
- );
- }
-
- if (EFI_ERROR (Status)) {
- goto lbl_exit;
- }
-
- NumberOfHiiHandles = HiiHandleBufferLength / sizeof (EFI_HII_HANDLE);
-
- //
- // Iterate Hii handles and look for the one that matches our Guid
- //
- for (Index = 0; Index < NumberOfHiiHandles; Index++) {
-
- Length = 0;
- ExtractDataFromHiiHandle (HiiHandleBuffer[Index], &Length, NULL, &HiiGuid);
-
- if (CompareGuid (&HiiGuid, Guid)) {
-
- HiiHandle = HiiHandleBuffer[Index];
- break;
- }
- }
-
-lbl_exit:
- gBS->FreePool (HiiHandleBuffer);
- return HiiHandle;
-}
-
-
-EFI_STATUS
-ValidateDataFromHiiHandle (
- IN EFI_HII_HANDLE HiiHandle,
- OUT BOOLEAN *Results
- )
-/*++
-
-Routine Description:
-
- Validate that the data associated with the HiiHandle in NVRAM is within
- the reasonable parameters for that FormSet. Values for strings and passwords
- are not verified due to their not having the equivalent of valid range settings.
-
-Arguments:
-
- HiiHandle - Handle of the HII database entry to query
-
- Results - If return Status is EFI_SUCCESS, Results provides valid data
- TRUE = NVRAM Data is within parameters
- FALSE = NVRAM Data is NOT within parameters
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Data successfully validated
---*/
-{
- EFI_STATUS Status;
- EFI_HII_PROTOCOL *Hii;
- EFI_GUID Guid;
- UINT8 *RawData;
- UINT8 *OldData;
- UINTN RawDataLength;
- UINT8 *VariableData;
- UINTN Index;
- UINTN Temp;
- UINTN SizeOfNvStore;
- UINTN CachedStart;
- BOOLEAN GotMatch;
-
- RawDataLength = DEFAULT_FORM_BUFFER_SIZE;
- SizeOfNvStore = 0;
- CachedStart = 0;
- GotMatch = FALSE;
- *Results = TRUE;
-
- Status = GetHiiInterface (&Hii);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (RawDataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);
-
- if (EFI_ERROR (Status)) {
- gBS->FreePool (RawData);
-
- //
- // Allocate space for retrieval of IFR data
- //
- RawData = AllocateZeroPool (RawDataLength);
- if (RawData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Get all the forms associated with this HiiHandle
- //
- Status = Hii->GetForms (Hii, HiiHandle, 0, &RawDataLength, RawData);
- }
-
- OldData = RawData;
-
- //
- // Point RawData to the beginning of the form data
- //
- RawData = (UINT8 *) ((UINTN) RawData + sizeof (EFI_HII_PACK_HEADER));
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- if (RawData[Index] == EFI_IFR_FORM_SET_OP) {
- CopyMem (&Guid, &((EFI_IFR_FORM_SET *) &RawData[Index])->Guid, sizeof (EFI_GUID));
- break;
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_FORM_SET_OP:
- break;
-
- case EFI_IFR_ONE_OF_OP:
- case EFI_IFR_CHECKBOX_OP:
- case EFI_IFR_NUMERIC_OP:
- case EFI_IFR_DATE_OP:
- case EFI_IFR_TIME_OP:
- case EFI_IFR_PASSWORD_OP:
- case EFI_IFR_STRING_OP:
- //
- // Remember, multiple op-codes may reference the same item, so let's keep a running
- // marker of what the highest QuestionId that wasn't zero length. This will accurately
- // maintain the Size of the NvStore
- //
- if (((EFI_IFR_ONE_OF *) &RawData[Index])->Width != 0) {
- Temp = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- if (SizeOfNvStore < Temp) {
- SizeOfNvStore = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId + ((EFI_IFR_ONE_OF *) &RawData[Index])->Width;
- }
- }
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- //
- // Allocate memory for our File Form Tags
- //
- VariableData = AllocateZeroPool (SizeOfNvStore);
- if (VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gRT->GetVariable (
- (CHAR16 *) L"Setup",
- &Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableData
- );
-
- if (EFI_ERROR (Status)) {
-
- //
- // If there is a variable that exists already and it is larger than what we calculated the
- // storage needs to be, we must assume the variable size from GetVariable is correct and not
- // allow the truncation of the variable. It is very possible that the user who created the IFR
- // we are cracking is not referring to a variable that was in a previous map, however we cannot
- // allow it's truncation.
- //
- if (Status == EFI_BUFFER_TOO_SMALL) {
- //
- // Free the buffer that was allocated that was too small
- //
- gBS->FreePool (VariableData);
-
- VariableData = AllocatePool (SizeOfNvStore);
- if (VariableData == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- Status = gRT->GetVariable (
- (CHAR16 *) L"Setup",
- &Guid,
- NULL,
- &SizeOfNvStore,
- (VOID *) VariableData
- );
- }
- }
-
- //
- // Walk through the form and see that the variable data it refers to is ok.
- // This allows for the possibility of stale (obsoleted) data in the variable
- // can be overlooked without causing an error
- //
- for (Index = 0; RawData[Index] != EFI_IFR_END_FORM_SET_OP;) {
- switch (RawData[Index]) {
- case EFI_IFR_ONE_OF_OP:
- //
- // A one_of has no data, its the option that does - cache the storage Id
- //
- CachedStart = ((EFI_IFR_ONE_OF *) &RawData[Index])->QuestionId;
- break;
-
- case EFI_IFR_ONE_OF_OPTION_OP:
- //
- // A one_of_option can be any value
- //
- if (VariableData[CachedStart] == ((EFI_IFR_ONE_OF_OPTION *) &RawData[Index])->Value) {
- GotMatch = TRUE;
- }
- break;
-
- case EFI_IFR_END_ONE_OF_OP:
- //
- // At this point lets make sure that the data value in the NVRAM matches one of the options
- //
- if (!GotMatch) {
- *Results = FALSE;
- return EFI_SUCCESS;
- }
- break;
-
- case EFI_IFR_CHECKBOX_OP:
- //
- // A checkbox is a boolean, so 0 and 1 are valid
- // Remember, QuestionId corresponds to the offset location of the data in the variable
- //
- if (VariableData[((EFI_IFR_CHECKBOX *) &RawData[Index])->QuestionId] > 1) {
- *Results = FALSE;
- return EFI_SUCCESS;
- }
- break;
-
- case EFI_IFR_NUMERIC_OP:
- if ((VariableData[((EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] < ((EFI_IFR_NUMERIC *)&RawData[Index])->Minimum) ||
- (VariableData[((EFI_IFR_NUMERIC *)&RawData[Index])->QuestionId] > ((EFI_IFR_NUMERIC *)&RawData[Index])->Maximum)) {
- *Results = FALSE;
- return EFI_SUCCESS;
- }
- break;
-
- }
-
- Index = RawData[Index + 1] + Index;
- }
-
- //
- // Free our temporary repository of form data
- //
- gBS->FreePool (OldData);
- gBS->FreePool (VariableData);
-
- return EFI_SUCCESS;
-}
-
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c deleted file mode 100644 index e3d1040896..0000000000 --- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOnTheFly.c +++ /dev/null @@ -1,972 +0,0 @@ -/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrOnTheFly.c
-
-Abstract:
-
- Library Routines to create IFR on-the-fly
-
-Revision History:
-
---*/
-
-EFI_STATUS
-CreateFormSet (
- IN CHAR16 *FormSetTitle,
- IN EFI_GUID *Guid,
- IN UINT8 Class,
- IN UINT8 SubClass,
- IN OUT VOID **FormBuffer,
- IN OUT VOID **StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a formset
-
-Arguments:
-
- FormSetTitle - Title of formset
-
- Guid - Guid of formset
-
- Class - Class of formset
-
- SubClass - Sub class of formset
-
- FormBuffer - Pointer of the formset created
-
- StringBuffer - Pointer of FormSetTitile string created
-
-Returns:
-
- EFI_OUT_OF_RESOURCES - No enough buffer to allocate
-
- EFI_SUCCESS - Formset successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_HII_IFR_PACK IfrPack;
- EFI_IFR_FORM_SET FormSet;
- EFI_IFR_END_FORM_SET EndFormSet;
- UINT8 *Destination;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Pre-allocate a buffer sufficient for us to work from.
- //
- FormBuffer = AllocateZeroPool (DEFAULT_FORM_BUFFER_SIZE);
- if (FormBuffer == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Pre-allocate a buffer sufficient for us to work from.
- //
- StringBuffer = AllocateZeroPool (DEFAULT_STRING_BUFFER_SIZE);
- if (StringBuffer == NULL) {
- gBS->FreePool (FormBuffer);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add the FormSetTitle to the string buffer and get the StringToken
- //
- Status = AddString (*StringBuffer, CurrentLanguage, FormSetTitle, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
- // Initialize the Ifr Package header data
- //
- IfrPack.Header.Length = sizeof (EFI_HII_PACK_HEADER) + sizeof (EFI_IFR_FORM_SET) + sizeof (EFI_IFR_END_FORM_SET);
- IfrPack.Header.Type = EFI_HII_IFR;
-
- //
- // Initialize FormSet with the appropriate information
- //
- FormSet.Header.OpCode = EFI_IFR_FORM_SET_OP;
- FormSet.Header.Length = sizeof (EFI_IFR_FORM_SET);
- FormSet.FormSetTitle = StringToken;
- FormSet.Class = Class;
- FormSet.SubClass = SubClass;
- CopyMem (&FormSet.Guid, Guid, sizeof (EFI_GUID));
-
- //
- // Initialize the end formset data
- //
- EndFormSet.Header.Length = sizeof (EFI_IFR_END_FORM_SET);
- EndFormSet.Header.OpCode = EFI_IFR_END_FORM_SET_OP;
-
- Destination = (UINT8 *) *FormBuffer;
-
- //
- // Copy the formset/endformset data to the form buffer
- //
- CopyMem (Destination, &IfrPack, sizeof (EFI_HII_PACK_HEADER));
-
- Destination = Destination + sizeof (EFI_HII_PACK_HEADER);
-
- CopyMem (Destination, &FormSet, sizeof (EFI_IFR_FORM_SET));
-
- Destination = Destination + sizeof (EFI_IFR_FORM_SET);
-
- CopyMem (Destination, &EndFormSet, sizeof (EFI_IFR_END_FORM_SET));
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateForm (
- IN CHAR16 *FormTitle,
- IN UINT16 FormId,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a form
-
-Arguments:
-
- FormTitle - Title of the form
-
- FormId - Id of the form
-
- FormBuffer - Pointer of the form created
-
- StringBuffer - Pointer of FormTitil string created
-
-Returns:
-
- EFI_SUCCESS - Form successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_FORM Form;
- EFI_IFR_END_FORM EndForm;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- Status = AddString (StringBuffer, CurrentLanguage, FormTitle, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Form.Header.OpCode = EFI_IFR_FORM_OP;
- Form.Header.Length = sizeof (EFI_IFR_FORM);
- Form.FormId = FormId;
- Form.FormTitle = StringToken;
-
- Status = AddOpCode (FormBuffer, &Form);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- EndForm.Header.OpCode = EFI_IFR_END_FORM_OP;
- EndForm.Header.Length = sizeof (EFI_IFR_END_FORM);
-
- Status = AddOpCode (FormBuffer, &EndForm);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateSubTitle (
- IN CHAR16 *SubTitle,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a SubTitle
-
-Arguments:
-
- SubTitle - Sub title to be created
-
- FormBuffer - Where this subtitle to add to
-
- StringBuffer - String buffer created for subtitle
-
-Returns:
-
- EFI_SUCCESS - Subtitle successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_SUBTITLE Subtitle;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- Status = AddString (StringBuffer, CurrentLanguage, SubTitle, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
- Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
- Subtitle.SubTitle = StringToken;
-
- Status = AddOpCode (FormBuffer, &Subtitle);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateText (
- IN CHAR16 *String,
- IN CHAR16 *String2,
- IN CHAR16 *String3,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a line of text
-
-Arguments:
-
- String - First string of the text
-
- String2 - Second string of the text
-
- String3 - Help string of the text
-
- Flags - Flag of the text
-
- Key - Key of the text
-
- FormBuffer - The form where this text adds to
-
- StringBuffer - String buffer created for String, String2 and String3
-
-Returns:
-
- EFI_SUCCESS - Text successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_TEXT Text;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, String, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Text.Header.OpCode = EFI_IFR_TEXT_OP;
- Text.Header.Length = sizeof (EFI_IFR_TEXT);
- Text.Text = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, String2, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Text.TextTwo = StringToken;
-
- Text.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
- Text.Key = Key;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, String3, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Text.Help = StringToken;
-
- Status = AddOpCode (FormBuffer, &Text);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateGoto (
- IN UINT16 FormId,
- IN CHAR16 *Prompt,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a hyperlink
-
-Arguments:
-
- FormId - Form ID of the hyperlink
-
- Prompt - Prompt of the hyperlink
-
- FormBuffer - The form where this hyperlink adds to
-
- StringBuffer - String buffer created for Prompt
-
-Returns:
-
- EFI_SUCCESS - Hyperlink successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_REF Hyperlink;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Hyperlink.Header.OpCode = EFI_IFR_REF_OP;
- Hyperlink.Header.Length = sizeof (EFI_IFR_REF);
- Hyperlink.FormId = FormId;
- Hyperlink.Prompt = StringToken;
-
- Status = AddOpCode (FormBuffer, &Hyperlink);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateOneOf (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of question with a set of options to choose from. The
- OptionsList is a pointer to a null-terminated list of option descriptions.
-
-Arguments:
-
- QuestionId - Question ID of the one-of box
-
- DataWidth - DataWidth of the one-of box
-
- Prompt - Prompt of the one-of box
-
- Help - Help of the one-of box
-
- OptionsList - Each string in it is an option of the one-of box
-
- OptionCount - Option string count
-
- FormBuffer - The form where this one-of box adds to
-
- StringBuffer - String buffer created for Prompt, Help and Option strings
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
- EFI_SUCCESS - One-Of box successfully created.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_IFR_ONE_OF OneOf;
- EFI_IFR_ONE_OF_OPTION OneOfOption;
- EFI_IFR_END_ONE_OF EndOneOf;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // We do not create op-code storage widths for one-of in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
- OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
- OneOf.QuestionId = QuestionId;
- OneOf.Width = DataWidth;
- OneOf.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OneOf.Help = StringToken;
-
- Status = AddOpCode (FormBuffer, &OneOf);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < OptionCount; Index++) {
- OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- //
- // Add string and get token back
- //
- Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
-
- OneOfOption.Option = StringToken;
- OneOfOption.Value = OptionsList[Index].Value;
- OneOfOption.Flags = (UINT8) (OptionsList[Index].Flags | EFI_IFR_FLAG_CREATED);
- OneOfOption.Key = OptionsList[Index].Key;
-
- Status = AddOpCode (FormBuffer, &OneOfOption);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- EndOneOf.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOneOf.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- Status = AddOpCode (FormBuffer, &EndOneOf);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateOrderedList (
- IN UINT16 QuestionId,
- IN UINT8 MaxEntries,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of question with a set of options to choose from. The
- OptionsList is a pointer to a null-terminated list of option descriptions.
-
-Arguments:
-
- QuestionId - Question ID of the ordered list
-
- MaxEntries - MaxEntries of the ordered list
-
- Prompt - Prompt of the ordered list
-
- Help - Help of the ordered list
-
- OptionsList - Each string in it is an option of the ordered list
-
- OptionCount - Option string count
-
- FormBuffer - The form where this ordered list adds to
-
- StringBuffer - String buffer created for Prompt, Help and Option strings
-
-Returns:
-
- EFI_SUCCESS - Ordered list successfully created.
-
---*/
-{
- EFI_STATUS Status;
- UINTN Index;
- EFI_IFR_ORDERED_LIST OrderedList;
- EFI_IFR_ONE_OF_OPTION OrderedListOption;
- EFI_IFR_END_ONE_OF EndOrderedList;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
- OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
- OrderedList.QuestionId = QuestionId;
- OrderedList.MaxEntries = MaxEntries;
- OrderedList.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- OrderedList.Help = StringToken;
-
- Status = AddOpCode (FormBuffer, &OrderedList);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- for (Index = 0; Index < OptionCount; Index++) {
- OrderedListOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OrderedListOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- //
- // Add string and get token back
- //
- Status = AddString (StringBuffer, CurrentLanguage, OptionsList[Index].OptionString, &StringToken);
-
- OrderedListOption.Option = StringToken;
- OrderedListOption.Value = OptionsList[Index].Value;
- OrderedListOption.Flags = (UINT8) (OptionsList[Index].Flags | EFI_IFR_FLAG_CREATED);
- OrderedListOption.Key = OptionsList[Index].Key;
-
- Status = AddOpCode (FormBuffer, &OrderedListOption);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
- }
-
- EndOrderedList.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOrderedList.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- Status = AddOpCode (FormBuffer, &EndOrderedList);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateCheckBox (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT8 Flags,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a checkbox
-
-Arguments:
-
- QuestionId - Question ID of the check box
-
- DataWidth - DataWidth of the check box
-
- Prompt - Prompt of the check box
-
- Help - Help of the check box
-
- Flags - Flags of the check box
-
- FormBuffer - The form where this check box adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 1
-
- EFI_SUCCESS - Check box successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_CHECKBOX CheckBox;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // We do not create op-code storage widths for checkbox in excess of 8 bits for now
- //
- if (DataWidth > 1) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
- CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
- CheckBox.QuestionId = QuestionId;
- CheckBox.Width = DataWidth;
- CheckBox.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- CheckBox.Help = StringToken;
- CheckBox.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
-
- Status = AddOpCode (FormBuffer, &CheckBox);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateNumeric (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT16 Minimum,
- IN UINT16 Maximum,
- IN UINT16 Step,
- IN UINT16 Default,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric
-
-Arguments:
-
- QuestionId - Question ID of the numeric
-
- DataWidth - DataWidth of the numeric
-
- Prompt - Prompt of the numeric
-
- Help - Help of the numeric
-
- Minimum - Minumun boundary of the numeric
-
- Maximum - Maximum boundary of the numeric
-
- Step - Step of the numeric
-
- Default - Default value
-
- Flags - Flags of the numeric
-
- Key - Key of the numeric
-
- FormBuffer - The form where this numeric adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
- EFI_SUCCESS - Numeric is successfully created
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_NUMERIC Numeric;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // We do not create op-code storage widths for numerics in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
- Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
- Numeric.QuestionId = QuestionId;
- Numeric.Width = DataWidth;
- Numeric.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Numeric.Help = StringToken;
- Numeric.Minimum = Minimum;
- Numeric.Maximum = Maximum;
- Numeric.Step = Step;
- Numeric.Default = Default;
- Numeric.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
- Numeric.Key = Key;
-
- Status = AddOpCode (FormBuffer, &Numeric);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateString (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN CHAR16 *Prompt,
- IN CHAR16 *Help,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer,
- IN OUT VOID *StringBuffer
- )
-/*++
-
-Routine Description:
-
- Create a string
-
-Arguments:
-
- QuestionId - Question ID of the string
-
- DataWidth - DataWidth of the string
-
- Prompt - Prompt of the string
-
- Help - Help of the string
-
- MinSize - Min size boundary of the string
-
- MaxSize - Max size boundary of the string
-
- Flags - Flags of the string
-
- Key - Key of the string
-
- FormBuffer - The form where this string adds to
-
- StringBuffer - String buffer created for Prompt and Help.
-
-Returns:
-
- EFI_SUCCESS - String successfully created.
-
---*/
-{
- EFI_STATUS Status;
- EFI_IFR_STRING String;
- CHAR16 CurrentLanguage[4];
- STRING_REF StringToken;
-
- //
- // Obtain current language value
- //
- GetCurrentLanguage (CurrentLanguage);
-
- //
- // Add first string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Prompt, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- String.Header.OpCode = EFI_IFR_STRING_OP;
- String.Header.Length = sizeof (EFI_IFR_STRING);
- String.QuestionId = QuestionId;
- String.Width = DataWidth;
- String.Prompt = StringToken;
-
- //
- // Add second string, get first string's token
- //
- Status = AddString (StringBuffer, CurrentLanguage, Help, &StringToken);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- String.Help = StringToken;
- String.MinSize = MinSize;
- String.MaxSize = MaxSize;
- String.Flags = (UINT8) (Flags | EFI_IFR_FLAG_CREATED);
- String.Key = Key;
-
- Status = AddOpCode (FormBuffer, &String);
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c deleted file mode 100644 index 6fb2be791e..0000000000 --- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrOpCodeCreation.c +++ /dev/null @@ -1,613 +0,0 @@ -/*++
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrOpCodeCreation.c
-
-Abstract:
-
- Library Routines to create IFR independent of string data - assume tokens already exist
- Primarily to be used for exporting op-codes at a label in pre-defined forms.
-
-Revision History:
-
---*/
-
-EFI_STATUS
-CreateSubTitleOpCode (
- IN STRING_REF StringToken,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a SubTitle opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- StringToken - StringToken of the subtitle
-
- FormBuffer - Output of subtitle as a form
-
-Returns:
-
- EFI_SUCCESS - Subtitle created to be a form
-
---*/
-{
- EFI_IFR_SUBTITLE Subtitle;
-
- Subtitle.Header.OpCode = EFI_IFR_SUBTITLE_OP;
- Subtitle.Header.Length = sizeof (EFI_IFR_SUBTITLE);
- Subtitle.SubTitle = StringToken;
-
- CopyMem (FormBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE));
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateTextOpCode (
- IN STRING_REF StringToken,
- IN STRING_REF StringTokenTwo,
- IN STRING_REF StringTokenThree,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a Text opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- StringToken - First string token of the text
-
- StringTokenTwo - Second string token of the text
-
- StringTokenThree - Help string token of the text
-
- Flags - Flag of the text
-
- Key - Key of the text
-
- FormBuffer - Output of text as a form
-
-Returns:
-
- EFI_SUCCESS - Text created to be a form
-
---*/
-{
- EFI_IFR_TEXT Text;
-
- Text.Header.OpCode = EFI_IFR_TEXT_OP;
- Text.Header.Length = sizeof (EFI_IFR_TEXT);
- Text.Text = StringToken;
-
- Text.TextTwo = StringTokenTwo;
- Text.Help = StringTokenThree;
- Text.Flags = Flags;
- Text.Key = Key;
-
- CopyMem (FormBuffer, &Text, sizeof (EFI_IFR_TEXT));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateGotoOpCode (
- IN UINT16 FormId,
- IN STRING_REF StringToken,
- IN STRING_REF StringTokenTwo,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a hyperlink opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- FormId - Form ID of the hyperlink
-
- StringToken - Prompt string token of the hyperlink
-
- StringTokenTwo - Help string token of the hyperlink
-
- Flags - Flags of the hyperlink
-
- Key - Key of the hyperlink
-
- FormBuffer - Output of hyperlink as a form
-
-Returns:
-
- EFI_SUCCESS - Hyperlink created to be a form
-
---*/
-{
- EFI_IFR_REF Hyperlink;
-
- Hyperlink.Header.OpCode = EFI_IFR_REF_OP;
- Hyperlink.Header.Length = sizeof (EFI_IFR_REF);
- Hyperlink.FormId = FormId;
- Hyperlink.Prompt = StringToken;
- Hyperlink.Help = StringTokenTwo;
- Hyperlink.Key = Key;
- Hyperlink.Flags = Flags;
-
- CopyMem (FormBuffer, &Hyperlink, sizeof (EFI_IFR_REF));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateOneOfOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a one-of opcode with a set of option op-codes to choose from independent of string creation.
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
- has been filled in since this routine will not generate StringToken values.
-
-Arguments:
-
- QuestionId - Question ID of the one-of box
-
- DataWidth - DataWidth of the one-of box
-
- PromptToken - Prompt string token of the one-of box
-
- HelpToken - Help string token of the one-of box
-
- OptionsList - Each string in it is an option of the one-of box
-
- OptionCount - Option string count
-
- FormBuffer - Output of One-Of box as a form
-
-Returns:
-
- EFI_SUCCESS - One-Of box created to be a form
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
---*/
-{
- UINTN Index;
- EFI_IFR_ONE_OF OneOf;
- EFI_IFR_ONE_OF_OPTION OneOfOption;
- EFI_IFR_END_ONE_OF EndOneOf;
- UINT8 *LocalBuffer;
-
- //
- // We do not create op-code storage widths for one-of in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- OneOf.Header.OpCode = EFI_IFR_ONE_OF_OP;
- OneOf.Header.Length = sizeof (EFI_IFR_ONE_OF);
- OneOf.QuestionId = QuestionId;
- OneOf.Width = DataWidth;
- OneOf.Prompt = PromptToken;
-
- OneOf.Help = HelpToken;
-
- LocalBuffer = (UINT8 *) FormBuffer;
-
- CopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF));
-
- for (Index = 0; Index < OptionCount; Index++) {
- OneOfOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OneOfOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- OneOfOption.Option = OptionsList[Index].StringToken;
- OneOfOption.Value = OptionsList[Index].Value;
- OneOfOption.Flags = OptionsList[Index].Flags;
- OneOfOption.Key = OptionsList[Index].Key;
-
- CopyMem (LocalBuffer, &OneOfOption, sizeof (EFI_IFR_ONE_OF_OPTION));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF_OPTION));
- }
-
- EndOneOf.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOneOf.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- CopyMem (LocalBuffer, &EndOneOf, sizeof (EFI_IFR_END_ONE_OF));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_END_ONE_OF));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateOrderedListOpCode (
- IN UINT16 QuestionId,
- IN UINT8 MaxEntries,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN IFR_OPTION *OptionsList,
- IN UINTN OptionCount,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a ordered list opcode with a set of option op-codes to choose from independent of string creation.
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
- OptionsList is a pointer to a null-terminated list of option descriptions. Ensure that OptionsList[x].StringToken
- has been filled in since this routine will not generate StringToken values.
-
-Arguments:
-
- QuestionId - Question ID of the ordered list
-
- MaxEntries - MaxEntries of the ordered list
-
- PromptToken - Prompt string token of the ordered list
-
- HelpToken - Help string token of the ordered list
-
- OptionsList - Each string in it is an option of the ordered list
-
- OptionCount - Option string count
-
- FormBuffer - Output of ordered list as a form
-
-Returns:
-
- EFI_SUCCESS - Ordered list created to be a form
-
---*/
-{
- UINTN Index;
- EFI_IFR_ORDERED_LIST OrderedList;
- EFI_IFR_ONE_OF_OPTION OrderedListOption;
- EFI_IFR_END_ONE_OF EndOrderedList;
- UINT8 *LocalBuffer;
-
- OrderedList.Header.OpCode = EFI_IFR_ORDERED_LIST_OP;
- OrderedList.Header.Length = sizeof (EFI_IFR_ORDERED_LIST);
- OrderedList.QuestionId = QuestionId;
- OrderedList.MaxEntries = MaxEntries;
- OrderedList.Prompt = PromptToken;
-
- OrderedList.Help = HelpToken;
-
- LocalBuffer = (UINT8 *) FormBuffer;
-
- CopyMem (LocalBuffer, &OrderedList, sizeof (EFI_IFR_ORDERED_LIST));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ORDERED_LIST));
-
- for (Index = 0; Index < OptionCount; Index++) {
- OrderedListOption.Header.OpCode = EFI_IFR_ONE_OF_OPTION_OP;
- OrderedListOption.Header.Length = sizeof (EFI_IFR_ONE_OF_OPTION);
-
- OrderedListOption.Option = OptionsList[Index].StringToken;
- OrderedListOption.Value = OptionsList[Index].Value;
- OrderedListOption.Flags = OptionsList[Index].Flags;
- OrderedListOption.Key = OptionsList[Index].Key;
-
- CopyMem (LocalBuffer, &OrderedListOption, sizeof (EFI_IFR_ONE_OF_OPTION));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_ONE_OF_OPTION));
- }
-
- EndOrderedList.Header.Length = sizeof (EFI_IFR_END_ONE_OF);
- EndOrderedList.Header.OpCode = EFI_IFR_END_ONE_OF_OP;
-
- CopyMem (LocalBuffer, &EndOrderedList, sizeof (EFI_IFR_END_ONE_OF));
-
- LocalBuffer = (UINT8 *) (LocalBuffer + sizeof (EFI_IFR_END_ONE_OF));
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-CreateCheckBoxOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a checkbox opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the check box
-
- DataWidth - DataWidth of the check box
-
- PromptToken - Prompt string token of the check box
-
- HelpToken - Help string token of the check box
-
- Flags - Flags of the check box
-
- Key - Key of the check box
-
- FormBuffer - Output of the check box as a form
-
-Returns:
-
- EFI_SUCCESS - Checkbox created to be a form
-
- EFI_DEVICE_ERROR - DataWidth > 1
-
---*/
-{
- EFI_IFR_CHECKBOX CheckBox;
-
- //
- // We do not create op-code storage widths for checkbox in excess of 8 bits for now
- //
- if (DataWidth > 1) {
- return EFI_DEVICE_ERROR;
- }
-
- CheckBox.Header.OpCode = EFI_IFR_CHECKBOX_OP;
- CheckBox.Header.Length = sizeof (EFI_IFR_CHECKBOX);
- CheckBox.QuestionId = QuestionId;
- CheckBox.Width = DataWidth;
- CheckBox.Prompt = PromptToken;
-
- CheckBox.Help = HelpToken;
- CheckBox.Flags = Flags;
- CheckBox.Key = Key;
-
- CopyMem (FormBuffer, &CheckBox, sizeof (EFI_IFR_CHECKBOX));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateNumericOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT16 Minimum,
- IN UINT16 Maximum,
- IN UINT16 Step,
- IN UINT16 Default,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the numeric
-
- DataWidth - DataWidth of the numeric
-
- PromptToken - Prompt string token of the numeric
-
- HelpToken - Help string token of the numeric
-
- Minimum - Minumun boundary of the numeric
-
- Maximum - Maximum boundary of the numeric
-
- Step - Step of the numeric
-
- Default - Default value of the numeric
-
- Flags - Flags of the numeric
-
- Key - Key of the numeric
-
- FormBuffer - Output of the numeric as a form
-
-Returns:
-
- EFI_SUCCESS - The numeric created to be a form.
-
- EFI_DEVICE_ERROR - DataWidth > 2
-
---*/
-{
- EFI_IFR_NUMERIC Numeric;
-
- //
- // We do not create op-code storage widths for numerics in excess of 16 bits for now
- //
- if (DataWidth > 2) {
- return EFI_DEVICE_ERROR;
- }
-
- Numeric.Header.OpCode = EFI_IFR_NUMERIC_OP;
- Numeric.Header.Length = sizeof (EFI_IFR_NUMERIC);
- Numeric.QuestionId = QuestionId;
- Numeric.Width = DataWidth;
- Numeric.Prompt = PromptToken;
-
- Numeric.Help = HelpToken;
- Numeric.Minimum = Minimum;
- Numeric.Maximum = Maximum;
- Numeric.Step = Step;
- Numeric.Default = Default;
- Numeric.Flags = Flags;
- Numeric.Key = Key;
-
- CopyMem (FormBuffer, &Numeric, sizeof (EFI_IFR_NUMERIC));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateStringOpCode (
- IN UINT16 QuestionId,
- IN UINT8 DataWidth,
- IN STRING_REF PromptToken,
- IN STRING_REF HelpToken,
- IN UINT8 MinSize,
- IN UINT8 MaxSize,
- IN UINT8 Flags,
- IN UINT16 Key,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a numeric opcode independent of string creation
- This is used primarily by users who need to create just one particular valid op-code and the string
- data will be assumed to exist in the HiiDatabase already. (Useful when exporting op-codes at a label
- location to pre-defined forms in HII)
-
-Arguments:
-
- QuestionId - Question ID of the string
-
- DataWidth - DataWidth of the string
-
- PromptToken - Prompt token of the string
-
- HelpToken - Help token of the string
-
- MinSize - Min size boundary of the string
-
- MaxSize - Max size boundary of the string
-
- Flags - Flags of the string
-
- Key - Key of the string
-
- FormBuffer - Output of the string as a form
-
-Returns:
-
- EFI_SUCCESS - String created to be a form.
-
---*/
-{
- EFI_IFR_STRING String;
-
- String.Header.OpCode = EFI_IFR_STRING_OP;
- String.Header.Length = sizeof (EFI_IFR_STRING);
- String.QuestionId = QuestionId;
- String.Width = DataWidth;
- String.Prompt = PromptToken;
-
- String.Help = HelpToken;
- String.MinSize = MinSize;
- String.MaxSize = MaxSize;
- String.Flags = Flags;
- String.Key = Key;
-
- CopyMem (FormBuffer, &String, sizeof (EFI_IFR_STRING));
-
- return EFI_SUCCESS;
-}
-
-
-EFI_STATUS
-CreateBannerOpCode (
- IN UINT16 Title,
- IN UINT16 LineNumber,
- IN UINT8 Alignment,
- IN OUT VOID *FormBuffer
- )
-/*++
-
-Routine Description:
-
- Create a banner opcode. This is primarily used by the FrontPage implementation from BDS.
-
-Arguments:
-
- Title - Title of the banner
-
- LineNumber - LineNumber of the banner
-
- Alignment - Alignment of the banner
-
- FormBuffer - Output of banner as a form
-
-Returns:
-
- EFI_SUCCESS - Banner created to be a form.
-
---*/
-{
- EFI_IFR_BANNER Banner;
-
- Banner.Header.OpCode = EFI_IFR_BANNER_OP;
- Banner.Header.Length = sizeof (EFI_IFR_BANNER);
- CopyMem (&Banner.Title, &Title, sizeof (UINT16));
- CopyMem (&Banner.LineNumber, &LineNumber, sizeof (UINT16));
- Banner.Alignment = Alignment;
-
- CopyMem (FormBuffer, &Banner, sizeof (EFI_IFR_BANNER));
-
- return EFI_SUCCESS;
-}
diff --git a/EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c b/EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c deleted file mode 100644 index a4aab0ff01..0000000000 --- a/EdkModulePkg/Library/EdkIfrSupportLib/IfrVariable.c +++ /dev/null @@ -1,488 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- IfrVariable.c
-
-Abstract:
- Variable/Map manipulations routines
-
---*/
-
-VOID
-EfiLibHiiVariablePackGetMap (
- IN EFI_HII_VARIABLE_PACK *Pack,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT UINT16 *Id, OPTIONAL
- OUT VOID **Var, OPTIONAL
- OUT UINTN *Size OPTIONAL
- )
-/*++
-
-Routine Description:
-
- Extracts a variable form a Pack.
-
-Arguments:
-
- Pack - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- VOID
-
---*/
-{
- if (NULL != Name) {
- *Name = (VOID *) (Pack + 1);
- }
-
- if (NULL != Guid) {
- *Guid = (EFI_GUID *)(UINTN)&Pack->VariableGuid;
- }
-
-
- if (NULL != Id) {
- *Id = Pack->VariableId;
- }
-
- if (NULL != Var) {
- *Var = (VOID *) ((CHAR8 *) (Pack + 1) + Pack->VariableNameLength);
- }
-
- if (NULL != Size) {
- *Size = Pack->Header.Length - sizeof (*Pack) - Pack->VariableNameLength;
- }
-}
-
-
-UINTN
-EfiLibHiiVariablePackListGetMapCnt (
- IN EFI_HII_VARIABLE_PACK_LIST *List
- )
-
-/*++
-
-Routine Description:
-
- Finds a count of the variables/maps in the List.
-
-Arguments:
-
- List - List of variables
-
-Returns:
-
- UINTN - The number of map count.
-
---*/
-
-{
- UINTN Cnt = 0;
- while (NULL != List) {
- Cnt++;
- List = List->NextVariablePack;
- }
- return Cnt;
-}
-
-
-VOID
-EfiLibHiiVariablePackListForEachVar (
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- IN EFI_LIB_HII_VARIABLE_PACK_LIST_CALLBACK *Callback
- )
-/*++
-
-Routine Description:
-
- Will iterate all variable/maps as appearing
- in List and for each, it will call the Callback.
-
-Arguments:
-
- List - List of variables
- Callback - Routine to be called for each iterated variable.
-
-Returns:
-
- VOID
-
---*/
-
-{
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
- UINT16 MapId;
- VOID *Map;
- UINTN MapSize;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- //
- // call the callback
- //
- Callback (MapName, MapGuid, MapId, Map, MapSize);
- List = List->NextVariablePack;
- }
-}
-
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMapByIdx (
- IN UINTN Idx,
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT UINT16 *Id, OPTIONAL
- OUT VOID **Var,
- OUT UINTN *Size
- )
-
-/*++
-
-Routine Description:
-
- Finds a variable form List given
- the order number as appears in the List.
-
-Arguments:
-
- Idx - The index of the variable/map to retrieve
- List - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- EFI_SUCCESS - Variable is found, OUT parameters are valid
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
-
---*/
-{
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
- UINT16 MapId;
- VOID *Map;
- UINTN MapSize;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- if (0 == Idx--) {
- *Var = Map;
- *Size = MapSize;
-
- if (NULL != Name) {
- *Name = MapName;
- }
-
- if (NULL != Guid) {
- *Guid = MapGuid;
- }
-
- if (NULL != Id) {
- *Id = MapId;
- }
-
- return EFI_SUCCESS; // Map found
- }
- List = List->NextVariablePack;
- }
- //
- // If here, the map is not found
- //
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMapById (
- IN UINT16 Id,
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- OUT CHAR16 **Name, OPTIONAL
- OUT EFI_GUID **Guid, OPTIONAL
- OUT VOID **Var,
- OUT UINTN *Size
- )
-
-/*++
-
-Routine Description:
-
- Finds a variable form List given the
- order number as appears in the List.
-
-Arguments:
-
- Id - The ID of the variable/map to retrieve
- List - List of variables
- Name - Name of the variable/map
- Guid - GUID of the variable/map
- Var - Pointer to the variable/map
- Size - Size of the variable/map in bytes
-
-Returns:
-
- EFI_SUCCESS - Variable is found, OUT parameters are valid
- EFI_NOT_FOUND - Variable is not found, OUT parameters are not valid
-
---*/
-
-{
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
- UINT16 MapId;
- VOID *Map;
- UINTN MapSize;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- if (MapId == Id) {
- *Var = Map;
- *Size = MapSize;
- if (NULL != Name) {
- *Name = MapName;
- }
- if (NULL != Guid) {
- *Guid = MapGuid;
- }
- //
- // Map found
- //
- return EFI_SUCCESS;
- }
- List = List->NextVariablePack;
- }
- //
- // If here, the map is not found
- //
- return EFI_NOT_FOUND;
-}
-
-
-EFI_STATUS
-EfiLibHiiVariablePackListGetMap (
- IN EFI_HII_VARIABLE_PACK_LIST *List,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- OUT UINT16 *Id,
- OUT VOID **Var,
- OUT UINTN *Size
- )
-
-/*++
-
-Routine Description:
-
- Finds a variable form EFI_HII_VARIABLE_PACK_LIST given name and GUID.
-
-Arguments:
-
- List - List of variables
- Name - Name of the variable/map to be found
- Guid - GUID of the variable/map to be found
- Var - Pointer to the variable/map found
- Size - Size of the variable/map in bytes found
-
-Returns:
-
- EFI_SUCCESS - variable is found, OUT parameters are valid
- EFI_NOT_FOUND - variable is not found, OUT parameters are not valid
-
---*/
-
-{
- VOID *Map;
- UINTN MapSize;
- UINT16 MapId;
- CHAR16 *MapName;
- EFI_GUID *MapGuid;
-
- while (NULL != List) {
- EfiLibHiiVariablePackGetMap (List->VariablePack, &MapName, &MapGuid, &MapId, &Map, &MapSize);
- if ((0 == StrCmp (Name, MapName)) && CompareGuid (Guid, MapGuid)) {
- *Id = MapId;
- *Var = Map;
- *Size = MapSize;
- return EFI_SUCCESS;
- }
- List = List->NextVariablePack;
- }
- //
- // If here, the map is not found
- //
- return EFI_NOT_FOUND;
-}
-
-EFI_STATUS
-EfiLibHiiVariableRetrieveFromNv (
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID **Var
- )
-/*++
-
-Routine Description:
- Finds out if a variable of specific Name/Guid/Size exists in NV.
- If it does, it will retrieve it into the Var.
-
-Arguments:
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into buffer pointed by this pointer.
- If pointing to NULL, the buffer will be allocated. Caller is responsible for releasing the buffer.
-Returns:
- EFI_SUCCESS - The variable of exact Name/Guid/Size parameters was retrieved and written to Var.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-{
- EFI_STATUS Status;
- UINTN SizeNv;
-
- //
- // Test for existence of the variable.
- //
- SizeNv = 0;
- Status = gRT->GetVariable (Name, Guid, NULL, &SizeNv, NULL);
- if (EFI_BUFFER_TOO_SMALL != Status) {
- ASSERT (EFI_SUCCESS != Status);
- return EFI_NOT_FOUND;
- }
- if (SizeNv != Size) {
- //
- // The variable is considered corrupt, as it has different size from expected.
- //
- return EFI_LOAD_ERROR;
- }
-
- if (NULL == *Var) {
- *Var = AllocatePool (Size);
- ASSERT (NULL != *Var);
- }
- SizeNv = Size;
- //
- // Final read into the Var
- //
- Status = gRT->GetVariable (Name, Guid, NULL, &SizeNv, *Var);
- //
- // No tolerance for random failures. Such behavior is undetermined and not validated.
- //
- ASSERT_EFI_ERROR (Status);
- ASSERT (SizeNv == Size);
- return EFI_SUCCESS;
-}
-
-
-
-EFI_STATUS
-EfiLibHiiVariableOverrideIfSuffix (
- IN CHAR16 *Suffix,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID *Var
- )
-/*++
-
-Routine Description:
- Overrrides the variable with NV data if found.
- But it only does it if the Name ends with specified Suffix.
- For example, if Suffix="MyOverride" and the Name="XyzSetupMyOverride",
- the Suffix matches the end of Name, so the variable will be loaded from NV
- provided the variable exists and the GUID and Size matches.
-
-Arguments:
- Suffix - Suffix the Name should end with.
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into this buffer.
- Caller is responsible for providing storage of exactly Size size in bytes.
-Returns:
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
- EFI_INVALID_PARAMETER - The name of the variable does not end with <Suffix>.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-{
- UINTN StrLength;
- UINTN StrLenSuffix;
-
- StrLength = StrLen (Name);
- StrLenSuffix = StrLen (Suffix);
- if ((StrLength <= StrLenSuffix) || (0 != StrCmp (Suffix, &Name[StrLength - StrLenSuffix]))) {
- //
- // Not ending with <Suffix>.
- //
- return EFI_INVALID_PARAMETER;
- }
- return EfiLibHiiVariableRetrieveFromNv (Name, Guid, Size, &Var);
-}
-
-EFI_STATUS
-EfiLibHiiVariableOverrideBySuffix (
- IN CHAR16 *Suffix,
- IN CHAR16 *Name,
- IN EFI_GUID *Guid,
- IN UINTN Size,
- OUT VOID *Var
- )
-/*++
-
-Routine Description:
- Overrrides the variable with NV data if found.
- But it only does it if the NV contains the same variable with Name is appended with Suffix.
- For example, if Suffix="MyOverride" and the Name="XyzSetup",
- the Suffix will be appended to the end of Name, and the variable with Name="XyzSetupMyOverride"
- will be loaded from NV provided the variable exists and the GUID and Size matches.
-
-Arguments:
- Suffix - Suffix the variable will be appended with.
- Name, Guid, Size - Parameters of the variable to retrieve. Must match exactly.
- Var - Variable will be retrieved into this buffer.
- Caller is responsible for providing storage of exactly Size size in bytes.
-
-Returns:
- EFI_SUCCESS - The variable was overriden with NV variable of same Name/Guid/Size.
- EFI_NOT_FOUND - The variable of this Name/Guid was not found in the NV.
- EFI_LOAD_ERROR - The variable in the NV was of different size, or NV API returned error.
-
---*/
-{
- EFI_STATUS Status;
- CHAR16 *NameSuffixed;
- UINTN NameLength;
- UINTN SuffixLength;
-
- //
- // enough to concatenate both strings.
- //
- NameLength = StrLen (Name);
- SuffixLength = StrLen (Suffix);
- NameSuffixed = AllocateZeroPool ((NameLength + SuffixLength + 1) * sizeof (CHAR16));
-
- StrCpy (NameSuffixed, Name);
- StrCat (NameSuffixed, Suffix);
-
- Status = EfiLibHiiVariableRetrieveFromNv (NameSuffixed, Guid, Size, &Var);
- gBS->FreePool (NameSuffixed);
-
- return Status;
-}
-
diff --git a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa b/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa deleted file mode 100644 index 40e4561c5f..0000000000 --- a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/EdkOemHookStatusCodeLibNull.msa +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkOemHookStatusCodeLibNull</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>54D2878F-25CD-4a2b-8420-EBD18E609C76</GuidValue>
- <Version>1.0</Version>
- <Abstract>Memory Status Code Library for UEFI drivers</Abstract>
- <Description>Lib to provide memory journal status code reporting Routines</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkOemHookStatusCodeLibNull</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>OemHookStatusCodeLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>OemHookStatusCodeLibNull.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c b/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c deleted file mode 100644 index 7816931e96..0000000000 --- a/EdkModulePkg/Library/EdkOemHookStatusCodeLibNull/OemHookStatusCodeLibNull.c +++ /dev/null @@ -1,73 +0,0 @@ -/** @file
- OEM hook status code library functions with no library constructor/destructor
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: OemHookStatusCodeLibNull.c
-
-**/
-
-/**
-
- Initialize OEM status code device .
-
- @return Always return EFI_SUCCESS.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeInitialize (
- VOID
- )
-{
- return EFI_SUCCESS;
-}
-
-/**
- Report status code to OEM device.
-
- @param CodeType Indicates the type of status code being reported. Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.
-
- @param Value Describes the current status of a hardware or software entity.
- This included information about the class and subclass that is used to classify the entity
- as well as an operation. For progress codes, the operation is the current activity.
- For error codes, it is the exception. For debug codes, it is not defined at this time.
- Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.
- Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.
-
- @param Instance The enumeration of a hardware or software entity within the system.
- A system may contain multiple entities that match a class/subclass pairing.
- The instance differentiates between them. An instance of 0 indicates that instance information is unavailable,
- not meaningful, or not relevant. Valid instance numbers start with 1.
-
-
- @param CallerId This optional parameter may be used to identify the caller.
- This parameter allows the status code driver to apply different rules to different callers.
- Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.
-
-
- @param Data This optional parameter may be used to pass additional data
-
- @return The function always return EFI_UNSUPPORTED.
-
-**/
-EFI_STATUS
-EFIAPI
-OemHookStatusCodeReport (
- IN EFI_STATUS_CODE_TYPE CodeType,
- IN EFI_STATUS_CODE_VALUE Value,
- IN UINT32 Instance,
- IN EFI_GUID *CallerId, OPTIONAL
- IN EFI_STATUS_CODE_DATA *Data OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c deleted file mode 100644 index f6638c1607..0000000000 --- a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.c +++ /dev/null @@ -1,388 +0,0 @@ -/** @file
- The implementation of PCI incompatible device support libary.
-
-Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-**/
-
-#include "IncompatiblePciDeviceList.h"
-
-/**
- Check whether two PCI devices matched
-
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param Header A pointer to EFI_PCI_DEVICE_INFO.
-
- @retval returns EFI_SUCCESS if two PCI device matched.
-**/
-STATIC
-EFI_STATUS
-DeviceCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN EFI_PCI_DEVICE_INFO *Header
- )
-{
- //
- // See if the Header matches the parameters passed in
- //
- if (Header->VendorID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->VendorID != Header->VendorID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->DeviceID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->DeviceID != Header->DeviceID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->RevisionID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->RevisionID != Header->RevisionID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->SubsystemVendorID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->SubsystemVendorID != Header->SubsystemVendorID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- if (Header->SubsystemID != DEVICE_ID_NOCARE) {
- if (PciDeviceInfo->SubsystemID != Header->SubsystemID) {
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-
-/**
- Check the incompatible device list for ACPI resource update and return
- the configuration
-
- This function searches the incompatible device list according to request
- information. If the PCI device belongs to the devices list, corresponding
- configuration informtion will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to PCI device information.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciResourceUpdateCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- OUT VOID *Configuration
- )
-{
- UINT64 Tag;
- UINT64 *ListPtr;
- UINT64 *TempListPtr;
- EFI_PCI_DEVICE_INFO *Header;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *AcpiPtr;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *OldAcpiPtr;
- EFI_PCI_RESOUCE_DESCRIPTOR *Dsc;
- EFI_ACPI_END_TAG_DESCRIPTOR *PtrEnd;
- UINTN Index;
-
- ASSERT (PciDeviceInfo != NULL);
-
- //
- // Initialize the return value to NULL
- //
- * (VOID **) Configuration = NULL;
-
- ListPtr = IncompatiblePciDeviceListForResource;
- while (*ListPtr != LIST_END_TAG) {
-
- Tag = *ListPtr;
-
- switch (Tag) {
- case DEVICE_INF_TAG:
- Header = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);
- ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);
-
- if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {
- continue;
- }
-
- //
- // Matched an item, so construct the ACPI descriptor for the resource.
- //
- //
- // Count the resource items so that to allocate space
- //
- for (Index = 0, TempListPtr = ListPtr; *TempListPtr == DEVICE_RES_TAG; Index++) {
- TempListPtr = TempListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));
- }
- //
- // If there is at least one type of resource request,
- // allocate a acpi resource node
- //
- if (Index == 0) {
- return EFI_ABORTED;
- }
-
- AcpiPtr = AllocateZeroPool (
- sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
- );
-
- OldAcpiPtr = AcpiPtr;
-
- //
- // Fill the EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR structure
- // according to the EFI_PCI_RESOUCE_DESCRIPTOR structure
- //
- for (; *ListPtr == DEVICE_RES_TAG;) {
-
- Dsc = (EFI_PCI_RESOUCE_DESCRIPTOR *) (ListPtr + 1);
-
- AcpiPtr->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
- AcpiPtr->Len = sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR);
- AcpiPtr->ResType = (UINT8) Dsc->ResType;
- AcpiPtr->GenFlag = (UINT8) Dsc->GenFlag;
- AcpiPtr->SpecificFlag = (UINT8) Dsc->SpecificFlag;
- AcpiPtr->AddrSpaceGranularity = Dsc->AddrSpaceGranularity;;
- AcpiPtr->AddrRangeMin = Dsc->AddrRangeMin;
- AcpiPtr->AddrRangeMax = Dsc->AddrRangeMax;
- AcpiPtr->AddrTranslationOffset = Dsc->AddrTranslationOffset;
- AcpiPtr->AddrLen = Dsc->AddrLen;
-
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));
- AcpiPtr++;
- }
- //
- // put the checksum
- //
- PtrEnd = (EFI_ACPI_END_TAG_DESCRIPTOR *) (AcpiPtr);
- PtrEnd->Desc = ACPI_END_TAG_DESCRIPTOR;
- PtrEnd->Checksum = 0;
-
- *(VOID **) Configuration = OldAcpiPtr;
-
- return EFI_SUCCESS;
-
- case DEVICE_RES_TAG:
- //
- // Adjust the pointer to the next PCI resource descriptor item
- //
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_RESOUCE_DESCRIPTOR)) / sizeof (UINT64));
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_UNSUPPORTED;
-
-}
-
-/**
- Check the incompatible device list and return configuraton register mask values.
-
- This function searches the incompatible device list according to request
- information. If the PCI device belongs to the devices list, corresponding
- configuration informtion will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param AccessType Access Type, READ or WRITE.
- @param Offset The address within the PCI configuration space.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciRegisterUpdateCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Offset,
- OUT VOID *Configuration
- )
-{
- EFI_PCI_DEVICE_INFO *Header;
- UINT64 Tag;
- UINT64 *ListPtr;
- EFI_PCI_REGISTER_VALUE_DATA *RegisterPtr;
- EFI_PCI_REGISTER_VALUE_DATA *Dsc;
-
- ASSERT (PciDeviceInfo != NULL);
-
- ListPtr = IncompatiblePciDeviceListForRegister;
-
- //
- // Initialize the return value to NULL
- //
- * (VOID **) Configuration = NULL;
-
- while (*ListPtr != LIST_END_TAG) {
-
- Tag = *ListPtr;
-
- switch (Tag) {
- case DEVICE_INF_TAG:
- Header = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);
- ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);
-
- //
- // Check whether the PCI device matches the device in the incompatible devices list?
- // If not, ship next
- //
- if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {
- continue;
- }
-
- //
- // Matched an item, check whether access matches?
- //
- for (; *ListPtr == DEVICE_RES_TAG;) {
- ListPtr ++;
- if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->Offset == (Offset & 0xfc)) {
- if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {
-
- Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);
- RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA));
-
- RegisterPtr->AndValue = Dsc->AndValue;
- RegisterPtr->OrValue = Dsc->OrValue;
-
- *(VOID **) Configuration = RegisterPtr;
-
- return EFI_SUCCESS;
- }
- }
- ListPtr += sizeof (EFI_PCI_REGISTER_VALUE_DESCRIPTOR) / (sizeof (UINT64));
- }
- return EFI_UNSUPPORTED;
-
- case DEVICE_RES_TAG:
- //
- // Adjust the pointer to the next item
- //
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_REGISTER_VALUE_DESCRIPTOR)) / sizeof (UINT64));
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_UNSUPPORTED;
-}
-
-/**
- Check the incompatible device list for access width incompatibility and
- return the configuration
-
- This function searches the incompatible device list for access width
- incompatibility according to request information. If the PCI device
- belongs to the devices list, corresponding configuration informtion
- will be returned, in the meantime return EFI_SUCCESS.
-
- @param PciDeviceInfo A pointer to PCI device information.
- @param AccessType Access type, READ or WRITE.
- @param Offset The address within the PCI configuration space.
- @param AccessWidth Access width needs to check incompatibility.
- @param Configuration Returned information.
-
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
-**/
-RETURN_STATUS
-EFIAPI
-PciRegisterAccessCheck (
- IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
- IN UINT64 AccessType,
- IN UINT64 Offset,
- IN UINT64 AccessWidth,
- OUT VOID *Configuration
- )
-{
- EFI_PCI_DEVICE_INFO *Header;
- UINT64 Tag;
- UINT64 *ListPtr;
- EFI_PCI_REGISTER_ACCESS_DATA *RegisterPtr;
- EFI_PCI_REGISTER_ACCESS_DATA *Dsc;
-
- ASSERT (PciDeviceInfo != NULL);
-
- ListPtr = DeviceListForAccessWidth;
-
- //
- // Initialize the return value to NULL
- //
- * (VOID **) Configuration = NULL;
-
- while (*ListPtr != LIST_END_TAG) {
-
- Tag = *ListPtr;
-
- switch (Tag) {
- case DEVICE_INF_TAG:
- Header = (EFI_PCI_DEVICE_INFO *) (ListPtr + 1);
- ListPtr = ListPtr + 1 + sizeof (EFI_PCI_DEVICE_INFO) / sizeof (UINT64);
-
- //
- // Check whether the PCI device matches the device in the incompatible devices list?
- // If not, ship next
- //
- if (DeviceCheck (PciDeviceInfo, Header) != EFI_SUCCESS) {
- continue;
- }
-
- //
- // Matched an item, check whether access matches?
- //
- for (; *ListPtr == DEVICE_RES_TAG;) {
- ListPtr ++;
- if (((EFI_PCI_REGISTER_ACCESS_DESCRIPTOR *) ListPtr)->AccessType == AccessType &&
- ((EFI_PCI_REGISTER_ACCESS_DESCRIPTOR *) ListPtr)->AccessWidth == AccessWidth ) {
-
- Dsc = (EFI_PCI_REGISTER_ACCESS_DATA *) (ListPtr + 2);
-
- if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {
-
- RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));
-
- RegisterPtr->StartOffset = Dsc->StartOffset;
- RegisterPtr->EndOffset = Dsc->EndOffset;
- RegisterPtr->Width = Dsc->Width;
-
- *(VOID **) Configuration = RegisterPtr;
-
- return EFI_SUCCESS;
- }
- }
- ListPtr += sizeof (EFI_PCI_REGISTER_ACCESS_DESCRIPTOR) / (sizeof (UINT64));
- }
- return EFI_UNSUPPORTED;
-
- case DEVICE_RES_TAG:
- //
- // Adjust the pointer to the next item
- //
- ListPtr = ListPtr + 1 + ((sizeof (EFI_PCI_REGISTER_ACCESS_DESCRIPTOR)) / sizeof (UINT64));
- break;
-
- default:
- return EFI_UNSUPPORTED;
- }
- }
-
- return EFI_UNSUPPORTED;
-}
-
diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa deleted file mode 100644 index e7b8529ebd..0000000000 --- a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.msa +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkPciIncompatibleDeviceSuppportLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>1ca1c1f9-5baf-4204-b6e5-5e24109a4e4e</GuidValue>
- <Version>1.0</Version>
- <Abstract>PCI Incompatible device support Library</Abstract>
- <Description>Check PCI incompatible devices and set necessary configuration</Description>
- <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkPciIncompatibleDeviceSupportLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>PciIncompatibleDeviceSupportLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>MemoryAllocationLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>EdkPciIncompatibleDeviceSupportLib.c</Filename>
- <Filename>IncompatiblePciDeviceList.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h b/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h deleted file mode 100644 index a00c614c75..0000000000 --- a/EdkModulePkg/Library/EdkPciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h +++ /dev/null @@ -1,209 +0,0 @@ -/** @file
- The incompatible PCI device list
-
-Copyright (c) 2007 Intel Corporation. All rights reserved. <BR>
-This software and associated documentation (if any) is furnished
-under a license and may only be used or copied in accordance
-with the terms of the license. Except as permitted by such
-license, no part of this software or documentation may be
-reproduced, stored in a retrieval system, or transmitted in any
-form or by any means without the express written consent of
-Intel Corporation.
-
-**/
-
-#ifndef _EFI_INCOMPATIBLE_PCI_DEVICE_LIST_H
-#define _EFI_INCOMPATIBLE_PCI_DEVICE_LIST_H
-
-#include <IndustryStandard/pci22.h>
-#include <IndustryStandard/Acpi.h>
-
-
-#define PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId) \
- VendorId, DeviceId, Revision, SubVendorId, SubDeviceId
-
-#define PCI_BAR_TYPE_IO ACPI_ADDRESS_SPACE_TYPE_IO
-#define PCI_BAR_TYPE_MEM ACPI_ADDRESS_SPACE_TYPE_MEM
-
-#define DEVICE_INF_TAG 0xFFF2
-#define DEVICE_RES_TAG 0xFFF1
-#define LIST_END_TAG 0x0000
-
-//
-// descriptor for access width of incompatible PCI device
-//
-typedef struct {
- UINT64 AccessType;
- UINT64 AccessWidth;
- EFI_PCI_REGISTER_ACCESS_DATA PciRegisterAccessData;
-} EFI_PCI_REGISTER_ACCESS_DESCRIPTOR;
-
-//
-// descriptor for register value of incompatible PCI device
-//
-typedef struct {
- UINT64 AccessType;
- UINT64 Offset;
- EFI_PCI_REGISTER_VALUE_DATA PciRegisterValueData;
-} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;
-
-
-//
-// the incompatible PCI devices list for ACPI resource
-//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
- //
- // DEVICE_INF_TAG,
- // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
- // DEVICE_RES_TAG,
- // ResType, GFlag , SFlag, Granularity, RangeMin,
- // RangeMax, Offset, AddrLen
- //
- //
- // Device Adaptec 9004
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Adaptec 9005
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device QLogic 1007
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Agilent 103C
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Agilent 15BC
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // The end of the list
- //
- LIST_END_TAG
-};
-
-//
-// the incompatible PCI devices list for the values of configuration registers
-//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
- //
- // DEVICE_INF_TAG,
- // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
- // PCI_RES_TAG,
- // PCI_ACCESS_TYPE, PCI_CONFIG_ADDRESS,
- // AND_VALUE, OR_VALUE
-
- //
- // Device Lava 0x1407, DeviceId 0x0110
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1407, 0x0110, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_REGISTER_READ,
- PCI_CAPBILITY_POINTER_OFFSET,
- 0xffffff00,
- VALUE_NOCARE,
-
- //
- // Device Lava 0x1407, DeviceId 0x0111
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1407, 0x0111, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_REGISTER_READ,
- PCI_CAPBILITY_POINTER_OFFSET,
- 0xffffff00,
- VALUE_NOCARE,
-
- //
- // The end of the list
- //
- LIST_END_TAG
-};
-
-//
-// the incompatible PCI devices list for the access width of configuration registers
-//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 DeviceListForAccessWidth[] = {
- //
- // DEVICE_INF_TAG,
- // PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
- // DEVICE_RES_TAG,
- // PCI_ACCESS_TYPE, PCI_ACCESS_WIDTH,
- // START_ADDRESS, END_ADDRESS,
- // ACTUAL_PCI_ACCESS_WIDTH,
- //
-
- //
- // Sample Device
- //
- //DEVICE_INF_TAG,
- //PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- //DEVICE_RES_TAG,
- //PCI_REGISTER_READ,
- //EfiPciWidthUint8,
- //0,
- //0xFF,
- //EfiPciWidthUint32,
- //
-
- //
- // The end of the list
- //
- LIST_END_TAG
-};
-
-#endif
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c deleted file mode 100644 index d83d1ad2a7..0000000000 --- a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoader.c +++ /dev/null @@ -1,112 +0,0 @@ -/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- EdkPeCoffLoader.c
-
-Abstract:
-
- Wrap the Base PE/COFF loader with the PE COFF Protocol
-
-
---*/
-
-#include "EdkPeCoffLoaderLibInternals.h"
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibGetImageInfo (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- EFI_STATUS Status;
-
- Status = PeCoffLoaderGetImageInfo (ImageContext);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- switch (ImageContext->ImageType) {
-
- case EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION:
- ImageContext->ImageCodeMemoryType = EfiLoaderCode;
- ImageContext->ImageDataMemoryType = EfiLoaderData;
- break;
-
- case EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
- ImageContext->ImageCodeMemoryType = EfiBootServicesCode;
- ImageContext->ImageDataMemoryType = EfiBootServicesData;
- break;
-
- case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
- case EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER:
- ImageContext->ImageCodeMemoryType = EfiRuntimeServicesCode;
- ImageContext->ImageDataMemoryType = EfiRuntimeServicesData;
- break;
-
- default:
- ImageContext->ImageError = IMAGE_ERROR_INVALID_SUBSYSTEM;
- return RETURN_UNSUPPORTED;
- }
-
- return Status;
-}
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibLoadImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- return PeCoffLoaderLoadImage (ImageContext);
-}
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibRelocateImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- return PeCoffLoaderRelocateImage (ImageContext);
-}
-
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibUnloadimage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
- return EFI_SUCCESS;
-}
-
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL mPeiEfiPeiPeCoffLoader = {
- TianoPeCoffLoaderLibGetImageInfo,
- TianoPeCoffLoaderLibLoadImage,
- TianoPeCoffLoaderLibRelocateImage,
- TianoPeCoffLoaderLibUnloadimage
-};
-
-EFI_PEI_PE_COFF_LOADER_PROTOCOL *
-EFIAPI
-GetPeCoffLoaderProtocol (
- )
-{
- return &mPeiEfiPeiPeCoffLoader;
-}
-
-
diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa deleted file mode 100644 index 53af6f1fe4..0000000000 --- a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLib.msa +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkPeCoffLoaderLib</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>858bbbc9-474f-4556-a361-0ae52a44ffa5</GuidValue>
- <Version>1.0</Version>
- <Abstract>EdkPeCoffLoaderLib library instance</Abstract>
- <Description>This library provides PeCoffLoader protocol based on PeCoffLib functions.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkPeCoffLoaderLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE PEIM">
- <Keyword>EdkPeCoffLoaderLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PeCoffLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>EdkPeCoffLoader.c</Filename>
- <Filename>EdkPeCoffLoaderLibInternals.h</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h b/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h deleted file mode 100644 index b356724cf5..0000000000 --- a/EdkModulePkg/Library/EdkPeCoffLoaderLib/EdkPeCoffLoaderLibInternals.h +++ /dev/null @@ -1,48 +0,0 @@ -/** @file
- Declaration of internal functions in PE/COFF Lib.
-
- Copyright (c) 2006, Intel Corporation<BR>
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: BasePeCoffLibInternals.h
-
-**/
-
-#ifndef __PECOFF_LOADER_LIB_INTERNALS__
-#define __PECOFF_LOADER_LIB_INTERNALS__
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibGetImageInfo (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibLoadImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibRelocateImage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-EFI_STATUS
-EFIAPI
-TianoPeCoffLoaderLibUnloadimage (
- IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- );
-
-#endif
diff --git a/EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa b/EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa deleted file mode 100644 index 1135e4af27..0000000000 --- a/EdkModulePkg/Library/EdkScsiLib/EdkScsiLib.msa +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkScsiLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>46c9adef-aee6-410c-99e4-240e3af18d8b</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for Scsi Dxe Library.</Abstract>
- <Description>this Libarary implements Scsi command.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkScsiLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkScsiLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>ScsiLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00010010</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkScsiLib/ScsiLib.c b/EdkModulePkg/Library/EdkScsiLib/ScsiLib.c deleted file mode 100644 index 55b950390a..0000000000 --- a/EdkModulePkg/Library/EdkScsiLib/ScsiLib.c +++ /dev/null @@ -1,648 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- ScsiLib.c
-
-Abstract:
-
-
-Revision History
---*/
-
-
-#include <IndustryStandard/scsi.h>
-
-EFI_STATUS
-SubmitTestUnitReadyCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- OUT VOID *SenseData,
- OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
- Function tests the ready status of SCSI unit.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in InTransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[6];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 6);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = NULL;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = 0;
- CommandPacket.Cdb = Cdb;
-
- //
- // Fill Cdb for Test Unit Ready Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_TEST_UNIT_READY;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- CommandPacket.CdbLength = (UINT8) 6;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitInquiryCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN OUT VOID *InquiryDataBuffer,
- IN OUT UINT32 *InquiryDataLength,
- IN BOOLEAN EnableVitalProductData
- )
-/*++
-
-Routine Description:
- Function to submit SCSI inquiry command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- InquiryDataBuffer - A pointer to inquiry data buffer.
- InquiryDataLength - The length of inquiry data buffer.
- EnableVitalProductData - Boolean to enable Vital Product Data.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[6];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 6);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = InquiryDataBuffer;
- CommandPacket.TransferLength = *InquiryDataLength;
- CommandPacket.SenseData = SenseData;
- CommandPacket.SenseDataLength = *SenseDataLength;
- CommandPacket.Cdb = Cdb;
-
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_INQUIRY;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- if (EnableVitalProductData) {
- Cdb[1] |= 0x01;
- }
-
- if (*InquiryDataLength > 0xff) {
- *InquiryDataLength = 0xff;
- }
-
- Cdb[4] = (UINT8) (*InquiryDataLength);
- CommandPacket.CdbLength = (UINT8) 6;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *InquiryDataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitModeSense10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- IN VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT8 DBDField, OPTIONAL
- IN UINT8 PageControl,
- IN UINT8 PageCode
- )
-/*++
-
-Routine Description:
- Function to submit SCSI mode sense 10 command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to input data buffer.
- DataLength - The length of input data buffer.
- DBDField - The DBD Field (Optional).
- PageControl - Page Control.
- PageCode - Page code.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Mode Sense (10) Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_MODE_SEN10;
- Cdb[1] = (UINT8) ((Lun & 0xe0) + ((DBDField << 3) & 0x08));
- Cdb[2] = (UINT8) ((PageControl & 0xc0) | (PageCode & 0x3f));
- Cdb[7] = (UINT8) (*DataLength >> 8);
- Cdb[8] = (UINT8) (*DataLength);
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitRequestSenseCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus
- )
-/*++
-
-Routine Description:
- Function to submit SCSI request sense command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[6];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 6);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = SenseData;
- CommandPacket.SenseData = NULL;
- CommandPacket.TransferLength = *SenseDataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Request Sense Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_REQUEST_SENSE;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- Cdb[4] = (UINT8) (*SenseDataLength);
-
- CommandPacket.CdbLength = (UINT8) 6;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = 0;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = (UINT8) CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitReadCapacityCommand (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN BOOLEAN PMI
- )
-/*++
-
-Routine Description:
- Function to submit read capacity command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to a data buffer.
- DataLength - The length of data buffer.
- PMI - Partial medium indicator.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Read Capacity Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_READ_CAPACITY;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- if (!PMI) {
- //
- // Partial medium indicator,if PMI is FALSE, the Cdb.2 ~ Cdb.5 MUST BE ZERO.
- //
- ZeroMem ((Cdb + 2), 4);
- } else {
- Cdb[8] |= 0x01;
- }
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitRead10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT32 StartLba,
- IN UINT32 SectorSize
- )
-/*++
-
-Routine Description:
- Function to submit read 10 command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to a data buffer.
- DataLength - The length of data buffer.
- StartLba - The start address of LBA.
- SectorSize - The sector size.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in TransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Read (10) Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_READ10;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- Cdb[2] = (UINT8) (StartLba >> 24);
- Cdb[3] = (UINT8) (StartLba >> 16);
- Cdb[4] = (UINT8) (StartLba >> 8);
- Cdb[5] = (UINT8) StartLba;
- Cdb[7] = (UINT8) (SectorSize >> 8);
- Cdb[8] = (UINT8) SectorSize;
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_IN;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
-
-EFI_STATUS
-SubmitWrite10Command (
- IN EFI_SCSI_IO_PROTOCOL *ScsiIo,
- IN UINT64 Timeout,
- IN VOID *SenseData,
- IN OUT UINT8 *SenseDataLength,
- OUT UINT8 *HostAdapterStatus,
- OUT UINT8 *TargetStatus,
- OUT VOID *DataBuffer,
- IN OUT UINT32 *DataLength,
- IN UINT32 StartLba,
- IN UINT32 SectorSize
- )
-/*++
-
-Routine Description:
- Function to submit SCSI write 10 command.
-
-Arguments:
- ScsiIo - A pointer to SCSI IO protocol.
- Timeout - The length of timeout period.
- SenseData - A pointer to output sense data.
- SenseDataLength - The length of output sense data.
- HostAdapterStatus - The status of Host Adapter.
- TargetStatus - The status of the target.
- DataBuffer - A pointer to a data buffer.
- DataLength - The length of data buffer.
- StartLba - The start address of LBA.
- SectorSize - The sector size.
-
-Returns:
-
- Returns:
- EFI_SUCCESS - The status of the unit is tested successfully.
- EFI_WARN_BUFFER_TOO_SMALL - The SCSI Request Packet was executed,
- but the entire DataBuffer could not be transferred.
- The actual number of bytes transferred is returned
- in InTransferLength.
- EFI_NOT_READY - The SCSI Request Packet could not be sent because
- there are too many SCSI Command Packets already
- queued.
- EFI_DEVICE_ERROR - A device error occurred while attempting to send
- the SCSI Request Packet.
- EFI_INVALID_PARAMETER - The contents of CommandPacket are invalid.
- EFI_UNSUPPORTED - The command described by the SCSI Request Packet
- is not supported by the SCSI initiator(i.e., SCSI
- Host Controller).
- EFI_TIMEOUT - A timeout occurred while waiting for the SCSI
- Request Packet to execute.
-
---*/
-{
- EFI_SCSI_IO_SCSI_REQUEST_PACKET CommandPacket;
- UINT64 Lun;
- UINT32 Target;
- EFI_STATUS Status;
- UINT8 Cdb[10];
-
- ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
- ZeroMem (Cdb, 10);
-
- CommandPacket.Timeout = Timeout;
- CommandPacket.DataBuffer = DataBuffer;
- CommandPacket.SenseData = SenseData;
- CommandPacket.TransferLength = *DataLength;
- CommandPacket.Cdb = Cdb;
- //
- // Fill Cdb for Write (10) Command
- //
- ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);
-
- Cdb[0] = EFI_SCSI_OP_WRITE10;
- Cdb[1] = (UINT8) (Lun & 0xe0);
- Cdb[2] = (UINT8) (StartLba >> 24);
- Cdb[3] = (UINT8) (StartLba >> 16);
- Cdb[4] = (UINT8) (StartLba >> 8);
- Cdb[5] = (UINT8) StartLba;
- Cdb[7] = (UINT8) (SectorSize >> 8);
- Cdb[8] = (UINT8) SectorSize;
-
- CommandPacket.CdbLength = 10;
- CommandPacket.DataDirection = EFI_SCSI_DATA_OUT;
- CommandPacket.SenseDataLength = *SenseDataLength;
-
- Status = ScsiIo->ExecuteSCSICommand (ScsiIo, &CommandPacket, NULL);
-
- *HostAdapterStatus = CommandPacket.HostAdapterStatus;
- *TargetStatus = CommandPacket.TargetStatus;
- *SenseDataLength = CommandPacket.SenseDataLength;
- *DataLength = CommandPacket.TransferLength;
-
- return Status;
-}
diff --git a/EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa b/EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa deleted file mode 100644 index 9c992ead07..0000000000 --- a/EdkModulePkg/Library/EdkSerialPortLibNull/EdkSerialPortLibNull.msa +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkSerialPortLibNull</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>E4541241-8897-411a-91F8-7D7E45837146</GuidValue>
- <Version>1.0</Version>
- <Abstract>Memory Status Code Library for UEFI drivers</Abstract>
- <Description>Lib to provide memory journal status code reporting Routines</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkSerialPortLibNull</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED">
- <Keyword>SerialPortLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>SerialPortLibNull.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c b/EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c deleted file mode 100644 index 3f2f183be5..0000000000 --- a/EdkModulePkg/Library/EdkSerialPortLibNull/SerialPortLibNull.c +++ /dev/null @@ -1,73 +0,0 @@ -/** @file
- Serial I/O Port library functions with no library constructor/destructor
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name: SerialPortLibNull.c
-
-**/
-
-/*
-
- Programmed hardware of Serial port.
-
- @return Always return EFI_UNSUPPORTED.
-
-**/
-EFI_STATUS
-EFIAPI
-SerialPortInitialize (
- VOID
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-/**
- Write data to serial device.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Write data failed.
- @retval !0 Actual number of bytes writed to serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- return 0;
-}
-
-
-/**
- Read data from serial device and save the datas in buffer.
-
- @param Buffer Point of data buffer which need to be writed.
- @param NumberOfBytes Number of output bytes which are cached in Buffer.
-
- @retval 0 Read data failed.
- @retval !0 Aactual number of bytes read from serial device.
-
-**/
-UINTN
-EFIAPI
-SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
-{
- return 0;
-}
-
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c deleted file mode 100644 index 3cb11d8924..0000000000 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeLib.c +++ /dev/null @@ -1,173 +0,0 @@ -/**@file
- Library utility functions for Runtime driver.
-
-Copyright (c) 2006 Intel Corporation. <BR>
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include <RuntimeLibInternal.h>
-
-///
-/// Driver Lib Module Globals
-///
-
-STATIC EFI_EVENT mEfiVirtualNotifyEvent;
-STATIC BOOLEAN mEfiGoneVirtual = FALSE;
-STATIC BOOLEAN mEfiAtRuntime = FALSE;
-EFI_RUNTIME_SERVICES *mRT;
-
-/**
- Set AtRuntime flag as TRUE after ExitBootServices
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-VOID
-EFIAPI
-RuntimeDriverExitBootServices (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- //
- // Clear out BootService globals
- //
- gBS = NULL;
-
- mEfiAtRuntime = TRUE;
-}
-
-/**
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
- @param[in] Event The Event that is being processed
- @param[in] Context Event Context
-**/
-STATIC
-VOID
-EFIAPI
-RuntimeLibVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-{
- UINTN Index;
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;
-
- for (Index = 0;
- _gDriverSetVirtualAddressMapEvent[Index] != NULL;
- Index++) {
- ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];
- ChildNotifyEventHandler (Event, NULL);
- }
-
- //
- // Update global for Runtime Services Table and IO
- //
- EfiConvertPointer (0, (VOID **) &mRT);
-
- mEfiGoneVirtual = TRUE;
-}
-
-/**
- Intialize runtime Driver Lib if it has not yet been initialized.
-
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
-
- @return EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
-**/
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- ASSERT (SystemTable != NULL);
- mRT = SystemTable->RuntimeServices;
- ASSERT (mRT != NULL);
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- ASSERT (gBS != NULL);
- Status = gBS->CreateEvent (
- EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- TPL_NOTIFY,
- RuntimeLibVirtualNotifyEvent,
- NULL,
- &mEfiVirtualNotifyEvent
- );
-
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- This routine will free some resources which have been allocated in
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
- it must call this routine to free the allocated resource before the exiting.
-
- @retval EFI_SUCCESS Shutdown the Runtime Driver Lib successfully
- @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized at all
-**/
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibDeconstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-{
- EFI_STATUS Status;
-
- //
- // Close SetVirtualAddressMap () notify function
- //
- ASSERT (gBS != NULL);
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
- ASSERT_EFI_ERROR (Status);
-
- return Status;
-}
-
-/**
- Return TRUE if ExitBootServices () has been called
-
- @retval TRUE If ExitBootServices () has been called
-**/
-BOOLEAN
-EFIAPI
-EfiAtRuntime (
- VOID
- )
-{
- return mEfiAtRuntime;
-}
-
-/**
- Return TRUE if SetVirtualAddressMap () has been called
-
- @retval TRUE If SetVirtualAddressMap () has been called
-**/
-BOOLEAN
-EFIAPI
-EfiGoneVirtual (
- VOID
- )
-{
- return mEfiGoneVirtual;
-}
-
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c deleted file mode 100644 index e9a539de4d..0000000000 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Common/RuntimeService.c +++ /dev/null @@ -1,454 +0,0 @@ -/*++
-
-Copyright (c) 2006 - 2007, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeService.c
-
---*/
-
-#include <RuntimeLibInternal.h>
-
-VOID
-EFIAPI
-EfiResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN CHAR16 *ResetData
- )
-/*++
-
-Routine Description:
-
- Resets the entire platform.
-
-Arguments:
-
- ResetType - The type of reset to perform.
- ResetStatus - The status code for the reset.
- DataSize - The size, in bytes, of ResetData.
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
- followed by additional binary data.
-
-Returns:
-
- None
-
---*/
-{
- mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);
-}
-
-//
-// The following functions hide the mRT local global from the call to
-// runtime service in the EFI system table.
-//
-EFI_STATUS
-EFIAPI
-EfiGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities
- )
-/*++
-
-Routine Description:
-
- Returns the current time and date information, and the time-keeping
- capabilities of the hardware platform.
-
-Arguments:
-
- Time - A pointer to storage to receive a snapshot of the current time.
- Capabilities - An optional pointer to a buffer to receive the real time clock device's
- capabilities.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetTime (Time, Capabilities);
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetTime (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the current local time and date information.
-
-Arguments:
-
- Time - A pointer to the current time.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->SetTime (Time);
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Returns the current wakeup alarm clock setting.
-
-Arguments:
-
- Enabled - Indicates if the alarm is currently enabled or disabled.
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.
- Time - The current alarm setting.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetWakeupTime (Enabled, Pending, Time);
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetWakeupTime (
- IN BOOLEAN Enable,
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the system wakeup alarm clock time.
-
-Arguments:
-
- Enable - Enable or disable the wakeup alarm.
- Time - If Enable is TRUE, the time to set the wakeup alarm for.
- If Enable is FALSE, then this parameter is optional, and may be NULL.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->SetWakeupTime (Enable, Time);
-}
-
-
-
-
-EFI_STATUS
-EFIAPI
-EfiGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
- Returns the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - If not NULL, a pointer to the memory location to return the
- attributes bitmask for the variable.
- DataSize - On input, the size in bytes of the return Data buffer.
- On output the size of data returned in Data.
- Data - The buffer to return the contents of the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
- Enumerates the current variable names.
-
-Arguments:
-
- VariableNameSize - The size of the VariableName buffer.
- VariableName - On input, supplies the last VariableName that was returned
- by GetNextVariableName().
- On output, returns the Nullterminated Unicode string of the
- current variable.
- VendorGuid - On input, supplies the last VendorGuid that was returned by
- GetNextVariableName().
- On output, returns the VendorGuid of the current variable.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
- Sets the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - Attributes bitmask to set for the variable.
- DataSize - The size in bytes of the Data buffer.
- Data - The contents for the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextHighMonotonicCount (
- OUT UINT32 *HighCount
- )
-/*++
-
-Routine Description:
-
- Returns the next high 32 bits of the platform's monotonic counter.
-
-Arguments:
-
- HighCount - Pointer to returned value.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->GetNextHighMonotonicCount (HighCount);
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **Address
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses.
-
-Arguments:
-
- DebugDisposition - Supplies type information for the pointer being converted.
- Address - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->ConvertPointer (DebugDisposition, Address);
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertList (
- IN UINTN DebugDisposition,
- IN OUT LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
- Conver the standard Lib double linked list to a virtual mapping.
-
-Arguments:
-
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
-
- ListHead - Head of linked list to convert
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
-
- //
- // Convert all the ForwardLink & BackLink pointers in the list
- //
- Link = ListHead;
- do {
- NextLink = Link->ForwardLink;
-
- EfiConvertPointer (
- Link->ForwardLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->ForwardLink
- );
-
- EfiConvertPointer (
- Link->BackLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->BackLink
- );
-
- Link = NextLink;
- } while (Link != ListHead);
- return EFI_SUCCESS;
-}
-
-
-/**
- Change the runtime addressing mode of EFI firmware from physical to virtual.
-
- @param MemoryMapSize The size in bytes of VirtualMap.
- @param DescriptorSize The size in bytes of an entry in the VirtualMap.
- @param DescriptorVersion The version of the structure entries in VirtualMap.
- @param VirtualMap An array of memory descriptors which contain new virtual
- address mapping information for all runtime ranges. Type
- EFI_MEMORY_DESCRIPTOR is defined in the
- GetMemoryMap() function description.
-
- @retval EFI_SUCCESS The virtual address map has been applied.
- @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
- virtual address mapped mode.
- @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
- invalid.
- @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
- map that requires a mapping.
- @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
- in the memory map.
-**/
-EFI_STATUS
-EFIAPI
-EfiSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
- )
-{
- return mRT->SetVirtualAddressMap (
- MemoryMapSize,
- DescriptorSize,
- DescriptorVersion,
- (EFI_MEMORY_DESCRIPTOR *) VirtualMap
- );
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiUpdateCapsule (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
- )
-{
- return mRT->UpdateCapsule (
- CapsuleHeaderArray,
- CapsuleCount,
- ScatterGatherList
- );
-}
-
-EFI_STATUS
-EFIAPI
-EfiQueryCapsuleCapabilities (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaximumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
- )
-{
- return mRT->QueryCapsuleCapabilities (
- CapsuleHeaderArray,
- CapsuleCount,
- MaximumCapsuleSize,
- ResetType
- );
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
- )
-{
- return mRT->QueryVariableInfo (
- Attributes,
- MaximumVariableStorageSize,
- RemainingVariableStorageSize,
- MaximumVariableSize
- );
-}
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa b/EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa deleted file mode 100644 index 75cd691da8..0000000000 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkUefiRuntimeLib</ModuleName>
- <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>
- <GuidValue>b1ee6c28-54aa-4d17-b705-3e28ccb27b2e</GuidValue>
- <Version>1.0</Version>
- <Abstract>Runtime driver library</Abstract>
- <Description>Instance of runtime driver library, Hook VitualAddressChange and - BooterviceExit event and provide runtime service.</Description>
- <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkUefiRuntimeLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_RUNTIME_DRIVER DXE_SAL_DRIVER">
- <Keyword>UefiRuntimeLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>UefiBootServicesTableLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED" SupArchList="IPF">
- <Keyword>ExtendedSalLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>RuntimeLibInternal.h</Filename>
- <Filename SupArchList="IA32">Common/RuntimeLib.c</Filename>
- <Filename SupArchList="IA32">Common/RuntimeService.c</Filename>
- <Filename SupArchList="X64">Common/RuntimeLib.c</Filename>
- <Filename SupArchList="X64">Common/RuntimeService.c</Filename>
- <Filename SupArchList="EBC">Common/RuntimeLib.c</Filename>
- <Filename SupArchList="EBC">Common/RuntimeService.c</Filename>
- <Filename SupArchList="IPF">Ipf/RuntimeLib.c</Filename>
- <Filename SupArchList="IPF">Ipf/RuntimeService.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" SupArchList="IPF"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- <Extern>
- <Constructor>RuntimeDriverLibConstruct</Constructor>
- <Destructor>RuntimeDriverLibDeconstruct</Destructor>
- </Extern>
- <Extern>
- <ExitBootServicesCallBack>RuntimeDriverExitBootServices</ExitBootServicesCallBack>
- </Extern>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c deleted file mode 100644 index 2382d4a1d5..0000000000 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c +++ /dev/null @@ -1,238 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeLib.c
-
---*/
-
-#include <RuntimeLibInternal.h>
-
-//
-// Driver Lib Module Globals
-//
-static EFI_EVENT mEfiVirtualNotifyEvent;
-EFI_RUNTIME_SERVICES *mRT;
-
-VOID
-EFIAPI
-RuntimeDriverExitBootServices (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Set AtRuntime flag as TRUE after ExitBootServices
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- if (EfiAtRuntime()) {
- return;
- }
-}
-
-STATIC
-VOID
-EFIAPI
-RuntimeLibVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
- )
-/*++
-
-Routine Description:
-
- Fixup internal data so that EFI can be call in virtual mode.
- Call the passed in Child Notify event and convert any pointers in
- lib to virtual mode.
-
-Arguments:
-
- Event - The Event that is being processed
-
- Context - Event Context
-
-Returns:
-
- None
-
---*/
-{
- UINTN Index;
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;
-
- for (Index = 0; _gDriverSetVirtualAddressMapEvent[Index] != NULL; Index++) {
- ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];
- ChildNotifyEventHandler (Event, NULL);
- }
-
- //
- // Update global for Runtime Services Table
- //
- EfiConvertPointer (0, (VOID **) &mRT);
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibConstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- Intialize runtime Driver Lib if it has not yet been initialized.
-
-Arguments:
-
- ImageHandle - The firmware allocated handle for the EFI image.
-
- SystemTable - A pointer to the EFI System Table.
-
- GoVirtualChildEvent - Caller can register a virtual notification event.
-
-Returns:
-
- EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.
-
---*/
-{
- EFI_STATUS Status;
-
- mRT = SystemTable->RuntimeServices;
-
- //
- // Register SetVirtualAddressMap () notify function
- //
- if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {
- Status = gBS->CreateEvent (
- EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
- TPL_NOTIFY,
- RuntimeLibVirtualNotifyEvent,
- NULL,
- &mEfiVirtualNotifyEvent
- );
- ASSERT_EFI_ERROR (Status);
- }
-
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-EFIAPI
-RuntimeDriverLibDeconstruct (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
- )
-/*++
-
-Routine Description:
-
- This routine will free some resources which have been allocated in
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error,
- it must call this routine to free the allocated resource before the exiting.
-
-Arguments:
-
- None
-
-Returns:
-
- EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully
- EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all
-
---*/
-{
- EFI_STATUS Status;
-
- //
- // Close SetVirtualAddressMap () notify function
- //
- if (_gDriverSetVirtualAddressMapEvent[0] != NULL) {
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);
- ASSERT_EFI_ERROR (Status);
- }
-
- return EFI_SUCCESS;
-}
-
-BOOLEAN
-EFIAPI
-EfiAtRuntime (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if ExitBootService () has been called
-
-Arguments:
- NONE
-
-Returns:
- TRUE - If ExitBootService () has been called
-
---*/
-{
- EFI_GUID Guid;
- SAL_RETURN_REGS ReturnReg;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, IsEfiRuntimeFunctionId, 0, 0, 0, 0, 0, 0, 0);
-
- return (BOOLEAN) (ReturnReg.r9 == 1);
-}
-
-BOOLEAN
-EFIAPI
-EfiGoneVirtual (
- VOID
- )
-/*++
-
-Routine Description:
- Return TRUE if SetVirtualAddressMap () has been called
-
-Arguments:
- NONE
-
-Returns:
- TRUE - If SetVirtualAddressMap () has been called
-
---*/
-{
- EFI_GUID Guid;
- SAL_RETURN_REGS ReturnReg;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, IsVirtualFunctionId, 0, 0, 0, 0, 0, 0, 0);
-
- return (BOOLEAN) (ReturnReg.r9 == 1);
-}
-
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c deleted file mode 100644 index c6ea0b1d10..0000000000 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c +++ /dev/null @@ -1,552 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeService.c
-
---*/
-
-#include <RuntimeLibInternal.h>
-
-VOID
-EFIAPI
-EfiResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN CHAR16 *ResetData
- )
-/*++
-
-Routine Description:
-
- Resets the entire platform.
-
-Arguments:
-
- ResetType - The type of reset to perform.
- ResetStatus - The status code for the reset.
- DataSize - The size, in bytes, of ResetData.
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally
- followed by additional binary data.
-
-Returns:
-
- None
-
---*/
-{
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI;
-
- EsalCall (
- &Guid,
- ResetSystemFunctionId,
- (UINT64) ResetType,
- (UINT64) ResetStatus,
- (UINT64) DataSize,
- (UINT64) ResetData,
- 0,
- 0,
- 0
- );
-}
-
-
-//
-// The following functions hide the mRT local global from the call to
-// runtime service in the EFI system table.
-//
-EFI_STATUS
-EFIAPI
-EfiGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities
- )
-/*++
-
-Routine Description:
-
- Returns the current time and date information, and the time-keeping
- capabilities of the hardware platform.
-
-Arguments:
-
- Time - A pointer to storage to receive a snapshot of the current time.
- Capabilities - An optional pointer to a buffer to receive the real time clock device's
- capabilities.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, GetTimeFunctionId, (UINT64) Time, (UINT64) Capabilities, 0, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetTime (
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the current local time and date information.
-
-Arguments:
-
- Time - A pointer to the current time.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, SetTimeFunctionId, (UINT64) Time, 0, 0, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Returns the current wakeup alarm clock setting.
-
-Arguments:
-
- Enabled - Indicates if the alarm is currently enabled or disabled.
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.
- Time - The current alarm setting.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, GetWakeupTimeFunctionId, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetWakeupTime (
- IN BOOLEAN Enable,
- IN EFI_TIME *Time
- )
-/*++
-
-Routine Description:
-
- Sets the system wakeup alarm clock time.
-
-Arguments:
-
- Enable - Enable or disable the wakeup alarm.
- Time - If Enable is TRUE, the time to set the wakeup alarm for.
- If Enable is FALSE, then this parameter is optional, and may be NULL.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, SetWakeupTimeFunctionId, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);
- return ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID * VendorGuid,
- OUT UINT32 *Attributes OPTIONAL,
- IN OUT UINTN *DataSize,
- OUT VOID *Data
- )
-/*++
-
-Routine Description:
-
- Returns the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - If not NULL, a pointer to the memory location to return the
- attributes bitmask for the variable.
- DataSize - On input, the size in bytes of the return Data buffer.
- On output the size of data returned in Data.
- Data - The buffer to return the contents of the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- EsalGetVariableFunctionId,
- (UINT64) VariableName,
- (UINT64) VendorGuid,
- (UINT64) Attributes,
- (UINT64) DataSize,
- (UINT64) Data,
- 0,
- 0
- );
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextVariableName (
- IN OUT UINTN *VariableNameSize,
- IN OUT CHAR16 *VariableName,
- IN OUT EFI_GUID *VendorGuid
- )
-/*++
-
-Routine Description:
-
- Enumerates the current variable names.
-
-Arguments:
-
- VariableNameSize - The size of the VariableName buffer.
- VariableName - On input, supplies the last VariableName that was returned
- by GetNextVariableName().
- On output, returns the Nullterminated Unicode string of the
- current variable.
- VendorGuid - On input, supplies the last VendorGuid that was returned by
- GetNextVariableName().
- On output, returns the VendorGuid of the current variable.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- EsalGetNextVariableNameFunctionId,
- (UINT64) VariableNameSize,
- (UINT64) VariableName,
- (UINT64) VendorGuid,
- 0,
- 0,
- 0,
- 0
- );
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiSetVariable (
- IN CHAR16 *VariableName,
- IN EFI_GUID *VendorGuid,
- IN UINT32 Attributes,
- IN UINTN DataSize,
- IN VOID *Data
- )
-/*++
-
-Routine Description:
-
- Sets the value of a variable.
-
-Arguments:
-
- VariableName - A Null-terminated Unicode string that is the name of the
- vendor's variable.
- VendorGuid - A unique identifier for the vendor.
- Attributes - Attributes bitmask to set for the variable.
- DataSize - The size in bytes of the Data buffer.
- Data - The contents for the variable.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- EsalSetVariableFunctionId,
- (UINT64) VariableName,
- (UINT64) VendorGuid,
- (UINT64) Attributes,
- (UINT64) DataSize,
- (UINT64) Data,
- 0,
- 0
- );
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiGetNextHighMonotonicCount (
- OUT UINT32 *HighCount
- )
-/*++
-
-Routine Description:
-
- Returns the next high 32 bits of the platform's monotonic counter.
-
-Arguments:
-
- HighCount - Pointer to returned value.
-
-Returns:
-
- Status code
-
---*/
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (&Guid, GetNextHighMonotonicCountFunctionId, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);
- return (EFI_STATUS) ReturnReg.Status;
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertPointer (
- IN UINTN DebugDisposition,
- IN OUT VOID **Address
- )
-/*++
-
-Routine Description:
-
- Determines the new virtual address that is to be used on subsequent memory accesses.
-
-Arguments:
-
- DebugDisposition - Supplies type information for the pointer being converted.
- Address - A pointer to a pointer that is to be fixed to be the value needed
- for the new virtual address mappings being applied.
-
-Returns:
-
- Status code
-
---*/
-{
- return mRT->ConvertPointer (DebugDisposition, Address);
-}
-
-EFI_STATUS
-EFIAPI
-EfiConvertList (
- IN UINTN DebugDisposition,
- IN OUT LIST_ENTRY *ListHead
- )
-/*++
-
-Routine Description:
-
- Conver the standard Lib double linked list to a virtual mapping.
-
-Arguments:
-
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)
-
- ListHead - Head of linked list to convert
-
-Returns:
-
- EFI_SUCCESS
-
---*/
-{
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
-
- //
- // Convert all the ForwardLink & BackLink pointers in the list
- //
- Link = ListHead;
- do {
- NextLink = Link->ForwardLink;
-
- EfiConvertPointer (
- Link->ForwardLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->ForwardLink
- );
-
- EfiConvertPointer (
- Link->BackLink == ListHead ? DebugDisposition : 0,
- (VOID **) &Link->BackLink
- );
-
- Link = NextLink;
- } while (Link != ListHead);
- return EFI_SUCCESS;
-}
-
-
-/**
- Change the runtime addressing mode of EFI firmware from physical to virtual.
-
- @param MemoryMapSize The size in bytes of VirtualMap.
- @param DescriptorSize The size in bytes of an entry in the VirtualMap.
- @param DescriptorVersion The version of the structure entries in VirtualMap.
- @param VirtualMap An array of memory descriptors which contain new virtual
- address mapping information for all runtime ranges. Type
- EFI_MEMORY_DESCRIPTOR is defined in the
- GetMemoryMap() function description.
-
- @retval EFI_SUCCESS The virtual address map has been applied.
- @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
- virtual address mapped mode.
- @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
- invalid.
- @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
- map that requires a mapping.
- @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
- in the memory map.
-**/
-EFI_STATUS
-EFIAPI
-EfiSetVirtualAddressMap (
- IN UINTN MemoryMapSize,
- IN UINTN DescriptorSize,
- IN UINT32 DescriptorVersion,
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap
- )
-{
- SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid;
-
- *((UINT64 *) &Guid) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO;
- *(((UINT64 *)&Guid) + 1) = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI;
-
- ReturnReg = EsalCall (
- &Guid,
- SetVirtualAddressFunctionId,
- (UINT64) MemoryMapSize,
- (UINT64) DescriptorSize,
- (UINT64) DescriptorVersion,
- (UINT64) VirtualMap,
- 0,
- 0,
- 0
- );
-
- return ReturnReg.Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiUpdateCapsule (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-EFI_STATUS
-EFIAPI
-EfiQueryCapsuleCapabilities (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaximumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
- )
-{
- return EFI_UNSUPPORTED;
-}
-
-
-EFI_STATUS
-EFIAPI
-EfiQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
- )
-{
- return EFI_UNSUPPORTED;
-}
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h b/EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h deleted file mode 100644 index 223ad40f9d..0000000000 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/RuntimeLibInternal.h +++ /dev/null @@ -1,25 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- RuntimeLibInternal.h
-
-Abstract:
-
---*/
-
-#ifndef __RUNTIMELIBINTERNAL_H__
-#define __RUNTIMELIBINTERNAL_H__
-
-extern EFI_RUNTIME_SERVICES *mRT;
-
-#endif //__RUNTIMELIBINTERNAL_H__
diff --git a/EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa b/EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa deleted file mode 100644 index 263b608217..0000000000 --- a/EdkModulePkg/Library/EdkUsbLib/EdkUsbLib.msa +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>EdkUsbLib</ModuleName>
- <ModuleType>DXE_DRIVER</ModuleType>
- <GuidValue>87eb5df9-722a-4241-ad7f-370d0b3a56d7</GuidValue>
- <Version>1.0</Version>
- <Abstract>Component description file for UsbDxeLib module</Abstract>
- <Description>This library provides supports for common USB functions.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>EdkUsbLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">
- <Keyword>EdkUsbLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>UsbDxeLib.c</Filename>
- <Filename>hid.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
-</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c b/EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c deleted file mode 100644 index 8bbd0893ae..0000000000 --- a/EdkModulePkg/Library/EdkUsbLib/UsbDxeLib.c +++ /dev/null @@ -1,699 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- UsbDxeLib.c
-
- Abstract:
-
- Common Dxe Libarary for USB
-
- Revision History
-
---*/
-
-//
-// Get Device Descriptor
-//
-EFI_STATUS
-UsbGetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Descriptor
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Device Request Value
- Index - Device Request Index
- DescriptorLength - Descriptor Length
- Descriptor - Descriptor buffer to contain result
- Status - Transfer Status
-Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Descriptor,
- DescriptorLength,
- Status
- );
-}
-//
-// Set Device Descriptor
-//
-EFI_STATUS
-UsbSetDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- IN VOID *Descriptor,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Descriptor
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Device Request Value
- Index - Device Request Index
- DescriptorLength - Descriptor Length
- Descriptor - Descriptor buffer to set
- Status - Transfer Status
-Returns:
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataOut,
- TIMEOUT_VALUE,
- Descriptor,
- DescriptorLength,
- Status
- );
-}
-
-//
-// Get device Interface
-//
-EFI_STATUS
-UsbGetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Index,
- OUT UINT8 *AltSetting,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Device Interface
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Index - Interface index value
- AltSetting - Alternate setting
- Status - Trasnsfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_GET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_INTERFACE;
- DevReq.Index = Index;
- DevReq.Length = 1;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- AltSetting,
- 1,
- Status
- );
-}
-//
-// Set device interface
-//
-EFI_STATUS
-UsbSetDeviceInterface (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 InterfaceNo,
- IN UINT16 AltSetting,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Interface
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- InterfaceNo - Interface Number
- AltSetting - Alternate setting
- Status - Trasnsfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_INTERFACE_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_INTERFACE;
- DevReq.Value = AltSetting;
- DevReq.Index = InterfaceNo;
-
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Get device configuration
-//
-EFI_STATUS
-UsbGetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- OUT UINT8 *ConfigValue,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Device Configuration
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- ConfigValue - Config Value
- Status - Transfer Status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_GET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_CONFIGURATION;
- DevReq.Length = 1;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- ConfigValue,
- 1,
- Status
- );
-}
-//
-// Set device configuration
-//
-EFI_STATUS
-UsbSetDeviceConfiguration (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 Value,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Configuration
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Value - Configuration Value to set
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_CONFIGURATION;
- DevReq.Value = Value;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Set Device Feature
-//
-EFI_STATUS
-UsbSetDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Set Device Feature
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Value - Request value
- Target - Request Index
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- switch (Recipient) {
-
- case EfiUsbDevice:
- DevReq.RequestType = 0x00;
- break;
-
- case EfiUsbInterface:
- DevReq.RequestType = 0x01;
- break;
-
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x02;
- break;
- }
- //
- // Fill device request, see USB1.1 spec
- //
- DevReq.Request = USB_DEV_SET_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Clear Device Feature
-//
-EFI_STATUS
-UsbClearDeviceFeature (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Value,
- IN UINT16 Target,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Clear Device Feature
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Value - Request value
- Target - Request Index
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- switch (Recipient) {
-
- case EfiUsbDevice:
- DevReq.RequestType = 0x00;
- break;
-
- case EfiUsbInterface:
- DevReq.RequestType = 0x01;
- break;
-
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x02;
- break;
- }
- //
- // Fill device request, see USB1.1 spec
- //
- DevReq.Request = USB_DEV_CLEAR_FEATURE;
- DevReq.Value = Value;
- DevReq.Index = Target;
-
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- Status
- );
-}
-//
-// Get Device Status
-//
-EFI_STATUS
-UsbGetDeviceStatus (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN EFI_USB_RECIPIENT Recipient,
- IN UINT16 Target,
- OUT UINT16 *DevStatus,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get Device Status
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- Recipient - Interface/Device/Endpoint
- Target - Request index
- DevStatus - Device status
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- EFI_USB_DEVICE_REQUEST DevReq;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
-
- switch (Recipient) {
-
- case EfiUsbDevice:
- DevReq.RequestType = 0x80;
- break;
-
- case EfiUsbInterface:
- DevReq.RequestType = 0x81;
- break;
-
- case EfiUsbEndpoint:
- DevReq.RequestType = 0x82;
- break;
- }
- //
- // Fill device request, see USB1.1 spec
- //
- DevReq.Request = USB_DEV_GET_STATUS;
- DevReq.Value = 0;
- DevReq.Index = Target;
- DevReq.Length = 2;
-
- return UsbIo->UsbControlTransfer (
- UsbIo,
- &DevReq,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- DevStatus,
- 2,
- Status
- );
-}
-//
-// Usb Get String
-//
-EFI_STATUS
-UsbGetString (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT16 LangID,
- IN UINT8 Index,
- IN VOID *Buf,
- IN UINTN BufSize,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Usb Get String
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- LangID - Language ID
- Index - Request index
- Buf - Buffer to store string
- BufSize - Buffer size
- Status - Transfer status
-
-Returns:
-
- EFI_INVALID_PARAMETER - Parameter is error
- EFI_SUCCESS - Success
- EFI_TIMEOUT - Device has no response
-
---*/
-{
- UINT16 Value;
-
- if (UsbIo == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Fill value, see USB1.1 spec
- //
- Value = (UINT16) ((USB_DT_STRING << 8) | Index);
-
- return UsbGetDescriptor (
- UsbIo,
- Value,
- LangID,
- (UINT16) BufSize,
- Buf,
- Status
- );
-}
-
-EFI_STATUS
-UsbClearEndpointHalt (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 EndpointNo,
- OUT UINT32 *Status
- )
-/*++
-
-Routine Description:
-
- Clear endpoint stall
-
-Arguments:
-
- UsbIo - EFI_USB_IO_PROTOCOL
- EndpointNo - Endpoint Number
- Status - Transfer Status
-
-Returns:
-
- EFI_NOT_FOUND - Can't find the Endpoint
- EFI_DEVICE_ERROR - Hardware error
- EFI_SUCCESS - Success
-
---*/
-{
- EFI_STATUS Result;
- EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;
- EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
- UINT8 Index;
-
- ZeroMem (&EndpointDescriptor, sizeof (EFI_USB_ENDPOINT_DESCRIPTOR));
- //
- // First seach the endpoint descriptor for that endpoint addr
- //
- Result = UsbIo->UsbGetInterfaceDescriptor (
- UsbIo,
- &InterfaceDescriptor
- );
- if (EFI_ERROR (Result)) {
- return Result;
- }
-
- for (Index = 0; Index < InterfaceDescriptor.NumEndpoints; Index++) {
- Result = UsbIo->UsbGetEndpointDescriptor (
- UsbIo,
- Index,
- &EndpointDescriptor
- );
- if (EFI_ERROR (Result)) {
- continue;
- }
-
- if (EndpointDescriptor.EndpointAddress == EndpointNo) {
- break;
- }
- }
-
- if (Index == InterfaceDescriptor.NumEndpoints) {
- //
- // No such endpoint
- //
- return EFI_NOT_FOUND;
- }
-
- Result = UsbClearDeviceFeature (
- UsbIo,
- EfiUsbEndpoint,
- EfiUsbEndpointHalt,
- EndpointDescriptor.EndpointAddress,
- Status
- );
-
- return Result;
-}
diff --git a/EdkModulePkg/Library/EdkUsbLib/hid.c b/EdkModulePkg/Library/EdkUsbLib/hid.c deleted file mode 100644 index edf9a94efc..0000000000 --- a/EdkModulePkg/Library/EdkUsbLib/hid.c +++ /dev/null @@ -1,459 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- Module Name:
-
- hid.c
-
- Abstract:
-
- HID class request
-
- Revision History
-
---*/
-
-//
-// Function to get HID descriptor
-//
-EFI_STATUS
-UsbGetHidDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 InterfaceNum,
- OUT EFI_USB_HID_DESCRIPTOR *HidDescriptor
- )
-/*++
-
- Routine Description:
- Get Hid Descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- InterfaceNum - Hid interface number
- HidDescriptor - Caller allocated buffer to store Usb hid descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- Request.RequestType = 0x81;
- Request.Request = 0x06;
- Request.Value = (UINT16) (0x21 << 8);
- Request.Index = InterfaceNum;
- Request.Length = sizeof (EFI_USB_HID_DESCRIPTOR);
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- HidDescriptor,
- sizeof (EFI_USB_HID_DESCRIPTOR),
- &Status
- );
-
- return Result;
-
-}
-//
-// Function to get Report Class descriptor
-//
-EFI_STATUS
-UsbGetReportDescriptor (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 InterfaceNum,
- IN UINT16 DescriptorSize,
- OUT UINT8 *DescriptorBuffer
- )
-/*++
-
- Routine Description:
- get Report Class descriptor
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL.
- InterfaceNum - Report interface number.
- DescriptorSize - Length of DescriptorBuffer.
- DescriptorBuffer - Caller allocated buffer to store Usb report descriptor
- if successfully returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x81;
- Request.Request = 0x06;
- Request.Value = (UINT16) (0x22 << 8);
- Request.Index = InterfaceNum;
- Request.Length = DescriptorSize;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- DescriptorBuffer,
- DescriptorSize,
- &Status
- );
-
- return Result;
-
-}
-//
-// Following are HID class request
-//
-EFI_STATUS
-UsbGetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 *Protocol
- )
-/*++
-
- Routine Description:
- Get Hid Protocol Request
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to get protocol
- Protocol - Protocol value returned.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
- Request.Request = EFI_USB_GET_PROTOCOL_REQUEST;
- Request.Value = 0;
- Request.Index = Interface;
- Request.Length = 1;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Protocol,
- sizeof (UINT8),
- &Status
- );
-
- return Result;
-}
-
-
-EFI_STATUS
-UsbSetProtocolRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 Protocol
- )
-/*++
-
- Routine Description:
- Set Hid Protocol Request
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set protocol
- Protocol - Protocol value the caller wants to set.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
- Request.Request = EFI_USB_SET_PROTOCOL_REQUEST;
- Request.Value = Protocol;
- Request.Index = Interface;
- Request.Length = 0;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- &Status
- );
- return Result;
-}
-
-
-EFI_STATUS
-UsbSetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 Duration
- )
-/*++
-
- Routine Description:
- Set Idel request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- Duration - Idle rate the caller wants to set.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
- Request.Request = EFI_USB_SET_IDLE_REQUEST;
- Request.Value = (UINT16) ((Duration << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = 0;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbNoData,
- TIMEOUT_VALUE,
- NULL,
- 0,
- &Status
- );
- return Result;
-}
-
-EFI_STATUS
-UsbGetIdleRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- OUT UINT8 *Duration
- )
-/*++
-
- Routine Description:
- Get Idel request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to get.
- ReportId - Which report the caller wants to get.
- Duration - Idle rate the caller wants to get.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
- Request.Request = EFI_USB_GET_IDLE_REQUEST;
- Request.Value = ReportId;
- Request.Index = Interface;
- Request.Length = 1;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Duration,
- 1,
- &Status
- );
-
- return Result;
-}
-
-
-EFI_STATUS
-UsbSetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
- )
-/*++
-
- Routine Description:
- Hid Set Report request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- ReportType - Type of report.
- ReportLen - Length of report descriptor.
- Report - Report Descriptor buffer.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0x21;
- //
- // 00100001b;
- //
- Request.Request = EFI_USB_SET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataOut,
- TIMEOUT_VALUE,
- Report,
- ReportLen,
- &Status
- );
-
- return Result;
-}
-
-EFI_STATUS
-UsbGetReportRequest (
- IN EFI_USB_IO_PROTOCOL *UsbIo,
- IN UINT8 Interface,
- IN UINT8 ReportId,
- IN UINT8 ReportType,
- IN UINT16 ReportLen,
- IN UINT8 *Report
- )
-/*++
-
- Routine Description:
- Hid Set Report request.
-
- Arguments:
- UsbIo - EFI_USB_IO_PROTOCOL
- Interface - Which interface the caller wants to set.
- ReportId - Which report the caller wants to set.
- ReportType - Type of report.
- ReportLen - Length of report descriptor.
- Report - Caller allocated buffer to store Report Descriptor.
-
- Returns:
- EFI_SUCCESS
- EFI_DEVICE_ERROR
- EFI_TIMEOUT
-
---*/
-{
- UINT32 Status;
- EFI_STATUS Result;
- EFI_USB_DEVICE_REQUEST Request;
-
- //
- // Fill Device request packet
- //
- Request.RequestType = 0xa1;
- //
- // 10100001b;
- //
- Request.Request = EFI_USB_GET_REPORT_REQUEST;
- Request.Value = (UINT16) ((ReportType << 8) | ReportId);
- Request.Index = Interface;
- Request.Length = ReportLen;
-
- Result = UsbIo->UsbControlTransfer (
- UsbIo,
- &Request,
- EfiUsbDataIn,
- TIMEOUT_VALUE,
- Report,
- ReportLen,
- &Status
- );
-
- return Result;
-}
diff --git a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c deleted file mode 100644 index c71f1e7167..0000000000 --- a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c +++ /dev/null @@ -1,332 +0,0 @@ -/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiPerformanceLib.c
-
-Abstract:
-
- Performance Library
-
---*/
-
-/**
- Gets PEI the GUID HOB for PEI performance.
-
- This internal function searches for the GUID HOB for PEI performance.
- If that GUID HOB is not found, it will build a new one.
- It returns the data area of that GUID HOB to record performance log.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
-
- @retval The index of log entry in the array.
-
-**/
-STATIC
-PEI_PERFORMANCE_LOG_HEADER *
-InternalGetPerformanceHobLog (
- VOID
- )
-{
- EFI_HOB_GUID_TYPE *GuidHob;
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- UINTN PeiPerformanceLogSize;
-
- GuidHob = GetFirstGuidHob (&gPeiPerformanceHobGuid);
-
- if (GuidHob != NULL) {
- //
- // PEI Performance HOB was found, then return the existing one.
- //
- PeiPerformanceLog = GET_GUID_HOB_DATA (GuidHob);
- } else {
- //
- // PEI Performance HOB was not found, then build one.
- //
- PeiPerformanceLogSize = sizeof (PEI_PERFORMANCE_LOG_HEADER) +
- sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);
- PeiPerformanceLog = BuildGuidHob (&gPeiPerformanceHobGuid, PeiPerformanceLogSize);
- PeiPerformanceLog = ZeroMem (PeiPerformanceLog, PeiPerformanceLogSize);
- }
-
- return PeiPerformanceLog;
-}
-
-/**
- Searches in the log array with keyword Handle, Token and Module.
-
- This internal function searches for the log entry in the log array.
- If there is an entry that exactly matches the given key word triple
- and its end time stamp is zero, then the index of that log entry is returned;
- otherwise, the the number of log entries in the array is returned.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
-
- @retval The index of log entry in the array.
-
-**/
-STATIC
-UINT32
-InternalSearchForLogEntry (
- IN PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog,
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module OPTIONAL
- )
-{
- UINT32 Index;
- UINT32 NumberOfEntries;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
-
-
- if (Token == NULL) {
- Token = "";
- }
- if (Module == NULL) {
- Module = "";
- }
- NumberOfEntries = PeiPerformanceLog->NumberOfEntries;
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
-
- for (Index = 0; Index < NumberOfEntries; Index++) {
- if ((LogEntryArray[Index].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&
- AsciiStrnCmp (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- AsciiStrnCmp (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&
- LogEntryArray[Index].EndTimeStamp == 0
- ) {
- break;
- }
- }
- return Index;
-}
-
-/**
- Creates a record for the beginning of a performance measurement.
-
- Creates a record that contains the Handle, Token, and Module.
- If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
- If TimeStamp is zero, then this function reads the current time stamp
- and adds that time stamp value to the record as the start time.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The start of the measurement was recorded.
- @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
-
-**/
-RETURN_STATUS
-EFIAPI
-StartPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- UINT32 Index;
-
- PeiPerformanceLog = InternalGetPerformanceHobLog ();
-
- if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) {
- return RETURN_OUT_OF_RESOURCES;
- }
- Index = PeiPerformanceLog->NumberOfEntries++;
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
- LogEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;
-
- if (Token != NULL) {
- AsciiStrnCpy (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH);
- }
- if (Module != NULL) {
- AsciiStrnCpy (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH);
- }
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
- LogEntryArray[Index].StartTimeStamp = TimeStamp;
-
- return RETURN_SUCCESS;
-}
-
-/**
- Fills in the end time of a performance measurement.
-
- Looks up the record that matches Handle, Token, and Module.
- If the record can not be found then return RETURN_NOT_FOUND.
- If the record is found and TimeStamp is not zero,
- then TimeStamp is added to the record as the end time.
- If the record is found and TimeStamp is zero, then this function reads
- the current time stamp and adds that time stamp value to the record as the end time.
- If this function is called multiple times for the same record, then the end time is overwritten.
-
- @param Handle Pointer to environment specific context used
- to identify the component being measured.
- @param Token Pointer to a Null-terminated ASCII string
- that identifies the component being measured.
- @param Module Pointer to a Null-terminated ASCII string
- that identifies the module being measured.
- @param TimeStamp 64-bit time stamp.
-
- @retval RETURN_SUCCESS The end of the measurement was recorded.
- @retval RETURN_NOT_FOUND The specified measurement record could not be found.
-
-**/
-RETURN_STATUS
-EFIAPI
-EndPerformanceMeasurement (
- IN CONST VOID *Handle, OPTIONAL
- IN CONST CHAR8 *Token, OPTIONAL
- IN CONST CHAR8 *Module, OPTIONAL
- IN UINT64 TimeStamp
- )
-{
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- UINT32 Index;
-
- if (TimeStamp == 0) {
- TimeStamp = GetPerformanceCounter ();
- }
-
- PeiPerformanceLog = InternalGetPerformanceHobLog ();
- Index = InternalSearchForLogEntry (PeiPerformanceLog, Handle, Token, Module);
- if (Index >= PeiPerformanceLog->NumberOfEntries) {
- return RETURN_NOT_FOUND;
- }
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
- LogEntryArray[Index].EndTimeStamp = TimeStamp;
-
- return RETURN_SUCCESS;
-}
-
-/**
- Attempts to retrieve a performance measurement log entry from the performance measurement log.
-
- Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
- zero on entry, then an attempt is made to retrieve the first entry from the performance log,
- and the key for the second entry in the log is returned. If the performance log is empty,
- then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
- log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
- returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
- retrieved and an implementation specific non-zero key value that specifies the end of the performance
- log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
- is retrieved and zero is returned. In the cases where a performance log entry can be returned,
- the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
- If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
- If Handle is NULL, then ASSERT().
- If Token is NULL, then ASSERT().
- If Module is NULL, then ASSERT().
- If StartTimeStamp is NULL, then ASSERT().
- If EndTimeStamp is NULL, then ASSERT().
-
- @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
- 0, then the first performance measurement log entry is retrieved.
- On exit, the key of the next performance lof entry entry.
- @param Handle Pointer to environment specific context used to identify the component
- being measured.
- @param Token Pointer to a Null-terminated ASCII string that identifies the component
- being measured.
- @param Module Pointer to a Null-terminated ASCII string that identifies the module
- being measured.
- @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was started.
- @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
- was ended.
-
- @return The key for the next performance log entry (in general case).
-
-**/
-UINTN
-EFIAPI
-GetPerformanceMeasurement (
- IN UINTN LogEntryKey,
- OUT CONST VOID **Handle,
- OUT CONST CHAR8 **Token,
- OUT CONST CHAR8 **Module,
- OUT UINT64 *StartTimeStamp,
- OUT UINT64 *EndTimeStamp
- )
-{
- PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;
- PEI_PERFORMANCE_LOG_ENTRY *CurrentLogEntry;
- PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;
- UINTN NumberOfEntries;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
-
- PeiPerformanceLog = InternalGetPerformanceHobLog ();
-
- NumberOfEntries = (UINTN) (PeiPerformanceLog->NumberOfEntries);
- LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);
- //
- // Make sure that LogEntryKey is a valid log entry key.
- //
- ASSERT (LogEntryKey <= NumberOfEntries);
-
- if (LogEntryKey == NumberOfEntries) {
- return 0;
- }
-
- CurrentLogEntry = &(LogEntryArray[LogEntryKey++]);
-
- *Handle = (VOID *) (UINTN) (CurrentLogEntry->Handle);
- *Token = CurrentLogEntry->Token;
- *Module = CurrentLogEntry->Module;
- *StartTimeStamp = CurrentLogEntry->StartTimeStamp;
- *EndTimeStamp = CurrentLogEntry->EndTimeStamp;
-
- return LogEntryKey;
-}
-
-/**
- Returns TRUE if the performance measurement macros are enabled.
-
- This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
-
- @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is set.
- @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
- PcdPerformanceLibraryPropertyMask is clear.
-
-**/
-BOOLEAN
-EFIAPI
-PerformanceMeasurementEnabled (
- VOID
- )
-{
- return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
-}
diff --git a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa b/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa deleted file mode 100644 index 85ce0ad520..0000000000 --- a/EdkModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.msa +++ /dev/null @@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <MsaHeader>
- <ModuleName>PeiPerformanceLib</ModuleName>
- <ModuleType>PEIM</ModuleType>
- <GuidValue>F72DE735-B24F-4ef6-897F-70A85D01A047</GuidValue>
- <Version>1.0</Version>
- <Abstract>Memory-only library functions with no library constructor/destructor</Abstract>
- <Description>This module provides the performance measurement interfaces in PEI phase, it is one instance of Performance Libarary.</Description>
- <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>
- <License>All rights reserved. This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
- </MsaHeader>
- <ModuleDefinitions>
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
- <BinaryModule>false</BinaryModule>
- <OutputFileBasename>PeiPerformanceLib</OutputFileBasename>
- </ModuleDefinitions>
- <LibraryClassDefinitions>
- <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM PEI_CORE">
- <Keyword>PerformanceLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>DebugLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>HobLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>TimerLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>PcdLib</Keyword>
- </LibraryClass>
- <LibraryClass Usage="ALWAYS_CONSUMED">
- <Keyword>BaseMemoryLib</Keyword>
- </LibraryClass>
- </LibraryClassDefinitions>
- <SourceFiles>
- <Filename>PeiPerformanceLib.c</Filename>
- </SourceFiles>
- <PackageDependencies>
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
- <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
- </PackageDependencies>
- <Guids>
- <GuidCNames Usage="SOMETIMES_CONSUMED">
- <GuidCName>gPeiPerformanceHobGuid</GuidCName>
- </GuidCNames>
- </Guids>
- <Externs>
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
- </Externs>
- <PcdCoded>
- <PcdEntry PcdItemType="FIXED_AT_BUILD">
- <C_Name>PcdPerformanceLibraryPropertyMask</C_Name>
- <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>The bitmask of flags that specify the enable/disable of - Performance Measurement.</HelpText>
- </PcdEntry>
- <PcdEntry PcdItemType="DYNAMIC">
- <C_Name>PcdMaxPeiPerformanceLogEntries</C_Name>
- <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
- <HelpText>Maximun number of performance log entries during PEI phase.</HelpText>
- </PcdEntry>
- </PcdCoded>
-</ModuleSurfaceArea>
\ No newline at end of file |