MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
1436aea4d5
commit
2f88bd3a12
@@ -30,18 +30,18 @@
|
||||
**/
|
||||
EFI_ACPI_COMMON_HEADER *
|
||||
ScanTableInSDT (
|
||||
IN EFI_ACPI_DESCRIPTION_HEADER *Sdt,
|
||||
IN UINTN TablePointerSize,
|
||||
IN UINT32 Signature,
|
||||
IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
|
||||
OUT BOOLEAN *PreviousTableLocated OPTIONAL
|
||||
IN EFI_ACPI_DESCRIPTION_HEADER *Sdt,
|
||||
IN UINTN TablePointerSize,
|
||||
IN UINT32 Signature,
|
||||
IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
|
||||
OUT BOOLEAN *PreviousTableLocated OPTIONAL
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN EntryCount;
|
||||
UINT64 EntryPtr;
|
||||
UINTN BasePtr;
|
||||
EFI_ACPI_COMMON_HEADER *Table;
|
||||
UINTN Index;
|
||||
UINTN EntryCount;
|
||||
UINT64 EntryPtr;
|
||||
UINTN BasePtr;
|
||||
EFI_ACPI_COMMON_HEADER *Table;
|
||||
|
||||
if (PreviousTableLocated != NULL) {
|
||||
ASSERT (PreviousTable != NULL);
|
||||
@@ -57,7 +57,7 @@ ScanTableInSDT (
|
||||
EntryCount = (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / TablePointerSize;
|
||||
|
||||
BasePtr = (UINTN)(Sdt + 1);
|
||||
for (Index = 0; Index < EntryCount; Index ++) {
|
||||
for (Index = 0; Index < EntryCount; Index++) {
|
||||
EntryPtr = 0;
|
||||
CopyMem (&EntryPtr, (VOID *)(BasePtr + Index * TablePointerSize), TablePointerSize);
|
||||
Table = (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr));
|
||||
@@ -77,7 +77,6 @@ ScanTableInSDT (
|
||||
//
|
||||
return Table;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,8 +96,8 @@ LocateAcpiFacsFromFadt (
|
||||
IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
|
||||
)
|
||||
{
|
||||
EFI_ACPI_COMMON_HEADER *Facs;
|
||||
UINT64 Data64;
|
||||
EFI_ACPI_COMMON_HEADER *Facs;
|
||||
UINT64 Data64;
|
||||
|
||||
if (Fadt == NULL) {
|
||||
return NULL;
|
||||
@@ -107,13 +106,14 @@ LocateAcpiFacsFromFadt (
|
||||
if (Fadt->Header.Revision < EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
|
||||
Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->FirmwareCtrl;
|
||||
} else {
|
||||
CopyMem (&Data64, &Fadt->XFirmwareCtrl, sizeof(UINT64));
|
||||
CopyMem (&Data64, &Fadt->XFirmwareCtrl, sizeof (UINT64));
|
||||
if (Data64 != 0) {
|
||||
Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Data64;
|
||||
} else {
|
||||
Facs = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->FirmwareCtrl;
|
||||
}
|
||||
}
|
||||
|
||||
return Facs;
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ LocateAcpiDsdtFromFadt (
|
||||
IN EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt
|
||||
)
|
||||
{
|
||||
EFI_ACPI_COMMON_HEADER *Dsdt;
|
||||
UINT64 Data64;
|
||||
EFI_ACPI_COMMON_HEADER *Dsdt;
|
||||
UINT64 Data64;
|
||||
|
||||
if (Fadt == NULL) {
|
||||
return NULL;
|
||||
@@ -140,13 +140,14 @@ LocateAcpiDsdtFromFadt (
|
||||
if (Fadt->Header.Revision < EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
|
||||
Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->Dsdt;
|
||||
} else {
|
||||
CopyMem (&Data64, &Fadt->XDsdt, sizeof(UINT64));
|
||||
CopyMem (&Data64, &Fadt->XDsdt, sizeof (UINT64));
|
||||
if (Data64 != 0) {
|
||||
Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Data64;
|
||||
} else {
|
||||
Dsdt = (EFI_ACPI_COMMON_HEADER *)(UINTN)Fadt->Dsdt;
|
||||
}
|
||||
}
|
||||
|
||||
return Dsdt;
|
||||
}
|
||||
|
||||
@@ -170,10 +171,10 @@ LocateAcpiDsdtFromFadt (
|
||||
**/
|
||||
EFI_ACPI_COMMON_HEADER *
|
||||
LocateAcpiTableInAcpiConfigurationTable (
|
||||
IN EFI_GUID *AcpiGuid,
|
||||
IN UINT32 Signature,
|
||||
IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
|
||||
OUT BOOLEAN *PreviousTableLocated OPTIONAL
|
||||
IN EFI_GUID *AcpiGuid,
|
||||
IN UINT32 Signature,
|
||||
IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL,
|
||||
OUT BOOLEAN *PreviousTableLocated OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -194,7 +195,7 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
//
|
||||
// Get ACPI ConfigurationTable (RSD_PTR)
|
||||
//
|
||||
Status = EfiGetSystemConfigurationTable(AcpiGuid, (VOID **)&Rsdp);
|
||||
Status = EfiGetSystemConfigurationTable (AcpiGuid, (VOID **)&Rsdp);
|
||||
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -205,20 +206,20 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
// Search XSDT
|
||||
//
|
||||
if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) {
|
||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->XsdtAddress;
|
||||
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->XsdtAddress;
|
||||
if (Signature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
ASSERT (PreviousTable == NULL);
|
||||
//
|
||||
// It is to locate DSDT,
|
||||
// need to locate FADT first.
|
||||
//
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
|
||||
Xsdt,
|
||||
sizeof (UINT64),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
|
||||
Xsdt,
|
||||
sizeof (UINT64),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Table = LocateAcpiDsdtFromFadt (Fadt);
|
||||
} else if (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
|
||||
ASSERT (PreviousTable == NULL);
|
||||
@@ -226,13 +227,13 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
// It is to locate FACS,
|
||||
// need to locate FADT first.
|
||||
//
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
|
||||
Xsdt,
|
||||
sizeof (UINT64),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
|
||||
Xsdt,
|
||||
sizeof (UINT64),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Table = LocateAcpiFacsFromFadt (Fadt);
|
||||
} else {
|
||||
Table = ScanTableInSDT (
|
||||
@@ -248,7 +249,8 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
if (Table != NULL) {
|
||||
return Table;
|
||||
} else if ((PreviousTableLocated != NULL) &&
|
||||
*PreviousTableLocated) {
|
||||
*PreviousTableLocated)
|
||||
{
|
||||
//
|
||||
// PreviousTable could be located in XSDT,
|
||||
// but next table could not be located in XSDT.
|
||||
@@ -259,20 +261,20 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
//
|
||||
// Search RSDT
|
||||
//
|
||||
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->RsdtAddress;
|
||||
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)Rsdp->RsdtAddress;
|
||||
if (Signature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
ASSERT (PreviousTable == NULL);
|
||||
//
|
||||
// It is to locate DSDT,
|
||||
// need to locate FADT first.
|
||||
//
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
|
||||
Rsdt,
|
||||
sizeof (UINT32),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
|
||||
Rsdt,
|
||||
sizeof (UINT32),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Table = LocateAcpiDsdtFromFadt (Fadt);
|
||||
} else if (Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
|
||||
ASSERT (PreviousTable == NULL);
|
||||
@@ -280,13 +282,13 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
// It is to locate FACS,
|
||||
// need to locate FADT first.
|
||||
//
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) ScanTableInSDT (
|
||||
Rsdt,
|
||||
sizeof (UINT32),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)ScanTableInSDT (
|
||||
Rsdt,
|
||||
sizeof (UINT32),
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
Table = LocateAcpiFacsFromFadt (Fadt);
|
||||
} else {
|
||||
Table = ScanTableInSDT (
|
||||
@@ -339,13 +341,13 @@ LocateAcpiTableInAcpiConfigurationTable (
|
||||
EFI_ACPI_COMMON_HEADER *
|
||||
EFIAPI
|
||||
EfiLocateNextAcpiTable (
|
||||
IN UINT32 Signature,
|
||||
IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL
|
||||
IN UINT32 Signature,
|
||||
IN EFI_ACPI_COMMON_HEADER *PreviousTable OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_ACPI_COMMON_HEADER *Table;
|
||||
BOOLEAN TempPreviousTableLocated;
|
||||
BOOLEAN *PreviousTableLocated;
|
||||
EFI_ACPI_COMMON_HEADER *Table;
|
||||
BOOLEAN TempPreviousTableLocated;
|
||||
BOOLEAN *PreviousTableLocated;
|
||||
|
||||
if (PreviousTable != NULL) {
|
||||
if (PreviousTable->Signature != Signature) {
|
||||
@@ -355,7 +357,8 @@ EfiLocateNextAcpiTable (
|
||||
return NULL;
|
||||
} else if ((Signature == EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) ||
|
||||
(Signature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) ||
|
||||
(Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE)) {
|
||||
(Signature == EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE))
|
||||
{
|
||||
//
|
||||
// There is only one FADT/DSDT/FACS table,
|
||||
// so don't try to locate next one.
|
||||
@@ -363,7 +366,7 @@ EfiLocateNextAcpiTable (
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PreviousTableLocated = &TempPreviousTableLocated;
|
||||
PreviousTableLocated = &TempPreviousTableLocated;
|
||||
*PreviousTableLocated = FALSE;
|
||||
} else {
|
||||
PreviousTableLocated = NULL;
|
||||
@@ -378,7 +381,8 @@ EfiLocateNextAcpiTable (
|
||||
if (Table != NULL) {
|
||||
return Table;
|
||||
} else if ((PreviousTableLocated != NULL) &&
|
||||
*PreviousTableLocated) {
|
||||
*PreviousTableLocated)
|
||||
{
|
||||
//
|
||||
// PreviousTable could be located in gEfiAcpi20TableGuid system
|
||||
// configuration table, but next table could not be located in
|
||||
@@ -415,7 +419,7 @@ EfiLocateNextAcpiTable (
|
||||
EFI_ACPI_COMMON_HEADER *
|
||||
EFIAPI
|
||||
EfiLocateFirstAcpiTable (
|
||||
IN UINT32 Signature
|
||||
IN UINT32 Signature
|
||||
)
|
||||
{
|
||||
return EfiLocateNextAcpiTable (Signature, NULL);
|
||||
|
@@ -6,24 +6,22 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "UefiLibInternal.h"
|
||||
|
||||
typedef struct {
|
||||
CHAR16 WChar;
|
||||
UINT32 Width;
|
||||
CHAR16 WChar;
|
||||
UINT32 Width;
|
||||
} UNICODE_WIDTH_ENTRY;
|
||||
|
||||
#define NARROW_CHAR 0xFFF0
|
||||
#define WIDE_CHAR 0xFFF1
|
||||
#define NARROW_CHAR 0xFFF0
|
||||
#define WIDE_CHAR 0xFFF1
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
//
|
||||
// General script area
|
||||
//
|
||||
{(CHAR16)0x1FFF, 1},
|
||||
{ (CHAR16)0x1FFF, 1 },
|
||||
|
||||
/*
|
||||
* Merge the blocks and replace them with the above entry as they fall to
|
||||
* the same category and they are all narrow glyph. This will reduce search
|
||||
@@ -70,7 +68,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
//
|
||||
// Symbol area
|
||||
//
|
||||
{(CHAR16)0x2FFF, 1},
|
||||
{ (CHAR16)0x2FFF, 1 },
|
||||
|
||||
/*
|
||||
* Merge the blocks and replace them with the above entry as they fall to
|
||||
* the same category and they are all narrow glyph. This will reduce search
|
||||
@@ -102,7 +101,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
//
|
||||
// CJK phonetics and symbol area
|
||||
//
|
||||
{(CHAR16)0x33FF, 2},
|
||||
{ (CHAR16)0x33FF, 2 },
|
||||
|
||||
/*
|
||||
* Merge the blocks and replace them with the above entry as they fall to
|
||||
* the same category and they are all wide glyph. This will reduce search
|
||||
@@ -125,7 +125,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
//
|
||||
// CJK ideograph area
|
||||
//
|
||||
{(CHAR16)0x9FFF, 2},
|
||||
{ (CHAR16)0x9FFF, 2 },
|
||||
|
||||
/*
|
||||
* Merge the blocks and replace them with the above entry as they fall to
|
||||
* the same category and they are all wide glyph. This will reduce search
|
||||
@@ -142,12 +143,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
//
|
||||
// Reserved
|
||||
//
|
||||
{(CHAR16)0xABFF, 0}, // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0
|
||||
{ (CHAR16)0xABFF, 0 }, // Reserved. 0xA000-0xA490 as Yi syllables. 0xA490-0xA4D0
|
||||
// as Yi radicals in ver3.0. 0xA000-0xABFF
|
||||
//
|
||||
// Hangul syllables
|
||||
//
|
||||
{(CHAR16)0xD7FF, 2},
|
||||
{ (CHAR16)0xD7FF, 2 },
|
||||
|
||||
/*
|
||||
* Merge the blocks and replace them with the above entry as they fall to
|
||||
* the same category and they are all wide glyph. This will reduce search
|
||||
@@ -163,26 +165,26 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UNICODE_WIDTH_ENTRY mUnicodeWidthTable[] = {
|
||||
//
|
||||
// Surrogates area
|
||||
//
|
||||
{(CHAR16)0xDFFF, 0}, // Surrogates, not used now. 0xD800-0xDFFF
|
||||
{ (CHAR16)0xDFFF, 0 }, // Surrogates, not used now. 0xD800-0xDFFF
|
||||
|
||||
//
|
||||
// Private use area
|
||||
//
|
||||
{(CHAR16)0xF8FF, 0}, // Private use area. 0xE000-0xF8FF
|
||||
{ (CHAR16)0xF8FF, 0 }, // Private use area. 0xE000-0xF8FF
|
||||
|
||||
//
|
||||
// Compatibility area and specials
|
||||
//
|
||||
{(CHAR16)0xFAFF, 2}, // CJK compatibility ideographs. 0xF900-0xFAFF
|
||||
{(CHAR16)0xFB4F, 1}, // Alphabetic presentation forms. 0xFB00-0xFB4F
|
||||
{(CHAR16)0xFDFF, 1}, // Arabic presentation forms-A. 0xFB50-0xFDFF
|
||||
{(CHAR16)0xFE1F, 0}, // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F
|
||||
{(CHAR16)0xFE2F, 1}, // Combining half marks. 0xFE20-0xFE2F
|
||||
{(CHAR16)0xFE4F, 2}, // CJK compatibility forms. 0xFE30-0xFE4F
|
||||
{(CHAR16)0xFE6F, 1}, // Small Form Variants. 0xFE50-0xFE6F
|
||||
{(CHAR16)0xFEFF, 1}, // Arabic presentation forms-B. 0xFE70-0xFEFF
|
||||
{(CHAR16)0xFFEF, 1}, // Half width and full width forms. 0xFF00-0xFFEF
|
||||
{(CHAR16)0xFFFF, 0}, // Speicials. 0xFFF0-0xFFFF
|
||||
{ (CHAR16)0xFAFF, 2 }, // CJK compatibility ideographs. 0xF900-0xFAFF
|
||||
{ (CHAR16)0xFB4F, 1 }, // Alphabetic presentation forms. 0xFB00-0xFB4F
|
||||
{ (CHAR16)0xFDFF, 1 }, // Arabic presentation forms-A. 0xFB50-0xFDFF
|
||||
{ (CHAR16)0xFE1F, 0 }, // Reserved. As variation selectors in ver3.0. 0xFE00-0xFE1F
|
||||
{ (CHAR16)0xFE2F, 1 }, // Combining half marks. 0xFE20-0xFE2F
|
||||
{ (CHAR16)0xFE4F, 2 }, // CJK compatibility forms. 0xFE30-0xFE4F
|
||||
{ (CHAR16)0xFE6F, 1 }, // Small Form Variants. 0xFE50-0xFE6F
|
||||
{ (CHAR16)0xFEFF, 1 }, // Arabic presentation forms-B. 0xFE70-0xFEFF
|
||||
{ (CHAR16)0xFFEF, 1 }, // Half width and full width forms. 0xFF00-0xFFEF
|
||||
{ (CHAR16)0xFFFF, 0 }, // Speicials. 0xFFF0-0xFFFF
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -204,14 +206,14 @@ GetGlyphWidth (
|
||||
IN CHAR16 UnicodeChar
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Low;
|
||||
UINTN High;
|
||||
CONST UNICODE_WIDTH_ENTRY *Item;
|
||||
UINTN Index;
|
||||
UINTN Low;
|
||||
UINTN High;
|
||||
CONST UNICODE_WIDTH_ENTRY *Item;
|
||||
|
||||
Item = NULL;
|
||||
Low = 0;
|
||||
High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
|
||||
Item = NULL;
|
||||
Low = 0;
|
||||
High = (sizeof (mUnicodeWidthTable)) / (sizeof (UNICODE_WIDTH_ENTRY)) - 1;
|
||||
while (Low <= High) {
|
||||
Index = (Low + High) >> 1;
|
||||
Item = &(mUnicodeWidthTable[Index]);
|
||||
@@ -264,8 +266,8 @@ UnicodeStringDisplayLength (
|
||||
IN CONST CHAR16 *String
|
||||
)
|
||||
{
|
||||
UINTN Length;
|
||||
UINTN Width;
|
||||
UINTN Length;
|
||||
UINTN Width;
|
||||
|
||||
if (String == NULL) {
|
||||
return 0;
|
||||
@@ -304,32 +306,32 @@ UnicodeStringDisplayLength (
|
||||
**/
|
||||
UINTN
|
||||
UefiLibGetStringWidth (
|
||||
IN CHAR16 *String,
|
||||
IN BOOLEAN LimitLen,
|
||||
IN UINTN MaxWidth,
|
||||
OUT UINTN *Offset
|
||||
IN CHAR16 *String,
|
||||
IN BOOLEAN LimitLen,
|
||||
IN UINTN MaxWidth,
|
||||
OUT UINTN *Offset
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Count;
|
||||
UINTN IncrementValue;
|
||||
UINTN Index;
|
||||
UINTN Count;
|
||||
UINTN IncrementValue;
|
||||
|
||||
if (String == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index = 0;
|
||||
Count = 0;
|
||||
IncrementValue = 1;
|
||||
Index = 0;
|
||||
Count = 0;
|
||||
IncrementValue = 1;
|
||||
|
||||
do {
|
||||
//
|
||||
// Advance to the null-terminator or to the first width directive
|
||||
//
|
||||
for (;(String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {
|
||||
for ( ; (String[Index] != NARROW_CHAR) && (String[Index] != WIDE_CHAR) && (String[Index] != 0); Index++) {
|
||||
Count = Count + IncrementValue;
|
||||
|
||||
if (LimitLen && Count > MaxWidth) {
|
||||
if (LimitLen && (Count > MaxWidth)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -341,7 +343,7 @@ UefiLibGetStringWidth (
|
||||
break;
|
||||
}
|
||||
|
||||
if (LimitLen && Count > MaxWidth) {
|
||||
if (LimitLen && (Count > MaxWidth)) {
|
||||
*Offset = Index;
|
||||
break;
|
||||
}
|
||||
@@ -415,12 +417,13 @@ CreatePopUp (
|
||||
// number of lines in the popup
|
||||
//
|
||||
VA_START (Args, Key);
|
||||
MaxLength = 0;
|
||||
MaxLength = 0;
|
||||
NumberOfLines = 0;
|
||||
while ((String = VA_ARG (Args, CHAR16 *)) != NULL) {
|
||||
MaxLength = MAX (MaxLength, UefiLibGetStringWidth (String, FALSE, 0, NULL) / 2);
|
||||
NumberOfLines++;
|
||||
}
|
||||
|
||||
VA_END (Args);
|
||||
|
||||
//
|
||||
@@ -518,8 +521,10 @@ CreatePopUp (
|
||||
ConOut->OutputString (ConOut, TmpString);
|
||||
FreePool (TmpString);
|
||||
}
|
||||
|
||||
NumberOfLines--;
|
||||
}
|
||||
|
||||
VA_END (Args);
|
||||
|
||||
//
|
||||
@@ -540,9 +545,9 @@ CreatePopUp (
|
||||
//
|
||||
// Restore the cursor visibility, position, and attributes
|
||||
//
|
||||
ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);
|
||||
ConOut->EnableCursor (ConOut, SavedConsoleMode.CursorVisible);
|
||||
ConOut->SetCursorPosition (ConOut, SavedConsoleMode.CursorColumn, SavedConsoleMode.CursorRow);
|
||||
ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);
|
||||
ConOut->SetAttribute (ConOut, SavedConsoleMode.Attribute);
|
||||
|
||||
//
|
||||
// Wait for a keystroke
|
||||
@@ -560,6 +565,7 @@ CreatePopUp (
|
||||
if (Status != EFI_NOT_READY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "UefiLibInternal.h"
|
||||
|
||||
/**
|
||||
@@ -54,10 +53,10 @@ CompareIso639LanguageCode (
|
||||
UINT32 Name1;
|
||||
UINT32 Name2;
|
||||
|
||||
Name1 = ReadUnaligned24 ((CONST UINT32 *) Language1);
|
||||
Name2 = ReadUnaligned24 ((CONST UINT32 *) Language2);
|
||||
Name1 = ReadUnaligned24 ((CONST UINT32 *)Language1);
|
||||
Name2 = ReadUnaligned24 ((CONST UINT32 *)Language2);
|
||||
|
||||
return (BOOLEAN) (Name1 == Name2);
|
||||
return (BOOLEAN)(Name1 == Name2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +91,7 @@ EfiGetSystemConfigurationTable (
|
||||
ASSERT (Table != NULL);
|
||||
|
||||
SystemTable = gST;
|
||||
*Table = NULL;
|
||||
*Table = NULL;
|
||||
for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {
|
||||
if (CompareGuid (TableGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) {
|
||||
*Table = SystemTable->ConfigurationTable[Index].VendorTable;
|
||||
@@ -132,7 +131,7 @@ EfiGetSystemConfigurationTable (
|
||||
**/
|
||||
EFI_EVENT
|
||||
EFIAPI
|
||||
EfiCreateProtocolNotifyEvent(
|
||||
EfiCreateProtocolNotifyEvent (
|
||||
IN EFI_GUID *ProtocolGuid,
|
||||
IN EFI_TPL NotifyTpl,
|
||||
IN EFI_EVENT_NOTIFY NotifyFunction,
|
||||
@@ -226,7 +225,7 @@ EfiNamedEventListen (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
NotifyTpl,
|
||||
NotifyFunction,
|
||||
(VOID *) NotifyContext,
|
||||
(VOID *)NotifyContext,
|
||||
&Event
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -246,7 +245,7 @@ EfiNamedEventListen (
|
||||
//
|
||||
|
||||
Status = gBS->RegisterProtocolNotify (
|
||||
(EFI_GUID *) Name,
|
||||
(EFI_GUID *)Name,
|
||||
Event,
|
||||
RegistrationLocal
|
||||
);
|
||||
@@ -277,12 +276,12 @@ EfiNamedEventSignal (
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
ASSERT(Name != NULL);
|
||||
ASSERT (Name != NULL);
|
||||
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&Handle,
|
||||
(EFI_GUID *) Name,
|
||||
(EFI_GUID *)Name,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
@@ -290,7 +289,7 @@ EfiNamedEventSignal (
|
||||
|
||||
Status = gBS->UninstallProtocolInterface (
|
||||
Handle,
|
||||
(EFI_GUID *) Name,
|
||||
(EFI_GUID *)Name,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@@ -313,11 +312,11 @@ EfiNamedEventSignal (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiEventGroupSignal (
|
||||
IN CONST EFI_GUID *EventGroup
|
||||
IN CONST EFI_GUID *EventGroup
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT Event;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT Event;
|
||||
|
||||
if (EventGroup == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -353,8 +352,8 @@ EfiEventGroupSignal (
|
||||
VOID
|
||||
EFIAPI
|
||||
EfiEventEmptyFunction (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
}
|
||||
@@ -377,7 +376,7 @@ EfiGetCurrentTpl (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_TPL Tpl;
|
||||
EFI_TPL Tpl;
|
||||
|
||||
Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
|
||||
gBS->RestoreTPL (Tpl);
|
||||
@@ -385,7 +384,6 @@ EfiGetCurrentTpl (
|
||||
return Tpl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initializes a basic mutual exclusion lock.
|
||||
|
||||
@@ -406,15 +404,15 @@ EFI_LOCK *
|
||||
EFIAPI
|
||||
EfiInitializeLock (
|
||||
IN OUT EFI_LOCK *Lock,
|
||||
IN EFI_TPL Priority
|
||||
IN EFI_TPL Priority
|
||||
)
|
||||
{
|
||||
ASSERT (Lock != NULL);
|
||||
ASSERT (Priority <= TPL_HIGH_LEVEL);
|
||||
|
||||
Lock->Tpl = Priority;
|
||||
Lock->OwnerTpl = TPL_APPLICATION;
|
||||
Lock->Lock = EfiLockReleased ;
|
||||
Lock->Tpl = Priority;
|
||||
Lock->OwnerTpl = TPL_APPLICATION;
|
||||
Lock->Lock = EfiLockReleased;
|
||||
return Lock;
|
||||
}
|
||||
|
||||
@@ -466,7 +464,6 @@ EfiAcquireLockOrFail (
|
||||
IN EFI_LOCK *Lock
|
||||
)
|
||||
{
|
||||
|
||||
ASSERT (Lock != NULL);
|
||||
ASSERT (Lock->Lock != EfiLockUninitialized);
|
||||
|
||||
@@ -503,7 +500,7 @@ EfiReleaseLock (
|
||||
IN EFI_LOCK *Lock
|
||||
)
|
||||
{
|
||||
EFI_TPL Tpl;
|
||||
EFI_TPL Tpl;
|
||||
|
||||
ASSERT (Lock != NULL);
|
||||
ASSERT (Lock->Lock == EfiLockAcquired);
|
||||
@@ -541,19 +538,19 @@ EfiReleaseLock (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiTestManagedDevice (
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
IN CONST EFI_HANDLE DriverBindingHandle,
|
||||
IN CONST EFI_GUID *ProtocolGuid
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
IN CONST EFI_HANDLE DriverBindingHandle,
|
||||
IN CONST EFI_GUID *ProtocolGuid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *ManagedInterface;
|
||||
EFI_STATUS Status;
|
||||
VOID *ManagedInterface;
|
||||
|
||||
ASSERT (ProtocolGuid != NULL);
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
(EFI_GUID *) ProtocolGuid,
|
||||
(EFI_GUID *)ProtocolGuid,
|
||||
&ManagedInterface,
|
||||
DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
@@ -562,7 +559,7 @@ EfiTestManagedDevice (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
(EFI_GUID *) ProtocolGuid,
|
||||
(EFI_GUID *)ProtocolGuid,
|
||||
DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
@@ -598,15 +595,15 @@ EfiTestManagedDevice (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
EfiTestChildHandle (
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
IN CONST EFI_HANDLE ChildHandle,
|
||||
IN CONST EFI_GUID *ProtocolGuid
|
||||
IN CONST EFI_HANDLE ControllerHandle,
|
||||
IN CONST EFI_HANDLE ChildHandle,
|
||||
IN CONST EFI_GUID *ProtocolGuid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
|
||||
UINTN EntryCount;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
|
||||
UINTN EntryCount;
|
||||
UINTN Index;
|
||||
|
||||
ASSERT (ProtocolGuid != NULL);
|
||||
|
||||
@@ -616,7 +613,7 @@ EfiTestChildHandle (
|
||||
//
|
||||
Status = gBS->OpenProtocolInformation (
|
||||
ControllerHandle,
|
||||
(EFI_GUID *) ProtocolGuid,
|
||||
(EFI_GUID *)ProtocolGuid,
|
||||
&OpenInfoBuffer,
|
||||
&EntryCount
|
||||
);
|
||||
@@ -630,7 +627,8 @@ EfiTestChildHandle (
|
||||
Status = EFI_UNSUPPORTED;
|
||||
for (Index = 0; Index < EntryCount; Index++) {
|
||||
if ((OpenInfoBuffer[Index].ControllerHandle == ChildHandle) &&
|
||||
(OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
|
||||
((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0))
|
||||
{
|
||||
Status = EFI_SUCCESS;
|
||||
break;
|
||||
}
|
||||
@@ -653,18 +651,23 @@ EfiTestChildHandle (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
IsLanguageSupported (
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN CONST CHAR8 *TargetLanguage
|
||||
IN CONST CHAR8 *SupportedLanguages,
|
||||
IN CONST CHAR8 *TargetLanguage
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
while (*SupportedLanguages != 0) {
|
||||
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
|
||||
if ((AsciiStrnCmp(SupportedLanguages, TargetLanguage, Index) == 0) && (TargetLanguage[Index] == 0)) {
|
||||
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++) {
|
||||
}
|
||||
|
||||
if ((AsciiStrnCmp (SupportedLanguages, TargetLanguage, Index) == 0) && (TargetLanguage[Index] == 0)) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
SupportedLanguages += Index;
|
||||
for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
|
||||
for ( ; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++) {
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
@@ -712,7 +715,7 @@ LookupUnicodeString (
|
||||
//
|
||||
// Make sure the parameters are valid
|
||||
//
|
||||
if (Language == NULL || UnicodeString == NULL) {
|
||||
if ((Language == NULL) || (UnicodeString == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -720,7 +723,7 @@ LookupUnicodeString (
|
||||
// If there are no supported languages, or the Unicode String Table is empty, then the
|
||||
// Unicode String specified by Language is not supported by this Unicode String Table
|
||||
//
|
||||
if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {
|
||||
if ((SupportedLanguages == NULL) || (UnicodeStringTable == NULL)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -729,13 +732,11 @@ LookupUnicodeString (
|
||||
//
|
||||
while (*SupportedLanguages != 0) {
|
||||
if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
|
||||
|
||||
//
|
||||
// Search the Unicode String Table for the matching Language specifier
|
||||
//
|
||||
while (UnicodeStringTable->Language != NULL) {
|
||||
if (CompareIso639LanguageCode (Language, UnicodeStringTable->Language)) {
|
||||
|
||||
//
|
||||
// A matching string was found, so return it
|
||||
//
|
||||
@@ -755,8 +756,6 @@ LookupUnicodeString (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
This function looks up a Unicode string in UnicodeStringTable.
|
||||
|
||||
@@ -807,14 +806,14 @@ LookupUnicodeString2 (
|
||||
IN BOOLEAN Iso639Language
|
||||
)
|
||||
{
|
||||
BOOLEAN Found;
|
||||
UINTN Index;
|
||||
CHAR8 *LanguageString;
|
||||
BOOLEAN Found;
|
||||
UINTN Index;
|
||||
CHAR8 *LanguageString;
|
||||
|
||||
//
|
||||
// Make sure the parameters are valid
|
||||
//
|
||||
if (Language == NULL || UnicodeString == NULL) {
|
||||
if ((Language == NULL) || (UnicodeString == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -822,7 +821,7 @@ LookupUnicodeString2 (
|
||||
// If there are no supported languages, or the Unicode String Table is empty, then the
|
||||
// Unicode String specified by Language is not supported by this Unicode String Table
|
||||
//
|
||||
if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {
|
||||
if ((SupportedLanguages == NULL) || (UnicodeStringTable == NULL)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
@@ -836,13 +835,13 @@ LookupUnicodeString2 (
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
SupportedLanguages += 3;
|
||||
}
|
||||
} else {
|
||||
Found = !IsLanguageSupported(SupportedLanguages, Language);
|
||||
Found = !IsLanguageSupported (SupportedLanguages, Language);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
|
||||
//
|
||||
@@ -856,21 +855,25 @@ LookupUnicodeString2 (
|
||||
while (UnicodeStringTable->Language != NULL) {
|
||||
LanguageString = UnicodeStringTable->Language;
|
||||
while (0 != *LanguageString) {
|
||||
for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);
|
||||
if (AsciiStrnCmp(LanguageString, Language, Index) == 0) {
|
||||
for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++) {
|
||||
}
|
||||
|
||||
if (AsciiStrnCmp (LanguageString, Language, Index) == 0) {
|
||||
*UnicodeString = UnicodeStringTable->UnicodeString;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
LanguageString += Index;
|
||||
for (Index = 0 ;LanguageString[Index] != 0 && LanguageString[Index] == ';'; Index++);
|
||||
for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] == ';'; Index++) {
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeStringTable++;
|
||||
}
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function adds a Unicode string to UnicodeStringTable.
|
||||
|
||||
@@ -921,7 +924,7 @@ AddUnicodeString (
|
||||
//
|
||||
// Make sure the parameter are valid
|
||||
//
|
||||
if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
|
||||
if ((Language == NULL) || (UnicodeString == NULL) || (UnicodeStringTable == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -944,7 +947,6 @@ AddUnicodeString (
|
||||
//
|
||||
while (*SupportedLanguages != 0) {
|
||||
if (CompareIso639LanguageCode (Language, SupportedLanguages)) {
|
||||
|
||||
//
|
||||
// Determine the size of the Unicode String Table by looking for a NULL Language entry
|
||||
//
|
||||
@@ -977,10 +979,10 @@ AddUnicodeString (
|
||||
//
|
||||
if (*UnicodeStringTable != NULL) {
|
||||
CopyMem (
|
||||
NewUnicodeStringTable,
|
||||
*UnicodeStringTable,
|
||||
NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)
|
||||
);
|
||||
NewUnicodeStringTable,
|
||||
*UnicodeStringTable,
|
||||
NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -995,16 +997,16 @@ AddUnicodeString (
|
||||
//
|
||||
// Compute the length of the Unicode String
|
||||
//
|
||||
for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++)
|
||||
;
|
||||
for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++) {
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate space for a copy of the Unicode String
|
||||
//
|
||||
NewUnicodeStringTable[NumberOfEntries].UnicodeString = AllocateCopyPool (
|
||||
(UnicodeStringLength + 1) * sizeof (CHAR16),
|
||||
UnicodeString
|
||||
);
|
||||
(UnicodeStringLength + 1) * sizeof (CHAR16),
|
||||
UnicodeString
|
||||
);
|
||||
if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) {
|
||||
FreePool (NewUnicodeStringTable[NumberOfEntries].Language);
|
||||
FreePool (NewUnicodeStringTable);
|
||||
@@ -1014,8 +1016,8 @@ AddUnicodeString (
|
||||
//
|
||||
// Mark the end of the Unicode String Table
|
||||
//
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
|
||||
|
||||
//
|
||||
// Free the old Unicode String Table
|
||||
@@ -1038,7 +1040,6 @@ AddUnicodeString (
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function adds the Null-terminated Unicode string specified by UnicodeString
|
||||
to UnicodeStringTable.
|
||||
@@ -1102,7 +1103,7 @@ AddUnicodeString2 (
|
||||
//
|
||||
// Make sure the parameter are valid
|
||||
//
|
||||
if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {
|
||||
if ((Language == NULL) || (UnicodeString == NULL) || (UnicodeStringTable == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -1130,11 +1131,13 @@ AddUnicodeString2 (
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
SupportedLanguages += 3;
|
||||
}
|
||||
} else {
|
||||
Found = !IsLanguageSupported(SupportedLanguages, Language);
|
||||
Found = !IsLanguageSupported (SupportedLanguages, Language);
|
||||
}
|
||||
|
||||
//
|
||||
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
|
||||
//
|
||||
@@ -1152,14 +1155,18 @@ AddUnicodeString2 (
|
||||
LanguageString = OldUnicodeStringTable->Language;
|
||||
|
||||
while (*LanguageString != 0) {
|
||||
for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++);
|
||||
for (Index = 0; LanguageString[Index] != 0 && LanguageString[Index] != ';'; Index++) {
|
||||
}
|
||||
|
||||
if (AsciiStrnCmp (Language, LanguageString, Index) == 0) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
LanguageString += Index;
|
||||
for (; *LanguageString != 0 && *LanguageString == ';'; LanguageString++);
|
||||
for ( ; *LanguageString != 0 && *LanguageString == ';'; LanguageString++) {
|
||||
}
|
||||
}
|
||||
|
||||
OldUnicodeStringTable++;
|
||||
NumberOfEntries++;
|
||||
}
|
||||
@@ -1190,7 +1197,7 @@ AddUnicodeString2 (
|
||||
//
|
||||
// Allocate space for a copy of the Language specifier
|
||||
//
|
||||
NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (AsciiStrSize(Language), Language);
|
||||
NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (AsciiStrSize (Language), Language);
|
||||
if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) {
|
||||
FreePool (NewUnicodeStringTable);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
@@ -1199,7 +1206,8 @@ AddUnicodeString2 (
|
||||
//
|
||||
// Compute the length of the Unicode String
|
||||
//
|
||||
for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++);
|
||||
for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++) {
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate space for a copy of the Unicode String
|
||||
@@ -1214,8 +1222,8 @@ AddUnicodeString2 (
|
||||
//
|
||||
// Mark the end of the Unicode String Table
|
||||
//
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;
|
||||
NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;
|
||||
|
||||
//
|
||||
// Free the old Unicode String Table
|
||||
@@ -1250,7 +1258,7 @@ FreeUnicodeStringTable (
|
||||
IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// If the Unicode String Table is NULL, then it is already freed
|
||||
@@ -1263,7 +1271,6 @@ FreeUnicodeStringTable (
|
||||
// Loop through the Unicode String Table until we reach the end of table marker
|
||||
//
|
||||
for (Index = 0; UnicodeStringTable[Index].Language != NULL; Index++) {
|
||||
|
||||
//
|
||||
// Free the Language string from the Unicode String Table
|
||||
//
|
||||
@@ -1285,7 +1292,6 @@ FreeUnicodeStringTable (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Returns the status whether get the variable success. The function retrieves
|
||||
variable through the UEFI Runtime Service GetVariable(). The
|
||||
@@ -1326,10 +1332,10 @@ GetVariable2 (
|
||||
BufferSize = 0;
|
||||
*Value = NULL;
|
||||
if (Size != NULL) {
|
||||
*Size = 0;
|
||||
*Size = 0;
|
||||
}
|
||||
|
||||
Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
|
||||
Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value);
|
||||
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||
return Status;
|
||||
}
|
||||
@@ -1346,9 +1352,9 @@ GetVariable2 (
|
||||
//
|
||||
// Get the variable data.
|
||||
//
|
||||
Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value);
|
||||
Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, NULL, &BufferSize, *Value);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool(*Value);
|
||||
FreePool (*Value);
|
||||
*Value = NULL;
|
||||
}
|
||||
|
||||
@@ -1384,24 +1390,24 @@ GetVariable2 (
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetVariable3(
|
||||
IN CONST CHAR16 *Name,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
OUT VOID **Value,
|
||||
OUT UINTN *Size OPTIONAL,
|
||||
OUT UINT32 *Attr OPTIONAL
|
||||
GetVariable3 (
|
||||
IN CONST CHAR16 *Name,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
OUT VOID **Value,
|
||||
OUT UINTN *Size OPTIONAL,
|
||||
OUT UINT32 *Attr OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
|
||||
ASSERT(Name != NULL && Guid != NULL && Value != NULL);
|
||||
ASSERT (Name != NULL && Guid != NULL && Value != NULL);
|
||||
|
||||
//
|
||||
// Try to get the variable size.
|
||||
//
|
||||
BufferSize = 0;
|
||||
*Value = NULL;
|
||||
*Value = NULL;
|
||||
if (Size != NULL) {
|
||||
*Size = 0;
|
||||
}
|
||||
@@ -1410,7 +1416,7 @@ GetVariable3(
|
||||
*Attr = 0;
|
||||
}
|
||||
|
||||
Status = gRT->GetVariable((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
|
||||
Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
|
||||
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||
return Status;
|
||||
}
|
||||
@@ -1418,8 +1424,8 @@ GetVariable3(
|
||||
//
|
||||
// Allocate buffer to get the variable.
|
||||
//
|
||||
*Value = AllocatePool(BufferSize);
|
||||
ASSERT(*Value != NULL);
|
||||
*Value = AllocatePool (BufferSize);
|
||||
ASSERT (*Value != NULL);
|
||||
if (*Value == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -1427,9 +1433,9 @@ GetVariable3(
|
||||
//
|
||||
// Get the variable data.
|
||||
//
|
||||
Status = gRT->GetVariable((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
|
||||
if (EFI_ERROR(Status)) {
|
||||
FreePool(*Value);
|
||||
Status = gRT->GetVariable ((CHAR16 *)Name, (EFI_GUID *)Guid, Attr, &BufferSize, *Value);
|
||||
if (EFI_ERROR (Status)) {
|
||||
FreePool (*Value);
|
||||
*Value = NULL;
|
||||
}
|
||||
|
||||
@@ -1462,9 +1468,9 @@ GetVariable3(
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetEfiGlobalVariable2 (
|
||||
IN CONST CHAR16 *Name,
|
||||
OUT VOID **Value,
|
||||
OUT UINTN *Size OPTIONAL
|
||||
IN CONST CHAR16 *Name,
|
||||
OUT VOID **Value,
|
||||
OUT UINTN *Size OPTIONAL
|
||||
)
|
||||
{
|
||||
return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size);
|
||||
@@ -1540,7 +1546,8 @@ GetBestLanguage (
|
||||
// If in RFC 4646 mode, then determine the length of the first RFC 4646 language code in Language
|
||||
//
|
||||
if (Iso639Language == 0) {
|
||||
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
|
||||
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++) {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1558,11 +1565,15 @@ GetBestLanguage (
|
||||
//
|
||||
// Skip ';' characters in Supported
|
||||
//
|
||||
for (; *Supported != '\0' && *Supported == ';'; Supported++);
|
||||
for ( ; *Supported != '\0' && *Supported == ';'; Supported++) {
|
||||
}
|
||||
|
||||
//
|
||||
// Determine the length of the next language code in Supported
|
||||
//
|
||||
for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++);
|
||||
for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++) {
|
||||
}
|
||||
|
||||
//
|
||||
// If Language is longer than the Supported, then skip to the next language
|
||||
//
|
||||
@@ -1570,6 +1581,7 @@ GetBestLanguage (
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// See if the first LanguageLength characters in Supported match Language
|
||||
//
|
||||
@@ -1582,6 +1594,7 @@ GetBestLanguage (
|
||||
if (BestLanguage == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return CopyMem (BestLanguage, Supported, CompareLength);
|
||||
}
|
||||
}
|
||||
@@ -1595,10 +1608,12 @@ GetBestLanguage (
|
||||
//
|
||||
// If RFC 4646 mode, then trim Language from the right to the next '-' character
|
||||
//
|
||||
for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--);
|
||||
for (LanguageLength--; LanguageLength > 0 && Language[LanguageLength] != '-'; LanguageLength--) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VA_END (Args);
|
||||
|
||||
//
|
||||
@@ -1646,7 +1661,7 @@ EfiLocateProtocolBuffer (
|
||||
//
|
||||
// Check input parameters
|
||||
//
|
||||
if (Protocol == NULL || NoProtocols == NULL || Buffer == NULL) {
|
||||
if ((Protocol == NULL) || (NoProtocols == NULL) || (Buffer == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -1654,7 +1669,7 @@ EfiLocateProtocolBuffer (
|
||||
// Initialze output parameters
|
||||
//
|
||||
*NoProtocols = 0;
|
||||
*Buffer = NULL;
|
||||
*Buffer = NULL;
|
||||
|
||||
//
|
||||
// Retrieve the array of handles that support Protocol
|
||||
@@ -1685,6 +1700,7 @@ EfiLocateProtocolBuffer (
|
||||
gBS->FreePool (HandleBuffer);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
ZeroMem (*Buffer, NoHandles * sizeof (VOID *));
|
||||
|
||||
//
|
||||
@@ -1794,18 +1810,19 @@ EfiOpenFileByDevicePath (
|
||||
IN UINT64 Attributes
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE FileSystemHandle;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
|
||||
EFI_FILE_PROTOCOL *LastFile;
|
||||
FILEPATH_DEVICE_PATH *FilePathNode;
|
||||
CHAR16 *AlignedPathName;
|
||||
CHAR16 *PathName;
|
||||
EFI_FILE_PROTOCOL *NextFile;
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE FileSystemHandle;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
|
||||
EFI_FILE_PROTOCOL *LastFile;
|
||||
FILEPATH_DEVICE_PATH *FilePathNode;
|
||||
CHAR16 *AlignedPathName;
|
||||
CHAR16 *PathName;
|
||||
EFI_FILE_PROTOCOL *NextFile;
|
||||
|
||||
if (File == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*File = NULL;
|
||||
|
||||
if (FilePath == NULL) {
|
||||
@@ -1823,6 +1840,7 @@ EfiOpenFileByDevicePath (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->OpenProtocol (
|
||||
FileSystemHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
@@ -1848,11 +1866,13 @@ EfiOpenFileByDevicePath (
|
||||
// Traverse the device path nodes relative to the filesystem.
|
||||
//
|
||||
while (!IsDevicePathEnd (*FilePath)) {
|
||||
if (DevicePathType (*FilePath) != MEDIA_DEVICE_PATH ||
|
||||
DevicePathSubType (*FilePath) != MEDIA_FILEPATH_DP) {
|
||||
if ((DevicePathType (*FilePath) != MEDIA_DEVICE_PATH) ||
|
||||
(DevicePathSubType (*FilePath) != MEDIA_FILEPATH_DP))
|
||||
{
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
goto CloseLastFile;
|
||||
}
|
||||
|
||||
FilePathNode = (FILEPATH_DEVICE_PATH *)*FilePath;
|
||||
|
||||
//
|
||||
@@ -1862,7 +1882,7 @@ EfiOpenFileByDevicePath (
|
||||
//
|
||||
if ((UINTN)FilePathNode->PathName % sizeof *FilePathNode->PathName == 0) {
|
||||
AlignedPathName = NULL;
|
||||
PathName = FilePathNode->PathName;
|
||||
PathName = FilePathNode->PathName;
|
||||
} else {
|
||||
AlignedPathName = AllocateCopyPool (
|
||||
(DevicePathNodeLength (FilePathNode) -
|
||||
@@ -1873,6 +1893,7 @@ EfiOpenFileByDevicePath (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto CloseLastFile;
|
||||
}
|
||||
|
||||
PathName = AlignedPathName;
|
||||
}
|
||||
|
||||
@@ -1894,6 +1915,7 @@ EfiOpenFileByDevicePath (
|
||||
if (AlignedPathName != NULL) {
|
||||
FreePool (AlignedPathName);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto CloseLastFile;
|
||||
}
|
||||
@@ -1902,7 +1924,7 @@ EfiOpenFileByDevicePath (
|
||||
// Advance to the next device path node.
|
||||
//
|
||||
LastFile->Close (LastFile);
|
||||
LastFile = NextFile;
|
||||
LastFile = NextFile;
|
||||
*FilePath = NextDevicePathNode (FilePathNode);
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#ifndef __UEFI_LIB_INTERNAL_H_
|
||||
#define __UEFI_LIB_INTERNAL_H_
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
#include <Protocol/ComponentName.h>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "UefiLibInternal.h"
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_GRAPHICS_OUTPUT_BLT_PIXEL mEfiColors[16] = {
|
||||
{ 0x00, 0x00, 0x00, 0x00 },
|
||||
{ 0x98, 0x00, 0x00, 0x00 },
|
||||
{ 0x00, 0x98, 0x00, 0x00 },
|
||||
@@ -59,17 +59,17 @@ InternalPrint (
|
||||
UINTN BufferSize;
|
||||
|
||||
ASSERT (Format != NULL);
|
||||
ASSERT (((UINTN) Format & BIT0) == 0);
|
||||
ASSERT (((UINTN)Format & BIT0) == 0);
|
||||
ASSERT (Console != NULL);
|
||||
|
||||
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||
|
||||
Buffer = (CHAR16 *) AllocatePool(BufferSize);
|
||||
Buffer = (CHAR16 *)AllocatePool (BufferSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
|
||||
|
||||
if (Console != NULL && Return > 0) {
|
||||
if ((Console != NULL) && (Return > 0)) {
|
||||
//
|
||||
// To be extra safe make sure Console has been initialized
|
||||
//
|
||||
@@ -111,8 +111,8 @@ Print (
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
|
||||
VA_START (Marker, Format);
|
||||
|
||||
@@ -150,19 +150,18 @@ ErrorPrint (
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
|
||||
VA_START (Marker, Format);
|
||||
|
||||
Return = InternalPrint( Format, gST->StdErr, Marker);
|
||||
Return = InternalPrint (Format, gST->StdErr, Marker);
|
||||
|
||||
VA_END (Marker);
|
||||
|
||||
return Return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Internal function which prints a formatted ASCII string to the console output device
|
||||
specified by Console
|
||||
@@ -199,7 +198,7 @@ AsciiInternalPrint (
|
||||
|
||||
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||
|
||||
Buffer = (CHAR16 *) AllocatePool(BufferSize);
|
||||
Buffer = (CHAR16 *)AllocatePool (BufferSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
Return = UnicodeVSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
|
||||
@@ -245,13 +244,14 @@ AsciiPrint (
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
|
||||
ASSERT (Format != NULL);
|
||||
|
||||
VA_START (Marker, Format);
|
||||
|
||||
Return = AsciiInternalPrint( Format, gST->ConOut, Marker);
|
||||
Return = AsciiInternalPrint (Format, gST->ConOut, Marker);
|
||||
|
||||
VA_END (Marker);
|
||||
|
||||
@@ -284,14 +284,14 @@ AsciiErrorPrint (
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
VA_LIST Marker;
|
||||
UINTN Return;
|
||||
|
||||
ASSERT (Format != NULL);
|
||||
|
||||
VA_START (Marker, Format);
|
||||
|
||||
Return = AsciiInternalPrint( Format, gST->StdErr, Marker);
|
||||
Return = AsciiInternalPrint (Format, gST->StdErr, Marker);
|
||||
|
||||
VA_END (Marker);
|
||||
|
||||
@@ -333,45 +333,45 @@ AsciiErrorPrint (
|
||||
**/
|
||||
UINTN
|
||||
InternalPrintGraphic (
|
||||
IN UINTN PointX,
|
||||
IN UINTN PointY,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
|
||||
IN CHAR16 *Buffer,
|
||||
IN UINTN PrintNum
|
||||
IN UINTN PointX,
|
||||
IN UINTN PointY,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Foreground,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Background,
|
||||
IN CHAR16 *Buffer,
|
||||
IN UINTN PrintNum
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
EFI_HII_FONT_PROTOCOL *HiiFont;
|
||||
EFI_IMAGE_OUTPUT *Blt;
|
||||
EFI_FONT_DISPLAY_INFO FontInfo;
|
||||
EFI_HII_ROW_INFO *RowInfoArray;
|
||||
UINTN RowInfoArraySize;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
|
||||
EFI_HANDLE ConsoleHandle;
|
||||
UINTN Width;
|
||||
UINTN Height;
|
||||
UINTN Delta;
|
||||
EFI_STATUS Status;
|
||||
UINT32 HorizontalResolution;
|
||||
UINT32 VerticalResolution;
|
||||
UINT32 ColorDepth;
|
||||
UINT32 RefreshRate;
|
||||
EFI_HII_FONT_PROTOCOL *HiiFont;
|
||||
EFI_IMAGE_OUTPUT *Blt;
|
||||
EFI_FONT_DISPLAY_INFO FontInfo;
|
||||
EFI_HII_ROW_INFO *RowInfoArray;
|
||||
UINTN RowInfoArraySize;
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
|
||||
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
|
||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
|
||||
EFI_HANDLE ConsoleHandle;
|
||||
UINTN Width;
|
||||
UINTN Height;
|
||||
UINTN Delta;
|
||||
|
||||
HorizontalResolution = 0;
|
||||
VerticalResolution = 0;
|
||||
Blt = NULL;
|
||||
RowInfoArray = NULL;
|
||||
HorizontalResolution = 0;
|
||||
VerticalResolution = 0;
|
||||
Blt = NULL;
|
||||
RowInfoArray = NULL;
|
||||
|
||||
ConsoleHandle = gST->ConsoleOutHandle;
|
||||
|
||||
ASSERT( ConsoleHandle != NULL);
|
||||
ASSERT (ConsoleHandle != NULL);
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
ConsoleHandle,
|
||||
&gEfiGraphicsOutputProtocolGuid,
|
||||
(VOID **) &GraphicsOutput
|
||||
(VOID **)&GraphicsOutput
|
||||
);
|
||||
|
||||
UgaDraw = NULL;
|
||||
@@ -384,9 +384,10 @@ InternalPrintGraphic (
|
||||
Status = gBS->HandleProtocol (
|
||||
ConsoleHandle,
|
||||
&gEfiUgaDrawProtocolGuid,
|
||||
(VOID **) &UgaDraw
|
||||
(VOID **)&UgaDraw
|
||||
);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
@@ -394,7 +395,7 @@ InternalPrintGraphic (
|
||||
Status = gBS->HandleProtocol (
|
||||
ConsoleHandle,
|
||||
&gEfiSimpleTextOutProtocolGuid,
|
||||
(VOID **) &Sto
|
||||
(VOID **)&Sto
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -403,25 +404,25 @@ InternalPrintGraphic (
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
HorizontalResolution = GraphicsOutput->Mode->Info->HorizontalResolution;
|
||||
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
|
||||
} else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||
VerticalResolution = GraphicsOutput->Mode->Info->VerticalResolution;
|
||||
} else if ((UgaDraw != NULL) && FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||
UgaDraw->GetMode (UgaDraw, &HorizontalResolution, &VerticalResolution, &ColorDepth, &RefreshRate);
|
||||
} else {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
ASSERT ((HorizontalResolution != 0) && (VerticalResolution !=0));
|
||||
ASSERT ((HorizontalResolution != 0) && (VerticalResolution != 0));
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &HiiFont);
|
||||
Status = gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **)&HiiFont);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Blt = (EFI_IMAGE_OUTPUT *) AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||
Blt = (EFI_IMAGE_OUTPUT *)AllocateZeroPool (sizeof (EFI_IMAGE_OUTPUT));
|
||||
ASSERT (Blt != NULL);
|
||||
|
||||
Blt->Width = (UINT16) (HorizontalResolution);
|
||||
Blt->Height = (UINT16) (VerticalResolution);
|
||||
Blt->Width = (UINT16)(HorizontalResolution);
|
||||
Blt->Height = (UINT16)(VerticalResolution);
|
||||
|
||||
ZeroMem (&FontInfo, sizeof (EFI_FONT_DISPLAY_INFO));
|
||||
|
||||
@@ -434,6 +435,7 @@ InternalPrintGraphic (
|
||||
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
|
||||
);
|
||||
}
|
||||
|
||||
if (Background != NULL) {
|
||||
CopyMem (&FontInfo.BackgroundColor, Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
} else {
|
||||
@@ -448,25 +450,24 @@ InternalPrintGraphic (
|
||||
Blt->Image.Screen = GraphicsOutput;
|
||||
|
||||
Status = HiiFont->StringToImage (
|
||||
HiiFont,
|
||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
|
||||
EFI_HII_IGNORE_LINE_BREAK | EFI_HII_DIRECT_TO_SCREEN,
|
||||
Buffer,
|
||||
&FontInfo,
|
||||
&Blt,
|
||||
PointX,
|
||||
PointY,
|
||||
&RowInfoArray,
|
||||
&RowInfoArraySize,
|
||||
NULL
|
||||
);
|
||||
HiiFont,
|
||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
|
||||
EFI_HII_IGNORE_LINE_BREAK | EFI_HII_DIRECT_TO_SCREEN,
|
||||
Buffer,
|
||||
&FontInfo,
|
||||
&Blt,
|
||||
PointX,
|
||||
PointY,
|
||||
&RowInfoArray,
|
||||
&RowInfoArraySize,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
|
||||
ASSERT (UgaDraw!= NULL);
|
||||
ASSERT (UgaDraw != NULL);
|
||||
|
||||
//
|
||||
// Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow.
|
||||
@@ -475,7 +476,7 @@ InternalPrintGraphic (
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Blt->Image.Bitmap = AllocateZeroPool ((UINT32) Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
Blt->Image.Bitmap = AllocateZeroPool ((UINT32)Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
ASSERT (Blt->Image.Bitmap != NULL);
|
||||
|
||||
//
|
||||
@@ -483,19 +484,19 @@ InternalPrintGraphic (
|
||||
// we ask StringToImage to print the string to blt buffer, then blt to device using UgaDraw.
|
||||
//
|
||||
Status = HiiFont->StringToImage (
|
||||
HiiFont,
|
||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
|
||||
EFI_HII_IGNORE_LINE_BREAK,
|
||||
Buffer,
|
||||
&FontInfo,
|
||||
&Blt,
|
||||
PointX,
|
||||
PointY,
|
||||
&RowInfoArray,
|
||||
&RowInfoArraySize,
|
||||
NULL
|
||||
);
|
||||
HiiFont,
|
||||
EFI_HII_IGNORE_IF_NO_GLYPH | EFI_HII_OUT_FLAG_CLIP |
|
||||
EFI_HII_OUT_FLAG_CLIP_CLEAN_X | EFI_HII_OUT_FLAG_CLIP_CLEAN_Y |
|
||||
EFI_HII_IGNORE_LINE_BREAK,
|
||||
Buffer,
|
||||
&FontInfo,
|
||||
&Blt,
|
||||
PointX,
|
||||
PointY,
|
||||
&RowInfoArray,
|
||||
&RowInfoArraySize,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ASSERT (RowInfoArray != NULL);
|
||||
@@ -514,9 +515,10 @@ InternalPrintGraphic (
|
||||
Height = 0;
|
||||
Delta = 0;
|
||||
}
|
||||
|
||||
Status = UgaDraw->Blt (
|
||||
UgaDraw,
|
||||
(EFI_UGA_PIXEL *) Blt->Image.Bitmap,
|
||||
(EFI_UGA_PIXEL *)Blt->Image.Bitmap,
|
||||
EfiUgaBltBufferToVideo,
|
||||
PointX,
|
||||
PointY,
|
||||
@@ -529,10 +531,12 @@ InternalPrintGraphic (
|
||||
} else {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
FreePool (Blt->Image.Bitmap);
|
||||
} else {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate the number of actual printed characters
|
||||
//
|
||||
@@ -550,6 +554,7 @@ Error:
|
||||
if (Blt != NULL) {
|
||||
FreePool (Blt);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -598,28 +603,28 @@ Error:
|
||||
UINTN
|
||||
EFIAPI
|
||||
PrintXY (
|
||||
IN UINTN PointX,
|
||||
IN UINTN PointY,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
|
||||
IN CONST CHAR16 *Format,
|
||||
IN UINTN PointX,
|
||||
IN UINTN PointY,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
|
||||
IN CONST CHAR16 *Format,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
CHAR16 *Buffer;
|
||||
UINTN BufferSize;
|
||||
UINTN PrintNum;
|
||||
UINTN ReturnNum;
|
||||
VA_LIST Marker;
|
||||
CHAR16 *Buffer;
|
||||
UINTN BufferSize;
|
||||
UINTN PrintNum;
|
||||
UINTN ReturnNum;
|
||||
|
||||
ASSERT (Format != NULL);
|
||||
ASSERT (((UINTN) Format & BIT0) == 0);
|
||||
ASSERT (((UINTN)Format & BIT0) == 0);
|
||||
|
||||
VA_START (Marker, Format);
|
||||
|
||||
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||
|
||||
Buffer = (CHAR16 *) AllocatePool (BufferSize);
|
||||
Buffer = (CHAR16 *)AllocatePool (BufferSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
PrintNum = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
|
||||
@@ -677,19 +682,19 @@ PrintXY (
|
||||
UINTN
|
||||
EFIAPI
|
||||
AsciiPrintXY (
|
||||
IN UINTN PointX,
|
||||
IN UINTN PointY,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
|
||||
IN CONST CHAR8 *Format,
|
||||
IN UINTN PointX,
|
||||
IN UINTN PointY,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *ForeGround OPTIONAL,
|
||||
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BackGround OPTIONAL,
|
||||
IN CONST CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
CHAR16 *Buffer;
|
||||
UINTN BufferSize;
|
||||
UINTN PrintNum;
|
||||
UINTN ReturnNum;
|
||||
VA_LIST Marker;
|
||||
CHAR16 *Buffer;
|
||||
UINTN BufferSize;
|
||||
UINTN PrintNum;
|
||||
UINTN ReturnNum;
|
||||
|
||||
ASSERT (Format != NULL);
|
||||
|
||||
@@ -697,7 +702,7 @@ AsciiPrintXY (
|
||||
|
||||
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
|
||||
|
||||
Buffer = (CHAR16 *) AllocatePool (BufferSize);
|
||||
Buffer = (CHAR16 *)AllocatePool (BufferSize);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
PrintNum = UnicodeSPrintAsciiFormat (Buffer, BufferSize, Format, Marker);
|
||||
@@ -732,30 +737,30 @@ AsciiPrintXY (
|
||||
@return Null-terminated Unicode string is that is the formatted
|
||||
string appended to String.
|
||||
**/
|
||||
CHAR16*
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
CatVSPrint (
|
||||
IN CHAR16 *String OPTIONAL,
|
||||
IN CHAR16 *String OPTIONAL,
|
||||
IN CONST CHAR16 *FormatString,
|
||||
IN VA_LIST Marker
|
||||
)
|
||||
{
|
||||
UINTN CharactersRequired;
|
||||
UINTN SizeRequired;
|
||||
CHAR16 *BufferToReturn;
|
||||
VA_LIST ExtraMarker;
|
||||
UINTN CharactersRequired;
|
||||
UINTN SizeRequired;
|
||||
CHAR16 *BufferToReturn;
|
||||
VA_LIST ExtraMarker;
|
||||
|
||||
VA_COPY (ExtraMarker, Marker);
|
||||
CharactersRequired = SPrintLength(FormatString, ExtraMarker);
|
||||
CharactersRequired = SPrintLength (FormatString, ExtraMarker);
|
||||
VA_END (ExtraMarker);
|
||||
|
||||
if (String != NULL) {
|
||||
SizeRequired = StrSize(String) + (CharactersRequired * sizeof(CHAR16));
|
||||
SizeRequired = StrSize (String) + (CharactersRequired * sizeof (CHAR16));
|
||||
} else {
|
||||
SizeRequired = sizeof(CHAR16) + (CharactersRequired * sizeof(CHAR16));
|
||||
SizeRequired = sizeof (CHAR16) + (CharactersRequired * sizeof (CHAR16));
|
||||
}
|
||||
|
||||
BufferToReturn = AllocatePool(SizeRequired);
|
||||
BufferToReturn = AllocatePool (SizeRequired);
|
||||
|
||||
if (BufferToReturn == NULL) {
|
||||
return NULL;
|
||||
@@ -764,12 +769,12 @@ CatVSPrint (
|
||||
}
|
||||
|
||||
if (String != NULL) {
|
||||
StrCpyS(BufferToReturn, SizeRequired / sizeof(CHAR16), String);
|
||||
StrCpyS (BufferToReturn, SizeRequired / sizeof (CHAR16), String);
|
||||
}
|
||||
|
||||
UnicodeVSPrint(BufferToReturn + StrLen(BufferToReturn), (CharactersRequired+1) * sizeof(CHAR16), FormatString, Marker);
|
||||
UnicodeVSPrint (BufferToReturn + StrLen (BufferToReturn), (CharactersRequired+1) * sizeof (CHAR16), FormatString, Marker);
|
||||
|
||||
ASSERT(StrSize(BufferToReturn)==SizeRequired);
|
||||
ASSERT (StrSize (BufferToReturn) == SizeRequired);
|
||||
|
||||
return (BufferToReturn);
|
||||
}
|
||||
@@ -800,16 +805,16 @@ CatVSPrint (
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
CatSPrint (
|
||||
IN CHAR16 *String OPTIONAL,
|
||||
IN CHAR16 *String OPTIONAL,
|
||||
IN CONST CHAR16 *FormatString,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
CHAR16 *NewString;
|
||||
VA_LIST Marker;
|
||||
CHAR16 *NewString;
|
||||
|
||||
VA_START (Marker, FormatString);
|
||||
NewString = CatVSPrint(String, FormatString, Marker);
|
||||
NewString = CatVSPrint (String, FormatString, Marker);
|
||||
VA_END (Marker);
|
||||
return NewString;
|
||||
}
|
||||
|
@@ -11,8 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
|
||||
#include "UefiLibInternal.h"
|
||||
|
||||
/**
|
||||
@@ -97,6 +95,7 @@ EfiCreateEventLegacyBootEx (
|
||||
} else {
|
||||
WorkerNotifyFunction = NotifyFunction;
|
||||
}
|
||||
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
NotifyTpl,
|
||||
@@ -192,6 +191,7 @@ EfiCreateEventReadyToBootEx (
|
||||
} else {
|
||||
WorkerNotifyFunction = NotifyFunction;
|
||||
}
|
||||
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
NotifyTpl,
|
||||
@@ -205,7 +205,6 @@ EfiCreateEventReadyToBootEx (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Create, Signal, and Close the Ready to Boot event using EfiSignalEventReadyToBoot().
|
||||
|
||||
@@ -221,8 +220,8 @@ EfiSignalEventReadyToBoot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT ReadyToBootEvent;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT ReadyToBootEvent;
|
||||
|
||||
Status = EfiCreateEventReadyToBoot (&ReadyToBootEvent);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@@ -246,8 +245,8 @@ EfiSignalEventLegacyBoot (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT LegacyBootEvent;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT LegacyBootEvent;
|
||||
|
||||
Status = EfiCreateEventLegacyBoot (&LegacyBootEvent);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
@@ -256,7 +255,6 @@ EfiSignalEventLegacyBoot (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check to see if the Firmware Volume (FV) Media Device Path is valid
|
||||
|
||||
@@ -283,15 +281,15 @@ EfiGetNameGuidFromFwVolDevicePathNode (
|
||||
{
|
||||
ASSERT (FvDevicePathNode != NULL);
|
||||
|
||||
if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&
|
||||
DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) {
|
||||
return (EFI_GUID *) &FvDevicePathNode->FvFileName;
|
||||
if ((DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH) &&
|
||||
(DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP))
|
||||
{
|
||||
return (EFI_GUID *)&FvDevicePathNode->FvFileName;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize a Firmware Volume (FV) Media Device Path node.
|
||||
|
||||
@@ -321,8 +319,8 @@ EfiInitializeFwVolDevicepathNode (
|
||||
//
|
||||
// Use the new Device path that does not conflict with the UEFI
|
||||
//
|
||||
FvDevicePathNode->Header.Type = MEDIA_DEVICE_PATH;
|
||||
FvDevicePathNode->Header.SubType = MEDIA_PIWG_FW_FILE_DP;
|
||||
FvDevicePathNode->Header.Type = MEDIA_DEVICE_PATH;
|
||||
FvDevicePathNode->Header.SubType = MEDIA_PIWG_FW_FILE_DP;
|
||||
SetDevicePathNodeLength (&FvDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));
|
||||
|
||||
CopyGuid (&FvDevicePathNode->FvFileName, NameGuid);
|
||||
|
Reference in New Issue
Block a user