MdeModulePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg 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:
Michael Kubacki
2021-12-05 14:54:02 -08:00
committed by mergify[bot]
parent 7c7184e201
commit 1436aea4d5
994 changed files with 107608 additions and 101311 deletions

View File

@@ -32,18 +32,18 @@
**/
EFI_STATUS
LocateFvInstanceWithTables (
OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
)
{
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles;
EFI_FV_FILETYPE FileType;
UINT32 FvStatus;
EFI_FV_FILE_ATTRIBUTES Attributes;
UINTN Size;
UINTN Index;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
EFI_STATUS Status;
EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles;
EFI_FV_FILETYPE FileType;
UINT32 FvStatus;
EFI_FV_FILE_ATTRIBUTES Attributes;
UINTN Size;
UINTN Index;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
FvStatus = 0;
@@ -51,12 +51,12 @@ LocateFvInstanceWithTables (
// Locate protocol.
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiFirmwareVolume2ProtocolGuid,
NULL,
&NumberOfHandles,
&HandleBuffer
);
ByProtocol,
&gEfiFirmwareVolume2ProtocolGuid,
NULL,
&NumberOfHandles,
&HandleBuffer
);
if (EFI_ERROR (Status)) {
//
// Defined errors at this time are not found and out of resources.
@@ -64,8 +64,6 @@ LocateFvInstanceWithTables (
return Status;
}
//
// Looking for FV with ACPI storage file
//
@@ -76,10 +74,10 @@ LocateFvInstanceWithTables (
// This should not fail because of LocateHandleBuffer
//
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiFirmwareVolume2ProtocolGuid,
(VOID**) &FvInstance
);
HandleBuffer[Index],
&gEfiFirmwareVolume2ProtocolGuid,
(VOID **)&FvInstance
);
ASSERT_EFI_ERROR (Status);
//
@@ -87,7 +85,7 @@ LocateFvInstanceWithTables (
//
Status = FvInstance->ReadFile (
FvInstance,
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
(EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),
NULL,
&Size,
&FileType,
@@ -117,7 +115,6 @@ LocateFvInstanceWithTables (
return Status;
}
/**
This function calculates and updates an UINT8 checksum.
@@ -127,11 +124,11 @@ LocateFvInstanceWithTables (
**/
VOID
AcpiPlatformChecksum (
IN UINT8 *Buffer,
IN UINTN Size
IN UINT8 *Buffer,
IN UINTN Size
)
{
UINTN ChecksumOffset;
UINTN ChecksumOffset;
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
@@ -143,10 +140,9 @@ AcpiPlatformChecksum (
//
// Update checksum value
//
Buffer[ChecksumOffset] = CalculateCheckSum8(Buffer, Size);
Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);
}
/**
Entrypoint of Acpi Platform driver.
@@ -161,8 +157,8 @@ AcpiPlatformChecksum (
EFI_STATUS
EFIAPI
AcpiPlatformEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -182,7 +178,7 @@ AcpiPlatformEntryPoint (
//
// Find the AcpiTable protocol
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable);
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTable);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
@@ -194,33 +190,33 @@ AcpiPlatformEntryPoint (
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
//
// Read tables from the storage file.
//
while (Status == EFI_SUCCESS) {
Status = FwVol->ReadSection (
FwVol,
(EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
(EFI_GUID *)PcdGetPtr (PcdAcpiTableStorageFile),
EFI_SECTION_RAW,
Instance,
(VOID**) &CurrentTable,
(VOID **)&CurrentTable,
&Size,
&FvStatus
);
if (!EFI_ERROR(Status)) {
if (!EFI_ERROR (Status)) {
//
// Add the table
//
TableHandle = 0;
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *)CurrentTable)->Length;
ASSERT (Size >= TableSize);
//
// Checksum ACPI table
//
AcpiPlatformChecksum ((UINT8*)CurrentTable, TableSize);
AcpiPlatformChecksum ((UINT8 *)CurrentTable, TableSize);
//
// Install ACPI table
@@ -237,7 +233,7 @@ AcpiPlatformEntryPoint (
//
gBS->FreePool (CurrentTable);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
@@ -254,4 +250,3 @@ AcpiPlatformEntryPoint (
//
return EFI_REQUEST_UNLOAD_IMAGE;
}

View File

@@ -50,10 +50,10 @@ FindTableByBuffer (
IN VOID *Buffer
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
LIST_ENTRY *CurrentLink;
EFI_ACPI_TABLE_LIST *CurrentTableList;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
LIST_ENTRY *CurrentLink;
EFI_ACPI_TABLE_LIST *CurrentTableList;
LIST_ENTRY *StartLink;
//
// Get the instance of the ACPI Table
@@ -69,7 +69,8 @@ FindTableByBuffer (
while (CurrentLink != StartLink) {
CurrentTableList = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
if (((UINTN)CurrentTableList->Table <= (UINTN)Buffer) &&
((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer)) {
((UINTN)CurrentTableList->Table + CurrentTableList->TableSize > (UINTN)Buffer))
{
//
// Good! Found Table.
//
@@ -96,7 +97,7 @@ SdtUpdateAmlChecksum (
IN VOID *Buffer
)
{
EFI_ACPI_TABLE_LIST *CurrentTableList;
EFI_ACPI_TABLE_LIST *CurrentTableList;
CurrentTableList = FindTableByBuffer (Buffer);
if (CurrentTableList == NULL) {
@@ -123,11 +124,11 @@ SdtUpdateAmlChecksum (
**/
EFI_STATUS
SdtGetMaxAmlBufferSize (
IN VOID *Buffer,
OUT UINTN *MaxSize
IN VOID *Buffer,
OUT UINTN *MaxSize
)
{
EFI_ACPI_TABLE_LIST *CurrentTableList;
EFI_ACPI_TABLE_LIST *CurrentTableList;
CurrentTableList = FindTableByBuffer (Buffer);
if (CurrentTableList == NULL) {
@@ -147,16 +148,16 @@ SdtGetMaxAmlBufferSize (
**/
VOID
SdtNotifyAcpiList (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
)
{
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *Table;
EFI_STATUS Status;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *Table;
EFI_STATUS Status;
//
// We should not use Table buffer, because it is user input buffer.
@@ -185,7 +186,7 @@ SdtNotifyAcpiList (
CurrentLink = CurrentLink->ForwardLink;
}
return ;
return;
}
/**
@@ -215,33 +216,35 @@ SdtNotifyAcpiList (
**/
EFI_STATUS
SdtGetAcpiTable (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
)
{
UINTN TableIndex;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *CurrentTable;
UINTN TableIndex;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_LIST *CurrentTable;
//
// Find the table
//
StartLink = &AcpiTableInstance->TableList;
CurrentLink = StartLink->ForwardLink;
TableIndex = 0;
TableIndex = 0;
while (CurrentLink != StartLink) {
if (TableIndex == Index) {
break;
}
//
// Next one
//
CurrentLink = CurrentLink->ForwardLink;
TableIndex ++;
TableIndex++;
}
if ((TableIndex != Index) || (CurrentLink == StartLink)) {
@@ -251,10 +254,10 @@ SdtGetAcpiTable (
//
// Get handle and version
//
CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
*TableKey = CurrentTable->Handle;
*Version = CurrentTable->Version;
*Table = (EFI_ACPI_SDT_HEADER *)CurrentTable->Table;
CurrentTable = EFI_ACPI_TABLE_LIST_FROM_LINK (CurrentLink);
*TableKey = CurrentTable->Handle;
*Version = CurrentTable->Version;
*Table = (EFI_ACPI_SDT_HEADER *)CurrentTable->Table;
return EFI_SUCCESS;
}
@@ -287,13 +290,13 @@ SdtGetAcpiTable (
EFI_STATUS
EFIAPI
GetAcpiTable2 (
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
ASSERT (Table != NULL);
ASSERT (Version != NULL);
@@ -307,7 +310,6 @@ GetAcpiTable2 (
return SdtGetAcpiTable (AcpiTableInstance, Index, Table, Version, TableKey);
}
/**
Register a callback when an ACPI table is installed.
@@ -317,11 +319,11 @@ GetAcpiTable2 (
**/
VOID
SdtRegisterNotify (
IN EFI_ACPI_NOTIFICATION_FN Notification
IN EFI_ACPI_NOTIFICATION_FN Notification
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
//
// Get the instance of the ACPI Table
@@ -345,7 +347,7 @@ SdtRegisterNotify (
//
InsertTailList (&AcpiTableInstance->NotifyList, &CurrentNotifyList->Link);
return ;
return;
}
/**
@@ -360,13 +362,13 @@ SdtRegisterNotify (
**/
EFI_STATUS
SdtUnregisterNotify (
IN EFI_ACPI_NOTIFICATION_FN Notification
IN EFI_ACPI_NOTIFICATION_FN Notification
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_ACPI_NOTIFY_LIST *CurrentNotifyList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
//
// Get the instance of the ACPI Table
@@ -418,8 +420,8 @@ SdtUnregisterNotify (
EFI_STATUS
EFIAPI
RegisterNotify (
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
)
{
//
@@ -454,14 +456,14 @@ RegisterNotify (
**/
EFI_STATUS
SdtOpenSdtTable (
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
)
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
EFI_ACPI_TABLE_LIST *Table;
EFI_AML_HANDLE *AmlHandle;
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
EFI_ACPI_TABLE_LIST *Table;
EFI_AML_HANDLE *AmlHandle;
//
// Get the instance of the ACPI Table
@@ -480,11 +482,11 @@ SdtOpenSdtTable (
return EFI_NOT_FOUND;
}
AmlHandle = AllocatePool (sizeof(*AmlHandle));
AmlHandle = AllocatePool (sizeof (*AmlHandle));
ASSERT (AmlHandle != NULL);
AmlHandle->Signature = EFI_AML_ROOT_HANDLE_SIGNATURE;
AmlHandle->Buffer = (VOID *)((UINTN)Table->Table + sizeof(EFI_ACPI_SDT_HEADER));
AmlHandle->Size = Table->Table->Length - sizeof(EFI_ACPI_SDT_HEADER);
AmlHandle->Buffer = (VOID *)((UINTN)Table->Table + sizeof (EFI_ACPI_SDT_HEADER));
AmlHandle->Size = Table->Table->Length - sizeof (EFI_ACPI_SDT_HEADER);
AmlHandle->AmlByteEncoding = NULL;
AmlHandle->Modified = FALSE;
@@ -508,8 +510,8 @@ SdtOpenSdtTable (
EFI_STATUS
EFIAPI
OpenSdt (
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
)
{
if (Handle == NULL) {
@@ -533,13 +535,13 @@ OpenSdt (
**/
EFI_STATUS
SdtOpenEx (
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_AML_HANDLE *AmlHandle;
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_AML_HANDLE *AmlHandle;
AmlByteEncoding = AmlSearchByOpByte (Buffer);
if (AmlByteEncoding == NULL) {
@@ -556,7 +558,7 @@ SdtOpenEx (
//
// Good, find it
//
AmlHandle = AllocatePool (sizeof(*AmlHandle));
AmlHandle = AllocatePool (sizeof (*AmlHandle));
ASSERT (AmlHandle != NULL);
AmlHandle->Signature = EFI_AML_HANDLE_SIGNATURE;
@@ -589,19 +591,19 @@ SdtOpenEx (
EFI_STATUS
EFIAPI
Open (
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
)
{
EFI_STATUS Status;
UINTN MaxSize;
EFI_STATUS Status;
UINTN MaxSize;
MaxSize = 0;
//
// Check for invalid input parameters
//
if (Buffer == NULL || Handle == NULL) {
if ((Buffer == NULL) || (Handle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -624,11 +626,11 @@ Open (
EFI_STATUS
EFIAPI
Close (
IN EFI_ACPI_HANDLE Handle
IN EFI_ACPI_HANDLE Handle
)
{
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
//
// Check for invalid input parameters
@@ -639,7 +641,8 @@ Close (
AmlHandle = (EFI_AML_HANDLE *)Handle;
if ((AmlHandle->Signature != EFI_AML_ROOT_HANDLE_SIGNATURE) &&
(AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE)) {
(AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE))
{
return EFI_INVALID_PARAMETER;
}
@@ -682,9 +685,9 @@ GetOption (
OUT UINTN *DataSize
)
{
EFI_AML_HANDLE *AmlHandle;
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlHandle;
AML_BYTE_ENCODING *AmlByteEncoding;
EFI_STATUS Status;
ASSERT (DataType != NULL);
ASSERT (Data != NULL);
@@ -740,10 +743,10 @@ GetOption (
EFI_STATUS
EFIAPI
SetOption (
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
)
{
EFI_AML_HANDLE *AmlHandle;
@@ -769,6 +772,7 @@ SetOption (
if (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
AmlByteEncoding = AmlHandle->AmlByteEncoding;
if (Index > AmlByteEncoding->MaxIndex) {
@@ -782,6 +786,7 @@ SetOption (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (DataType == EFI_ACPI_DATA_TYPE_NONE) {
return EFI_INVALID_PARAMETER;
}
@@ -813,14 +818,14 @@ SetOption (
EFI_STATUS
EFIAPI
GetChild (
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
)
{
EFI_AML_HANDLE *AmlParentHandle;
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlParentHandle;
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
ASSERT (Handle != NULL);
@@ -831,7 +836,7 @@ GetChild (
return EFI_INVALID_PARAMETER;
}
AmlHandle = *Handle;
AmlHandle = *Handle;
if ((AmlHandle != NULL) && (AmlHandle->Signature != EFI_AML_HANDLE_SIGNATURE)) {
return EFI_INVALID_PARAMETER;
}
@@ -857,10 +862,12 @@ GetChild (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (Buffer == NULL) {
*Handle = NULL;
return EFI_SUCCESS;
}
return SdtOpenEx (Buffer, (UINTN)AmlParentHandle->Buffer + AmlParentHandle->Size - (UINTN)Buffer, Handle);
}
@@ -877,16 +884,16 @@ GetChild (
**/
EFI_STATUS
SdtFindPathFromNonRoot (
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
)
{
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
EFI_AML_HANDLE *AmlHandle;
VOID *Buffer;
EFI_STATUS Status;
Buffer = NULL;
Buffer = NULL;
AmlHandle = (EFI_AML_HANDLE *)HandleIn;
//
@@ -896,10 +903,12 @@ SdtFindPathFromNonRoot (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (Buffer == NULL) {
*HandleOut = NULL;
return EFI_SUCCESS;
}
return SdtOpenEx (Buffer, (UINTN)AmlHandle->Buffer + AmlHandle->Size - (UINTN)Buffer, HandleOut);
}
@@ -912,14 +921,14 @@ SdtFindPathFromNonRoot (
**/
EFI_AML_HANDLE *
SdtDuplicateHandle (
IN EFI_AML_HANDLE *AmlHandle
IN EFI_AML_HANDLE *AmlHandle
)
{
EFI_AML_HANDLE *DstAmlHandle;
DstAmlHandle = AllocatePool (sizeof(*DstAmlHandle));
DstAmlHandle = AllocatePool (sizeof (*DstAmlHandle));
ASSERT (DstAmlHandle != NULL);
CopyMem (DstAmlHandle, (VOID *)AmlHandle, sizeof(*DstAmlHandle));
CopyMem (DstAmlHandle, (VOID *)AmlHandle, sizeof (*DstAmlHandle));
return DstAmlHandle;
}
@@ -937,17 +946,17 @@ SdtDuplicateHandle (
**/
EFI_STATUS
SdtFindPathFromRoot (
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN UINT8 *AmlPath,
OUT EFI_ACPI_HANDLE *HandleOut
)
{
EFI_ACPI_HANDLE ChildHandle;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
VOID *Buffer;
EFI_ACPI_HANDLE ChildHandle;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
VOID *Buffer;
Buffer = NULL;
Buffer = NULL;
AmlHandle = (EFI_AML_HANDLE *)HandleIn;
//
@@ -983,7 +992,7 @@ SdtFindPathFromRoot (
// More child
//
AmlHandle = (EFI_AML_HANDLE *)ChildHandle;
Status = AmlFindPath (AmlHandle, AmlPath, &Buffer, TRUE);
Status = AmlFindPath (AmlHandle, AmlPath, &Buffer, TRUE);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
@@ -993,9 +1002,10 @@ SdtFindPathFromRoot (
// Great! Find it, open
//
Status = SdtOpenEx (Buffer, (UINTN)AmlHandle->Buffer + AmlHandle->Size - (UINTN)Buffer, HandleOut);
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
//
// Not success, try next one
//
@@ -1021,14 +1031,14 @@ SdtFindPathFromRoot (
EFI_STATUS
EFIAPI
FindPath (
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
)
{
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
UINT8 *AmlPath;
EFI_AML_HANDLE *AmlHandle;
EFI_STATUS Status;
UINT8 *AmlPath;
//
// Check for invalid input parameters
@@ -1079,13 +1089,12 @@ FindPath (
**/
VOID
SdtAcpiTableAcpiSdtConstructor (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
)
{
InitializeListHead (&AcpiTableInstance->NotifyList);
CopyMem (&AcpiTableInstance->AcpiSdtProtocol, &mAcpiSdtProtocolTemplate, sizeof(mAcpiSdtProtocolTemplate));
CopyMem (&AcpiTableInstance->AcpiSdtProtocol, &mAcpiSdtProtocolTemplate, sizeof (mAcpiSdtProtocolTemplate));
AcpiTableInstance->AcpiSdtProtocol.AcpiVersion = (EFI_ACPI_TABLE_VERSION)PcdGet32 (PcdAcpiExposedTableVersions);
return ;
return;
}

View File

@@ -16,7 +16,7 @@
//
// ACPI Notify Linked List Signature.
//
#define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')
#define EFI_ACPI_NOTIFY_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'N', 'L')
//
// ACPI Notify List Entry definition.
@@ -26,9 +26,9 @@
// Notification is the callback function.
//
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_NOTIFICATION_FN Notification;
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_NOTIFICATION_FN Notification;
} EFI_ACPI_NOTIFY_LIST;
//
@@ -36,13 +36,13 @@ typedef struct {
//
#define EFI_ACPI_NOTIFY_LIST_FROM_LINK(_link) CR (_link, EFI_ACPI_NOTIFY_LIST, Link, EFI_ACPI_NOTIFY_LIST_SIGNATURE)
typedef struct _AML_BYTE_ENCODING AML_BYTE_ENCODING;
typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
typedef struct _AML_BYTE_ENCODING AML_BYTE_ENCODING;
typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
//
// AML Node Linked List Signature.
//
#define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')
#define EFI_AML_NODE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'M', 'L')
//
// AML Node Linked List Entry definition.
@@ -58,14 +58,14 @@ typedef struct _EFI_AML_NODE_LIST EFI_AML_NODE_LIST;
//
struct _EFI_AML_NODE_LIST {
UINT32 Signature;
UINT8 Name[AML_NAME_SEG_SIZE];
UINT8 *Buffer;
UINTN Size;
LIST_ENTRY Link;
LIST_ENTRY Children;
EFI_AML_NODE_LIST *Parent;
AML_BYTE_ENCODING *AmlByteEncoding;
UINT32 Signature;
UINT8 Name[AML_NAME_SEG_SIZE];
UINT8 *Buffer;
UINTN Size;
LIST_ENTRY Link;
LIST_ENTRY Children;
EFI_AML_NODE_LIST *Parent;
AML_BYTE_ENCODING *AmlByteEncoding;
};
//
@@ -76,8 +76,8 @@ struct _EFI_AML_NODE_LIST {
//
// AML Handle Signature.
//
#define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')
#define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')
#define EFI_AML_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'H', 'S')
#define EFI_AML_ROOT_HANDLE_SIGNATURE SIGNATURE_32 ('E', 'A', 'R', 'H')
//
// AML Handle Entry definition.
@@ -88,50 +88,50 @@ struct _EFI_AML_NODE_LIST {
// Size is the total size of this ACPI node buffer.
//
typedef struct {
UINT32 Signature;
UINT8 *Buffer;
UINTN Size;
AML_BYTE_ENCODING *AmlByteEncoding;
BOOLEAN Modified;
UINT32 Signature;
UINT8 *Buffer;
UINTN Size;
AML_BYTE_ENCODING *AmlByteEncoding;
BOOLEAN Modified;
} EFI_AML_HANDLE;
typedef UINT32 AML_OP_PARSE_INDEX;
#define AML_OP_PARSE_INDEX_GET_OPCODE 0
#define AML_OP_PARSE_INDEX_GET_TERM1 1
#define AML_OP_PARSE_INDEX_GET_TERM2 2
#define AML_OP_PARSE_INDEX_GET_TERM3 3
#define AML_OP_PARSE_INDEX_GET_TERM4 4
#define AML_OP_PARSE_INDEX_GET_TERM5 5
#define AML_OP_PARSE_INDEX_GET_TERM6 6
#define AML_OP_PARSE_INDEX_GET_SIZE (AML_OP_PARSE_INDEX)-1
#define AML_OP_PARSE_INDEX_GET_OPCODE 0
#define AML_OP_PARSE_INDEX_GET_TERM1 1
#define AML_OP_PARSE_INDEX_GET_TERM2 2
#define AML_OP_PARSE_INDEX_GET_TERM3 3
#define AML_OP_PARSE_INDEX_GET_TERM4 4
#define AML_OP_PARSE_INDEX_GET_TERM5 5
#define AML_OP_PARSE_INDEX_GET_TERM6 6
#define AML_OP_PARSE_INDEX_GET_SIZE (AML_OP_PARSE_INDEX)-1
typedef UINT32 AML_OP_PARSE_FORMAT;
#define AML_NONE 0
#define AML_OPCODE 1
#define AML_UINT8 2
#define AML_UINT16 3
#define AML_UINT32 4
#define AML_UINT64 5
#define AML_NAME 6
#define AML_STRING 7
#define AML_OBJECT 8
#define AML_NONE 0
#define AML_OPCODE 1
#define AML_UINT8 2
#define AML_UINT16 3
#define AML_UINT32 4
#define AML_UINT64 5
#define AML_NAME 6
#define AML_STRING 7
#define AML_OBJECT 8
typedef UINT32 AML_OP_ATTRIBUTE;
#define AML_HAS_PKG_LENGTH 0x1 // It is ACPI attribute - if OpCode has PkgLength
#define AML_IS_NAME_CHAR 0x2 // It is ACPI attribute - if this is NameChar
#define AML_HAS_CHILD_OBJ 0x4 // it is ACPI attribute - if OpCode has Child Object.
#define AML_IN_NAMESPACE 0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace
#define AML_HAS_PKG_LENGTH 0x1 // It is ACPI attribute - if OpCode has PkgLength
#define AML_IS_NAME_CHAR 0x2 // It is ACPI attribute - if this is NameChar
#define AML_HAS_CHILD_OBJ 0x4 // it is ACPI attribute - if OpCode has Child Object.
#define AML_IN_NAMESPACE 0x10000 // It is UEFI SDT attribute - if OpCode will be in NameSpace
// NOTE; Not all OBJECT will be in NameSpace
// For example, BankField | CreateBitField | CreateByteField | CreateDWordField |
// CreateField | CreateQWordField | CreateWordField | Field | IndexField.
struct _AML_BYTE_ENCODING {
UINT8 OpCode;
UINT8 SubOpCode;
AML_OP_PARSE_INDEX MaxIndex;
AML_OP_PARSE_FORMAT Format[6];
AML_OP_ATTRIBUTE Attribute;
UINT8 OpCode;
UINT8 SubOpCode;
AML_OP_PARSE_INDEX MaxIndex;
AML_OP_PARSE_FORMAT Format[6];
AML_OP_ATTRIBUTE Attribute;
};
//
@@ -167,10 +167,10 @@ struct _AML_BYTE_ENCODING {
EFI_STATUS
EFIAPI
GetAcpiTable2 (
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
);
/**
@@ -190,8 +190,8 @@ GetAcpiTable2 (
EFI_STATUS
EFIAPI
RegisterNotify (
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
IN BOOLEAN Register,
IN EFI_ACPI_NOTIFICATION_FN Notification
);
/**
@@ -206,8 +206,8 @@ RegisterNotify (
EFI_STATUS
EFIAPI
OpenSdt (
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
IN UINTN TableKey,
OUT EFI_ACPI_HANDLE *Handle
);
/**
@@ -224,8 +224,8 @@ OpenSdt (
EFI_STATUS
EFIAPI
Open (
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
OUT EFI_ACPI_HANDLE *Handle
);
/**
@@ -239,7 +239,7 @@ Open (
EFI_STATUS
EFIAPI
Close (
IN EFI_ACPI_HANDLE Handle
IN EFI_ACPI_HANDLE Handle
);
/**
@@ -284,10 +284,10 @@ GetOption (
EFI_STATUS
EFIAPI
SetOption (
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
IN EFI_ACPI_HANDLE Handle,
IN UINTN Index,
IN CONST VOID *Data,
IN UINTN DataSize
);
/**
@@ -304,8 +304,8 @@ SetOption (
EFI_STATUS
EFIAPI
GetChild (
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
IN EFI_ACPI_HANDLE ParentHandle,
IN OUT EFI_ACPI_HANDLE *Handle
);
/**
@@ -322,9 +322,9 @@ GetChild (
EFI_STATUS
EFIAPI
FindPath (
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
IN EFI_ACPI_HANDLE HandleIn,
IN VOID *AcpiPath,
OUT EFI_ACPI_HANDLE *HandleOut
);
//
@@ -345,9 +345,9 @@ FindPath (
**/
EFI_STATUS
SdtOpenEx (
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
IN VOID *Buffer,
IN UINTN BufferSize,
OUT EFI_ACPI_HANDLE *Handle
);
//
@@ -365,8 +365,8 @@ SdtOpenEx (
**/
EFI_STATUS
AmlGetNameStringSize (
IN UINT8 *Buffer,
OUT UINTN *BufferSize
IN UINT8 *Buffer,
OUT UINTN *BufferSize
);
/**
@@ -379,8 +379,8 @@ AmlGetNameStringSize (
**/
UINTN
AmlGetPkgLength (
IN UINT8 *Buffer,
OUT UINTN *PkgLength
IN UINT8 *Buffer,
OUT UINTN *PkgLength
);
/**
@@ -404,7 +404,7 @@ AmlTypeToAcpiType (
**/
AML_BYTE_ENCODING *
AmlSearchByOpByte (
IN UINT8 *OpByteBuffer
IN UINT8 *OpByteBuffer
);
/**
@@ -418,9 +418,9 @@ AmlSearchByOpByte (
**/
UINTN
AmlGetObjectSize (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
);
/**
@@ -432,7 +432,7 @@ AmlGetObjectSize (
**/
CHAR8 *
AmlGetObjectName (
IN EFI_AML_HANDLE *AmlHandle
IN EFI_AML_HANDLE *AmlHandle
);
/**
@@ -451,11 +451,11 @@ AmlGetObjectName (
**/
EFI_STATUS
AmlParseOptionHandleCommon (
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
);
/**
@@ -469,8 +469,8 @@ AmlParseOptionHandleCommon (
**/
EFI_STATUS
AmlGetOffsetAfterLastOption (
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
);
/**
@@ -486,9 +486,9 @@ AmlGetOffsetAfterLastOption (
**/
EFI_STATUS
AmlGetChildFromRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
);
/**
@@ -504,9 +504,9 @@ AmlGetChildFromRoot (
**/
EFI_STATUS
AmlGetChildFromNonRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
);
/**
@@ -519,7 +519,7 @@ AmlGetChildFromNonRoot (
**/
UINT8 *
AmlNameFromAslName (
IN UINT8 *AslPath
IN UINT8 *AslPath
);
/**
@@ -550,7 +550,7 @@ AmlFindPath (
**/
VOID
AmlPrintNameString (
IN UINT8 *Buffer
IN UINT8 *Buffer
);
/**
@@ -560,7 +560,7 @@ AmlPrintNameString (
**/
VOID
AmlPrintNameSeg (
IN UINT8 *Buffer
IN UINT8 *Buffer
);
/**
@@ -573,7 +573,7 @@ AmlPrintNameSeg (
**/
BOOLEAN
AmlIsRootPath (
IN UINT8 *Buffer
IN UINT8 *Buffer
);
#endif

View File

@@ -14,8 +14,8 @@
//
// Handle to install ACPI Table Protocol
//
EFI_HANDLE mHandle = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
EFI_HANDLE mHandle = NULL;
GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
/**
Entry point of the ACPI table driver.
@@ -33,12 +33,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
EFI_STATUS
EFIAPI
InitializeAcpiTableDxe (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_ACPI_TABLE_INSTANCE *PrivateData;
EFI_STATUS Status;
EFI_ACPI_TABLE_INSTANCE *PrivateData;
//
// Initialize our protocol
@@ -61,14 +61,14 @@ InitializeAcpiTableDxe (
//
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
mPrivateData = PrivateData;
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEfiAcpiTableProtocolGuid,
&PrivateData->AcpiTableProtocol,
&gEfiAcpiSdtProtocolGuid,
&mPrivateData->AcpiSdtProtocol,
NULL
);
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
&gEfiAcpiTableProtocolGuid,
&PrivateData->AcpiTableProtocol,
&gEfiAcpiSdtProtocolGuid,
&mPrivateData->AcpiSdtProtocol,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&mHandle,
@@ -77,8 +77,8 @@ InitializeAcpiTableDxe (
NULL
);
}
ASSERT_EFI_ERROR (Status);
return Status;
}

View File

@@ -9,7 +9,6 @@
#ifndef _ACPI_TABLE_H_
#define _ACPI_TABLE_H_
#include <PiDxe.h>
#include <Protocol/AcpiTable.h>
@@ -37,7 +36,7 @@
//
// Great than or equal to 2.0.
//
#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 | \
#define ACPI_TABLE_VERSION_GTE_2_0 (EFI_ACPI_TABLE_VERSION_2_0 |\
EFI_ACPI_TABLE_VERSION_3_0 | \
EFI_ACPI_TABLE_VERSION_4_0 | \
EFI_ACPI_TABLE_VERSION_5_0)
@@ -48,7 +47,7 @@
//
// ACPI Table Linked List Signature.
//
#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
#define EFI_ACPI_TABLE_LIST_SIGNATURE SIGNATURE_32 ('E', 'A', 'T', 'L')
//
// ACPI Table Linked List Entry definition.
@@ -65,13 +64,13 @@
// TRUE: Table points to TableSize bytes allocated using gBS->AllocatePool ()
//
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_TABLE_VERSION Version;
EFI_ACPI_COMMON_HEADER *Table;
UINTN TableSize;
UINTN Handle;
BOOLEAN PoolAllocation;
UINT32 Signature;
LIST_ENTRY Link;
EFI_ACPI_TABLE_VERSION Version;
EFI_ACPI_COMMON_HEADER *Table;
UINTN TableSize;
UINTN Handle;
BOOLEAN PoolAllocation;
} EFI_ACPI_TABLE_LIST;
//
@@ -82,7 +81,7 @@ typedef struct {
//
// The maximum number of tables this driver supports
//
#define EFI_ACPI_MAX_NUM_TABLES 20
#define EFI_ACPI_MAX_NUM_TABLES 20
//
// Protocol private structure definition
@@ -96,25 +95,25 @@ typedef struct {
// ACPI support protocol instance data structure
//
typedef struct {
UINTN Signature;
EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure
EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure
EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header
EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header
EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header
EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header
EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header
EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header
EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header
EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header
EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header
LIST_ENTRY TableList;
UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
UINTN CurrentHandle;
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;
LIST_ENTRY NotifyList;
UINTN Signature;
EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp1; // Pointer to RSD_PTR structure
EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp3; // Pointer to RSD_PTR structure
EFI_ACPI_DESCRIPTION_HEADER *Rsdt1; // Pointer to RSDT table header
EFI_ACPI_DESCRIPTION_HEADER *Rsdt3; // Pointer to RSDT table header
EFI_ACPI_DESCRIPTION_HEADER *Xsdt; // Pointer to XSDT table header
EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt1; // Pointer to FADT table header
EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt3; // Pointer to FADT table header
EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs1; // Pointer to FACS table header
EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs3; // Pointer to FACS table header
EFI_ACPI_DESCRIPTION_HEADER *Dsdt1; // Pointer to DSDT table header
EFI_ACPI_DESCRIPTION_HEADER *Dsdt3; // Pointer to DSDT table header
LIST_ENTRY TableList;
UINTN NumberOfTableEntries1; // Number of ACPI 1.0 tables
UINTN NumberOfTableEntries3; // Number of ACPI 3.0 tables
UINTN CurrentHandle;
EFI_ACPI_TABLE_PROTOCOL AcpiTableProtocol;
EFI_ACPI_SDT_PROTOCOL AcpiSdtProtocol;
LIST_ENTRY NotifyList;
} EFI_ACPI_TABLE_INSTANCE;
//
@@ -143,10 +142,9 @@ typedef struct {
**/
EFI_STATUS
AcpiTableAcpiTableConstructor (
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
);
/**
Entry point of the ACPI table driver.
Creates and initializes an instance of the ACPI Table
@@ -163,8 +161,8 @@ AcpiTableAcpiTableConstructor (
EFI_STATUS
EFIAPI
InitializeAcpiTableDxe (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -183,9 +181,9 @@ InitializeAcpiTableDxe (
**/
EFI_STATUS
FindTableByHandle (
IN UINTN Handle,
IN LIST_ENTRY *TableList,
OUT EFI_ACPI_TABLE_LIST **Table
IN UINTN Handle,
IN LIST_ENTRY *TableList,
OUT EFI_ACPI_TABLE_LIST **Table
);
/**
@@ -201,9 +199,9 @@ FindTableByHandle (
**/
EFI_STATUS
AcpiPlatformChecksum (
IN VOID *Buffer,
IN UINTN Size,
IN UINTN ChecksumOffset
IN VOID *Buffer,
IN UINTN Size,
IN UINTN ChecksumOffset
);
/**
@@ -215,9 +213,9 @@ AcpiPlatformChecksum (
**/
VOID
SdtNotifyAcpiList (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN EFI_ACPI_TABLE_VERSION Version,
IN UINTN Handle
);
/**
@@ -227,7 +225,7 @@ SdtNotifyAcpiList (
**/
VOID
SdtAcpiTableAcpiSdtConstructor (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance
);
/**
@@ -257,17 +255,17 @@ SdtAcpiTableAcpiSdtConstructor (
**/
EFI_STATUS
SdtGetAcpiTable (
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance,
IN UINTN Index,
OUT EFI_ACPI_SDT_HEADER **Table,
OUT EFI_ACPI_TABLE_VERSION *Version,
OUT UINTN *TableKey
);
//
// export PrivateData symbol, because we need that in AcpiSdtProtol implementation
//
extern EFI_HANDLE mHandle;
extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;
extern EFI_HANDLE mHandle;
extern EFI_ACPI_TABLE_INSTANCE *mPrivateData;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -9,151 +9,151 @@
#include "AcpiTable.h"
GLOBAL_REMOVE_IF_UNREFERENCED
AML_BYTE_ENCODING mAmlByteEncoding[] = {
AML_BYTE_ENCODING mAmlByteEncoding[] = {
// OpCode SubOpCode Num 1 2 3 4 5 6 Attribute
/* ZeroOp - 0x00 */ {AML_ZERO_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OneOp - 0x01 */ {AML_ONE_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AliasOp - 0x06 */ {AML_ALIAS_OP, 0, 2, {AML_NAME, AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* NameOp - 0x08 */ {AML_NAME_OP, 0, 2, {AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* BytePrefix - 0x0A */ {AML_BYTE_PREFIX, 0, 1, {AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* WordPrefix - 0x0B */ {AML_WORD_PREFIX, 0, 1, {AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DWordPrefix - 0x0C */ {AML_DWORD_PREFIX, 0, 1, {AML_UINT32, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* StringPrefix - 0x0D */ {AML_STRING_PREFIX, 0, 1, {AML_STRING, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* QWordPrefix - 0x0E */ {AML_QWORD_PREFIX, 0, 1, {AML_UINT64, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ScopeOp - 0x10 */ {AML_SCOPE_OP, 0, 1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* BufferOp - 0x11 */ {AML_BUFFER_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* PackageOp - 0x12 */ {AML_PACKAGE_OP, 0, 1, {AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* VarPackageOp - 0x13 */ {AML_VAR_PACKAGE_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* MethodOp - 0x14 */ {AML_METHOD_OP, 0, 2, {AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* DualNamePrefix - 0x2F */ {AML_DUAL_NAME_PREFIX, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* MultiNamePrefix - 0x2F */ {AML_MULTI_NAME_PREFIX, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x41 */ {'A', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x42 */ {'B', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x43 */ {'C', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x44 */ {'D', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x45 */ {'E', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x46 */ {'F', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x47 */ {'G', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x48 */ {'H', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x49 */ {'I', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4A */ {'J', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4B */ {'K', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4C */ {'L', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4D */ {'M', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4E */ {'N', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x4F */ {'O', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x50 */ {'P', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x51 */ {'Q', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x52 */ {'R', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x53 */ {'S', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x54 */ {'T', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x55 */ {'U', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x56 */ {'V', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x57 */ {'W', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x58 */ {'X', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x59 */ {'Y', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x5A */ {'Z', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* MutexOp - 0x5B 0x01 */ {AML_EXT_OP, AML_EXT_MUTEX_OP, 2, {AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* EventOp - 0x5B 0x02 */ {AML_EXT_OP, AML_EXT_EVENT_OP, 1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* CondRefOfOp - 0x5B 0x12 */ {AML_EXT_OP, AML_EXT_COND_REF_OF_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateFieldOp - 0x5B 0x13 */ {AML_EXT_OP, AML_EXT_CREATE_FIELD_OP,4, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE}, 0},
/* LoadTableOp - 0x5B 0x1F */ {AML_EXT_OP, AML_EXT_LOAD_TABLE_OP, 6, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT}, 0},
/* LoadOp - 0x5B 0x20 */ {AML_EXT_OP, AML_EXT_LOAD_OP, 2, {AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* StallOp - 0x5B 0x21 */ {AML_EXT_OP, AML_EXT_STALL_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SleepOp - 0x5B 0x22 */ {AML_EXT_OP, AML_EXT_SLEEP_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AcquireOp - 0x5B 0x23 */ {AML_EXT_OP, AML_EXT_ACQUIRE_OP, 2, {AML_OBJECT, AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SignalOp - 0x5B 0x24 */ {AML_EXT_OP, AML_EXT_SIGNAL_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* WaitOp - 0x5B 0x25 */ {AML_EXT_OP, AML_EXT_WAIT_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ResetOp - 0x5B 0x26 */ {AML_EXT_OP, AML_EXT_RESET_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ReleaseOp - 0x5B 0x27 */ {AML_EXT_OP, AML_EXT_RELEASE_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FromBCDOp - 0x5B 0x28 */ {AML_EXT_OP, AML_EXT_FROM_BCD_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToBCDOp - 0x5B 0x29 */ {AML_EXT_OP, AML_EXT_TO_BCD_OP, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* UnloadOp - 0x5B 0x2A */ {AML_EXT_OP, AML_EXT_UNLOAD_OP, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* RevisionOp - 0x5B 0x30 */ {AML_EXT_OP, AML_EXT_REVISION_OP, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DebugOp - 0x5B 0x31 */ {AML_EXT_OP, AML_EXT_DEBUG_OP, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FatalOp - 0x5B 0x32 */ {AML_EXT_OP, AML_EXT_FATAL_OP, 3, {AML_UINT8, AML_UINT32, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* TimerOp - 0x5B 0x33 */ {AML_EXT_OP, AML_EXT_TIMER_OP, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OpRegionOp - 0x5B 0x80 */ {AML_EXT_OP, AML_EXT_REGION_OP, 4, {AML_NAME, AML_UINT8, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* FieldOp - 0x5B 0x81 */ {AML_EXT_OP, AML_EXT_FIELD_OP, 2, {AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* DeviceOp - 0x5B 0x82 */ {AML_EXT_OP, AML_EXT_DEVICE_OP, 1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* ProcessorOp - 0x5B 0x83 */ {AML_EXT_OP, AML_EXT_PROCESSOR_OP, 4, {AML_NAME, AML_UINT8, AML_UINT32, AML_UINT8, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* PowerResOp - 0x5B 0x84 */ {AML_EXT_OP, AML_EXT_POWER_RES_OP, 3, {AML_NAME, AML_UINT8, AML_UINT16, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* ThermalZoneOp - 0x5B 0x85 */ {AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP,1, {AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE},
/* IndexFieldOp - 0x5B 0x86 */ {AML_EXT_OP, AML_EXT_INDEX_FIELD_OP, 3, {AML_NAME, AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* BankFieldOp - 0x5B 0x87 */ {AML_EXT_OP, AML_EXT_BANK_FIELD_OP, 4, {AML_NAME, AML_NAME, AML_OBJECT, AML_UINT8, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH},
/* DataRegionOp - 0x5B 0x88 */ {AML_EXT_OP, AML_EXT_DATA_REGION_OP, 4, {AML_NAME, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE}, AML_IN_NAMESPACE},
/* RootChar - 0x5C */ {AML_ROOT_CHAR, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* ParentPrefixChar - 0x5E */ {AML_PARENT_PREFIX_CHAR, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* NameChar - 0x5F */ {'_', 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_IS_NAME_CHAR},
/* Local0Op - 0x60 */ {AML_LOCAL0, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local1Op - 0x61 */ {AML_LOCAL1, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local2Op - 0x62 */ {AML_LOCAL2, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local3Op - 0x63 */ {AML_LOCAL3, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local4Op - 0x64 */ {AML_LOCAL4, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local5Op - 0x65 */ {AML_LOCAL5, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local6Op - 0x66 */ {AML_LOCAL6, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Local7Op - 0x67 */ {AML_LOCAL7, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg0Op - 0x68 */ {AML_ARG0, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg1Op - 0x69 */ {AML_ARG1, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg2Op - 0x6A */ {AML_ARG2, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg3Op - 0x6B */ {AML_ARG3, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg4Op - 0x6C */ {AML_ARG4, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg5Op - 0x6D */ {AML_ARG5, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* Arg6Op - 0x6E */ {AML_ARG6, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* StoreOp - 0x70 */ {AML_STORE_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* RefOfOp - 0x71 */ {AML_REF_OF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AddOp - 0x72 */ {AML_ADD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ConcatOp - 0x73 */ {AML_CONCAT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SubtractOp - 0x74 */ {AML_SUBTRACT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* IncrementOp - 0x75 */ {AML_INCREMENT_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DecrementOp - 0x76 */ {AML_DECREMENT_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* MultiplyOp - 0x77 */ {AML_MULTIPLY_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DivideOp - 0x78 */ {AML_DIVIDE_OP, 0, 4, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE}, 0},
/* ShiftLeftOp - 0x79 */ {AML_SHIFT_LEFT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ShiftRightOp - 0x7A */ {AML_SHIFT_RIGHT_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* AndOp - 0x7B */ {AML_AND_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NAndOp - 0x7C */ {AML_NAND_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OrOp - 0x7D */ {AML_OR_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NorOp - 0x7E */ {AML_NOR_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* XOrOp - 0x7F */ {AML_XOR_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NotOp - 0x80 */ {AML_NOT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FindSetLeftBitOp - 0x81 */ {AML_FIND_SET_LEFT_BIT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* FindSetRightBitOp - 0x82 */ {AML_FIND_SET_RIGHT_BIT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* DerefOfOp - 0x83 */ {AML_DEREF_OF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ConcatResOp - 0x84 */ {AML_CONCAT_RES_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ModOp - 0x85 */ {AML_MOD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* NotifyOp - 0x86 */ {AML_NOTIFY_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* SizeOfOp - 0x87 */ {AML_SIZE_OF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* IndexOp - 0x88 */ {AML_INDEX_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* MatchOp - 0x89 */ {AML_MATCH_OP, 0, 6, {AML_OBJECT, AML_UINT8, AML_OBJECT, AML_UINT8, AML_OBJECT, AML_OBJECT}, 0},
/* CreateDWordFieldOp - 0x8A */ {AML_CREATE_DWORD_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateWordFieldOp - 0x8B */ {AML_CREATE_WORD_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateByteFieldOp - 0x8C */ {AML_CREATE_BYTE_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateBitFieldOp - 0x8D */ {AML_CREATE_BIT_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ObjectTypeOp - 0x8E */ {AML_OBJECT_TYPE_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CreateQWordFieldOp - 0x8F */ {AML_CREATE_QWORD_FIELD_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LAndOp - 0x90 */ {AML_LAND_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LOrOp - 0x91 */ {AML_LOR_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LNotOp - 0x92 */ {AML_LNOT_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LEqualOp - 0x93 */ {AML_LEQUAL_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LGreaterOp - 0x94 */ {AML_LGREATER_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* LLessOp - 0x95 */ {AML_LLESS_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToBufferOp - 0x96 */ {AML_TO_BUFFER_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToDecimalStringOp - 0x97 */ {AML_TO_DEC_STRING_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToHexStringOp - 0x98 */ {AML_TO_HEX_STRING_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToIntegerOp - 0x99 */ {AML_TO_INTEGER_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ToStringOp - 0x9C */ {AML_TO_STRING_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* CopyObjectOp - 0x9D */ {AML_COPY_OBJECT_OP, 0, 2, {AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* MidOp - 0x9E */ {AML_MID_OP, 0, 3, {AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ContinueOp - 0x9F */ {AML_CONTINUE_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* IfOp - 0xA0 */ {AML_IF_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* ElseOp - 0xA1 */ {AML_ELSE_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* WhileOp - 0xA2 */ {AML_WHILE_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ},
/* NoopOp - 0xA3 */ {AML_NOOP_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ReturnOp - 0xA4 */ {AML_RETURN_OP, 0, 1, {AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* BreakOp - 0xA5 */ {AML_BREAK_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* BreakPointOp - 0xCC */ {AML_BREAK_POINT_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* OnesOp - 0xFF */ {AML_ONES_OP, 0, 0, {AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE}, 0},
/* ZeroOp - 0x00 */ { AML_ZERO_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OneOp - 0x01 */ { AML_ONE_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AliasOp - 0x06 */ { AML_ALIAS_OP, 0, 2, { AML_NAME, AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* NameOp - 0x08 */ { AML_NAME_OP, 0, 2, { AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* BytePrefix - 0x0A */ { AML_BYTE_PREFIX, 0, 1, { AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* WordPrefix - 0x0B */ { AML_WORD_PREFIX, 0, 1, { AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DWordPrefix - 0x0C */ { AML_DWORD_PREFIX, 0, 1, { AML_UINT32, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* StringPrefix - 0x0D */ { AML_STRING_PREFIX, 0, 1, { AML_STRING, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* QWordPrefix - 0x0E */ { AML_QWORD_PREFIX, 0, 1, { AML_UINT64, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ScopeOp - 0x10 */ { AML_SCOPE_OP, 0, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* BufferOp - 0x11 */ { AML_BUFFER_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* PackageOp - 0x12 */ { AML_PACKAGE_OP, 0, 1, { AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* VarPackageOp - 0x13 */ { AML_VAR_PACKAGE_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* MethodOp - 0x14 */ { AML_METHOD_OP, 0, 2, { AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* DualNamePrefix - 0x2F */ { AML_DUAL_NAME_PREFIX, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* MultiNamePrefix - 0x2F */ { AML_MULTI_NAME_PREFIX, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x41 */ { 'A', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x42 */ { 'B', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x43 */ { 'C', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x44 */ { 'D', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x45 */ { 'E', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x46 */ { 'F', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x47 */ { 'G', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x48 */ { 'H', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x49 */ { 'I', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4A */ { 'J', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4B */ { 'K', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4C */ { 'L', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4D */ { 'M', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4E */ { 'N', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x4F */ { 'O', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x50 */ { 'P', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x51 */ { 'Q', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x52 */ { 'R', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x53 */ { 'S', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x54 */ { 'T', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x55 */ { 'U', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x56 */ { 'V', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x57 */ { 'W', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x58 */ { 'X', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x59 */ { 'Y', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x5A */ { 'Z', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* MutexOp - 0x5B 0x01 */ { AML_EXT_OP, AML_EXT_MUTEX_OP, 2, { AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* EventOp - 0x5B 0x02 */ { AML_EXT_OP, AML_EXT_EVENT_OP, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* CondRefOfOp - 0x5B 0x12 */ { AML_EXT_OP, AML_EXT_COND_REF_OF_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateFieldOp - 0x5B 0x13 */ { AML_EXT_OP, AML_EXT_CREATE_FIELD_OP, 4, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE }, 0 },
/* LoadTableOp - 0x5B 0x1F */ { AML_EXT_OP, AML_EXT_LOAD_TABLE_OP, 6, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT }, 0 },
/* LoadOp - 0x5B 0x20 */ { AML_EXT_OP, AML_EXT_LOAD_OP, 2, { AML_NAME, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* StallOp - 0x5B 0x21 */ { AML_EXT_OP, AML_EXT_STALL_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SleepOp - 0x5B 0x22 */ { AML_EXT_OP, AML_EXT_SLEEP_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AcquireOp - 0x5B 0x23 */ { AML_EXT_OP, AML_EXT_ACQUIRE_OP, 2, { AML_OBJECT, AML_UINT16, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SignalOp - 0x5B 0x24 */ { AML_EXT_OP, AML_EXT_SIGNAL_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* WaitOp - 0x5B 0x25 */ { AML_EXT_OP, AML_EXT_WAIT_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ResetOp - 0x5B 0x26 */ { AML_EXT_OP, AML_EXT_RESET_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ReleaseOp - 0x5B 0x27 */ { AML_EXT_OP, AML_EXT_RELEASE_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FromBCDOp - 0x5B 0x28 */ { AML_EXT_OP, AML_EXT_FROM_BCD_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToBCDOp - 0x5B 0x29 */ { AML_EXT_OP, AML_EXT_TO_BCD_OP, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* UnloadOp - 0x5B 0x2A */ { AML_EXT_OP, AML_EXT_UNLOAD_OP, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* RevisionOp - 0x5B 0x30 */ { AML_EXT_OP, AML_EXT_REVISION_OP, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DebugOp - 0x5B 0x31 */ { AML_EXT_OP, AML_EXT_DEBUG_OP, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FatalOp - 0x5B 0x32 */ { AML_EXT_OP, AML_EXT_FATAL_OP, 3, { AML_UINT8, AML_UINT32, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* TimerOp - 0x5B 0x33 */ { AML_EXT_OP, AML_EXT_TIMER_OP, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OpRegionOp - 0x5B 0x80 */ { AML_EXT_OP, AML_EXT_REGION_OP, 4, { AML_NAME, AML_UINT8, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* FieldOp - 0x5B 0x81 */ { AML_EXT_OP, AML_EXT_FIELD_OP, 2, { AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* DeviceOp - 0x5B 0x82 */ { AML_EXT_OP, AML_EXT_DEVICE_OP, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* ProcessorOp - 0x5B 0x83 */ { AML_EXT_OP, AML_EXT_PROCESSOR_OP, 4, { AML_NAME, AML_UINT8, AML_UINT32, AML_UINT8, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* PowerResOp - 0x5B 0x84 */ { AML_EXT_OP, AML_EXT_POWER_RES_OP, 3, { AML_NAME, AML_UINT8, AML_UINT16, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* ThermalZoneOp - 0x5B 0x85 */ { AML_EXT_OP, AML_EXT_THERMAL_ZONE_OP, 1, { AML_NAME, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ | AML_IN_NAMESPACE },
/* IndexFieldOp - 0x5B 0x86 */ { AML_EXT_OP, AML_EXT_INDEX_FIELD_OP, 3, { AML_NAME, AML_NAME, AML_UINT8, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* BankFieldOp - 0x5B 0x87 */ { AML_EXT_OP, AML_EXT_BANK_FIELD_OP, 4, { AML_NAME, AML_NAME, AML_OBJECT, AML_UINT8, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH },
/* DataRegionOp - 0x5B 0x88 */ { AML_EXT_OP, AML_EXT_DATA_REGION_OP, 4, { AML_NAME, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE }, AML_IN_NAMESPACE },
/* RootChar - 0x5C */ { AML_ROOT_CHAR, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* ParentPrefixChar - 0x5E */ { AML_PARENT_PREFIX_CHAR, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* NameChar - 0x5F */ { '_', 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_IS_NAME_CHAR },
/* Local0Op - 0x60 */ { AML_LOCAL0, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local1Op - 0x61 */ { AML_LOCAL1, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local2Op - 0x62 */ { AML_LOCAL2, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local3Op - 0x63 */ { AML_LOCAL3, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local4Op - 0x64 */ { AML_LOCAL4, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local5Op - 0x65 */ { AML_LOCAL5, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local6Op - 0x66 */ { AML_LOCAL6, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Local7Op - 0x67 */ { AML_LOCAL7, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg0Op - 0x68 */ { AML_ARG0, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg1Op - 0x69 */ { AML_ARG1, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg2Op - 0x6A */ { AML_ARG2, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg3Op - 0x6B */ { AML_ARG3, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg4Op - 0x6C */ { AML_ARG4, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg5Op - 0x6D */ { AML_ARG5, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* Arg6Op - 0x6E */ { AML_ARG6, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* StoreOp - 0x70 */ { AML_STORE_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* RefOfOp - 0x71 */ { AML_REF_OF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AddOp - 0x72 */ { AML_ADD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ConcatOp - 0x73 */ { AML_CONCAT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SubtractOp - 0x74 */ { AML_SUBTRACT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* IncrementOp - 0x75 */ { AML_INCREMENT_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DecrementOp - 0x76 */ { AML_DECREMENT_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* MultiplyOp - 0x77 */ { AML_MULTIPLY_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DivideOp - 0x78 */ { AML_DIVIDE_OP, 0, 4, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE }, 0 },
/* ShiftLeftOp - 0x79 */ { AML_SHIFT_LEFT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ShiftRightOp - 0x7A */ { AML_SHIFT_RIGHT_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* AndOp - 0x7B */ { AML_AND_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NAndOp - 0x7C */ { AML_NAND_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OrOp - 0x7D */ { AML_OR_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NorOp - 0x7E */ { AML_NOR_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* XOrOp - 0x7F */ { AML_XOR_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NotOp - 0x80 */ { AML_NOT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FindSetLeftBitOp - 0x81 */ { AML_FIND_SET_LEFT_BIT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* FindSetRightBitOp - 0x82 */ { AML_FIND_SET_RIGHT_BIT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* DerefOfOp - 0x83 */ { AML_DEREF_OF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ConcatResOp - 0x84 */ { AML_CONCAT_RES_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ModOp - 0x85 */ { AML_MOD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* NotifyOp - 0x86 */ { AML_NOTIFY_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* SizeOfOp - 0x87 */ { AML_SIZE_OF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* IndexOp - 0x88 */ { AML_INDEX_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* MatchOp - 0x89 */ { AML_MATCH_OP, 0, 6, { AML_OBJECT, AML_UINT8, AML_OBJECT, AML_UINT8, AML_OBJECT, AML_OBJECT }, 0 },
/* CreateDWordFieldOp - 0x8A */ { AML_CREATE_DWORD_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateWordFieldOp - 0x8B */ { AML_CREATE_WORD_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateByteFieldOp - 0x8C */ { AML_CREATE_BYTE_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateBitFieldOp - 0x8D */ { AML_CREATE_BIT_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ObjectTypeOp - 0x8E */ { AML_OBJECT_TYPE_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CreateQWordFieldOp - 0x8F */ { AML_CREATE_QWORD_FIELD_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_NAME, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LAndOp - 0x90 */ { AML_LAND_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LOrOp - 0x91 */ { AML_LOR_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LNotOp - 0x92 */ { AML_LNOT_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LEqualOp - 0x93 */ { AML_LEQUAL_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LGreaterOp - 0x94 */ { AML_LGREATER_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* LLessOp - 0x95 */ { AML_LLESS_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToBufferOp - 0x96 */ { AML_TO_BUFFER_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToDecimalStringOp - 0x97 */ { AML_TO_DEC_STRING_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToHexStringOp - 0x98 */ { AML_TO_HEX_STRING_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToIntegerOp - 0x99 */ { AML_TO_INTEGER_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ToStringOp - 0x9C */ { AML_TO_STRING_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* CopyObjectOp - 0x9D */ { AML_COPY_OBJECT_OP, 0, 2, { AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* MidOp - 0x9E */ { AML_MID_OP, 0, 3, { AML_OBJECT, AML_OBJECT, AML_OBJECT, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ContinueOp - 0x9F */ { AML_CONTINUE_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* IfOp - 0xA0 */ { AML_IF_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* ElseOp - 0xA1 */ { AML_ELSE_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* WhileOp - 0xA2 */ { AML_WHILE_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, AML_HAS_PKG_LENGTH | AML_HAS_CHILD_OBJ },
/* NoopOp - 0xA3 */ { AML_NOOP_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* ReturnOp - 0xA4 */ { AML_RETURN_OP, 0, 1, { AML_OBJECT, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* BreakOp - 0xA5 */ { AML_BREAK_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* BreakPointOp - 0xCC */ { AML_BREAK_POINT_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
/* OnesOp - 0xFF */ { AML_ONES_OP, 0, 0, { AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE, AML_NONE }, 0 },
};
GLOBAL_REMOVE_IF_UNREFERENCED
@@ -178,12 +178,12 @@ EFI_ACPI_DATA_TYPE mAmlTypeToAcpiType[] = {
**/
AML_BYTE_ENCODING *
AmlSearchByOpByte (
IN UINT8 *OpByteBuffer
IN UINT8 *OpByteBuffer
)
{
UINT8 OpCode;
UINT8 SubOpCode;
UINTN Index;
UINT8 OpCode;
UINT8 SubOpCode;
UINTN Index;
//
// Get OpCode and SubOpCode
@@ -198,7 +198,7 @@ AmlSearchByOpByte (
//
// Search the table
//
for (Index = 0; Index < sizeof(mAmlByteEncoding)/sizeof(mAmlByteEncoding[0]); Index++) {
for (Index = 0; Index < sizeof (mAmlByteEncoding)/sizeof (mAmlByteEncoding[0]); Index++) {
if ((mAmlByteEncoding[Index].OpCode == OpCode) && (mAmlByteEncoding[Index].SubOpCode == SubOpCode)) {
return &mAmlByteEncoding[Index];
}
@@ -219,11 +219,12 @@ AmlTypeToAcpiType (
IN AML_OP_PARSE_FORMAT AmlType
)
{
if (AmlType >= sizeof(mAmlTypeToAcpiType)/sizeof(mAmlTypeToAcpiType[0])) {
ASSERT(FALSE);
if (AmlType >= sizeof (mAmlTypeToAcpiType)/sizeof (mAmlTypeToAcpiType[0])) {
ASSERT (FALSE);
return EFI_ACPI_DATA_TYPE_NONE;
}
return mAmlTypeToAcpiType [AmlType];
return mAmlTypeToAcpiType[AmlType];
}
/**
@@ -236,14 +237,14 @@ AmlTypeToAcpiType (
**/
UINTN
AmlGetPkgLength (
IN UINT8 *Buffer,
OUT UINTN *PkgLength
IN UINT8 *Buffer,
OUT UINTN *PkgLength
)
{
UINT8 LeadByte;
UINT8 ByteCount;
UINTN RealLength;
UINTN Offset;
UINT8 LeadByte;
UINT8 ByteCount;
UINTN RealLength;
UINTN Offset;
//
// <bit 7-6: ByteData count that follows (0-3)>
@@ -261,36 +262,35 @@ AmlGetPkgLength (
// length is 2**28.
//
LeadByte = *Buffer;
ByteCount = (UINT8)((LeadByte >> 6) & 0x03);
Offset = ByteCount + 1;
LeadByte = *Buffer;
ByteCount = (UINT8)((LeadByte >> 6) & 0x03);
Offset = ByteCount + 1;
RealLength = 0;
switch (ByteCount) {
case 0:
RealLength = (UINT32)LeadByte;
break;
case 1:
RealLength = *(Buffer + 1);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 2:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 3:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength |= (UINTN)((*(Buffer + 3)) << 16);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
default:
ASSERT (0);
break;
case 0:
RealLength = (UINT32)LeadByte;
break;
case 1:
RealLength = *(Buffer + 1);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 2:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 3:
RealLength = *(Buffer + 1);
RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength |= (UINTN)((*(Buffer + 3)) << 16);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
default:
ASSERT (0);
break;
}
*PkgLength = RealLength;
return Offset;
}

View File

@@ -21,13 +21,13 @@
**/
EFI_STATUS
AmlGetChildFromObjectBuffer (
IN EFI_AML_HANDLE *AmlParentHandle,
IN UINT8 *CurrentBuffer,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN UINT8 *CurrentBuffer,
OUT VOID **Buffer
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
UINTN DataSize;
AML_BYTE_ENCODING *AmlByteEncoding;
UINTN DataSize;
//
// Root is considered as SCOPE, which has TermList.
@@ -38,6 +38,7 @@ AmlGetChildFromObjectBuffer (
if (AmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// NOTE: We need return everything, because user might need parse the returned object.
//
@@ -54,6 +55,7 @@ AmlGetChildFromObjectBuffer (
if (DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
CurrentBuffer += DataSize;
}
@@ -77,12 +79,12 @@ AmlGetChildFromObjectBuffer (
**/
EFI_STATUS
AmlGetChildFromRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
UINT8 *CurrentBuffer;
UINT8 *CurrentBuffer;
if (AmlHandle == NULL) {
//
@@ -109,9 +111,9 @@ AmlGetChildFromRoot (
**/
EFI_STATUS
AmlGetChildFromOptionList (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
EFI_ACPI_DATA_TYPE DataType;
@@ -121,7 +123,7 @@ AmlGetChildFromOptionList (
EFI_STATUS Status;
AML_OP_PARSE_INDEX MaxTerm;
Index = AML_OP_PARSE_INDEX_GET_TERM1;
Index = AML_OP_PARSE_INDEX_GET_TERM1;
MaxTerm = AmlParentHandle->AmlByteEncoding->MaxIndex;
while (Index <= MaxTerm) {
Status = AmlParseOptionHandleCommon (
@@ -134,6 +136,7 @@ AmlGetChildFromOptionList (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (DataType == EFI_ACPI_DATA_TYPE_NONE) {
//
// Not found
@@ -145,17 +148,19 @@ AmlGetChildFromOptionList (
// Find it, and Check Data
//
if ((DataType == EFI_ACPI_DATA_TYPE_CHILD) &&
((UINTN)AmlHandle->Buffer < (UINTN)Data)) {
((UINTN)AmlHandle->Buffer < (UINTN)Data))
{
//
// Buffer < Data means current node is next one
//
*Buffer = Data;
return EFI_SUCCESS;
}
//
// Not Child
//
Index ++;
Index++;
}
*Buffer = NULL;
@@ -175,13 +180,13 @@ AmlGetChildFromOptionList (
**/
EFI_STATUS
AmlGetChildFromObjectChildList (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
EFI_STATUS Status;
UINT8 *CurrentBuffer;
EFI_STATUS Status;
UINT8 *CurrentBuffer;
CurrentBuffer = NULL;
@@ -242,12 +247,12 @@ AmlGetChildFromObjectChildList (
**/
EFI_STATUS
AmlGetChildFromNonRoot (
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
IN EFI_AML_HANDLE *AmlParentHandle,
IN EFI_AML_HANDLE *AmlHandle,
OUT VOID **Buffer
)
{
EFI_STATUS Status;
EFI_STATUS Status;
if (AmlHandle == NULL) {
//
@@ -263,6 +268,7 @@ AmlGetChildFromNonRoot (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (*Buffer != NULL) {
return EFI_SUCCESS;
}

View File

@@ -20,9 +20,9 @@
**/
EFI_STATUS
AmlConstructNodeList (
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
);
/**
@@ -41,18 +41,18 @@ AmlCreateNode (
IN AML_BYTE_ENCODING *AmlByteEncoding
)
{
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlNodeList;
AmlNodeList = AllocatePool (sizeof(*AmlNodeList));
AmlNodeList = AllocatePool (sizeof (*AmlNodeList));
ASSERT (AmlNodeList != NULL);
AmlNodeList->Signature = EFI_AML_NODE_LIST_SIGNATURE;
CopyMem (AmlNodeList->Name, NameSeg, AML_NAME_SEG_SIZE);
AmlNodeList->Buffer = NULL;
AmlNodeList->Size = 0;
AmlNodeList->Buffer = NULL;
AmlNodeList->Size = 0;
InitializeListHead (&AmlNodeList->Link);
InitializeListHead (&AmlNodeList->Children);
AmlNodeList->Parent = Parent;
AmlNodeList->Parent = Parent;
AmlNodeList->AmlByteEncoding = AmlByteEncoding;
return AmlNodeList;
@@ -69,15 +69,15 @@ AmlCreateNode (
**/
EFI_AML_NODE_LIST *
AmlFindNodeInThis (
IN UINT8 *NameSeg,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
IN UINT8 *NameSeg,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
)
{
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_AML_NODE_LIST *AmlNodeList;
StartLink = &AmlParentNodeList->Children;
CurrentLink = StartLink->ForwardLink;
@@ -93,6 +93,7 @@ AmlFindNodeInThis (
//
return CurrentAmlNodeList;
}
CurrentLink = CurrentLink->ForwardLink;
}
@@ -124,17 +125,17 @@ AmlFindNodeInThis (
**/
EFI_AML_NODE_LIST *
AmlFindNodeInTheTree (
IN UINT8 *NameString,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
IN UINT8 *NameString,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN BOOLEAN Create
)
{
UINT8 *Buffer;
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlCurrentNodeList;
UINT8 Index;
UINT8 SegCount;
UINT8 *Buffer;
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlCurrentNodeList;
UINT8 Index;
UINT8 SegCount;
Buffer = NameString;
@@ -143,7 +144,7 @@ AmlFindNodeInTheTree (
//
if (*Buffer == AML_ROOT_CHAR) {
AmlCurrentNodeList = AmlRootNodeList;
Buffer += 1;
Buffer += 1;
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
AmlCurrentNodeList = AmlParentNodeList;
do {
@@ -155,6 +156,7 @@ AmlFindNodeInTheTree (
//
ASSERT (AmlCurrentNodeList == AmlRootNodeList);
}
Buffer += 1;
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
} else {
@@ -165,12 +167,12 @@ AmlFindNodeInTheTree (
// Handle name segment
//
if (*Buffer == AML_DUAL_NAME_PREFIX) {
Buffer += 1;
Buffer += 1;
SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
Buffer += 1;
Buffer += 1;
SegCount = *Buffer;
Buffer += 1;
Buffer += 1;
} else if (*Buffer == 0) {
//
// NULL name, only for Root
@@ -190,9 +192,10 @@ AmlFindNodeInTheTree (
if (AmlNodeList == NULL) {
return NULL;
}
AmlCurrentNodeList = AmlNodeList;
Buffer += AML_NAME_SEG_SIZE;
Index ++;
Buffer += AML_NAME_SEG_SIZE;
Index++;
} while (Index < SegCount);
return AmlNodeList;
@@ -211,14 +214,14 @@ AmlFindNodeInTheTree (
**/
EFI_AML_NODE_LIST *
AmlInsertNodeToTree (
IN UINT8 *NameString,
IN VOID *Buffer,
IN UINTN Size,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN UINT8 *NameString,
IN VOID *Buffer,
IN UINTN Size,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
EFI_AML_NODE_LIST *AmlNodeList;
EFI_AML_NODE_LIST *AmlNodeList;
AmlNodeList = AmlFindNodeInTheTree (
NameString,
@@ -243,10 +246,11 @@ AmlInsertNodeToTree (
// We need check if new one is SCOPE_OP, because SCOPE_OP just means namespace, not a real device.
// We should not return SCOPE_OP.
//
AmlNodeList->Buffer = Buffer;
AmlNodeList->Size = Size;
AmlNodeList->Buffer = Buffer;
AmlNodeList->Size = Size;
AmlNodeList->AmlByteEncoding = AmlSearchByOpByte (Buffer);
}
return AmlNodeList;
}
@@ -282,17 +286,17 @@ AmlInsertNodeToTree (
**/
EFI_STATUS
AmlConstructNodeListForChild (
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
UINT8 *Buffer;
UINTN BufferSize;
UINT8 *CurrentBuffer;
EFI_AML_HANDLE *AmlChildHandle;
EFI_STATUS Status;
AML_BYTE_ENCODING *AmlByteEncoding;
UINT8 *Buffer;
UINTN BufferSize;
UINT8 *CurrentBuffer;
EFI_AML_HANDLE *AmlChildHandle;
EFI_STATUS Status;
CurrentBuffer = NULL;
AmlChildHandle = NULL;
@@ -373,13 +377,13 @@ AmlConstructNodeListForChild (
**/
EFI_STATUS
AmlConstructNodeList (
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_HANDLE *AmlHandle,
IN EFI_AML_NODE_LIST *AmlRootNodeList,
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
VOID *NameString;
EFI_AML_NODE_LIST *AmlNodeList;
VOID *NameString;
EFI_AML_NODE_LIST *AmlNodeList;
//
// 1. Check if there is need to construct node for this OpCode.
@@ -419,12 +423,12 @@ AmlConstructNodeList (
**/
VOID
AmlDestructNodeList (
IN EFI_AML_NODE_LIST *AmlParentNodeList
IN EFI_AML_NODE_LIST *AmlParentNodeList
)
{
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
LIST_ENTRY *StartLink;
//
// Get the children link
@@ -440,7 +444,7 @@ AmlDestructNodeList (
// Destruct the child's list recursively
//
CurrentAmlNodeList = EFI_AML_NODE_LIST_FROM_LINK (CurrentLink);
CurrentLink = CurrentLink->ForwardLink;
CurrentLink = CurrentLink->ForwardLink;
//
// Remove this child from list and free the node
@@ -454,7 +458,7 @@ AmlDestructNodeList (
// Done.
//
FreePool (AmlParentNodeList);
return ;
return;
}
/**
@@ -465,13 +469,13 @@ AmlDestructNodeList (
**/
VOID
AmlDumpNodeInfo (
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN UINTN Level
IN EFI_AML_NODE_LIST *AmlParentNodeList,
IN UINTN Level
)
{
EFI_AML_NODE_LIST *CurrentAmlNodeList;
volatile LIST_ENTRY *CurrentLink;
UINTN Index;
EFI_AML_NODE_LIST *CurrentAmlNodeList;
volatile LIST_ENTRY *CurrentLink;
UINTN Index;
CurrentLink = AmlParentNodeList->Children.ForwardLink;
@@ -481,8 +485,10 @@ AmlDumpNodeInfo (
for (Index = 0; Index < Level; Index++) {
DEBUG ((DEBUG_ERROR, " "));
}
AmlPrintNameSeg (AmlParentNodeList->Name);
}
DEBUG ((DEBUG_ERROR, "\n"));
while (CurrentLink != &AmlParentNodeList->Children) {
@@ -491,7 +497,7 @@ AmlDumpNodeInfo (
CurrentLink = CurrentLink->ForwardLink;
}
return ;
return;
}
/**
@@ -515,12 +521,12 @@ AmlFindPath (
IN BOOLEAN FromRoot
)
{
EFI_AML_NODE_LIST *AmlRootNodeList;
EFI_STATUS Status;
EFI_AML_NODE_LIST *AmlNodeList;
UINT8 RootNameSeg[AML_NAME_SEG_SIZE];
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
EFI_AML_NODE_LIST *AmlRootNodeList;
EFI_STATUS Status;
EFI_AML_NODE_LIST *AmlNodeList;
UINT8 RootNameSeg[AML_NAME_SEG_SIZE];
EFI_AML_NODE_LIST *CurrentAmlNodeList;
LIST_ENTRY *CurrentLink;
//
// 1. create tree
@@ -529,8 +535,8 @@ AmlFindPath (
//
// Create root handle
//
RootNameSeg[0] = AML_ROOT_CHAR;
RootNameSeg[1] = 0;
RootNameSeg[0] = AML_ROOT_CHAR;
RootNameSeg[1] = 0;
AmlRootNodeList = AmlCreateNode (RootNameSeg, NULL, AmlHandle->AmlByteEncoding);
Status = AmlConstructNodeList (
@@ -594,8 +600,8 @@ AmlFindPath (
}
*Buffer = NULL;
Status = EFI_SUCCESS;
if (AmlNodeList != NULL && AmlNodeList->Buffer != NULL) {
Status = EFI_SUCCESS;
if ((AmlNodeList != NULL) && (AmlNodeList->Buffer != NULL)) {
*Buffer = AmlNodeList->Buffer;
}

View File

@@ -25,95 +25,103 @@
**/
EFI_STATUS
AmlParseOptionTerm (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX TermIndex,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX TermIndex,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
)
{
AML_BYTE_ENCODING *ChildAmlByteEncoding;
EFI_STATUS Status;
AML_BYTE_ENCODING *ChildAmlByteEncoding;
EFI_STATUS Status;
if (DataType != NULL) {
*DataType = AmlTypeToAcpiType (AmlByteEncoding->Format[TermIndex - 1]);
}
if (Data != NULL) {
*Data = Buffer;
}
//
// Parse term according to AML type
//
switch (AmlByteEncoding->Format[TermIndex - 1]) {
case AML_UINT8:
*DataSize = sizeof(UINT8);
break;
case AML_UINT16:
*DataSize = sizeof(UINT16);
break;
case AML_UINT32:
*DataSize = sizeof(UINT32);
break;
case AML_UINT64:
*DataSize = sizeof(UINT64);
break;
case AML_STRING:
*DataSize = AsciiStrSize((CHAR8 *)Buffer);
break;
case AML_NAME:
Status = AmlGetNameStringSize (Buffer, DataSize);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
break;
case AML_OBJECT:
ChildAmlByteEncoding = AmlSearchByOpByte (Buffer);
if (ChildAmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// NOTE: We need override DataType here, if there is a case the AML_OBJECT is AML_NAME.
// We need convert type from EFI_ACPI_DATA_TYPE_CHILD to EFI_ACPI_DATA_TYPE_NAME_STRING.
// We should not return CHILD because there is NO OpCode for NameString.
//
if ((ChildAmlByteEncoding->Attribute & AML_IS_NAME_CHAR) != 0) {
if (DataType != NULL) {
*DataType = AmlTypeToAcpiType (AML_NAME);
}
case AML_UINT8:
*DataSize = sizeof (UINT8);
break;
case AML_UINT16:
*DataSize = sizeof (UINT16);
break;
case AML_UINT32:
*DataSize = sizeof (UINT32);
break;
case AML_UINT64:
*DataSize = sizeof (UINT64);
break;
case AML_STRING:
*DataSize = AsciiStrSize ((CHAR8 *)Buffer);
break;
case AML_NAME:
Status = AmlGetNameStringSize (Buffer, DataSize);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
break;
}
//
// It is real AML_OBJECT
//
*DataSize = AmlGetObjectSize (
ChildAmlByteEncoding,
Buffer,
MaxBufferSize
);
if (*DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
break;
case AML_NONE:
break;
case AML_OBJECT:
ChildAmlByteEncoding = AmlSearchByOpByte (Buffer);
if (ChildAmlByteEncoding == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// NOTE: We need override DataType here, if there is a case the AML_OBJECT is AML_NAME.
// We need convert type from EFI_ACPI_DATA_TYPE_CHILD to EFI_ACPI_DATA_TYPE_NAME_STRING.
// We should not return CHILD because there is NO OpCode for NameString.
//
if ((ChildAmlByteEncoding->Attribute & AML_IS_NAME_CHAR) != 0) {
if (DataType != NULL) {
*DataType = AmlTypeToAcpiType (AML_NAME);
}
Status = AmlGetNameStringSize (Buffer, DataSize);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
break;
}
//
// It is real AML_OBJECT
//
*DataSize = AmlGetObjectSize (
ChildAmlByteEncoding,
Buffer,
MaxBufferSize
);
if (*DataSize == 0) {
return EFI_INVALID_PARAMETER;
}
break;
case AML_NONE:
//
// No term
//
case AML_OPCODE:
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
case AML_OPCODE:
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
}
if (*DataSize > MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
@@ -135,13 +143,13 @@ AmlParseOptionTerm (
**/
EFI_STATUS
AmlParseOptionCommon (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
)
{
UINT8 *CurrentBuffer;
@@ -163,6 +171,7 @@ AmlParseOptionCommon (
if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
return EFI_INVALID_PARAMETER;
}
//
// return NameString size
//
@@ -170,9 +179,11 @@ AmlParseOptionCommon (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
if (*DataSize > MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
@@ -186,27 +197,31 @@ AmlParseOptionCommon (
//
if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
*DataType = EFI_ACPI_DATA_TYPE_OPCODE;
*Data = (VOID *)CurrentBuffer;
*Data = (VOID *)CurrentBuffer;
}
if (*CurrentBuffer == AML_EXT_OP) {
OpLength = 2;
} else {
OpLength = 1;
}
*DataSize = OpLength;
if (Index == AML_OP_PARSE_INDEX_GET_OPCODE) {
return EFI_SUCCESS;
}
if (OpLength > MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
CurrentBuffer += OpLength;
//
// 2. Skip PkgLength field, if have
//
if ((AmlByteEncoding->Attribute & AML_HAS_PKG_LENGTH) != 0) {
PkgOffset = AmlGetPkgLength(CurrentBuffer, &PkgLength);
PkgOffset = AmlGetPkgLength (CurrentBuffer, &PkgLength);
//
// Override MaxBufferSize if it is valid PkgLength
//
@@ -219,6 +234,7 @@ AmlParseOptionCommon (
PkgOffset = 0;
PkgLength = 0;
}
CurrentBuffer += PkgOffset;
//
@@ -250,7 +266,7 @@ AmlParseOptionCommon (
// Parse next one
//
CurrentBuffer += *DataSize;
TermIndex ++;
TermIndex++;
}
//
@@ -259,6 +275,7 @@ AmlParseOptionCommon (
if ((UINTN)CurrentBuffer > (UINTN)Buffer + MaxBufferSize) {
return EFI_INVALID_PARAMETER;
}
if ((UINTN)CurrentBuffer == (UINTN)Buffer + MaxBufferSize) {
if (Index != AML_OP_PARSE_INDEX_GET_SIZE) {
return EFI_INVALID_PARAMETER;
@@ -289,23 +306,23 @@ AmlParseOptionCommon (
**/
UINTN
AmlGetObjectSize (
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
IN AML_BYTE_ENCODING *AmlByteEncoding,
IN UINT8 *Buffer,
IN UINTN MaxBufferSize
)
{
EFI_STATUS Status;
UINTN DataSize;
EFI_STATUS Status;
UINTN DataSize;
Status = AmlParseOptionCommon (
AmlByteEncoding,
Buffer,
MaxBufferSize,
AML_OP_PARSE_INDEX_GET_SIZE,
NULL,
NULL,
&DataSize
);
AmlByteEncoding,
Buffer,
MaxBufferSize,
AML_OP_PARSE_INDEX_GET_SIZE,
NULL,
NULL,
&DataSize
);
if (EFI_ERROR (Status)) {
return 0;
} else {
@@ -322,7 +339,7 @@ AmlGetObjectSize (
**/
CHAR8 *
AmlGetObjectName (
IN EFI_AML_HANDLE *AmlHandle
IN EFI_AML_HANDLE *AmlHandle
)
{
AML_BYTE_ENCODING *AmlByteEncoding;
@@ -346,6 +363,7 @@ AmlGetObjectName (
break;
}
}
ASSERT (TermIndex != 0);
//
@@ -361,6 +379,7 @@ AmlGetObjectName (
if (EFI_ERROR (Status)) {
return NULL;
}
ASSERT (DataType == EFI_ACPI_DATA_TYPE_NAME_STRING);
return NameString;
@@ -377,8 +396,8 @@ AmlGetObjectName (
**/
EFI_STATUS
AmlGetOffsetAfterLastOption (
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
IN EFI_AML_HANDLE *AmlHandle,
OUT UINT8 **Buffer
)
{
EFI_ACPI_DATA_TYPE DataType;
@@ -408,6 +427,7 @@ AmlGetOffsetAfterLastOption (
if (DataType == EFI_ACPI_DATA_TYPE_OPCODE) {
*Buffer += AmlGetPkgLength (*Buffer, &DataSize);
}
return EFI_SUCCESS;
}
@@ -427,11 +447,11 @@ AmlGetOffsetAfterLastOption (
**/
EFI_STATUS
AmlParseOptionHandleCommon (
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
IN EFI_AML_HANDLE *AmlHandle,
IN AML_OP_PARSE_INDEX Index,
OUT EFI_ACPI_DATA_TYPE *DataType,
OUT VOID **Data,
OUT UINTN *DataSize
)
{
return AmlParseOptionCommon (

View File

@@ -18,7 +18,7 @@
**/
BOOLEAN
AmlIsRootPath (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
if ((Buffer[0] == AML_ROOT_CHAR) && (Buffer[1] == 0)) {
@@ -38,10 +38,10 @@ AmlIsRootPath (
**/
BOOLEAN
AmlIsLeadName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if ((Ch == '_') || (Ch >= 'A' && Ch <= 'Z')) {
if ((Ch == '_') || ((Ch >= 'A') && (Ch <= 'Z'))) {
return TRUE;
} else {
return FALSE;
@@ -58,10 +58,10 @@ AmlIsLeadName (
**/
BOOLEAN
AmlIsName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if (AmlIsLeadName (Ch) || (Ch >= '0' && Ch <= '9')) {
if (AmlIsLeadName (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE;
} else {
return FALSE;
@@ -78,18 +78,21 @@ AmlIsName (
**/
BOOLEAN
AmlIsNameSeg (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
UINTN Index;
if (!AmlIsLeadName (Buffer[0])) {
return FALSE;
}
for (Index = 1; Index < AML_NAME_SEG_SIZE; Index++) {
if (!AmlIsName (Buffer[Index])) {
return FALSE;
}
}
return TRUE;
}
@@ -104,13 +107,13 @@ AmlIsNameSeg (
**/
EFI_STATUS
AmlGetNameStringSize (
IN UINT8 *Buffer,
OUT UINTN *BufferSize
IN UINT8 *Buffer,
OUT UINTN *BufferSize
)
{
UINTN SegCount;
UINTN Length;
UINTN Index;
UINTN SegCount;
UINTN Length;
UINTN Index;
Length = 0;
@@ -118,12 +121,12 @@ AmlGetNameStringSize (
// Parse root or parent prefix
//
if (*Buffer == AML_ROOT_CHAR) {
Buffer ++;
Length ++;
Buffer++;
Length++;
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
do {
Buffer ++;
Length ++;
Buffer++;
Length++;
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
}
@@ -131,21 +134,21 @@ AmlGetNameStringSize (
// Parse name segment
//
if (*Buffer == AML_DUAL_NAME_PREFIX) {
Buffer ++;
Length ++;
Buffer++;
Length++;
SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
Buffer ++;
Length ++;
Buffer++;
Length++;
SegCount = *Buffer;
Buffer ++;
Length ++;
Buffer++;
Length++;
} else if (*Buffer == 0) {
//
// NULL Name, only for Root
//
SegCount = 0;
Buffer --;
Buffer--;
if ((Length == 1) && (*Buffer == AML_ROOT_CHAR)) {
*BufferSize = 2;
return EFI_SUCCESS;
@@ -164,9 +167,10 @@ AmlGetNameStringSize (
if (!AmlIsNameSeg (Buffer)) {
return EFI_INVALID_PARAMETER;
}
Buffer += AML_NAME_SEG_SIZE;
Length += AML_NAME_SEG_SIZE;
Index ++;
Index++;
} while (Index < SegCount);
*BufferSize = Length;
@@ -183,10 +187,10 @@ AmlGetNameStringSize (
**/
BOOLEAN
AmlIsAslLeadName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if (AmlIsLeadName (Ch) || (Ch >= 'a' && Ch <= 'z')) {
if (AmlIsLeadName (Ch) || ((Ch >= 'a') && (Ch <= 'z'))) {
return TRUE;
} else {
return FALSE;
@@ -203,10 +207,10 @@ AmlIsAslLeadName (
**/
BOOLEAN
AmlIsAslName (
IN CHAR8 Ch
IN CHAR8 Ch
)
{
if (AmlIsAslLeadName (Ch) || (Ch >= '0' && Ch <= '9')) {
if (AmlIsAslLeadName (Ch) || ((Ch >= '0') && (Ch <= '9'))) {
return TRUE;
} else {
return FALSE;
@@ -222,11 +226,11 @@ AmlIsAslName (
**/
UINTN
AmlGetAslNameSegLength (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
UINTN Length;
UINTN Index;
UINTN Length;
UINTN Index;
if (*Buffer == 0) {
return 0;
@@ -237,20 +241,23 @@ AmlGetAslNameSegLength (
// 1st
//
if (AmlIsAslLeadName (*Buffer)) {
Length ++;
Buffer ++;
Length++;
Buffer++;
}
if ((*Buffer == 0) || (*Buffer == '.')) {
return Length;
}
//
// 2, 3, 4 name char
//
for (Index = 0; Index < 3; Index++) {
if (AmlIsAslName (*Buffer)) {
Length ++;
Buffer ++;
Length++;
Buffer++;
}
if ((*Buffer == 0) || (*Buffer == '.')) {
return Length;
}
@@ -274,27 +281,27 @@ AmlGetAslNameSegLength (
**/
UINTN
AmlGetAslNameStringSize (
IN UINT8 *Buffer,
OUT UINTN *Root,
OUT UINTN *Parent,
OUT UINTN *SegCount
IN UINT8 *Buffer,
OUT UINTN *Root,
OUT UINTN *Parent,
OUT UINTN *SegCount
)
{
UINTN NameLength;
UINTN TotalLength;
UINTN NameLength;
UINTN TotalLength;
*Root = 0;
*Parent = 0;
*SegCount = 0;
*Root = 0;
*Parent = 0;
*SegCount = 0;
TotalLength = 0;
NameLength = 0;
NameLength = 0;
if (*Buffer == AML_ROOT_CHAR) {
*Root = 1;
Buffer ++;
Buffer++;
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
do {
Buffer ++;
(*Parent) ++;
Buffer++;
(*Parent)++;
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
}
@@ -306,12 +313,14 @@ AmlGetAslNameStringSize (
if ((NameLength == 0) || (NameLength > AML_NAME_SEG_SIZE)) {
return 0;
}
(*SegCount) ++;
(*SegCount)++;
Buffer += NameLength;
if (*Buffer == 0) {
break;
}
Buffer ++;
Buffer++;
}
//
@@ -334,7 +343,7 @@ AmlGetAslNameStringSize (
//
// Add NULL char
//
TotalLength ++;
TotalLength++;
return TotalLength;
}
@@ -348,15 +357,15 @@ AmlGetAslNameStringSize (
**/
VOID
AmlUpperCaseCopyMem (
IN UINT8 *DstBuffer,
IN UINT8 *SrcBuffer,
IN UINTN Length
IN UINT8 *DstBuffer,
IN UINT8 *SrcBuffer,
IN UINTN Length
)
{
UINTN Index;
UINTN Index;
for (Index = 0; Index < Length; Index++) {
if (SrcBuffer[Index] >= 'a' && SrcBuffer[Index] <= 'z') {
if ((SrcBuffer[Index] >= 'a') && (SrcBuffer[Index] <= 'z')) {
DstBuffer[Index] = (UINT8)(SrcBuffer[Index] - 'a' + 'A');
} else {
DstBuffer[Index] = SrcBuffer[Index];
@@ -374,17 +383,17 @@ AmlUpperCaseCopyMem (
**/
UINT8 *
AmlNameFromAslName (
IN UINT8 *AslPath
IN UINT8 *AslPath
)
{
UINTN Root;
UINTN Parent;
UINTN SegCount;
UINTN TotalLength;
UINTN NameLength;
UINT8 *Buffer;
UINT8 *AmlPath;
UINT8 *AmlBuffer;
UINTN Root;
UINTN Parent;
UINTN SegCount;
UINTN TotalLength;
UINTN NameLength;
UINT8 *Buffer;
UINT8 *AmlPath;
UINT8 *AmlBuffer;
TotalLength = AmlGetAslNameStringSize (AslPath, &Root, &Parent, &SegCount);
if (TotalLength == 0) {
@@ -395,19 +404,19 @@ AmlNameFromAslName (
ASSERT (AmlPath != NULL);
AmlBuffer = AmlPath;
Buffer = AslPath;
Buffer = AslPath;
//
// Handle Root and Parent
//
if (Root == 1) {
*AmlBuffer = AML_ROOT_CHAR;
AmlBuffer ++;
Buffer ++;
AmlBuffer++;
Buffer++;
} else if (Parent > 0) {
SetMem (AmlBuffer, Parent, AML_PARENT_PREFIX_CHAR);
AmlBuffer += Parent;
Buffer += Parent;
Buffer += Parent;
}
//
@@ -415,12 +424,12 @@ AmlNameFromAslName (
//
if (SegCount > 2) {
*AmlBuffer = AML_MULTI_NAME_PREFIX;
AmlBuffer ++;
AmlBuffer++;
*AmlBuffer = (UINT8)SegCount;
AmlBuffer ++;
AmlBuffer++;
} else if (SegCount == 2) {
*AmlBuffer = AML_DUAL_NAME_PREFIX;
AmlBuffer ++;
AmlBuffer++;
}
//
@@ -431,12 +440,13 @@ AmlNameFromAslName (
ASSERT ((NameLength != 0) && (NameLength <= AML_NAME_SEG_SIZE));
AmlUpperCaseCopyMem (AmlBuffer, Buffer, NameLength);
SetMem (AmlBuffer + NameLength, AML_NAME_SEG_SIZE - NameLength, AML_NAME_CHAR__);
Buffer += NameLength;
Buffer += NameLength;
AmlBuffer += AML_NAME_SEG_SIZE;
if (*Buffer == 0) {
break;
}
Buffer ++;
Buffer++;
}
//
@@ -454,23 +464,26 @@ AmlNameFromAslName (
**/
VOID
AmlPrintNameSeg (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
DEBUG ((DEBUG_ERROR, "%c", Buffer[0]));
if ((Buffer[1] == '_') && (Buffer[2] == '_') && (Buffer[3] == '_')) {
return ;
return;
}
DEBUG ((DEBUG_ERROR, "%c", Buffer[1]));
if ((Buffer[2] == '_') && (Buffer[3] == '_')) {
return ;
return;
}
DEBUG ((DEBUG_ERROR, "%c", Buffer[2]));
if (Buffer[3] == '_') {
return ;
return;
}
DEBUG ((DEBUG_ERROR, "%c", Buffer[3]));
return ;
return;
}
/**
@@ -480,24 +493,24 @@ AmlPrintNameSeg (
**/
VOID
AmlPrintNameString (
IN UINT8 *Buffer
IN UINT8 *Buffer
)
{
UINT8 SegCount;
UINT8 Index;
UINT8 SegCount;
UINT8 Index;
if (*Buffer == AML_ROOT_CHAR) {
//
// RootChar
//
Buffer ++;
Buffer++;
DEBUG ((DEBUG_ERROR, "\\"));
} else if (*Buffer == AML_PARENT_PREFIX_CHAR) {
//
// ParentPrefixChar
//
do {
Buffer ++;
Buffer++;
DEBUG ((DEBUG_ERROR, "^"));
} while (*Buffer == AML_PARENT_PREFIX_CHAR);
}
@@ -506,20 +519,20 @@ AmlPrintNameString (
//
// DualName
//
Buffer ++;
Buffer++;
SegCount = 2;
} else if (*Buffer == AML_MULTI_NAME_PREFIX) {
//
// MultiName
//
Buffer ++;
Buffer++;
SegCount = *Buffer;
Buffer ++;
Buffer++;
} else if (*Buffer == 0) {
//
// NULL Name
//
return ;
return;
} else {
//
// NameSeg
@@ -535,5 +548,5 @@ AmlPrintNameString (
Buffer += AML_NAME_SEG_SIZE;
}
return ;
return;
}

View File

@@ -132,36 +132,36 @@ EFI_BOOT_LOGO_PROTOCOL mBootLogoProtocolTemplate = {
///
/// Boot Logo 2 Protocol instance
///
EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {
EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {
SetBootLogo2,
GetBootLogo2
};
EFI_EVENT mBootGraphicsReadyToBootEvent;
UINTN mBootGraphicsResourceTableKey = 0;
BOOLEAN mIsLogoValid = FALSE;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *mLogoBltBuffer = NULL;
UINTN mLogoDestX = 0;
UINTN mLogoDestY = 0;
UINTN mLogoWidth = 0;
UINTN mLogoHeight = 0;
BOOLEAN mAcpiBgrtInstalled = FALSE;
BOOLEAN mAcpiBgrtStatusChanged = FALSE;
BOOLEAN mAcpiBgrtBufferChanged = FALSE;
BOOLEAN mIsLogoValid = FALSE;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *mLogoBltBuffer = NULL;
UINTN mLogoDestX = 0;
UINTN mLogoDestY = 0;
UINTN mLogoWidth = 0;
UINTN mLogoHeight = 0;
BOOLEAN mAcpiBgrtInstalled = FALSE;
BOOLEAN mAcpiBgrtStatusChanged = FALSE;
BOOLEAN mAcpiBgrtBufferChanged = FALSE;
//
// ACPI Boot Graphics Resource Table template
//
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
{
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE,
sizeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE),
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
//
// It is expected that these values will be updated at EntryPoint.
//
{0x00}, // OEM ID is a 6 bytes long field
{ 0x00 }, // OEM ID is a 6 bytes long field
0x00, // OEM Table ID(8 bytes long)
0x00, // OEM Revision
0x00, // Creator ID
@@ -196,12 +196,12 @@ EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
EFI_STATUS
EFIAPI
SetBootLogo (
IN EFI_BOOT_LOGO_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height
IN EFI_BOOT_LOGO_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height
)
{
//
@@ -250,7 +250,7 @@ SetBootLogo2 (
UINT32 Result32;
if (BltBuffer == NULL) {
mIsLogoValid = FALSE;
mIsLogoValid = FALSE;
mAcpiBgrtStatusChanged = TRUE;
return EFI_SUCCESS;
}
@@ -258,7 +258,7 @@ SetBootLogo2 (
//
// Width and height are not allowed to be zero.
//
if (Width == 0 || Height == 0) {
if ((Width == 0) || (Height == 0)) {
return EFI_INVALID_PARAMETER;
}
@@ -270,14 +270,17 @@ SetBootLogo2 (
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
Status = SafeUintnToUint32 (DestinationY, &Result32);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
Status = SafeUintnToUint32 (Width, &Result32);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
Status = SafeUintnToUint32 (Height, &Result32);
if (EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
@@ -295,6 +298,7 @@ SetBootLogo2 (
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
Status = SafeUintnMult (
BufferSize,
sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),
@@ -382,8 +386,9 @@ GetBootLogo2 (
//
// Make sure none of the boot logo location parameters are NULL.
//
if (BltBuffer == NULL || DestinationX == NULL || DestinationY == NULL ||
Width == NULL || Height == NULL) {
if ((BltBuffer == NULL) || (DestinationX == NULL) || (DestinationY == NULL) ||
(Width == NULL) || (Height == NULL))
{
return EFI_INVALID_PARAMETER;
}
@@ -425,7 +430,7 @@ BgrtReadyToBootEventNotify (
Status = gBS->LocateProtocol (
&gEfiAcpiTableProtocolGuid,
NULL,
(VOID **) &AcpiTableProtocol
(VOID **)&AcpiTableProtocol
);
if (EFI_ERROR (Status)) {
return;
@@ -475,13 +480,13 @@ BgrtReadyToBootEventNotify (
// so the BMP image is allocated by TranslateGopBltToBmp().
//
ImageBuffer = NULL;
Status = TranslateGopBltToBmp (
mLogoBltBuffer,
(UINT32)mLogoHeight,
(UINT32)mLogoWidth,
&ImageBuffer,
&BmpSize
);
Status = TranslateGopBltToBmp (
mLogoBltBuffer,
(UINT32)mLogoHeight,
(UINT32)mLogoWidth,
&ImageBuffer,
&BmpSize
);
if (EFI_ERROR (Status)) {
return;
}

View File

@@ -18,18 +18,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
SetIdtEntry (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
)
{
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
//
// Restore IDT for debug
//
IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile);
AsmWriteIdtr (IdtDescriptor);
//
@@ -39,17 +39,18 @@ SetIdtEntry (
ASSERT_EFI_ERROR (Status);
DEBUG_CODE_BEGIN ();
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
}
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN)-1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
}
DEBUG_CODE_END ();
}

View File

@@ -13,12 +13,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "ScriptExecute.h"
EFI_GUID mBootScriptExecutorImageGuid = {
EFI_GUID mBootScriptExecutorImageGuid = {
0x9a8d3433, 0x9fe8, 0x42b6, { 0x87, 0xb, 0x1e, 0x31, 0xc8, 0x4e, 0xbe, 0x3b }
};
BOOLEAN mPage1GSupport = FALSE;
UINT64 mAddressEncMask = 0;
BOOLEAN mPage1GSupport = FALSE;
UINT64 mAddressEncMask = 0;
/**
Entry function of Boot script exector. This function will be executed in
@@ -34,8 +34,8 @@ UINT64 mAddressEncMask = 0;
EFI_STATUS
EFIAPI
S3BootScriptExecutorEntryFunction (
IN ACPI_S3_CONTEXT *AcpiS3Context,
IN PEI_S3_RESUME_STATE *PeiS3ResumeState
IN ACPI_S3_CONTEXT *AcpiS3Context,
IN PEI_S3_RESUME_STATE *PeiS3ResumeState
)
{
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
@@ -82,7 +82,7 @@ S3BootScriptExecutorEntryFunction (
//
// Get ACPI Table Address
//
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable));
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)((UINTN)(AcpiS3Context->AcpiFacsTable));
//
// We need turn back to S3Resume - install boot script done ppi and report status code on S3resume.
@@ -102,13 +102,14 @@ S3BootScriptExecutorEntryFunction (
if ((Facs != NULL) &&
(Facs->Signature == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) &&
(Facs->FirmwareWakingVector != 0) ) {
(Facs->FirmwareWakingVector != 0))
{
//
// more step needed - because relative address is handled differently between X64 and IA32.
//
AsmTransferControl16Address = (UINTN)AsmTransferControl16;
AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
AsmFixAddress16 = (UINT32)AsmTransferControl16Address;
AsmJmpAddr32 = (UINT32)((Facs->FirmwareWakingVector & 0xF) | ((Facs->FirmwareWakingVector & 0xFFFF0) << 12));
}
AsmDisablePaging64 (
@@ -136,7 +137,7 @@ S3BootScriptExecutorEntryFunction (
//
// Never run to here
//
CpuDeadLoop();
CpuDeadLoop ();
return EFI_UNSUPPORTED;
}
@@ -147,10 +148,11 @@ S3BootScriptExecutorEntryFunction (
//
// Switch to native waking vector
//
TempStackTop = (UINTN)&TempStack + sizeof(TempStack);
TempStackTop = (UINTN)&TempStack + sizeof (TempStack);
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0) &&
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) {
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0))
{
//
// X64 long mode waking vector
//
@@ -164,7 +166,7 @@ S3BootScriptExecutorEntryFunction (
);
} else {
// Unsupported for 32bit DXE, 64bit OS vector
DEBUG (( DEBUG_ERROR, "Unsupported for 32bit DXE transfer to 64bit OS waking vector!\r\n"));
DEBUG ((DEBUG_ERROR, "Unsupported for 32bit DXE transfer to 64bit OS waking vector!\r\n"));
ASSERT (FALSE);
}
} else {
@@ -200,7 +202,7 @@ S3BootScriptExecutorEntryFunction (
//
// Never run to here
//
CpuDeadLoop();
CpuDeadLoop ();
return EFI_UNSUPPORTED;
}
@@ -215,28 +217,27 @@ S3BootScriptExecutorEntryFunction (
**/
VOID
RegisterMemoryProfileImage (
IN EFI_GUID *FileName,
IN PHYSICAL_ADDRESS ImageBase,
IN UINT64 ImageSize,
IN EFI_FV_FILETYPE FileType
IN EFI_GUID *FileName,
IN PHYSICAL_ADDRESS ImageBase,
IN UINT64 ImageSize,
IN EFI_FV_FILETYPE FileType
)
{
EFI_STATUS Status;
EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FilePath;
UINT8 TempBuffer[sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + sizeof (EFI_DEVICE_PATH_PROTOCOL)];
EFI_STATUS Status;
EDKII_MEMORY_PROFILE_PROTOCOL *ProfileProtocol;
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FilePath;
UINT8 TempBuffer[sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + sizeof (EFI_DEVICE_PATH_PROTOCOL)];
if ((PcdGet8 (PcdMemoryProfilePropertyMask) & BIT0) != 0) {
FilePath = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)TempBuffer;
Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **) &ProfileProtocol);
Status = gBS->LocateProtocol (&gEdkiiMemoryProfileGuid, NULL, (VOID **)&ProfileProtocol);
if (!EFI_ERROR (Status)) {
EfiInitializeFwVolDevicepathNode (FilePath, FileName);
SetDevicePathEndNode (FilePath + 1);
Status = ProfileProtocol->RegisterImage (
ProfileProtocol,
(EFI_DEVICE_PATH_PROTOCOL *) FilePath,
(EFI_DEVICE_PATH_PROTOCOL *)FilePath,
ImageBase,
ImageSize,
FileType
@@ -259,15 +260,15 @@ ReadyToLockEventNotify (
IN VOID *Context
)
{
EFI_STATUS Status;
VOID *Interface;
UINT8 *Buffer;
UINTN BufferSize;
EFI_HANDLE NewImageHandle;
UINTN Pages;
EFI_PHYSICAL_ADDRESS FfsBuffer;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
EFI_STATUS Status;
VOID *Interface;
UINT8 *Buffer;
UINTN BufferSize;
EFI_HANDLE NewImageHandle;
UINTN Pages;
EFI_PHYSICAL_ADDRESS FfsBuffer;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc;
Status = gBS->LocateProtocol (&gEfiDxeSmmReadyToLockProtocolGuid, NULL, &Interface);
if (EFI_ERROR (Status)) {
@@ -278,22 +279,22 @@ ReadyToLockEventNotify (
// A workaround: Here we install a dummy handle
//
NewImageHandle = NULL;
Status = gBS->InstallProtocolInterface (
&NewImageHandle,
&gEfiCallerIdGuid,
EFI_NATIVE_INTERFACE,
NULL
);
Status = gBS->InstallProtocolInterface (
&NewImageHandle,
&gEfiCallerIdGuid,
EFI_NATIVE_INTERFACE,
NULL
);
ASSERT_EFI_ERROR (Status);
//
// Reload BootScriptExecutor image itself to RESERVED mem
//
Status = GetSectionFromAnyFv (
Status = GetSectionFromAnyFv (
&gEfiCallerIdGuid,
EFI_SECTION_PE32,
0,
(VOID **) &Buffer,
(VOID **)&Buffer,
&BufferSize
);
ASSERT_EFI_ERROR (Status);
@@ -305,24 +306,25 @@ ReadyToLockEventNotify (
Status = PeCoffLoaderGetImageInfo (&ImageContext);
ASSERT_EFI_ERROR (Status);
if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
Pages = EFI_SIZE_TO_PAGES ((UINTN) (ImageContext.ImageSize + ImageContext.SectionAlignment));
Pages = EFI_SIZE_TO_PAGES ((UINTN)(ImageContext.ImageSize + ImageContext.SectionAlignment));
} else {
Pages = EFI_SIZE_TO_PAGES ((UINTN) ImageContext.ImageSize);
Pages = EFI_SIZE_TO_PAGES ((UINTN)ImageContext.ImageSize);
}
FfsBuffer = 0xFFFFFFFF;
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&FfsBuffer
);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&FfsBuffer
);
ASSERT_EFI_ERROR (Status);
//
// Make sure that the buffer can be used to store code.
//
Status = gDS->GetMemorySpaceDescriptor (FfsBuffer, &MemDesc);
if (!EFI_ERROR (Status) && (MemDesc.Attributes & EFI_MEMORY_XP) != 0) {
if (!EFI_ERROR (Status) && ((MemDesc.Attributes & EFI_MEMORY_XP) != 0)) {
gDS->SetMemorySpaceAttributes (
FfsBuffer,
EFI_PAGES_TO_SIZE (Pages),
@@ -365,7 +367,7 @@ ReadyToLockEventNotify (
EFI_FV_FILETYPE_DRIVER
);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) (NewImageHandle, gST);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint))(NewImageHandle, gST);
ASSERT_EFI_ERROR (Status);
//
@@ -398,20 +400,20 @@ ReadyToLockEventNotify (
EFI_STATUS
EFIAPI
BootScriptExecutorEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
UINTN BufferSize;
UINTN Pages;
BOOT_SCRIPT_EXECUTOR_VARIABLE *EfiBootScriptExecutorVariable;
EFI_PHYSICAL_ADDRESS BootScriptExecutorBuffer;
EFI_STATUS Status;
VOID *DevicePath;
EFI_EVENT ReadyToLockEvent;
VOID *Registration;
UINT32 RegEax;
UINT32 RegEdx;
UINTN BufferSize;
UINTN Pages;
BOOT_SCRIPT_EXECUTOR_VARIABLE *EfiBootScriptExecutorVariable;
EFI_PHYSICAL_ADDRESS BootScriptExecutorBuffer;
EFI_STATUS Status;
VOID *DevicePath;
EFI_EVENT ReadyToLockEvent;
VOID *Registration;
UINT32 RegEax;
UINT32 RegEdx;
if (!PcdGetBool (PcdAcpiS3Enable)) {
return EFI_UNSUPPORTED;
@@ -429,68 +431,68 @@ BootScriptExecutorEntryPoint (
//
Status = gBS->LocateProtocol (&gEfiCallerIdGuid, NULL, &DevicePath);
if (EFI_ERROR (Status)) {
//
// Create ReadyToLock event to reload BootScriptExecutor image
// to RESERVED mem and save it to LockBox.
//
ReadyToLockEvent = EfiCreateProtocolNotifyEvent (
&gEfiDxeSmmReadyToLockProtocolGuid,
TPL_NOTIFY,
ReadyToLockEventNotify,
NULL,
&Registration
);
ASSERT (ReadyToLockEvent != NULL);
} else {
//
// the entry point is invoked after reloading. following code only run in RESERVED mem
//
if (PcdGetBool(PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
if ((RegEdx & BIT26) != 0) {
mPage1GSupport = TRUE;
}
//
// Create ReadyToLock event to reload BootScriptExecutor image
// to RESERVED mem and save it to LockBox.
//
ReadyToLockEvent = EfiCreateProtocolNotifyEvent (
&gEfiDxeSmmReadyToLockProtocolGuid,
TPL_NOTIFY,
ReadyToLockEventNotify,
NULL,
&Registration
);
ASSERT (ReadyToLockEvent != NULL);
} else {
//
// the entry point is invoked after reloading. following code only run in RESERVED mem
//
if (PcdGetBool (PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
if ((RegEdx & BIT26) != 0) {
mPage1GSupport = TRUE;
}
}
BufferSize = sizeof (BOOT_SCRIPT_EXECUTOR_VARIABLE);
BootScriptExecutorBuffer = 0xFFFFFFFF;
Pages = EFI_SIZE_TO_PAGES(BufferSize);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&BootScriptExecutorBuffer
);
ASSERT_EFI_ERROR (Status);
EfiBootScriptExecutorVariable = (BOOT_SCRIPT_EXECUTOR_VARIABLE *)(UINTN)BootScriptExecutorBuffer;
EfiBootScriptExecutorVariable->BootScriptExecutorEntrypoint = (UINTN) S3BootScriptExecutorEntryFunction ;
Status = SaveLockBox (
&gEfiBootScriptExecutorVariableGuid,
&BootScriptExecutorBuffer,
sizeof(BootScriptExecutorBuffer)
);
ASSERT_EFI_ERROR (Status);
//
// Additional step for BootScript integrity
// Save BootScriptExecutor context
//
Status = SaveLockBox (
&gEfiBootScriptExecutorContextGuid,
EfiBootScriptExecutorVariable,
sizeof(*EfiBootScriptExecutorVariable)
);
ASSERT_EFI_ERROR (Status);
Status = SetLockBoxAttributes (&gEfiBootScriptExecutorContextGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
BufferSize = sizeof (BOOT_SCRIPT_EXECUTOR_VARIABLE);
BootScriptExecutorBuffer = 0xFFFFFFFF;
Pages = EFI_SIZE_TO_PAGES (BufferSize);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&BootScriptExecutorBuffer
);
ASSERT_EFI_ERROR (Status);
EfiBootScriptExecutorVariable = (BOOT_SCRIPT_EXECUTOR_VARIABLE *)(UINTN)BootScriptExecutorBuffer;
EfiBootScriptExecutorVariable->BootScriptExecutorEntrypoint = (UINTN)S3BootScriptExecutorEntryFunction;
Status = SaveLockBox (
&gEfiBootScriptExecutorVariableGuid,
&BootScriptExecutorBuffer,
sizeof (BootScriptExecutorBuffer)
);
ASSERT_EFI_ERROR (Status);
//
// Additional step for BootScript integrity
// Save BootScriptExecutor context
//
Status = SaveLockBox (
&gEfiBootScriptExecutorContextGuid,
EfiBootScriptExecutorVariable,
sizeof (*EfiBootScriptExecutorVariable)
);
ASSERT_EFI_ERROR (Status);
Status = SetLockBoxAttributes (&gEfiBootScriptExecutorContextGuid, LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE);
ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
}

View File

@@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _BOOT_SCRIPT_EXECUTOR_H_
#define _BOOT_SCRIPT_EXECUTOR_H_
@@ -51,9 +52,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
AsmTransferControl (
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
);
/**
a 32bit ASM function to transfer control to OS.
@@ -62,9 +64,10 @@ AsmTransferControl (
**/
VOID
AsmTransferControl32 (
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
IN UINT32 S3WakingVector,
IN UINT32 AcpiLowMemoryBase
);
/**
a 16bit ASM function to transfer control to OS.
**/
@@ -72,6 +75,7 @@ VOID
AsmTransferControl16 (
VOID
);
/**
Set a IDT entry for interrupt vector 3 for debug purpose.
@@ -80,12 +84,12 @@ AsmTransferControl16 (
**/
VOID
SetIdtEntry (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
);
extern UINT32 AsmFixAddress16;
extern UINT32 AsmJmpAddr32;
extern BOOLEAN mPage1GSupport;
extern UINT64 mAddressEncMask;
extern UINT32 AsmFixAddress16;
extern UINT32 AsmJmpAddr32;
extern BOOLEAN mPage1GSupport;
extern UINT64 mAddressEncMask;
#endif //_BOOT_SCRIPT_EXECUTOR_H_

View File

@@ -15,20 +15,20 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8 extra pages for PF handler.
//
#define EXTRA_PAGE_TABLE_PAGES 8
#define EXTRA_PAGE_TABLE_PAGES 8
#define IA32_PG_P BIT0
#define IA32_PG_RW BIT1
#define IA32_PG_PS BIT7
#define IA32_PG_P BIT0
#define IA32_PG_RW BIT1
#define IA32_PG_PS BIT7
UINT64 mPhyMask;
VOID *mOriginalHandler;
UINTN mPageFaultBuffer;
UINTN mPageFaultIndex = 0;
UINT64 mPhyMask;
VOID *mOriginalHandler;
UINTN mPageFaultBuffer;
UINTN mPageFaultIndex = 0;
//
// Store the uplink information for each page being used.
//
UINT64 *mPageFaultUplink[EXTRA_PAGE_TABLE_PAGES];
UINT64 *mPageFaultUplink[EXTRA_PAGE_TABLE_PAGES];
/**
Page fault handler.
@@ -48,41 +48,43 @@ PageFaultHandlerHook (
**/
VOID
HookPageFaultHandler (
IN IA32_IDT_GATE_DESCRIPTOR *IdtEntry
IN IA32_IDT_GATE_DESCRIPTOR *IdtEntry
)
{
UINT32 RegEax;
UINT8 PhysicalAddressBits;
UINTN PageFaultHandlerHookAddress;
UINT32 RegEax;
UINT8 PhysicalAddressBits;
UINTN PageFaultHandlerHookAddress;
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
PhysicalAddressBits = (UINT8) RegEax;
PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
mPhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
mPhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
mPhyMask &= (1ull << 48) - SIZE_4KB;
//
// Set Page Fault entry to catch >4G access
//
PageFaultHandlerHookAddress = (UINTN)PageFaultHandlerHook;
mOriginalHandler = (VOID *)(UINTN)(LShiftU64 (IdtEntry->Bits.OffsetUpper, 32) + IdtEntry->Bits.OffsetLow + (IdtEntry->Bits.OffsetHigh << 16));
IdtEntry->Bits.OffsetLow = (UINT16)PageFaultHandlerHookAddress;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(PageFaultHandlerHookAddress >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(PageFaultHandlerHookAddress >> 32);
IdtEntry->Bits.Reserved_1 = 0;
mOriginalHandler = (VOID *)(UINTN)(LShiftU64 (IdtEntry->Bits.OffsetUpper, 32) + IdtEntry->Bits.OffsetLow + (IdtEntry->Bits.OffsetHigh << 16));
IdtEntry->Bits.OffsetLow = (UINT16)PageFaultHandlerHookAddress;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(PageFaultHandlerHookAddress >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(PageFaultHandlerHookAddress >> 32);
IdtEntry->Bits.Reserved_1 = 0;
if (mPage1GSupport) {
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE(2);
}else {
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE(6);
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE (2);
} else {
mPageFaultBuffer = (UINTN)(AsmReadCr3 () & mPhyMask) + EFI_PAGES_TO_SIZE (6);
}
ZeroMem (mPageFaultUplink, sizeof (mPageFaultUplink));
}
@@ -96,28 +98,32 @@ HookPageFaultHandler (
**/
BOOLEAN
IsLongModeWakingVector (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
)
{
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) ((UINTN) (AcpiS3Context->AcpiFacsTable));
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)((UINTN)(AcpiS3Context->AcpiFacsTable));
if ((Facs == NULL) ||
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||
((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 0)) ) {
((Facs->FirmwareWakingVector == 0) && (Facs->XFirmwareWakingVector == 0)))
{
// Something wrong with FACS
return FALSE;
}
if (Facs->XFirmwareWakingVector != 0) {
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0) &&
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0)) {
((Facs->OspmFlags & EFI_ACPI_4_0_OSPM_64BIT_WAKE__F) != 0))
{
// Both BIOS and OS wants 64bit vector
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
return TRUE;
}
}
}
return FALSE;
}
@@ -129,18 +135,18 @@ IsLongModeWakingVector (
**/
VOID
SetIdtEntry (
IN ACPI_S3_CONTEXT *AcpiS3Context
IN ACPI_S3_CONTEXT *AcpiS3Context
)
{
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
IA32_DESCRIPTOR *IdtDescriptor;
UINTN S3DebugBuffer;
EFI_STATUS Status;
//
// Restore IDT for debug
//
IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);
IdtDescriptor = (IA32_DESCRIPTOR *)(UINTN)(AcpiS3Context->IdtrProfile);
AsmWriteIdtr (IdtDescriptor);
//
@@ -150,20 +156,21 @@ SetIdtEntry (
ASSERT_EFI_ERROR (Status);
DEBUG_CODE_BEGIN ();
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN) -1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(S3DebugBuffer >> 32);
IdtEntry->Bits.Reserved_1 = 0;
}
//
// Update IDT entry INT3 if the instruction is valid in it
//
S3DebugBuffer = (UINTN)(AcpiS3Context->S3DebugBufferAddress);
if (*(UINTN *)S3DebugBuffer != (UINTN)-1) {
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry->Bits.OffsetLow = (UINT16)S3DebugBuffer;
IdtEntry->Bits.Selector = (UINT16)AsmReadCs ();
IdtEntry->Bits.Reserved_0 = 0;
IdtEntry->Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
IdtEntry->Bits.OffsetHigh = (UINT16)(S3DebugBuffer >> 16);
IdtEntry->Bits.OffsetUpper = (UINT32)(S3DebugBuffer >> 32);
IdtEntry->Bits.Reserved_1 = 0;
}
DEBUG_CODE_END ();
//
@@ -185,26 +192,27 @@ SetIdtEntry (
**/
VOID
AcquirePage (
IN OUT UINT64 *Uplink
IN OUT UINT64 *Uplink
)
{
UINTN Address;
UINTN Address;
Address = mPageFaultBuffer + EFI_PAGES_TO_SIZE (mPageFaultIndex);
ZeroMem ((VOID *) Address, EFI_PAGES_TO_SIZE (1));
ZeroMem ((VOID *)Address, EFI_PAGES_TO_SIZE (1));
//
// Cut the previous uplink if it exists and wasn't overwritten.
//
if ((mPageFaultUplink[mPageFaultIndex] != NULL) &&
((*mPageFaultUplink[mPageFaultIndex] & ~mAddressEncMask & mPhyMask) == Address)) {
((*mPageFaultUplink[mPageFaultIndex] & ~mAddressEncMask & mPhyMask) == Address))
{
*mPageFaultUplink[mPageFaultIndex] = 0;
}
//
// Link & Record the current uplink.
//
*Uplink = Address | mAddressEncMask | IA32_PG_P | IA32_PG_RW;
*Uplink = Address | mAddressEncMask | IA32_PG_P | IA32_PG_RW;
mPageFaultUplink[mPageFaultIndex] = Uplink;
mPageFaultIndex = (mPageFaultIndex + 1) % EXTRA_PAGE_TABLE_PAGES;
@@ -223,9 +231,9 @@ PageFaultHandler (
VOID
)
{
UINT64 *PageTable;
UINT64 PFAddress;
UINTN PTIndex;
UINT64 *PageTable;
UINT64 PFAddress;
UINTN PTIndex;
PFAddress = AsmReadCr2 ();
DEBUG ((DEBUG_INFO, "BootScript - PageFaultHandler: Cr2 - %lx\n", PFAddress));
@@ -233,17 +241,19 @@ PageFaultHandler (
if (PFAddress >= mPhyMask + SIZE_4KB) {
return FALSE;
}
PFAddress &= mPhyMask;
PageTable = (UINT64*)(UINTN)(AsmReadCr3 () & mPhyMask);
PageTable = (UINT64 *)(UINTN)(AsmReadCr3 () & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 39, 47);
// PML4E
if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
AcquirePage (&PageTable[PTIndex]);
}
PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 30, 38);
PageTable = (UINT64 *)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 30, 38);
// PDPTE
if (mPage1GSupport) {
PageTable[PTIndex] = ((PFAddress | mAddressEncMask) & ~((1ull << 30) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
@@ -251,8 +261,9 @@ PageFaultHandler (
if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
AcquirePage (&PageTable[PTIndex]);
}
PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 21, 29);
PageTable = (UINT64 *)(UINTN)(PageTable[PTIndex] & ~mAddressEncMask & mPhyMask);
PTIndex = BitFieldRead64 (PFAddress, 21, 29);
// PD
PageTable[PTIndex] = ((PFAddress | mAddressEncMask) & ~((1ull << 21) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
}

View File

@@ -36,31 +36,31 @@
#include <Library/VariablePolicyHelperLib.h>
#include <Library/PerformanceLib.h>
#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
EFI_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
BOOLEAN mLockBoxReady = FALSE;
EFI_EVENT mReadyToBootEvent;
EFI_EVENT mLegacyBootEvent;
static EFI_EVENT mExitBootServicesEvent;
UINTN mFirmwarePerformanceTableTemplateKey = 0;
BOOLEAN mDxeCoreReportStatusCodeEnable = FALSE;
BOOLEAN mLockBoxReady = FALSE;
EFI_EVENT mReadyToBootEvent;
EFI_EVENT mLegacyBootEvent;
static EFI_EVENT mExitBootServicesEvent;
UINTN mFirmwarePerformanceTableTemplateKey = 0;
BOOLEAN mDxeCoreReportStatusCodeEnable = FALSE;
BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;
BOOT_PERFORMANCE_TABLE *mReceivedAcpiBootPerformanceTable = NULL;
S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;
BOOT_PERFORMANCE_TABLE *mAcpiBootPerformanceTable = NULL;
BOOT_PERFORMANCE_TABLE *mReceivedAcpiBootPerformanceTable = NULL;
S3_PERFORMANCE_TABLE *mAcpiS3PerformanceTable = NULL;
FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {
{
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_SIGNATURE,
sizeof (FIRMWARE_PERFORMANCE_TABLE),
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
EFI_ACPI_5_0_FIRMWARE_PERFORMANCE_DATA_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
//
// It is expected that these values will be updated at EntryPoint.
//
{0x00}, // OEM ID is a 6 bytes long field
{ 0x00 }, // OEM ID is a 6 bytes long field
0x00, // OEM Table ID(8 bytes long)
0x00, // OEM Revision
0x00, // Creator ID
@@ -71,7 +71,7 @@ FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {
//
{
{
EFI_ACPI_5_0_FPDT_RECORD_TYPE_FIRMWARE_BASIC_BOOT_POINTER , // Type
EFI_ACPI_5_0_FPDT_RECORD_TYPE_FIRMWARE_BASIC_BOOT_POINTER, // Type
sizeof (EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_POINTER_RECORD), // Length
EFI_ACPI_5_0_FPDT_RECORD_REVISION_FIRMWARE_BASIC_BOOT_POINTER // Revision
},
@@ -92,7 +92,7 @@ FIRMWARE_PERFORMANCE_TABLE mFirmwarePerformanceTableTemplate = {
}
};
BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {
BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {
{
EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE,
sizeof (BOOT_PERFORMANCE_TABLE)
@@ -115,7 +115,7 @@ BOOT_PERFORMANCE_TABLE mBootPerformanceTableTemplate = {
}
};
S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {
S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {
{
EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE,
sizeof (S3_PERFORMANCE_TABLE)
@@ -156,11 +156,11 @@ S3_PERFORMANCE_TABLE mS3PerformanceTableTemplate = {
**/
VOID
FpdtAcpiTableChecksum (
IN UINT8 *Buffer,
IN UINTN Size
IN UINT8 *Buffer,
IN UINTN Size
)
{
UINTN ChecksumOffset;
UINTN ChecksumOffset;
ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
@@ -185,15 +185,15 @@ FpdtAcpiTableChecksum (
VOID
EFIAPI
FpdtAllocateS3PerformanceTableMemory (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
VOID *Interface;
FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
UINTN Size;
EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer;
EFI_STATUS Status;
VOID *Interface;
FIRMWARE_PERFORMANCE_VARIABLE PerformanceVariable;
UINTN Size;
EFI_PHYSICAL_ADDRESS S3PerformanceTablePointer;
if (mLockBoxReady && (mAcpiS3PerformanceTable != NULL)) {
//
@@ -220,7 +220,7 @@ FpdtAllocateS3PerformanceTableMemory (
// Try to allocate the same runtime buffer as last time boot.
//
ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
Size = sizeof (PerformanceVariable);
Size = sizeof (PerformanceVariable);
Status = gRT->GetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
@@ -236,18 +236,20 @@ FpdtAllocateS3PerformanceTableMemory (
&PerformanceVariable.S3PerformanceTablePointer
);
if (!EFI_ERROR (Status)) {
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.S3PerformanceTablePointer;
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *)(UINTN)PerformanceVariable.S3PerformanceTablePointer;
}
}
if (mAcpiS3PerformanceTable == NULL) {
//
// Fail to allocate at specified address, continue to allocate at any address.
//
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE))
);
mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *)AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE))
);
}
DEBUG ((DEBUG_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable));
if (mAcpiS3PerformanceTable != NULL) {
CopyMem (mAcpiS3PerformanceTable, &mS3PerformanceTableTemplate, sizeof (mS3PerformanceTableTemplate));
@@ -260,12 +262,12 @@ FpdtAllocateS3PerformanceTableMemory (
// If LockBox services has been ready and memory for FPDT S3 performance table has been allocated,
// save the pointer to LockBox for use in S3 resume.
//
S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
Status = SaveLockBox (
&gFirmwarePerformanceS3PointerGuid,
&S3PerformanceTablePointer,
sizeof (EFI_PHYSICAL_ADDRESS)
);
S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS)(UINTN)mAcpiS3PerformanceTable;
Status = SaveLockBox (
&gFirmwarePerformanceS3PointerGuid,
&S3PerformanceTablePointer,
sizeof (EFI_PHYSICAL_ADDRESS)
);
ASSERT_EFI_ERROR (Status);
}
}
@@ -291,7 +293,7 @@ InstallFirmwarePerformanceDataTable (
//
// Get AcpiTable Protocol.
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -299,13 +301,13 @@ InstallFirmwarePerformanceDataTable (
//
// Get VariablePolicy Protocol.
//
Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicyProtocol);
Status = gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicyProtocol);
if (EFI_ERROR (Status)) {
return Status;
}
if (mReceivedAcpiBootPerformanceTable != NULL) {
mAcpiBootPerformanceTable = mReceivedAcpiBootPerformanceTable;
mAcpiBootPerformanceTable = mReceivedAcpiBootPerformanceTable;
mAcpiBootPerformanceTable->BasicBoot.ResetEnd = mBootPerformanceTableTemplate.BasicBoot.ResetEnd;
} else {
//
@@ -313,7 +315,7 @@ InstallFirmwarePerformanceDataTable (
//
BootPerformanceDataSize = sizeof (BOOT_PERFORMANCE_TABLE);
ZeroMem (&PerformanceVariable, sizeof (PerformanceVariable));
Size = sizeof (PerformanceVariable);
Size = sizeof (PerformanceVariable);
Status = gRT->GetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
@@ -329,57 +331,61 @@ InstallFirmwarePerformanceDataTable (
&PerformanceVariable.BootPerformanceTablePointer
);
if (!EFI_ERROR (Status)) {
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) (UINTN) PerformanceVariable.BootPerformanceTablePointer;
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *)(UINTN)PerformanceVariable.BootPerformanceTablePointer;
}
}
if (mAcpiBootPerformanceTable == NULL) {
//
// Fail to allocate at specified address, continue to allocate at any address.
//
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (BootPerformanceDataSize)
);
mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *)AllocatePeiAccessiblePages (
EfiReservedMemoryType,
EFI_SIZE_TO_PAGES (BootPerformanceDataSize)
);
}
DEBUG ((DEBUG_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable));
if (mAcpiBootPerformanceTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Fill Basic Boot record to Boot Performance Table.
//
CopyMem (mAcpiBootPerformanceTable, &mBootPerformanceTableTemplate, sizeof (mBootPerformanceTableTemplate));
}
BootPerformanceDataSize = mAcpiBootPerformanceTable->Header.Length;
BootPerformanceDataSize = mAcpiBootPerformanceTable->Header.Length;
//
// Save Boot Performance Table address to Variable for use in S4 resume.
//
PerformanceVariable.BootPerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiBootPerformanceTable;
PerformanceVariable.BootPerformanceTablePointer = (EFI_PHYSICAL_ADDRESS)(UINTN)mAcpiBootPerformanceTable;
//
// Update Boot Performance Table Pointer in template.
//
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64) (UINTN) mAcpiBootPerformanceTable;
mFirmwarePerformanceTableTemplate.BootPointerRecord.BootPerformanceTablePointer = (UINT64)(UINTN)mAcpiBootPerformanceTable;
//
// Save S3 Performance Table address to Variable for use in S4 resume.
//
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS) (UINTN) mAcpiS3PerformanceTable;
PerformanceVariable.S3PerformanceTablePointer = (EFI_PHYSICAL_ADDRESS)(UINTN)mAcpiS3PerformanceTable;
//
// Update S3 Performance Table Pointer in template.
//
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64) (UINTN) mAcpiS3PerformanceTable;
mFirmwarePerformanceTableTemplate.S3PointerRecord.S3PerformanceTablePointer = (UINT64)(UINTN)mAcpiS3PerformanceTable;
//
// Save Runtime Performance Table pointers to Variable.
// Don't check SetVariable return status. It doesn't impact FPDT table generation.
//
gRT->SetVariable (
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PerformanceVariable),
&PerformanceVariable
);
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (PerformanceVariable),
&PerformanceVariable
);
//
// Lock the variable which stores the Performance Table pointers.
@@ -394,15 +400,15 @@ InstallFirmwarePerformanceDataTable (
VARIABLE_POLICY_NO_CANT_ATTR,
VARIABLE_POLICY_TYPE_LOCK_NOW
);
if (EFI_ERROR(Status)) {
DEBUG((DEBUG_ERROR, "[FirmwarePerformanceDxe] Error when lock variable %s, Status = %r\n", EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, Status));
ASSERT_EFI_ERROR(Status);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "[FirmwarePerformanceDxe] Error when lock variable %s, Status = %r\n", EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME, Status));
ASSERT_EFI_ERROR (Status);
}
//
// Publish Firmware Performance Data Table.
//
FpdtAcpiTableChecksum ((UINT8 *) &mFirmwarePerformanceTableTemplate, mFirmwarePerformanceTableTemplate.Header.Length);
FpdtAcpiTableChecksum ((UINT8 *)&mFirmwarePerformanceTableTemplate, mFirmwarePerformanceTableTemplate.Header.Length);
Status = AcpiTableProtocol->InstallAcpiTable (
AcpiTableProtocol,
&mFirmwarePerformanceTableTemplate,
@@ -413,13 +419,16 @@ InstallFirmwarePerformanceDataTable (
if (mAcpiBootPerformanceTable != NULL) {
FreePages (mAcpiBootPerformanceTable, EFI_SIZE_TO_PAGES (BootPerformanceDataSize));
}
if (mAcpiS3PerformanceTable != NULL) {
FreePages (mAcpiS3PerformanceTable, EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)));
}
mAcpiBootPerformanceTable = NULL;
mAcpiS3PerformanceTable = NULL;
mAcpiS3PerformanceTable = NULL;
return Status;
}
return EFI_SUCCESS;
}
@@ -445,11 +454,11 @@ InstallFirmwarePerformanceDataTable (
EFI_STATUS
EFIAPI
FpdtStatusCodeListenerDxe (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
)
{
EFI_STATUS Status;
@@ -531,13 +540,13 @@ FpdtStatusCodeListenerDxe (
DEBUG ((DEBUG_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = %ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
DEBUG ((DEBUG_INFO, "FPDT: Boot Performance - ExitBootServicesEntry = 0\n"));
DEBUG ((DEBUG_INFO, "FPDT: Boot Performance - ExitBootServicesExit = 0\n"));
} else if (Data != NULL && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmwarePerformanceGuid)) {
} else if ((Data != NULL) && CompareGuid (&Data->Type, &gEdkiiFpdtExtendedFirmwarePerformanceGuid)) {
//
// Get the Boot performance table and then install it to ACPI table.
//
CopyMem (&mReceivedAcpiBootPerformanceTable, Data + 1, Data->Size);
InstallFirmwarePerformanceDataTable ();
} else if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
} else if ((Data != NULL) && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerDxe: Performance data reported through gEfiFirmwarePerformanceGuid will not be collected by FirmwarePerformanceDataTableDxe\n"));
Status = EFI_UNSUPPORTED;
} else {
@@ -562,17 +571,18 @@ FpdtStatusCodeListenerDxe (
VOID
EFIAPI
FpdtEndOfDxeEventNotify (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
//
// When performance is enabled, the FPDT will be installed when DxeCorePerformanceLib report the data to FimwarePerformanceDxe.
// This is used to install the FPDT for the basic boot recods when performance infrastructure is not enabled.
//
if ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0) {
if ((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0) {
return;
}
ASSERT (mReceivedAcpiBootPerformanceTable == NULL);
InstallFirmwarePerformanceDataTable ();
}
@@ -588,8 +598,8 @@ FpdtEndOfDxeEventNotify (
VOID
EFIAPI
FpdtExitBootServicesEventNotify (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
if (!mDxeCoreReportStatusCodeEnable) {
@@ -604,7 +614,7 @@ FpdtExitBootServicesEventNotify (
//
// Firmware Performance Data Table not installed, do nothing.
//
return ;
return;
}
//
@@ -637,16 +647,16 @@ FpdtExitBootServicesEventNotify (
EFI_STATUS
EFIAPI
FirmwarePerformanceDxeEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HOB_GUID_TYPE *GuidHob;
FIRMWARE_SEC_PERFORMANCE *Performance;
VOID *Registration;
UINT64 OemTableId;
EFI_EVENT EndOfDxeEvent;
EFI_STATUS Status;
EFI_HOB_GUID_TYPE *GuidHob;
FIRMWARE_SEC_PERFORMANCE *Performance;
VOID *Registration;
UINT64 OemTableId;
EFI_EVENT EndOfDxeEvent;
CopyMem (
mFirmwarePerformanceTableTemplate.Header.OemId,
@@ -655,14 +665,14 @@ FirmwarePerformanceDxeEntryPoint (
);
OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
CopyMem (&mFirmwarePerformanceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
mFirmwarePerformanceTableTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
mFirmwarePerformanceTableTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
mFirmwarePerformanceTableTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
mFirmwarePerformanceTableTemplate.Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
mFirmwarePerformanceTableTemplate.Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
mFirmwarePerformanceTableTemplate.Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
//
// Get Report Status Code Handler Protocol.
//
Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID **) &mRscHandlerProtocol);
Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid, NULL, (VOID **)&mRscHandlerProtocol);
ASSERT_EFI_ERROR (Status);
//
@@ -702,7 +712,7 @@ FirmwarePerformanceDxeEntryPoint (
//
GuidHob = GetFirstGuidHob (&gEfiFirmwarePerformanceGuid);
if (GuidHob != NULL) {
Performance = (FIRMWARE_SEC_PERFORMANCE *) GET_GUID_HOB_DATA (GuidHob);
Performance = (FIRMWARE_SEC_PERFORMANCE *)GET_GUID_HOB_DATA (GuidHob);
mBootPerformanceTableTemplate.BasicBoot.ResetEnd = Performance->ResetEnd;
} else {
//

View File

@@ -51,12 +51,12 @@
EFI_STATUS
EFIAPI
FpdtStatusCodeListenerPei (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data
)
{
EFI_STATUS Status;
@@ -80,7 +80,8 @@ FpdtStatusCodeListenerPei (
// Check whether status code is what we are interested in.
//
if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) != EFI_PROGRESS_CODE) ||
(Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE))) {
(Value != (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_PC_OS_WAKE)))
{
return EFI_UNSUPPORTED;
}
@@ -93,17 +94,18 @@ FpdtStatusCodeListenerPei (
// Update S3 Resume Performance Record.
//
S3PerformanceTablePointer = 0;
VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
Status = RestoreLockBox (&gFirmwarePerformanceS3PointerGuid, &S3PerformanceTablePointer, &VarSize);
VarSize = sizeof (EFI_PHYSICAL_ADDRESS);
Status = RestoreLockBox (&gFirmwarePerformanceS3PointerGuid, &S3PerformanceTablePointer, &VarSize);
ASSERT_EFI_ERROR (Status);
AcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) (UINTN) S3PerformanceTablePointer;
AcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *)(UINTN)S3PerformanceTablePointer;
ASSERT (AcpiS3PerformanceTable != NULL);
if (AcpiS3PerformanceTable->Header.Signature != EFI_ACPI_5_0_FPDT_S3_PERFORMANCE_TABLE_SIGNATURE) {
DEBUG ((DEBUG_ERROR, "FPDT S3 performance data in ACPI memory get corrupted\n"));
return EFI_ABORTED;
}
AcpiS3ResumeRecord = &AcpiS3PerformanceTable->S3Resume;
AcpiS3ResumeRecord = &AcpiS3PerformanceTable->S3Resume;
AcpiS3ResumeRecord->FullResume = CurrentTime;
//
// Calculate average S3 resume time.
@@ -120,7 +122,7 @@ FpdtStatusCodeListenerPei (
// Update S3 Suspend Performance Record.
//
AcpiS3SuspendRecord = &AcpiS3PerformanceTable->S3Suspend;
VarSize = sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD);
VarSize = sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD);
ZeroMem (&S3SuspendRecord, sizeof (EFI_ACPI_5_0_FPDT_S3_SUSPEND_RECORD));
Status = RestoreLockBox (
&gEfiFirmwarePerformanceGuid,
@@ -139,7 +141,7 @@ FpdtStatusCodeListenerPei (
&gEfiPeiReadOnlyVariable2PpiGuid,
0,
NULL,
(VOID **) &VariableServices
(VOID **)&VariableServices
);
ASSERT_EFI_ERROR (Status);
@@ -147,27 +149,28 @@ FpdtStatusCodeListenerPei (
// Update S3 boot records into the basic boot performance table.
//
VarSize = sizeof (PerformanceVariable);
Status = VariableServices->GetVariable (
VariableServices,
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
NULL,
&VarSize,
&PerformanceVariable
);
Status = VariableServices->GetVariable (
VariableServices,
EFI_FIRMWARE_PERFORMANCE_VARIABLE_NAME,
&gEfiFirmwarePerformanceGuid,
NULL,
&VarSize,
&PerformanceVariable
);
if (EFI_ERROR (Status)) {
return Status;
}
BootPerformanceTable = (UINT8*) (UINTN) PerformanceVariable.BootPerformanceTablePointer;
BootPerformanceTable = (UINT8 *)(UINTN)PerformanceVariable.BootPerformanceTablePointer;
//
// Dump PEI boot records
//
FirmwarePerformanceTablePtr = (BootPerformanceTable + sizeof (BOOT_PERFORMANCE_TABLE));
GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
while (GuidHob != NULL) {
FirmwarePerformanceData = GET_GUID_HOB_DATA (GuidHob);
PeiPerformanceLogHeader = (FPDT_PEI_EXT_PERF_HEADER *) FirmwarePerformanceData;
PeiPerformanceLogHeader = (FPDT_PEI_EXT_PERF_HEADER *)FirmwarePerformanceData;
CopyMem (FirmwarePerformanceTablePtr, FirmwarePerformanceData + sizeof (FPDT_PEI_EXT_PERF_HEADER), (UINTN)(PeiPerformanceLogHeader->SizeOfAllEntries));
@@ -179,7 +182,7 @@ FpdtStatusCodeListenerPei (
//
// Update Table length.
//
((BOOT_PERFORMANCE_TABLE *) BootPerformanceTable)->Header.Length = (UINT32)((UINTN)FirmwarePerformanceTablePtr - (UINTN)BootPerformanceTable);
((BOOT_PERFORMANCE_TABLE *)BootPerformanceTable)->Header.Length = (UINT32)((UINTN)FirmwarePerformanceTablePtr - (UINTN)BootPerformanceTable);
return EFI_SUCCESS;
}
@@ -213,7 +216,7 @@ FirmwarePerformancePeiEntryPoint (
&gEfiPeiRscHandlerPpiGuid,
0,
NULL,
(VOID **) &RscHandler
(VOID **)&RscHandler
);
ASSERT_EFI_ERROR (Status);

View File

@@ -31,10 +31,9 @@
#include <Library/BaseMemoryLib.h>
#include "FirmwarePerformanceCommon.h"
EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
UINT64 mSuspendStartTime = 0;
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
EFI_MM_RSC_HANDLER_PROTOCOL *mRscHandlerProtocol = NULL;
UINT64 mSuspendStartTime = 0;
BOOLEAN mS3SuspendLockBoxSaved = FALSE;
/**
Report status code listener for MM. This is used to record the performance
@@ -58,11 +57,11 @@ BOOLEAN mS3SuspendLockBoxSaved = FALSE;
EFI_STATUS
EFIAPI
FpdtStatusCodeListenerMm (
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId,
IN EFI_STATUS_CODE_DATA *Data
)
{
EFI_STATUS Status;
@@ -76,13 +75,14 @@ FpdtStatusCodeListenerMm (
return EFI_UNSUPPORTED;
}
if (Data != NULL && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
if ((Data != NULL) && CompareGuid (&Data->Type, &gEfiFirmwarePerformanceGuid)) {
DEBUG ((DEBUG_ERROR, "FpdtStatusCodeListenerMm: Performance data reported through gEfiFirmwarePerformanceGuid will not be collected by FirmwarePerformanceDataTableMm\n"));
return EFI_UNSUPPORTED;
}
if ((Value != PcdGet32 (PcdProgressCodeS3SuspendStart)) &&
(Value != PcdGet32 (PcdProgressCodeS3SuspendEnd))) {
(Value != PcdGet32 (PcdProgressCodeS3SuspendEnd)))
{
return EFI_UNSUPPORTED;
}
@@ -142,7 +142,7 @@ FirmwarePerformanceCommonEntryPoint (
VOID
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Get MM Report Status Code Handler Protocol.
@@ -150,7 +150,7 @@ FirmwarePerformanceCommonEntryPoint (
Status = gMmst->MmLocateProtocol (
&gEfiMmRscHandlerProtocolGuid,
NULL,
(VOID **) &mRscHandlerProtocol
(VOID **)&mRscHandlerProtocol
);
ASSERT_EFI_ERROR (Status);

View File

@@ -34,8 +34,8 @@
EFI_STATUS
EFIAPI
FirmwarePerformanceStandaloneMmEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_MM_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_MM_SYSTEM_TABLE *SystemTable
)
{
return FirmwarePerformanceCommonEntryPoint ();

View File

@@ -34,8 +34,8 @@
EFI_STATUS
EFIAPI
FirmwarePerformanceSmmEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return FirmwarePerformanceCommonEntryPoint ();

View File

@@ -23,9 +23,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8 extra pages for PF handler.
//
#define EXTRA_PAGE_TABLE_PAGES 8
#define EXTRA_PAGE_TABLE_PAGES 8
EFI_GUID mAcpiS3IdtrProfileGuid = {
EFI_GUID mAcpiS3IdtrProfileGuid = {
0xdea652b0, 0xd587, 0x4c54, { 0xb5, 0xb4, 0xc6, 0x82, 0xe7, 0xa0, 0xaa, 0x3d }
};
@@ -40,29 +40,29 @@ EFI_GUID mAcpiS3IdtrProfileGuid = {
@return Allocated address for output.
**/
VOID*
VOID *
AllocateMemoryBelow4G (
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Size
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Size
)
{
UINTN Pages;
EFI_PHYSICAL_ADDRESS Address;
EFI_STATUS Status;
VOID* Buffer;
VOID *Buffer;
Pages = EFI_SIZE_TO_PAGES (Size);
Pages = EFI_SIZE_TO_PAGES (Size);
Address = 0xffffffff;
Status = gBS->AllocatePages (
AllocateMaxAddress,
MemoryType,
Pages,
&Address
);
Status = gBS->AllocatePages (
AllocateMaxAddress,
MemoryType,
Pages,
&Address
);
ASSERT_EFI_ERROR (Status);
Buffer = (VOID *) (UINTN) Address;
Buffer = (VOID *)(UINTN)Address;
ZeroMem (Buffer, Size);
return Buffer;
@@ -79,18 +79,21 @@ AllocateMemoryBelow4G (
**/
BOOLEAN
IsLongModeWakingVectorSupport (
IN EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs
IN EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs
)
{
if ((Facs == NULL) ||
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ) {
(Facs->Signature != EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE))
{
//
// Something wrong with FACS.
//
return FALSE;
}
if ((Facs->Version == EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0)) {
((Facs->Flags & EFI_ACPI_4_0_64BIT_WAKE_SUPPORTED_F) != 0))
{
//
// BIOS supports 64bit waking vector.
//
@@ -98,6 +101,7 @@ IsLongModeWakingVectorSupport (
return TRUE;
}
}
return FALSE;
}
@@ -117,23 +121,23 @@ IsLongModeWakingVectorSupport (
**/
EFI_PHYSICAL_ADDRESS
S3AllocatePageTablesBuffer (
IN BOOLEAN LongModeWakingVectorSupport
IN BOOLEAN LongModeWakingVectorSupport
)
{
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
UINTN ExtraPageTablePages;
UINT32 RegEax;
UINT32 RegEdx;
UINT8 PhysicalAddressBits;
UINT32 NumberOfPml4EntriesNeeded;
UINT32 NumberOfPdpEntriesNeeded;
EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress;
UINTN TotalPageTableSize;
VOID *Hob;
BOOLEAN Page1GSupport;
UINTN ExtraPageTablePages;
UINT32 RegEax;
UINT32 RegEdx;
UINT8 PhysicalAddressBits;
UINT32 NumberOfPml4EntriesNeeded;
UINT32 NumberOfPdpEntriesNeeded;
EFI_PHYSICAL_ADDRESS S3NvsPageTableAddress;
UINTN TotalPageTableSize;
VOID *Hob;
BOOLEAN Page1GSupport;
Page1GSupport = FALSE;
if (PcdGetBool(PcdUse1GPageTable)) {
if (PcdGetBool (PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
@@ -148,12 +152,12 @@ S3AllocatePageTablesBuffer (
//
Hob = GetFirstHob (EFI_HOB_TYPE_CPU);
if (Hob != NULL) {
PhysicalAddressBits = ((EFI_HOB_CPU *) Hob)->SizeOfMemorySpace;
PhysicalAddressBits = ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
} else {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
PhysicalAddressBits = (UINT8) RegEax;
PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
@@ -182,10 +186,10 @@ S3AllocatePageTablesBuffer (
//
if (PhysicalAddressBits <= 39 ) {
NumberOfPml4EntriesNeeded = 1;
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
} else {
NumberOfPml4EntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 39));
NumberOfPdpEntriesNeeded = 512;
NumberOfPdpEntriesNeeded = 512;
}
//
@@ -203,14 +207,14 @@ S3AllocatePageTablesBuffer (
//
// By architecture only one PageMapLevel4 exists - so lets allocate storage for it.
//
S3NvsPageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGES_TO_SIZE(TotalPageTableSize));
S3NvsPageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGES_TO_SIZE (TotalPageTableSize));
ASSERT (S3NvsPageTableAddress != 0);
return S3NvsPageTableAddress;
} else {
//
// If DXE is running 32-bit mode, no need to establish page table.
//
return (EFI_PHYSICAL_ADDRESS) 0;
return (EFI_PHYSICAL_ADDRESS)0;
}
}
@@ -244,29 +248,29 @@ AcpiS3ContextSaveOnEndOfDxe (
goto Done;
}
AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(*AcpiS3Context));
AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof (*AcpiS3Context));
ASSERT (AcpiS3Context != NULL);
AcpiS3ContextBuffer = (EFI_PHYSICAL_ADDRESS)(UINTN)AcpiS3Context;
//
// Get ACPI Table because we will save its position to variable
//
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *) EfiLocateFirstAcpiTable (
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE
);
AcpiS3Context->AcpiFacsTable = (EFI_PHYSICAL_ADDRESS) (UINTN) Facs;
Facs = (EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)EfiLocateFirstAcpiTable (
EFI_ACPI_4_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE
);
AcpiS3Context->AcpiFacsTable = (EFI_PHYSICAL_ADDRESS)(UINTN)Facs;
ASSERT (AcpiS3Context->AcpiFacsTable != 0);
IdtGate = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(IA32_IDT_GATE_DESCRIPTOR) * 0x100 + sizeof(IA32_DESCRIPTOR));
Idtr = (IA32_DESCRIPTOR *)(IdtGate + 0x100);
Idtr->Base = (UINTN)IdtGate;
Idtr->Limit = (UINT16)(sizeof(IA32_IDT_GATE_DESCRIPTOR) * 0x100 - 1);
IdtGate = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof (IA32_IDT_GATE_DESCRIPTOR) * 0x100 + sizeof (IA32_DESCRIPTOR));
Idtr = (IA32_DESCRIPTOR *)(IdtGate + 0x100);
Idtr->Base = (UINTN)IdtGate;
Idtr->Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * 0x100 - 1);
AcpiS3Context->IdtrProfile = (EFI_PHYSICAL_ADDRESS)(UINTN)Idtr;
Status = SaveLockBox (
&mAcpiS3IdtrProfileGuid,
(VOID *)(UINTN)Idtr,
(UINTN)sizeof(IA32_DESCRIPTOR)
(UINTN)sizeof (IA32_DESCRIPTOR)
);
ASSERT_EFI_ERROR (Status);
@@ -291,24 +295,24 @@ AcpiS3ContextSaveOnEndOfDxe (
AcpiS3Context->S3DebugBufferAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateMemoryBelow4G (EfiReservedMemoryType, EFI_PAGE_SIZE);
SetMem ((VOID *)(UINTN)AcpiS3Context->S3DebugBufferAddress, EFI_PAGE_SIZE, 0xff);
DEBUG((DEBUG_INFO, "AcpiS3Context: AcpiFacsTable is 0x%8x\n", AcpiS3Context->AcpiFacsTable));
DEBUG((DEBUG_INFO, "AcpiS3Context: IdtrProfile is 0x%8x\n", AcpiS3Context->IdtrProfile));
DEBUG((DEBUG_INFO, "AcpiS3Context: S3NvsPageTableAddress is 0x%8x\n", AcpiS3Context->S3NvsPageTableAddress));
DEBUG((DEBUG_INFO, "AcpiS3Context: S3DebugBufferAddress is 0x%8x\n", AcpiS3Context->S3DebugBufferAddress));
DEBUG((DEBUG_INFO, "AcpiS3Context: BootScriptStackBase is 0x%8x\n", AcpiS3Context->BootScriptStackBase));
DEBUG((DEBUG_INFO, "AcpiS3Context: BootScriptStackSize is 0x%8x\n", AcpiS3Context->BootScriptStackSize));
DEBUG ((DEBUG_INFO, "AcpiS3Context: AcpiFacsTable is 0x%8x\n", AcpiS3Context->AcpiFacsTable));
DEBUG ((DEBUG_INFO, "AcpiS3Context: IdtrProfile is 0x%8x\n", AcpiS3Context->IdtrProfile));
DEBUG ((DEBUG_INFO, "AcpiS3Context: S3NvsPageTableAddress is 0x%8x\n", AcpiS3Context->S3NvsPageTableAddress));
DEBUG ((DEBUG_INFO, "AcpiS3Context: S3DebugBufferAddress is 0x%8x\n", AcpiS3Context->S3DebugBufferAddress));
DEBUG ((DEBUG_INFO, "AcpiS3Context: BootScriptStackBase is 0x%8x\n", AcpiS3Context->BootScriptStackBase));
DEBUG ((DEBUG_INFO, "AcpiS3Context: BootScriptStackSize is 0x%8x\n", AcpiS3Context->BootScriptStackSize));
Status = SaveLockBox (
&gEfiAcpiVariableGuid,
&AcpiS3ContextBuffer,
sizeof(AcpiS3ContextBuffer)
sizeof (AcpiS3ContextBuffer)
);
ASSERT_EFI_ERROR (Status);
Status = SaveLockBox (
&gEfiAcpiS3ContextGuid,
(VOID *)(UINTN)AcpiS3Context,
(UINTN)sizeof(*AcpiS3Context)
(UINTN)sizeof (*AcpiS3Context)
);
ASSERT_EFI_ERROR (Status);

View File

@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _INTERNAL_S3_SAVE_STATE_H_
#define _INTERNAL_S3_SAVE_STATE_H_
#include <PiDxe.h>
@@ -67,10 +68,11 @@ AcpiS3ContextSaveOnEndOfDxe (
EFI_STATUS
EFIAPI
BootScriptWrite (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
...
);
/**
Insert a record into a specified Framework boot script table.
@@ -102,12 +104,13 @@ BootScriptWrite (
EFI_STATUS
EFIAPI
BootScriptInsert (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
...
);
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -137,12 +140,13 @@ BootScriptInsert (
EFI_STATUS
EFIAPI
BootScriptLabel (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
);
/**
Compare two positions in the boot script table and return their relative position.
@@ -162,10 +166,10 @@ BootScriptLabel (
EFI_STATUS
EFIAPI
BootScriptCompare (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
);
#endif //_INTERNAL_S3_SAVE_STATE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _INTERNAL_SMM_S3_SAVE_STATE_H_
#define _INTERNAL_SMM_S3_SAVE_STATE_H_
#include <PiDxe.h>
@@ -20,6 +21,7 @@
#include <Library/PcdLib.h>
#include <Library/SmbusLib.h>
#include <IndustryStandard/SmBus.h>
/**
Adds a record into S3 boot script table.
@@ -50,10 +52,11 @@
EFI_STATUS
EFIAPI
BootScriptWrite (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN UINTN OpCode,
...
);
/**
Insert a record into a specified Framework boot script table.
@@ -85,12 +88,13 @@ BootScriptWrite (
EFI_STATUS
EFIAPI
BootScriptInsert (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN UINTN OpCode,
...
);
/**
Find a label within the boot script table and, if not present, optionally create it.
@@ -120,12 +124,13 @@ BootScriptInsert (
EFI_STATUS
EFIAPI
BootScriptLabel (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN BOOLEAN BeforeOrAfter,
IN BOOLEAN CreateIfNotFound,
IN OUT EFI_S3_BOOT_SCRIPT_POSITION *Position OPTIONAL,
IN CONST CHAR8 *Label
);
/**
Compare two positions in the boot script table and return their relative position.
@@ -145,10 +150,10 @@ BootScriptLabel (
EFI_STATUS
EFIAPI
BootScriptCompare (
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This,
IN EFI_S3_BOOT_SCRIPT_POSITION Position1,
IN EFI_S3_BOOT_SCRIPT_POSITION Position2,
OUT UINTN *RelativePosition
);
#endif //_INTERNAL_SMM_S3_SAVE_STATE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -37,15 +37,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PlatformBootManagerLib.h>
#if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
#if defined (MDE_CPU_EBC)
//
// Uefi specification only defines the default boot file name for IA32, X64
// and IPF processor, so need define boot file name for EBC architecture here.
//
#define EFI_REMOVABLE_MEDIA_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
#else
#error "Can not determine the default boot file name for unknown processor type!"
#endif
#if defined (MDE_CPU_EBC)
//
// Uefi specification only defines the default boot file name for IA32, X64
// and IPF processor, so need define boot file name for EBC architecture here.
//
#define EFI_REMOVABLE_MEDIA_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
#else
#error "Can not determine the default boot file name for unknown processor type!"
#endif
#endif
/**
@@ -59,7 +59,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
VOID
EFIAPI
BdsEntry (
IN EFI_BDS_ARCH_PROTOCOL *This
IN EFI_BDS_ARCH_PROTOCOL *This
);
/**
@@ -97,11 +97,11 @@ BdsEntry (
**/
EFI_STATUS
BdsDxeSetVariableAndReportStatusCodeOnError (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
);
#endif

View File

@@ -17,7 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "HwErrRecSupport.h"
#include <Library/VariablePolicyHelperLib.h>
#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \
#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \
(a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
}
@@ -31,7 +31,7 @@ EFI_BDS_ARCH_PROTOCOL gBds = {
//
// gConnectConInEvent - Event which is signaled when ConIn connection is required
//
EFI_EVENT gConnectConInEvent = NULL;
EFI_EVENT gConnectConInEvent = NULL;
///
/// The read-only variables defined in UEFI Spec.
@@ -42,9 +42,9 @@ CHAR16 *mReadOnlyVariables[] = {
EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME,
EFI_HW_ERR_REC_SUPPORT_VARIABLE_NAME,
EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME
};
};
CHAR16 *mBdsLoadOptionName[] = {
CHAR16 *mBdsLoadOptionName[] = {
L"Driver",
L"SysPrep",
L"Boot",
@@ -62,11 +62,11 @@ CHAR16 *mBdsLoadOptionName[] = {
VOID
EFIAPI
BdsDxeOnConnectConInCallBack (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// When Osloader call ReadKeyStroke to signal this event
@@ -81,6 +81,7 @@ BdsDxeOnConnectConInCallBack (
DEBUG ((DEBUG_WARN, "[Bds] Connect ConIn failed - %r!!!\n", Status));
}
}
/**
Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to
check whether there is remaining deferred load images.
@@ -92,40 +93,40 @@ BdsDxeOnConnectConInCallBack (
VOID
EFIAPI
CheckDeferredLoadImageOnReadyToBoot (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *DeferredImage;
UINTN HandleCount;
EFI_HANDLE *Handles;
UINTN Index;
UINTN ImageIndex;
EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
VOID *Image;
UINTN ImageSize;
BOOLEAN BootOption;
CHAR16 *DevicePathStr;
EFI_STATUS Status;
EFI_DEFERRED_IMAGE_LOAD_PROTOCOL *DeferredImage;
UINTN HandleCount;
EFI_HANDLE *Handles;
UINTN Index;
UINTN ImageIndex;
EFI_DEVICE_PATH_PROTOCOL *ImageDevicePath;
VOID *Image;
UINTN ImageSize;
BOOLEAN BootOption;
CHAR16 *DevicePathStr;
//
// Find all the deferred image load protocols.
//
HandleCount = 0;
Handles = NULL;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiDeferredImageLoadProtocolGuid,
NULL,
&HandleCount,
&Handles
);
Handles = NULL;
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiDeferredImageLoadProtocolGuid,
NULL,
&HandleCount,
&Handles
);
if (EFI_ERROR (Status)) {
return;
}
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (Handles[Index], &gEfiDeferredImageLoadProtocolGuid, (VOID **) &DeferredImage);
Status = gBS->HandleProtocol (Handles[Index], &gEfiDeferredImageLoadProtocolGuid, (VOID **)&DeferredImage);
if (EFI_ERROR (Status)) {
continue;
}
@@ -135,16 +136,17 @@ CheckDeferredLoadImageOnReadyToBoot (
// Load all the deferred images in this protocol instance.
//
Status = DeferredImage->GetImageInfo (
DeferredImage,
ImageIndex,
&ImageDevicePath,
(VOID **) &Image,
&ImageSize,
&BootOption
);
DeferredImage,
ImageIndex,
&ImageDevicePath,
(VOID **)&Image,
&ImageSize,
&BootOption
);
if (EFI_ERROR (Status)) {
break;
}
DevicePathStr = ConvertDevicePathToText (ImageDevicePath, FALSE, FALSE);
DEBUG ((DEBUG_LOAD, "[Bds] Image was deferred but not loaded: %s.\n", DevicePathStr));
if (DevicePathStr != NULL) {
@@ -152,6 +154,7 @@ CheckDeferredLoadImageOnReadyToBoot (
}
}
}
if (Handles != NULL) {
FreePool (Handles);
}
@@ -172,19 +175,21 @@ CheckDeferredLoadImageOnReadyToBoot (
EFI_STATUS
EFIAPI
BdsInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HANDLE Handle;
//
// Install protocol interface
//
Handle = NULL;
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiBdsArchProtocolGuid, &gBds,
&gEfiBdsArchProtocolGuid,
&gBds,
NULL
);
ASSERT_EFI_ERROR (Status);
@@ -203,7 +208,7 @@ BdsInitialize (
&Event
);
ASSERT_EFI_ERROR (Status);
);
);
return Status;
}
@@ -219,8 +224,8 @@ BdsInitialize (
**/
EFI_STATUS
BdsWaitForSingleEvent (
IN EFI_EVENT Event,
IN UINT64 Timeout OPTIONAL
IN EFI_EVENT Event,
IN UINT64 Timeout OPTIONAL
)
{
UINTN Index;
@@ -280,15 +285,14 @@ BdsReadKeys (
VOID
)
{
EFI_STATUS Status;
EFI_INPUT_KEY Key;
EFI_STATUS Status;
EFI_INPUT_KEY Key;
if (PcdGetBool (PcdConInConnectOnDemand)) {
return;
}
while (gST->ConIn != NULL) {
Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
if (EFI_ERROR (Status)) {
@@ -309,17 +313,17 @@ BdsReadKeys (
**/
VOID
BdsWait (
IN EFI_EVENT HotkeyTriggered
IN EFI_EVENT HotkeyTriggered
)
{
EFI_STATUS Status;
UINT16 TimeoutRemain;
EFI_STATUS Status;
UINT16 TimeoutRemain;
DEBUG ((DEBUG_INFO, "[Bds]BdsWait ...Zzzzzzzzzzzz...\n"));
TimeoutRemain = PcdGet16 (PcdPlatformBootTimeOut);
while (TimeoutRemain != 0) {
DEBUG ((DEBUG_INFO, "[Bds]BdsWait(%d)..Zzzz...\n", (UINTN) TimeoutRemain));
DEBUG ((DEBUG_INFO, "[Bds]BdsWait(%d)..Zzzz...\n", (UINTN)TimeoutRemain));
PlatformBootManagerWaitCallback (TimeoutRemain);
BdsReadKeys (); // BUGBUG: Only reading can signal HotkeyTriggered
@@ -350,9 +354,10 @@ BdsWait (
// Note that the (TimeoutRemain == 0) condition excludes
// PcdPlatformBootTimeOut=0xFFFF, and that's deliberate.
//
if (PcdGet16 (PcdPlatformBootTimeOut) != 0 && TimeoutRemain == 0) {
if ((PcdGet16 (PcdPlatformBootTimeOut) != 0) && (TimeoutRemain == 0)) {
PlatformBootManagerWaitCallback (0);
}
DEBUG ((DEBUG_INFO, "[Bds]Exit the waiting!\n"));
}
@@ -368,12 +373,12 @@ BdsWait (
**/
BOOLEAN
BootBootOptions (
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
IN UINTN BootOptionCount,
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootManagerMenu OPTIONAL
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions,
IN UINTN BootOptionCount,
IN EFI_BOOT_MANAGER_LOAD_OPTION *BootManagerMenu OPTIONAL
)
{
UINTN Index;
UINTN Index;
//
// Report Status Code to indicate BDS starts attempting booting from the UEFI BootOrder list.
@@ -420,7 +425,7 @@ BootBootOptions (
}
}
return (BOOLEAN) (Index < BootOptionCount);
return (BOOLEAN)(Index < BootOptionCount);
}
/**
@@ -431,14 +436,14 @@ BootBootOptions (
**/
VOID
ProcessLoadOptions (
IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions,
IN UINTN LoadOptionCount
IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOptions,
IN UINTN LoadOptionCount
)
{
EFI_STATUS Status;
UINTN Index;
BOOLEAN ReconnectAll;
EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType;
EFI_STATUS Status;
UINTN Index;
BOOLEAN ReconnectAll;
EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType;
ReconnectAll = FALSE;
LoadOptionType = LoadOptionTypeMax;
@@ -453,6 +458,7 @@ ProcessLoadOptions (
if (Index == 0) {
LoadOptionType = LoadOptions[Index].OptionType;
}
ASSERT (LoadOptionType == LoadOptions[Index].OptionType);
ASSERT (LoadOptionType != LoadOptionTypeBoot);
@@ -467,7 +473,8 @@ ProcessLoadOptions (
// Stop processing if any PlatformRecovery#### returns success.
//
if ((LoadOptions[Index].Status == EFI_SUCCESS) &&
(LoadOptionType == LoadOptionTypePlatformRecovery)) {
(LoadOptionType == LoadOptionTypePlatformRecovery))
{
break;
}
@@ -475,7 +482,8 @@ ProcessLoadOptions (
// Only set ReconnectAll flag when the load option executes successfully.
//
if (!EFI_ERROR (LoadOptions[Index].Status) &&
(LoadOptions[Index].Attributes & LOAD_OPTION_FORCE_RECONNECT) != 0) {
((LoadOptions[Index].Attributes & LOAD_OPTION_FORCE_RECONNECT) != 0))
{
ReconnectAll = TRUE;
}
}
@@ -486,7 +494,7 @@ ProcessLoadOptions (
// then all of the EFI drivers in the system will be disconnected and
// reconnected after the last driver load option is processed.
//
if (ReconnectAll && LoadOptionType == LoadOptionTypeDriver) {
if (ReconnectAll && (LoadOptionType == LoadOptionTypeDriver)) {
EfiBootManagerDisconnectAll ();
EfiBootManagerConnectAll ();
}
@@ -503,14 +511,14 @@ ProcessLoadOptions (
**/
VOID
BdsFormalizeConsoleVariable (
IN CHAR16 *VariableName
IN CHAR16 *VariableName
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN VariableSize;
EFI_STATUS Status;
GetEfiGlobalVariable2 (VariableName, (VOID **) &DevicePath, &VariableSize);
GetEfiGlobalVariable2 (VariableName, (VOID **)&DevicePath, &VariableSize);
if ((DevicePath != NULL) && !IsDevicePathValid (DevicePath, VariableSize)) {
Status = gRT->SetVariable (
VariableName,
@@ -546,12 +554,12 @@ BdsFormalizeOSIndicationVariable (
VOID
)
{
EFI_STATUS Status;
UINT64 OsIndicationSupport;
UINT64 OsIndication;
UINTN DataSize;
UINT32 Attributes;
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
EFI_STATUS Status;
UINT64 OsIndicationSupport;
UINT64 OsIndication;
UINTN DataSize;
UINT32 Attributes;
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
//
// OS indicater support variable
@@ -568,7 +576,7 @@ BdsFormalizeOSIndicationVariable (
OsIndicationSupport |= EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY;
}
if (PcdGetBool(PcdCapsuleOnDiskSupport)) {
if (PcdGetBool (PcdCapsuleOnDiskSupport)) {
OsIndicationSupport |= EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
}
@@ -576,7 +584,7 @@ BdsFormalizeOSIndicationVariable (
EFI_OS_INDICATIONS_SUPPORT_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(UINT64),
sizeof (UINT64),
&OsIndicationSupport
);
//
@@ -592,15 +600,15 @@ BdsFormalizeOSIndicationVariable (
// 3. OsIndication attribute inconsistence
//
OsIndication = 0;
Attributes = 0;
DataSize = sizeof(UINT64);
Status = gRT->GetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
&Attributes,
&DataSize,
&OsIndication
);
Attributes = 0;
DataSize = sizeof (UINT64);
Status = gRT->GetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
&Attributes,
&DataSize,
&OsIndication
);
if (Status == EFI_NOT_FOUND) {
return;
}
@@ -608,8 +616,8 @@ BdsFormalizeOSIndicationVariable (
if ((DataSize != sizeof (OsIndication)) ||
((OsIndication & ~OsIndicationSupport) != 0) ||
(Attributes != (EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE))
){
)
{
DEBUG ((DEBUG_ERROR, "[Bds] Unformalized OsIndications variable exists. Delete it\n"));
Status = gRT->SetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
@@ -621,7 +629,7 @@ BdsFormalizeOSIndicationVariable (
//
// Deleting variable with current variable implementation shouldn't fail.
//
ASSERT_EFI_ERROR(Status);
ASSERT_EFI_ERROR (Status);
}
}
@@ -691,14 +699,14 @@ BdsEntry (
//
// Insert the performance probe
//
PERF_CROSSMODULE_END("DXE");
PERF_CROSSMODULE_BEGIN("BDS");
PERF_CROSSMODULE_END ("DXE");
PERF_CROSSMODULE_BEGIN ("BDS");
DEBUG ((DEBUG_INFO, "[Bds] Entry...\n"));
//
// Fill in FirmwareVendor and FirmwareRevision from PCDs
//
FirmwareVendor = (CHAR16 *) PcdGetPtr (PcdFirmwareVendor);
FirmwareVendor = (CHAR16 *)PcdGetPtr (PcdFirmwareVendor);
gST->FirmwareVendor = AllocateRuntimeCopyPool (StrSize (FirmwareVendor), FirmwareVendor);
ASSERT (gST->FirmwareVendor != NULL);
gST->FirmwareRevision = PcdGet32 (PcdFirmwareRevision);
@@ -707,7 +715,7 @@ BdsEntry (
// Fixup Tasble CRC after we updated Firmware Vendor and Revision
//
gST->Hdr.CRC32 = 0;
gBS->CalculateCrc32 ((VOID *) gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);
gBS->CalculateCrc32 ((VOID *)gST, sizeof (EFI_SYSTEM_TABLE), &gST->Hdr.CRC32);
//
// Validate Variable.
@@ -717,11 +725,11 @@ BdsEntry (
//
// Mark the read-only variables if the Variable Lock protocol exists
//
Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID**)&VariablePolicy);
DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n", Status));
Status = gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicy);
DEBUG ((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n", Status));
if (!EFI_ERROR (Status)) {
for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
Status = RegisterBasicVariablePolicy(
Status = RegisterBasicVariablePolicy (
VariablePolicy,
&gEfiGlobalVariableGuid,
mReadOnlyVariables[Index],
@@ -731,7 +739,7 @@ BdsEntry (
VARIABLE_POLICY_NO_CANT_ATTR,
VARIABLE_POLICY_TYPE_LOCK_NOW
);
ASSERT_EFI_ERROR(Status);
ASSERT_EFI_ERROR (Status);
}
}
@@ -764,6 +772,7 @@ BdsEntry (
BootOptionSupport |= EFI_BOOT_OPTION_SUPPORT_KEY;
SET_BOOT_OPTION_SUPPORT_KEY_COUNT (BootOptionSupport, 3);
}
Status = gRT->SetVariable (
EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
@@ -780,11 +789,12 @@ BdsEntry (
// Cache the "BootNext" NV variable before calling any PlatformBootManagerLib APIs
// This could avoid the "BootNext" set by PlatformBootManagerLib be consumed in this boot.
//
GetEfiGlobalVariable2 (EFI_BOOT_NEXT_VARIABLE_NAME, (VOID **) &BootNext, &DataSize);
GetEfiGlobalVariable2 (EFI_BOOT_NEXT_VARIABLE_NAME, (VOID **)&BootNext, &DataSize);
if (DataSize != sizeof (UINT16)) {
if (BootNext != NULL) {
FreePool (BootNext);
}
BootNext = NULL;
}
@@ -798,6 +808,7 @@ BdsEntry (
DEBUG ((DEBUG_ERROR, "Fail to allocate memory for default boot file path. Unable to boot.\n"));
CpuDeadLoop ();
}
Status = EfiBootManagerInitializeLoadOption (
&PlatformDefaultBootOption,
LoadOptionNumberUnassigned,
@@ -827,12 +838,15 @@ BdsEntry (
break;
}
}
PlatformDefaultBootOption.OptionNumber = Index;
Status = EfiBootManagerLoadOptionToVariable (&PlatformDefaultBootOption);
Status = EfiBootManagerLoadOptionToVariable (&PlatformDefaultBootOption);
ASSERT_EFI_ERROR (Status);
}
EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);
}
FreePool (FilePath);
//
@@ -869,9 +883,9 @@ BdsEntry (
// > Signal ReadyToLock event
// > Authentication action: 1. connect Auth devices; 2. Identify auto logon user.
//
PERF_INMODULE_BEGIN("PlatformBootManagerBeforeConsole");
PERF_INMODULE_BEGIN ("PlatformBootManagerBeforeConsole");
PlatformBootManagerBeforeConsole ();
PERF_INMODULE_END("PlatformBootManagerBeforeConsole");
PERF_INMODULE_END ("PlatformBootManagerBeforeConsole");
//
// Initialize hotkey service
@@ -888,7 +902,7 @@ BdsEntry (
//
// Connect consoles
//
PERF_INMODULE_BEGIN("EfiBootManagerConnectAllDefaultConsoles");
PERF_INMODULE_BEGIN ("EfiBootManagerConnectAllDefaultConsoles");
if (PcdGetBool (PcdConInConnectOnDemand)) {
EfiBootManagerConnectConsoleVariable (ConOut);
EfiBootManagerConnectConsoleVariable (ErrOut);
@@ -898,7 +912,8 @@ BdsEntry (
} else {
EfiBootManagerConnectAllDefaultConsoles ();
}
PERF_INMODULE_END("EfiBootManagerConnectAllDefaultConsoles");
PERF_INMODULE_END ("EfiBootManagerConnectAllDefaultConsoles");
//
// Do the platform specific action after the console is ready
@@ -911,9 +926,9 @@ BdsEntry (
// > Dispatch aditional option roms
// > Special boot: e.g.: USB boot, enter UI
//
PERF_INMODULE_BEGIN("PlatformBootManagerAfterConsole");
PERF_INMODULE_BEGIN ("PlatformBootManagerAfterConsole");
PlatformBootManagerAfterConsole ();
PERF_INMODULE_END("PlatformBootManagerAfterConsole");
PERF_INMODULE_END ("PlatformBootManagerAfterConsole");
//
// If any component set PcdTestKeyUsed to TRUE because use of a test key
@@ -930,39 +945,44 @@ BdsEntry (
// Boot to Boot Manager Menu when EFI_OS_INDICATIONS_BOOT_TO_FW_UI is set. Skip HotkeyBoot
//
DataSize = sizeof (UINT64);
Status = gRT->GetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
NULL,
&DataSize,
&OsIndication
);
Status = gRT->GetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
NULL,
&DataSize,
&OsIndication
);
if (EFI_ERROR (Status)) {
OsIndication = 0;
}
DEBUG_CODE_BEGIN ();
EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType;
DEBUG ((DEBUG_INFO, "[Bds]OsIndication: %016x\n", OsIndication));
DEBUG ((DEBUG_INFO, "[Bds]=============Begin Load Options Dumping ...=============\n"));
for (LoadOptionType = 0; LoadOptionType < LoadOptionTypeMax; LoadOptionType++) {
EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType;
DEBUG ((DEBUG_INFO, "[Bds]OsIndication: %016x\n", OsIndication));
DEBUG ((DEBUG_INFO, "[Bds]=============Begin Load Options Dumping ...=============\n"));
for (LoadOptionType = 0; LoadOptionType < LoadOptionTypeMax; LoadOptionType++) {
DEBUG ((
DEBUG_INFO,
" %s Options:\n",
mBdsLoadOptionName[LoadOptionType]
));
LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionType);
for (Index = 0; Index < LoadOptionCount; Index++) {
DEBUG ((
DEBUG_INFO, " %s Options:\n",
mBdsLoadOptionName[LoadOptionType]
DEBUG_INFO,
" %s%04x: %s \t\t 0x%04x\n",
mBdsLoadOptionName[LoadOptionType],
LoadOptions[Index].OptionNumber,
LoadOptions[Index].Description,
LoadOptions[Index].Attributes
));
LoadOptions = EfiBootManagerGetLoadOptions (&LoadOptionCount, LoadOptionType);
for (Index = 0; Index < LoadOptionCount; Index++) {
DEBUG ((
DEBUG_INFO, " %s%04x: %s \t\t 0x%04x\n",
mBdsLoadOptionName[LoadOptionType],
LoadOptions[Index].OptionNumber,
LoadOptions[Index].Description,
LoadOptions[Index].Attributes
));
}
EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);
}
DEBUG ((DEBUG_INFO, "[Bds]=============End Load Options Dumping=============\n"));
EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount);
}
DEBUG ((DEBUG_INFO, "[Bds]=============End Load Options Dumping=============\n"));
DEBUG_CODE_END ();
//
@@ -970,20 +990,20 @@ BdsEntry (
//
BootManagerMenuStatus = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);
BootFwUi = (BOOLEAN) ((OsIndication & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0);
PlatformRecovery = (BOOLEAN) ((OsIndication & EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY) != 0);
BootFwUi = (BOOLEAN)((OsIndication & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0);
PlatformRecovery = (BOOLEAN)((OsIndication & EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY) != 0);
//
// Clear EFI_OS_INDICATIONS_BOOT_TO_FW_UI to acknowledge OS
//
if (BootFwUi || PlatformRecovery) {
OsIndication &= ~((UINT64) (EFI_OS_INDICATIONS_BOOT_TO_FW_UI | EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY));
Status = gRT->SetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
sizeof(UINT64),
&OsIndication
);
OsIndication &= ~((UINT64)(EFI_OS_INDICATIONS_BOOT_TO_FW_UI | EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY));
Status = gRT->SetVariable (
EFI_OS_INDICATIONS_VARIABLE_NAME,
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
sizeof (UINT64),
&OsIndication
);
//
// Changing the content without increasing its size with current variable implementation shouldn't fail.
//
@@ -1054,7 +1074,8 @@ BdsEntry (
EfiBootManagerFreeLoadOption (&LoadOption);
if ((LoadOption.Status == EFI_SUCCESS) &&
(BootManagerMenuStatus != EFI_NOT_FOUND) &&
(LoadOption.OptionNumber != BootManagerMenu.OptionNumber)) {
(LoadOption.OptionNumber != BootManagerMenu.OptionNumber))
{
//
// Boot to Boot Manager Menu upon EFI_SUCCESS
// Exception: Do not boot again when the BootNext points to Boot Manager Menu.
@@ -1090,6 +1111,7 @@ BdsEntry (
EfiBootManagerProcessLoadOption (&PlatformDefaultBootOption);
}
}
EfiBootManagerFreeLoadOption (&PlatformDefaultBootOption);
DEBUG ((DEBUG_ERROR, "[Bds] Unable to boot!\n"));
@@ -1132,11 +1154,11 @@ BdsEntry (
**/
EFI_STATUS
BdsDxeSetVariableAndReportStatusCodeOnError (
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
IN UINT32 Attributes,
IN UINTN DataSize,
IN VOID *Data
)
{
EFI_STATUS Status;
@@ -1151,7 +1173,7 @@ BdsDxeSetVariableAndReportStatusCodeOnError (
Data
);
if (EFI_ERROR (Status)) {
NameSize = StrSize (VariableName);
NameSize = StrSize (VariableName);
SetVariableStatus = AllocatePool (sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize);
if (SetVariableStatus != NULL) {
CopyGuid (&SetVariableStatus->Guid, VendorGuid);
@@ -1159,8 +1181,8 @@ BdsDxeSetVariableAndReportStatusCodeOnError (
SetVariableStatus->DataSize = DataSize;
SetVariableStatus->SetStatus = Status;
SetVariableStatus->Attributes = Attributes;
CopyMem (SetVariableStatus + 1, VariableName, NameSize);
CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Data, DataSize);
CopyMem (SetVariableStatus + 1, VariableName, NameSize);
CopyMem (((UINT8 *)(SetVariableStatus + 1)) + NameSize, Data, DataSize);
REPORT_STATUS_CODE_EX (
EFI_ERROR_CODE,

View File

@@ -20,8 +20,8 @@ InitializeHwErrRecSupport (
VOID
)
{
EFI_STATUS Status;
UINT16 HardwareErrorRecordLevel;
EFI_STATUS Status;
UINT16 HardwareErrorRecordLevel;
HardwareErrorRecordLevel = PcdGet16 (PcdHardwareErrorRecordLevel);
@@ -37,6 +37,6 @@ InitializeHwErrRecSupport (
sizeof (UINT16),
&HardwareErrorRecordLevel
);
ASSERT_EFI_ERROR(Status);
ASSERT_EFI_ERROR (Status);
}
}

View File

@@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Bds.h"
#define ISO_639_2_ENTRY_SIZE 3
#define ISO_639_2_ENTRY_SIZE 3
/**
Check if lang is in supported language codes according to language string.
@@ -37,15 +37,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
BOOLEAN
IsLangInSupportedLangCodes(
IN CHAR8 *SupportedLang,
IN CHAR8 *Lang,
IN BOOLEAN Iso639Language
IsLangInSupportedLangCodes (
IN CHAR8 *SupportedLang,
IN CHAR8 *Lang,
IN BOOLEAN Iso639Language
)
{
UINTN Index;
UINTN CompareLength;
UINTN LanguageLength;
UINTN Index;
UINTN CompareLength;
UINTN LanguageLength;
if (Iso639Language) {
CompareLength = ISO_639_2_ENTRY_SIZE;
@@ -57,31 +57,38 @@ IsLangInSupportedLangCodes(
return TRUE;
}
}
return FALSE;
} else {
//
// Compare RFC4646 language code
//
for (LanguageLength = 0; Lang[LanguageLength] != '\0'; LanguageLength++);
for (LanguageLength = 0; Lang[LanguageLength] != '\0'; LanguageLength++) {
}
for (; *SupportedLang != '\0'; SupportedLang += CompareLength) {
for ( ; *SupportedLang != '\0'; SupportedLang += CompareLength) {
//
// Skip ';' characters in SupportedLang
//
for (; *SupportedLang != '\0' && *SupportedLang == ';'; SupportedLang++);
for ( ; *SupportedLang != '\0' && *SupportedLang == ';'; SupportedLang++) {
}
//
// Determine the length of the next language code in SupportedLang
//
for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++);
for (CompareLength = 0; SupportedLang[CompareLength] != '\0' && SupportedLang[CompareLength] != ';'; CompareLength++) {
}
if ((CompareLength == LanguageLength) &&
(AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0)) {
(AsciiStrnCmp (Lang, SupportedLang, CompareLength) == 0))
{
//
// Successfully find the Lang string in SupportedLang string.
//
return TRUE;
}
}
return FALSE;
}
}
@@ -100,18 +107,18 @@ IsLangInSupportedLangCodes(
**/
VOID
InitializeLangVariable (
IN CHAR16 *LangName,
IN CHAR8 *SupportedLang,
IN CHAR8 *DefaultLang,
IN BOOLEAN Iso639Language
IN CHAR16 *LangName,
IN CHAR8 *SupportedLang,
IN CHAR8 *DefaultLang,
IN BOOLEAN Iso639Language
)
{
CHAR8 *Lang;
CHAR8 *Lang;
//
// Find current Lang or PlatformLang from EFI Variable.
//
GetEfiGlobalVariable2 (LangName, (VOID **) &Lang, NULL);
GetEfiGlobalVariable2 (LangName, (VOID **)&Lang, NULL);
//
// If Lang or PlatformLang variable is not found,
@@ -146,14 +153,14 @@ InitializeLangVariable (
**/
VOID
InitializeLanguage (
BOOLEAN LangCodesSettingRequired
BOOLEAN LangCodesSettingRequired
)
{
EFI_STATUS Status;
CHAR8 *LangCodes;
CHAR8 *PlatformLangCodes;
LangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLangCodes);
LangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLangCodes);
PlatformLangCodes = (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes);
if (LangCodesSettingRequired) {
if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {
@@ -170,7 +177,7 @@ InitializeLanguage (
//
// Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
//
ASSERT_EFI_ERROR(Status);
ASSERT_EFI_ERROR (Status);
}
Status = gRT->SetVariable (
@@ -183,14 +190,15 @@ InitializeLanguage (
//
// Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
//
ASSERT_EFI_ERROR(Status);
ASSERT_EFI_ERROR (Status);
}
if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {
//
// UEFI 2.1 depricated this variable so we support turning it off
//
InitializeLangVariable (L"Lang", LangCodes, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultLang), TRUE);
InitializeLangVariable (L"Lang", LangCodes, (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultLang), TRUE);
}
InitializeLangVariable (L"PlatformLang", PlatformLangCodes, (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang), FALSE);
InitializeLangVariable (L"PlatformLang", PlatformLangCodes, (CHAR8 *)PcdGetPtr (PcdUefiVariableDefaultPlatformLang), FALSE);
}

View File

@@ -18,7 +18,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
InitializeLanguage (
BOOLEAN LangCodesSettingRequired
BOOLEAN LangCodesSettingRequired
);
#endif // _LANGUAGE_H_

View File

@@ -18,7 +18,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootManagerLib.h>
CHAR16 mNetworkDeviceList[] = L"_NDL";
CHAR16 mNetworkDeviceList[] = L"_NDL";
/**
Connect all the system drivers to controllers and create the network device list in NV storage.
@@ -32,29 +32,30 @@ ConnectAllAndCreateNetworkDeviceList (
VOID
)
{
EFI_STATUS Status;
EFI_HANDLE *Handles;
UINTN HandleCount;
EFI_DEVICE_PATH_PROTOCOL *SingleDevice;
EFI_DEVICE_PATH_PROTOCOL *Devices;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EFI_STATUS Status;
EFI_HANDLE *Handles;
UINTN HandleCount;
EFI_DEVICE_PATH_PROTOCOL *SingleDevice;
EFI_DEVICE_PATH_PROTOCOL *Devices;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EfiBootManagerConnectAll ();
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiManagedNetworkServiceBindingProtocolGuid, NULL, &HandleCount, &Handles);
if (EFI_ERROR (Status)) {
Handles = NULL;
Handles = NULL;
HandleCount = 0;
}
Devices = NULL;
while (HandleCount-- != 0) {
Status = gBS->HandleProtocol (Handles[HandleCount], &gEfiDevicePathProtocolGuid, (VOID **) &SingleDevice);
Status = gBS->HandleProtocol (Handles[HandleCount], &gEfiDevicePathProtocolGuid, (VOID **)&SingleDevice);
if (EFI_ERROR (Status) || (SingleDevice == NULL)) {
continue;
}
TempDevicePath = Devices;
Devices = AppendDevicePathInstance (Devices, SingleDevice);
Devices = AppendDevicePathInstance (Devices, SingleDevice);
if (TempDevicePath != NULL) {
FreePool (TempDevicePath);
}
@@ -89,24 +90,26 @@ ConnectNetwork (
VOID
)
{
EFI_STATUS Status;
BOOLEAN OneConnected;
EFI_DEVICE_PATH_PROTOCOL *Devices;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EFI_DEVICE_PATH_PROTOCOL *SingleDevice;
UINTN Size;
EFI_STATUS Status;
BOOLEAN OneConnected;
EFI_DEVICE_PATH_PROTOCOL *Devices;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EFI_DEVICE_PATH_PROTOCOL *SingleDevice;
UINTN Size;
OneConnected = FALSE;
GetVariable2 (mNetworkDeviceList, &gEfiCallerIdGuid, (VOID **) &Devices, NULL);
GetVariable2 (mNetworkDeviceList, &gEfiCallerIdGuid, (VOID **)&Devices, NULL);
TempDevicePath = Devices;
while (TempDevicePath != NULL) {
SingleDevice = GetNextDevicePathInstance (&TempDevicePath, &Size);
Status = EfiBootManagerConnectDevicePath (SingleDevice, NULL);
Status = EfiBootManagerConnectDevicePath (SingleDevice, NULL);
if (!EFI_ERROR (Status)) {
OneConnected = TRUE;
}
FreePool (SingleDevice);
}
if (Devices != NULL) {
FreePool (Devices);
}
@@ -148,13 +151,13 @@ ConnectNetwork (
EFI_STATUS
EFIAPI
BootManagerPolicyConnectDevicePath (
IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This,
IN EFI_DEVICE_PATH *DevicePath,
IN BOOLEAN Recursive
IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This,
IN EFI_DEVICE_PATH *DevicePath,
IN BOOLEAN Recursive
)
{
EFI_STATUS Status;
EFI_HANDLE Controller;
EFI_STATUS Status;
EFI_HANDLE Controller;
if (EfiGetCurrentTpl () != TPL_APPLICATION) {
return EFI_UNSUPPORTED;
@@ -173,8 +176,10 @@ BootManagerPolicyConnectDevicePath (
Status = gBS->ConnectController (Controller, NULL, DevicePath, FALSE);
}
}
return Status;
}
/**
Connect a class of devices using the platform Boot Manager policy.
@@ -221,8 +226,8 @@ BootManagerPolicyConnectDevicePath (
EFI_STATUS
EFIAPI
BootManagerPolicyConnectDeviceClass (
IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This,
IN EFI_GUID *Class
IN EFI_BOOT_MANAGER_POLICY_PROTOCOL *This,
IN EFI_GUID *Class
)
{
if (EfiGetCurrentTpl () != TPL_APPLICATION) {
@@ -264,18 +269,19 @@ EFI_BOOT_MANAGER_POLICY_PROTOCOL mBootManagerPolicy = {
EFI_STATUS
EFIAPI
BootManagerPolicyInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_HANDLE Handle;
EFI_HANDLE Handle;
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiBootManagerPolicyProtocolGuid);
Handle = NULL;
return gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiBootManagerPolicyProtocolGuid, &mBootManagerPolicy,
&gEfiBootManagerPolicyProtocolGuid,
&mBootManagerPolicy,
NULL
);
}

View File

@@ -58,15 +58,15 @@
EFI_STATUS
EFIAPI
LoadCapsuleOnDisk (
IN EFI_PEI_SERVICES **PeiServices,
IN EDKII_PEI_CAPSULE_ON_DISK_PPI *This
IN EFI_PEI_SERVICES **PeiServices,
IN EDKII_PEI_CAPSULE_ON_DISK_PPI *This
);
static EDKII_PEI_CAPSULE_ON_DISK_PPI mCapsuleOnDiskPpi = {
static EDKII_PEI_CAPSULE_ON_DISK_PPI mCapsuleOnDiskPpi = {
LoadCapsuleOnDisk
};
static EFI_PEI_PPI_DESCRIPTOR mCapsuleOnDiskPpiList = {
static EFI_PEI_PPI_DESCRIPTOR mCapsuleOnDiskPpiList = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEdkiiPeiCapsuleOnDiskPpiGuid,
&mCapsuleOnDiskPpi
@@ -84,21 +84,21 @@ static EFI_PEI_PPI_DESCRIPTOR mCapsuleOnDiskPpiList = {
static
BOOLEAN
CheckCapsuleFromRam (
IN CONST EFI_PEI_SERVICES **PeiServices
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
EFI_STATUS Status;
PEI_CAPSULE_PPI *Capsule;
EFI_STATUS Status;
PEI_CAPSULE_PPI *Capsule;
Status = PeiServicesLocatePpi (
&gEfiPeiCapsulePpiGuid,
0,
NULL,
(VOID **) &Capsule
(VOID **)&Capsule
);
if (!EFI_ERROR(Status)) {
if (!EFI_ERROR (Status)) {
Status = Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES **)PeiServices);
if (!EFI_ERROR(Status)) {
if (!EFI_ERROR (Status)) {
return TRUE;
}
}
@@ -119,20 +119,20 @@ IsCapsuleOnDiskMode (
VOID
)
{
EFI_STATUS Status;
UINTN Size;
EFI_PEI_READ_ONLY_VARIABLE2_PPI *PPIVariableServices;
BOOLEAN CodRelocInfo;
EFI_STATUS Status;
UINTN Size;
EFI_PEI_READ_ONLY_VARIABLE2_PPI *PPIVariableServices;
BOOLEAN CodRelocInfo;
Status = PeiServicesLocatePpi (
&gEfiPeiReadOnlyVariable2PpiGuid,
0,
NULL,
(VOID **) &PPIVariableServices
(VOID **)&PPIVariableServices
);
ASSERT_EFI_ERROR (Status);
Size = sizeof (BOOLEAN);
Size = sizeof (BOOLEAN);
Status = PPIVariableServices->GetVariable (
PPIVariableServices,
COD_RELOCATION_INFO_VAR_NAME,
@@ -142,8 +142,8 @@ IsCapsuleOnDiskMode (
&CodRelocInfo
);
if (EFI_ERROR (Status) || Size != sizeof(BOOLEAN) || !CodRelocInfo) {
DEBUG (( DEBUG_ERROR, "Error Get CodRelocationInfo variable %r!\n", Status));
if (EFI_ERROR (Status) || (Size != sizeof (BOOLEAN)) || !CodRelocInfo) {
DEBUG ((DEBUG_ERROR, "Error Get CodRelocationInfo variable %r!\n", Status));
return FALSE;
}
@@ -169,37 +169,42 @@ IsCapsuleOnDiskMode (
static
EFI_STATUS
RetrieveRelocatedCapsule (
IN UINT8 *RelocCapsuleBuf,
IN UINTN RelocCapsuleTotalSize
IN UINT8 *RelocCapsuleBuf,
IN UINTN RelocCapsuleTotalSize
)
{
UINTN Index;
UINT8 *CapsuleDataBufEnd;
UINT8 *CapsulePtr;
UINT32 CapsuleSize;
UINT64 TotalImageSize;
UINTN CapsuleNum;
UINTN Index;
UINT8 *CapsuleDataBufEnd;
UINT8 *CapsulePtr;
UINT32 CapsuleSize;
UINT64 TotalImageSize;
UINTN CapsuleNum;
//
// Temp file contains at least 2 capsule (including 1 capsule name capsule) & 1 UINT64
//
if (RelocCapsuleTotalSize < sizeof(UINT64) + sizeof(EFI_CAPSULE_HEADER) * 2) {
if (RelocCapsuleTotalSize < sizeof (UINT64) + sizeof (EFI_CAPSULE_HEADER) * 2) {
return EFI_INVALID_PARAMETER;
}
CopyMem(&TotalImageSize, RelocCapsuleBuf, sizeof(UINT64));
CopyMem (&TotalImageSize, RelocCapsuleBuf, sizeof (UINT64));
DEBUG ((DEBUG_INFO, "ProcessRelocatedCapsule CapsuleBuf %x TotalCapSize %lx\n",
RelocCapsuleBuf, TotalImageSize));
DEBUG ((
DEBUG_INFO,
"ProcessRelocatedCapsule CapsuleBuf %x TotalCapSize %lx\n",
RelocCapsuleBuf,
TotalImageSize
));
RelocCapsuleBuf += sizeof(UINT64);
RelocCapsuleBuf += sizeof (UINT64);
//
// TempCaspule file length check
//
if (MAX_ADDRESS - TotalImageSize <= sizeof(UINT64) ||
(UINT64)RelocCapsuleTotalSize != TotalImageSize + sizeof(UINT64) ||
(UINTN)(MAX_ADDRESS - (PHYSICAL_ADDRESS)(UINTN)RelocCapsuleBuf) <= TotalImageSize) {
if ((MAX_ADDRESS - TotalImageSize <= sizeof (UINT64)) ||
((UINT64)RelocCapsuleTotalSize != TotalImageSize + sizeof (UINT64)) ||
((UINTN)(MAX_ADDRESS - (PHYSICAL_ADDRESS)(UINTN)RelocCapsuleBuf) <= TotalImageSize))
{
return EFI_INVALID_PARAMETER;
}
@@ -212,14 +217,16 @@ RetrieveRelocatedCapsule (
CapsuleNum = 0;
while (CapsulePtr < CapsuleDataBufEnd) {
if ((CapsuleDataBufEnd - CapsulePtr) < sizeof(EFI_CAPSULE_HEADER) ||
((EFI_CAPSULE_HEADER *)CapsulePtr)->CapsuleImageSize < sizeof(EFI_CAPSULE_HEADER) ||
(UINTN)(MAX_ADDRESS - (PHYSICAL_ADDRESS)(UINTN)CapsulePtr) < ((EFI_CAPSULE_HEADER *)CapsulePtr)->CapsuleImageSize
) {
if (((CapsuleDataBufEnd - CapsulePtr) < sizeof (EFI_CAPSULE_HEADER)) ||
(((EFI_CAPSULE_HEADER *)CapsulePtr)->CapsuleImageSize < sizeof (EFI_CAPSULE_HEADER)) ||
((UINTN)(MAX_ADDRESS - (PHYSICAL_ADDRESS)(UINTN)CapsulePtr) < ((EFI_CAPSULE_HEADER *)CapsulePtr)->CapsuleImageSize)
)
{
break;
}
CapsulePtr += ((EFI_CAPSULE_HEADER *)CapsulePtr)->CapsuleImageSize;
CapsuleNum ++;
CapsuleNum++;
}
if (CapsulePtr != CapsuleDataBufEnd) {
@@ -242,7 +249,7 @@ RetrieveRelocatedCapsule (
CapsuleSize = ((EFI_CAPSULE_HEADER *)CapsulePtr)->CapsuleImageSize;
BuildCvHob ((EFI_PHYSICAL_ADDRESS)(UINTN)CapsulePtr, CapsuleSize);
DEBUG((DEBUG_INFO, "Capsule saved in address %x size %x\n", CapsulePtr, CapsuleSize));
DEBUG ((DEBUG_INFO, "Capsule saved in address %x size %x\n", CapsulePtr, CapsuleSize));
CapsulePtr += CapsuleSize;
Index++;
@@ -270,22 +277,22 @@ InitializeCapsuleOnDiskLoad (
UINTN BootMode;
UINTN FileNameSize;
BootMode = GetBootModeHob();
ASSERT(BootMode == BOOT_ON_FLASH_UPDATE);
BootMode = GetBootModeHob ();
ASSERT (BootMode == BOOT_ON_FLASH_UPDATE);
//
// If there are capsules provisioned in memory, quit.
// Only one capsule resource is accept, CapsuleOnRam's priority is higher than CapsuleOnDisk.
//
if (CheckCapsuleFromRam(PeiServices)) {
DEBUG((DEBUG_ERROR, "Capsule On Memory Detected! Quit.\n"));
if (CheckCapsuleFromRam (PeiServices)) {
DEBUG ((DEBUG_ERROR, "Capsule On Memory Detected! Quit.\n"));
return EFI_ABORTED;
}
DEBUG_CODE_BEGIN ();
VOID *CapsuleOnDiskModePpi;
VOID *CapsuleOnDiskModePpi;
if (!IsCapsuleOnDiskMode()){
if (!IsCapsuleOnDiskMode ()) {
return EFI_NOT_FOUND;
}
@@ -298,17 +305,18 @@ InitializeCapsuleOnDiskLoad (
NULL,
(VOID **)&CapsuleOnDiskModePpi
);
if (EFI_ERROR(Status)) {
DEBUG((DEBUG_ERROR, "Locate CapsuleOnDiskModePpi error %x\n", Status));
return Status;
}
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Locate CapsuleOnDiskModePpi error %x\n", Status));
return Status;
}
DEBUG_CODE_END ();
Status = PeiServicesInstallPpi (&mCapsuleOnDiskPpiList);
ASSERT_EFI_ERROR (Status);
FileNameSize = PcdGetSize (PcdCoDRelocationFileName);
Status = PcdSetPtrS (PcdRecoveryFileName, &FileNameSize, (VOID *) PcdGetPtr(PcdCoDRelocationFileName));
Status = PcdSetPtrS (PcdRecoveryFileName, &FileNameSize, (VOID *)PcdGetPtr (PcdCoDRelocationFileName));
ASSERT_EFI_ERROR (Status);
return Status;
@@ -329,8 +337,8 @@ InitializeCapsuleOnDiskLoad (
EFI_STATUS
EFIAPI
LoadCapsuleOnDisk (
IN EFI_PEI_SERVICES **PeiServices,
IN EDKII_PEI_CAPSULE_ON_DISK_PPI *This
IN EFI_PEI_SERVICES **PeiServices,
IN EDKII_PEI_CAPSULE_ON_DISK_PPI *This
)
{
EFI_STATUS Status;
@@ -359,14 +367,16 @@ LoadCapsuleOnDisk (
(EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_RECOVERY_PPI_NOT_FOUND)
);
}
break;
}
NumberRecoveryCapsules = 0;
Status = DeviceRecoveryPpi->GetNumberRecoveryCapsules (
(EFI_PEI_SERVICES **)PeiServices,
DeviceRecoveryPpi,
&NumberRecoveryCapsules
);
Status = DeviceRecoveryPpi->GetNumberRecoveryCapsules (
(EFI_PEI_SERVICES **)PeiServices,
DeviceRecoveryPpi,
&NumberRecoveryCapsules
);
DEBUG ((DEBUG_INFO, "LoadCapsuleOnDisk - GetNumberRecoveryCapsules (%d) - %r\n", NumberRecoveryCapsules, Status));
if (EFI_ERROR (Status)) {
continue;
@@ -374,13 +384,13 @@ LoadCapsuleOnDisk (
for (CapsuleInstance = 1; CapsuleInstance <= NumberRecoveryCapsules; CapsuleInstance++) {
CapsuleSize = 0;
Status = DeviceRecoveryPpi->GetRecoveryCapsuleInfo (
(EFI_PEI_SERVICES **)PeiServices,
DeviceRecoveryPpi,
CapsuleInstance,
&CapsuleSize,
&CapsuleType
);
Status = DeviceRecoveryPpi->GetRecoveryCapsuleInfo (
(EFI_PEI_SERVICES **)PeiServices,
DeviceRecoveryPpi,
CapsuleInstance,
&CapsuleSize,
&CapsuleType
);
DEBUG ((DEBUG_INFO, "LoadCapsuleOnDisk - GetRecoveryCapsuleInfo (%d - %x) - %r\n", CapsuleInstance, CapsuleSize, Status));
if (EFI_ERROR (Status)) {
break;
@@ -405,14 +415,14 @@ LoadCapsuleOnDisk (
);
DEBUG ((DEBUG_INFO, "LoadCapsuleOnDisk - LoadRecoveryCapsule (%d) - %r\n", CapsuleInstance, Status));
if (EFI_ERROR (Status)) {
FreePages (CapsuleBuffer, EFI_SIZE_TO_PAGES(CapsuleSize));
FreePages (CapsuleBuffer, EFI_SIZE_TO_PAGES (CapsuleSize));
break;
}
//
// Capsule Update Mode, Split relocated Capsule buffer into different capsule vehical hobs.
//
Status = RetrieveRelocatedCapsule(CapsuleBuffer, CapsuleSize);
Status = RetrieveRelocatedCapsule (CapsuleBuffer, CapsuleSize);
break;
}

View File

@@ -36,7 +36,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifdef MDE_CPU_IA32
#pragma pack(1)
#pragma pack(1)
//
// Page-Map Level-4 Offset (PML4) and
@@ -45,18 +45,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
typedef union {
struct {
UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
UINT64 Reserved:1; // Reserved
UINT64 MustBeZero:2; // Must Be Zero
UINT64 Available:3; // Available for use by system software
UINT64 PageTableBaseAddress:40; // Page Table Base Address
UINT64 AvabilableHigh:11; // Available for use by system software
UINT64 Nx:1; // No Execute bit
UINT64 Present : 1; // 0 = Not present in memory, 1 = Present in memory
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
UINT64 WriteThrough : 1; // 0 = Write-Back caching, 1=Write-Through caching
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
UINT64 Accessed : 1; // 0 = Not accessed, 1 = Accessed (set by CPU)
UINT64 Reserved : 1; // Reserved
UINT64 MustBeZero : 2; // Must Be Zero
UINT64 Available : 3; // Available for use by system software
UINT64 PageTableBaseAddress : 40; // Page Table Base Address
UINT64 AvabilableHigh : 11; // Available for use by system software
UINT64 Nx : 1; // No Execute bit
} Bits;
UINT64 Uint64;
} PAGE_MAP_AND_DIRECTORY_POINTER;
@@ -66,21 +66,21 @@ typedef union {
//
typedef union {
struct {
UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
UINT64 MustBe1:1; // Must be 1
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
UINT64 Available:3; // Available for use by system software
UINT64 PAT:1; //
UINT64 MustBeZero:8; // Must be zero;
UINT64 PageTableBaseAddress:31; // Page Table Base Address
UINT64 AvabilableHigh:11; // Available for use by system software
UINT64 Nx:1; // 0 = Execute Code, 1 = No Code Execution
UINT64 Present : 1; // 0 = Not present in memory, 1 = Present in memory
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
UINT64 WriteThrough : 1; // 0 = Write-Back caching, 1=Write-Through caching
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
UINT64 Accessed : 1; // 0 = Not accessed, 1 = Accessed (set by CPU)
UINT64 Dirty : 1; // 0 = Not Dirty, 1 = written by processor on access to page
UINT64 MustBe1 : 1; // Must be 1
UINT64 Global : 1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
UINT64 Available : 3; // Available for use by system software
UINT64 PAT : 1; //
UINT64 MustBeZero : 8; // Must be zero;
UINT64 PageTableBaseAddress : 31; // Page Table Base Address
UINT64 AvabilableHigh : 11; // Available for use by system software
UINT64 Nx : 1; // 0 = Execute Code, 1 = No Code Execution
} Bits;
UINT64 Uint64;
} PAGE_TABLE_ENTRY;
@@ -90,32 +90,32 @@ typedef union {
//
typedef union {
struct {
UINT64 Present:1; // 0 = Not present in memory, 1 = Present in memory
UINT64 ReadWrite:1; // 0 = Read-Only, 1= Read/Write
UINT64 UserSupervisor:1; // 0 = Supervisor, 1=User
UINT64 WriteThrough:1; // 0 = Write-Back caching, 1=Write-Through caching
UINT64 CacheDisabled:1; // 0 = Cached, 1=Non-Cached
UINT64 Accessed:1; // 0 = Not accessed, 1 = Accessed (set by CPU)
UINT64 Dirty:1; // 0 = Not Dirty, 1 = written by processor on access to page
UINT64 MustBe1:1; // Must be 1
UINT64 Global:1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
UINT64 Available:3; // Available for use by system software
UINT64 PAT:1; //
UINT64 MustBeZero:17; // Must be zero;
UINT64 PageTableBaseAddress:22; // Page Table Base Address
UINT64 AvabilableHigh:11; // Available for use by system software
UINT64 Nx:1; // 0 = Execute Code, 1 = No Code Execution
UINT64 Present : 1; // 0 = Not present in memory, 1 = Present in memory
UINT64 ReadWrite : 1; // 0 = Read-Only, 1= Read/Write
UINT64 UserSupervisor : 1; // 0 = Supervisor, 1=User
UINT64 WriteThrough : 1; // 0 = Write-Back caching, 1=Write-Through caching
UINT64 CacheDisabled : 1; // 0 = Cached, 1=Non-Cached
UINT64 Accessed : 1; // 0 = Not accessed, 1 = Accessed (set by CPU)
UINT64 Dirty : 1; // 0 = Not Dirty, 1 = written by processor on access to page
UINT64 MustBe1 : 1; // Must be 1
UINT64 Global : 1; // 0 = Not global page, 1 = global page TLB not cleared on CR3 write
UINT64 Available : 3; // Available for use by system software
UINT64 PAT : 1; //
UINT64 MustBeZero : 17; // Must be zero;
UINT64 PageTableBaseAddress : 22; // Page Table Base Address
UINT64 AvabilableHigh : 11; // Available for use by system software
UINT64 Nx : 1; // 0 = Execute Code, 1 = No Code Execution
} Bits;
UINT64 Uint64;
} PAGE_TABLE_1G_ENTRY;
#pragma pack()
#pragma pack()
typedef
EFI_STATUS
(*COALESCE_ENTRY) (
SWITCH_32_TO_64_CONTEXT *EntrypointContext,
SWITCH_64_TO_32_CONTEXT *ReturnContext
SWITCH_32_TO_64_CONTEXT *EntrypointContext,
SWITCH_64_TO_32_CONTEXT *ReturnContext
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -14,22 +14,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8 extra pages for PF handler.
//
#define EXTRA_PAGE_TABLE_PAGES 8
#define EXTRA_PAGE_TABLE_PAGES 8
#define PAGING_1G_ADDRESS_MASK_64 0x000FFFFFC0000000ull
#define PAGING_1G_ADDRESS_MASK_64 0x000FFFFFC0000000ull
//
// This capsule PEIM puts its private data at the start of the
// coalesced capsule. Here's the structure definition.
//
#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'P')
#define EFI_CAPSULE_PEIM_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('C', 'a', 'p', 'P')
#pragma pack(1)
typedef struct {
UINT64 Signature;
UINT64 CapsuleAllImageSize;
UINT64 CapsuleNumber;
UINT64 CapsuleOffset[1];
UINT64 Signature;
UINT64 CapsuleAllImageSize;
UINT64 CapsuleNumber;
UINT64 CapsuleOffset[1];
} EFI_CAPSULE_PEIM_PRIVATE_DATA;
#pragma pack()
@@ -37,34 +37,34 @@ typedef struct {
///
/// The physical start address of the resource region.
///
EFI_PHYSICAL_ADDRESS PhysicalStart;
EFI_PHYSICAL_ADDRESS PhysicalStart;
///
/// The number of bytes of the resource region.
///
UINT64 ResourceLength;
UINT64 ResourceLength;
} MEMORY_RESOURCE_DESCRIPTOR;
#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')
#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
#pragma pack(1)
#pragma pack(1)
typedef struct {
EFI_PHYSICAL_ADDRESS EntryPoint;
EFI_PHYSICAL_ADDRESS StackBufferBase;
UINT64 StackBufferLength;
EFI_PHYSICAL_ADDRESS JumpBuffer;
EFI_PHYSICAL_ADDRESS BlockListAddr;
EFI_PHYSICAL_ADDRESS MemoryResource;
EFI_PHYSICAL_ADDRESS MemoryBase64Ptr;
EFI_PHYSICAL_ADDRESS MemorySize64Ptr;
BOOLEAN Page1GSupport;
UINT64 AddressEncMask;
EFI_PHYSICAL_ADDRESS EntryPoint;
EFI_PHYSICAL_ADDRESS StackBufferBase;
UINT64 StackBufferLength;
EFI_PHYSICAL_ADDRESS JumpBuffer;
EFI_PHYSICAL_ADDRESS BlockListAddr;
EFI_PHYSICAL_ADDRESS MemoryResource;
EFI_PHYSICAL_ADDRESS MemoryBase64Ptr;
EFI_PHYSICAL_ADDRESS MemorySize64Ptr;
BOOLEAN Page1GSupport;
UINT64 AddressEncMask;
} SWITCH_32_TO_64_CONTEXT;
typedef struct {
UINT16 ReturnCs;
EFI_PHYSICAL_ADDRESS ReturnEntryPoint;
UINT64 ReturnStatus;
UINT16 ReturnCs;
EFI_PHYSICAL_ADDRESS ReturnEntryPoint;
UINT64 ReturnStatus;
//
// NOTICE:
// Be careful about the Base field of IA32_DESCRIPTOR
@@ -72,9 +72,9 @@ typedef struct {
// To extend new field for this structure, add it to
// right before this Gdtr field.
//
IA32_DESCRIPTOR Gdtr;
IA32_DESCRIPTOR Gdtr;
} SWITCH_64_TO_32_CONTEXT;
#pragma pack()
#pragma pack()
#endif
/**
@@ -105,11 +105,11 @@ typedef struct {
EFI_STATUS
EFIAPI
CapsuleDataCoalesce (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS *BlockListBuffer,
IN MEMORY_RESOURCE_DESCRIPTOR *MemoryResource,
IN OUT VOID **MemoryBase,
IN OUT UINTN *MemorySize
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS *BlockListBuffer,
IN MEMORY_RESOURCE_DESCRIPTOR *MemoryResource,
IN OUT VOID **MemoryBase,
IN OUT UINTN *MemorySize
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -14,28 +14,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DebugAgentLib.h>
#include "CommonHeader.h"
#define EXCEPTION_VECTOR_NUMBER 0x22
#define EXCEPTION_VECTOR_NUMBER 0x22
#define IA32_PG_P BIT0
#define IA32_PG_RW BIT1
#define IA32_PG_PS BIT7
#define IA32_PG_P BIT0
#define IA32_PG_RW BIT1
#define IA32_PG_PS BIT7
typedef struct _PAGE_FAULT_CONTEXT {
BOOLEAN Page1GSupport;
UINT64 PhyMask;
UINTN PageFaultBuffer;
UINTN PageFaultIndex;
UINT64 AddressEncMask;
BOOLEAN Page1GSupport;
UINT64 PhyMask;
UINTN PageFaultBuffer;
UINTN PageFaultIndex;
UINT64 AddressEncMask;
//
// Store the uplink information for each page being used.
//
UINT64 *PageFaultUplink[EXTRA_PAGE_TABLE_PAGES];
VOID *OriginalHandler;
UINT64 *PageFaultUplink[EXTRA_PAGE_TABLE_PAGES];
VOID *OriginalHandler;
} PAGE_FAULT_CONTEXT;
typedef struct _PAGE_FAULT_IDT_TABLE {
PAGE_FAULT_CONTEXT PageFaultContext;
IA32_IDT_GATE_DESCRIPTOR IdtEntryTable[EXCEPTION_VECTOR_NUMBER];
PAGE_FAULT_CONTEXT PageFaultContext;
IA32_IDT_GATE_DESCRIPTOR IdtEntryTable[EXCEPTION_VECTOR_NUMBER];
} PAGE_FAULT_IDT_TABLE;
/**
@@ -57,22 +57,23 @@ PageFaultHandlerHook (
**/
VOID
HookPageFaultHandler (
IN OUT IA32_IDT_GATE_DESCRIPTOR *IdtEntry,
IN OUT PAGE_FAULT_CONTEXT *PageFaultContext
IN OUT IA32_IDT_GATE_DESCRIPTOR *IdtEntry,
IN OUT PAGE_FAULT_CONTEXT *PageFaultContext
)
{
UINT32 RegEax;
UINT8 PhysicalAddressBits;
UINTN PageFaultHandlerHookAddress;
UINT32 RegEax;
UINT8 PhysicalAddressBits;
UINTN PageFaultHandlerHookAddress;
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000008) {
AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL);
PhysicalAddressBits = (UINT8) RegEax;
PhysicalAddressBits = (UINT8)RegEax;
} else {
PhysicalAddressBits = 36;
}
PageFaultContext->PhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
PageFaultContext->PhyMask = LShiftU64 (1, PhysicalAddressBits) - 1;
PageFaultContext->PhyMask &= (1ull << 48) - SIZE_4KB;
//
@@ -89,10 +90,11 @@ HookPageFaultHandler (
IdtEntry->Bits.Reserved_1 = 0;
if (PageFaultContext->Page1GSupport) {
PageFaultContext->PageFaultBuffer = (UINTN)(AsmReadCr3 () & PageFaultContext->PhyMask) + EFI_PAGES_TO_SIZE(2);
}else {
PageFaultContext->PageFaultBuffer = (UINTN)(AsmReadCr3 () & PageFaultContext->PhyMask) + EFI_PAGES_TO_SIZE(6);
PageFaultContext->PageFaultBuffer = (UINTN)(AsmReadCr3 () & PageFaultContext->PhyMask) + EFI_PAGES_TO_SIZE (2);
} else {
PageFaultContext->PageFaultBuffer = (UINTN)(AsmReadCr3 () & PageFaultContext->PhyMask) + EFI_PAGES_TO_SIZE (6);
}
PageFaultContext->PageFaultIndex = 0;
ZeroMem (PageFaultContext->PageFaultUplink, sizeof (PageFaultContext->PageFaultUplink));
}
@@ -106,15 +108,15 @@ HookPageFaultHandler (
**/
VOID
AcquirePage (
IN OUT PAGE_FAULT_CONTEXT *PageFaultContext,
IN OUT UINT64 *Uplink
IN OUT PAGE_FAULT_CONTEXT *PageFaultContext,
IN OUT UINT64 *Uplink
)
{
UINTN Address;
UINT64 AddressEncMask;
UINTN Address;
UINT64 AddressEncMask;
Address = PageFaultContext->PageFaultBuffer + EFI_PAGES_TO_SIZE (PageFaultContext->PageFaultIndex);
ZeroMem ((VOID *) Address, EFI_PAGES_TO_SIZE (1));
ZeroMem ((VOID *)Address, EFI_PAGES_TO_SIZE (1));
AddressEncMask = PageFaultContext->AddressEncMask;
@@ -122,14 +124,15 @@ AcquirePage (
// Cut the previous uplink if it exists and wasn't overwritten.
//
if ((PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] != NULL) &&
((*PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] & ~AddressEncMask & PageFaultContext->PhyMask) == Address)) {
((*PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] & ~AddressEncMask & PageFaultContext->PhyMask) == Address))
{
*PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] = 0;
}
//
// Link & Record the current uplink.
//
*Uplink = Address | AddressEncMask | IA32_PG_P | IA32_PG_RW;
*Uplink = Address | AddressEncMask | IA32_PG_P | IA32_PG_RW;
PageFaultContext->PageFaultUplink[PageFaultContext->PageFaultIndex] = Uplink;
PageFaultContext->PageFaultIndex = (PageFaultContext->PageFaultIndex + 1) % EXTRA_PAGE_TABLE_PAGES;
@@ -148,24 +151,24 @@ PageFaultHandler (
VOID
)
{
IA32_DESCRIPTOR Idtr;
PAGE_FAULT_CONTEXT *PageFaultContext;
UINT64 PhyMask;
UINT64 *PageTable;
UINT64 PFAddress;
UINTN PTIndex;
UINT64 AddressEncMask;
IA32_DESCRIPTOR Idtr;
PAGE_FAULT_CONTEXT *PageFaultContext;
UINT64 PhyMask;
UINT64 *PageTable;
UINT64 PFAddress;
UINTN PTIndex;
UINT64 AddressEncMask;
//
// Get the IDT Descriptor.
//
AsmReadIdtr ((IA32_DESCRIPTOR *) &Idtr);
AsmReadIdtr ((IA32_DESCRIPTOR *)&Idtr);
//
// Then get page fault context by IDT Descriptor.
//
PageFaultContext = (PAGE_FAULT_CONTEXT *) (UINTN) (Idtr.Base - sizeof (PAGE_FAULT_CONTEXT));
PhyMask = PageFaultContext->PhyMask;
AddressEncMask = PageFaultContext->AddressEncMask;
PageFaultContext = (PAGE_FAULT_CONTEXT *)(UINTN)(Idtr.Base - sizeof (PAGE_FAULT_CONTEXT));
PhyMask = PageFaultContext->PhyMask;
AddressEncMask = PageFaultContext->AddressEncMask;
PFAddress = AsmReadCr2 ();
DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n", PFAddress));
@@ -173,17 +176,19 @@ PageFaultHandler (
if (PFAddress >= PhyMask + SIZE_4KB) {
return PageFaultContext->OriginalHandler;
}
PFAddress &= PhyMask;
PageTable = (UINT64*)(UINTN)(AsmReadCr3 () & PhyMask);
PageTable = (UINT64 *)(UINTN)(AsmReadCr3 () & PhyMask);
PTIndex = BitFieldRead64 (PFAddress, 39, 47);
// PML4E
if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
AcquirePage (PageFaultContext, &PageTable[PTIndex]);
}
PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & ~AddressEncMask & PhyMask);
PTIndex = BitFieldRead64 (PFAddress, 30, 38);
PageTable = (UINT64 *)(UINTN)(PageTable[PTIndex] & ~AddressEncMask & PhyMask);
PTIndex = BitFieldRead64 (PFAddress, 30, 38);
// PDPTE
if (PageFaultContext->Page1GSupport) {
PageTable[PTIndex] = ((PFAddress | AddressEncMask) & ~((1ull << 30) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
@@ -191,8 +196,9 @@ PageFaultHandler (
if ((PageTable[PTIndex] & IA32_PG_P) == 0) {
AcquirePage (PageFaultContext, &PageTable[PTIndex]);
}
PageTable = (UINT64*)(UINTN)(PageTable[PTIndex] & ~AddressEncMask & PhyMask);
PTIndex = BitFieldRead64 (PFAddress, 21, 29);
PageTable = (UINT64 *)(UINTN)(PageTable[PTIndex] & ~AddressEncMask & PhyMask);
PTIndex = BitFieldRead64 (PFAddress, 21, 29);
// PD
PageTable[PTIndex] = ((PFAddress | AddressEncMask) & ~((1ull << 21) - 1)) | IA32_PG_P | IA32_PG_RW | IA32_PG_PS;
}
@@ -200,7 +206,6 @@ PageFaultHandler (
return NULL;
}
/**
The X64 entrypoint is used to process capsule in long mode then
return to 32-bit protected mode.
@@ -214,28 +219,28 @@ PageFaultHandler (
EFI_STATUS
EFIAPI
_ModuleEntryPoint (
SWITCH_32_TO_64_CONTEXT *EntrypointContext,
SWITCH_64_TO_32_CONTEXT *ReturnContext
)
SWITCH_32_TO_64_CONTEXT *EntrypointContext,
SWITCH_64_TO_32_CONTEXT *ReturnContext
)
{
EFI_STATUS Status;
IA32_DESCRIPTOR Ia32Idtr;
IA32_DESCRIPTOR X64Idtr;
PAGE_FAULT_IDT_TABLE PageFaultIdtTable;
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
EFI_STATUS Status;
IA32_DESCRIPTOR Ia32Idtr;
IA32_DESCRIPTOR X64Idtr;
PAGE_FAULT_IDT_TABLE PageFaultIdtTable;
IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
//
// Save the IA32 IDT Descriptor
//
AsmReadIdtr ((IA32_DESCRIPTOR *) &Ia32Idtr);
AsmReadIdtr ((IA32_DESCRIPTOR *)&Ia32Idtr);
//
// Setup X64 IDT table
//
ZeroMem (PageFaultIdtTable.IdtEntryTable, sizeof (IA32_IDT_GATE_DESCRIPTOR) * EXCEPTION_VECTOR_NUMBER);
X64Idtr.Base = (UINTN) PageFaultIdtTable.IdtEntryTable;
X64Idtr.Limit = (UINT16) (sizeof (IA32_IDT_GATE_DESCRIPTOR) * EXCEPTION_VECTOR_NUMBER - 1);
AsmWriteIdtr ((IA32_DESCRIPTOR *) &X64Idtr);
X64Idtr.Base = (UINTN)PageFaultIdtTable.IdtEntryTable;
X64Idtr.Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * EXCEPTION_VECTOR_NUMBER - 1);
AsmWriteIdtr ((IA32_DESCRIPTOR *)&X64Idtr);
//
// Setup the default CPU exception handlers
@@ -246,25 +251,25 @@ _ModuleEntryPoint (
//
// Hook page fault handler to handle >4G request.
//
PageFaultIdtTable.PageFaultContext.Page1GSupport = EntrypointContext->Page1GSupport;
PageFaultIdtTable.PageFaultContext.Page1GSupport = EntrypointContext->Page1GSupport;
PageFaultIdtTable.PageFaultContext.AddressEncMask = EntrypointContext->AddressEncMask;
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *) (X64Idtr.Base + (14 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)(X64Idtr.Base + (14 * sizeof (IA32_IDT_GATE_DESCRIPTOR)));
HookPageFaultHandler (IdtEntry, &(PageFaultIdtTable.PageFaultContext));
//
// Initialize Debug Agent to support source level debug
//
InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64, (VOID *) &Ia32Idtr, NULL);
InitializeDebugAgent (DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64, (VOID *)&Ia32Idtr, NULL);
//
// Call CapsuleDataCoalesce to process capsule.
//
Status = CapsuleDataCoalesce (
NULL,
(EFI_PHYSICAL_ADDRESS *) (UINTN) EntrypointContext->BlockListAddr,
(MEMORY_RESOURCE_DESCRIPTOR *) (UINTN) EntrypointContext->MemoryResource,
(VOID **) (UINTN) EntrypointContext->MemoryBase64Ptr,
(UINTN *) (UINTN) EntrypointContext->MemorySize64Ptr
(EFI_PHYSICAL_ADDRESS *)(UINTN)EntrypointContext->BlockListAddr,
(MEMORY_RESOURCE_DESCRIPTOR *)(UINTN)EntrypointContext->MemoryResource,
(VOID **)(UINTN)EntrypointContext->MemoryBase64Ptr,
(UINTN *)(UINTN)EntrypointContext->MemorySize64Ptr
);
ReturnContext->ReturnStatus = Status;
@@ -284,17 +289,17 @@ _ModuleEntryPoint (
//
// Restore IA32 IDT table
//
AsmWriteIdtr ((IA32_DESCRIPTOR *) &Ia32Idtr);
AsmWriteIdtr ((IA32_DESCRIPTOR *)&Ia32Idtr);
//
// Finish to coalesce capsule, and return to 32-bit mode.
//
AsmDisablePaging64 (
ReturnContext->ReturnCs,
(UINT32) ReturnContext->ReturnEntryPoint,
(UINT32) (UINTN) EntrypointContext,
(UINT32) (UINTN) ReturnContext,
(UINT32) (EntrypointContext->StackBufferBase + EntrypointContext->StackBufferLength)
(UINT32)ReturnContext->ReturnEntryPoint,
(UINT32)(UINTN)EntrypointContext,
(UINT32)(UINTN)ReturnContext,
(UINT32)(EntrypointContext->StackBufferBase + EntrypointContext->StackBufferLength)
);
//

View File

@@ -33,4 +33,3 @@ IsPersistAcrossResetCapsuleSupported (
//
return FeaturePcdGet (PcdSupportUpdateCapsuleReset) && !EfiAtRuntime ();
}

View File

@@ -24,10 +24,10 @@
**/
VOID
CapsuleCacheWriteBack (
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
)
{
EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc;
EFI_CAPSULE_BLOCK_DESCRIPTOR *Desc;
if (!EfiAtRuntime ()) {
Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;
@@ -54,4 +54,3 @@ CapsuleCacheWriteBack (
);
}
}

View File

@@ -25,8 +25,7 @@
**/
VOID
CapsuleCacheWriteBack (
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
)
{
}

View File

@@ -26,4 +26,3 @@ IsPersistAcrossResetCapsuleSupported (
{
return FeaturePcdGet (PcdSupportUpdateCapsuleReset);
}

View File

@@ -19,10 +19,10 @@ EFI_HANDLE mNewHandle = NULL;
//
// The times of calling UpdateCapsule ()
//
UINTN mTimes = 0;
UINTN mTimes = 0;
UINT32 mMaxSizePopulateCapsule = 0;
UINT32 mMaxSizeNonPopulateCapsule = 0;
UINT32 mMaxSizePopulateCapsule = 0;
UINT32 mMaxSizeNonPopulateCapsule = 0;
/**
Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
@@ -58,24 +58,24 @@ UINT32 mMaxSizeNonPopulateCapsule = 0;
EFI_STATUS
EFIAPI
UpdateCapsule (
IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
)
{
UINTN ArrayNumber;
EFI_STATUS Status;
EFI_CAPSULE_HEADER *CapsuleHeader;
BOOLEAN NeedReset;
BOOLEAN InitiateReset;
CHAR16 CapsuleVarName[30];
CHAR16 *TempVarName;
UINTN ArrayNumber;
EFI_STATUS Status;
EFI_CAPSULE_HEADER *CapsuleHeader;
BOOLEAN NeedReset;
BOOLEAN InitiateReset;
CHAR16 CapsuleVarName[30];
CHAR16 *TempVarName;
//
// Check if platform support Capsule In RAM or not.
// Platform could choose to drop CapsulePei/CapsuleX64 and do not support Capsule In RAM.
//
if (!PcdGetBool(PcdCapsuleInRamSupport)) {
if (!PcdGetBool (PcdCapsuleInRamSupport)) {
return EFI_UNSUPPORTED;
}
@@ -100,6 +100,7 @@ UpdateCapsule (
if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
return EFI_INVALID_PARAMETER;
}
//
// A capsule which has the CAPSULE_FLAGS_INITIATE_RESET flag must have
// CAPSULE_FLAGS_PERSIST_ACROSS_RESET set in its header as well.
@@ -111,9 +112,10 @@ UpdateCapsule (
//
// Check FMP capsule flag
//
if (CompareGuid(&CapsuleHeader->CapsuleGuid, &gEfiFmpCapsuleGuid)
&& (CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0 ) {
return EFI_INVALID_PARAMETER;
if ( CompareGuid (&CapsuleHeader->CapsuleGuid, &gEfiFmpCapsuleGuid)
&& ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0))
{
return EFI_INVALID_PARAMETER;
}
//
@@ -121,7 +123,7 @@ UpdateCapsule (
//
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
Status = SupportCapsuleImage (CapsuleHeader);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
}
@@ -131,7 +133,7 @@ UpdateCapsule (
// Walk through all capsules, record whether there is a capsule needs reset
// or initiate reset. And then process capsules which has no reset flag directly.
//
for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
//
// Here should be in the boot-time for non-reset capsule image
@@ -141,9 +143,10 @@ UpdateCapsule (
if (EfiAtRuntime () && !FeaturePcdGet (PcdSupportProcessCapsuleAtRuntime)) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = ProcessCapsuleImage(CapsuleHeader);
Status = ProcessCapsuleImage (CapsuleHeader);
}
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
} else {
@@ -166,7 +169,7 @@ UpdateCapsule (
// ScatterGatherList is only referenced if the capsules are defined to persist across
// system reset.
//
if (ScatterGatherList == (EFI_PHYSICAL_ADDRESS) (UINTN) NULL) {
if (ScatterGatherList == (EFI_PHYSICAL_ADDRESS)(UINTN)NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -183,7 +186,7 @@ UpdateCapsule (
// Construct variable name CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...
// if user calls UpdateCapsule multiple times.
//
StrCpyS (CapsuleVarName, sizeof(CapsuleVarName)/sizeof(CHAR16), EFI_CAPSULE_VARIABLE_NAME);
StrCpyS (CapsuleVarName, sizeof (CapsuleVarName)/sizeof (CHAR16), EFI_CAPSULE_VARIABLE_NAME);
TempVarName = CapsuleVarName + StrLen (CapsuleVarName);
if (mTimes > 0) {
UnicodeValueToStringS (
@@ -205,22 +208,23 @@ UpdateCapsule (
&gEfiCapsuleVendorGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
sizeof (UINTN),
(VOID *) &ScatterGatherList
(VOID *)&ScatterGatherList
);
if (!EFI_ERROR (Status)) {
//
// Variable has been set successfully, increase variable index.
//
mTimes++;
if(InitiateReset) {
//
// Firmware that encounters a capsule which has the CAPSULE_FLAGS_INITIATE_RESET Flag set in its header
// will initiate a reset of the platform which is compatible with the passed-in capsule request and will
// not return back to the caller.
//
EfiResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
}
//
// Variable has been set successfully, increase variable index.
//
mTimes++;
if (InitiateReset) {
//
// Firmware that encounters a capsule which has the CAPSULE_FLAGS_INITIATE_RESET Flag set in its header
// will initiate a reset of the platform which is compatible with the passed-in capsule request and will
// not return back to the caller.
//
EfiResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
}
}
return Status;
}
@@ -248,16 +252,16 @@ UpdateCapsule (
EFI_STATUS
EFIAPI
QueryCapsuleCapabilities (
IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
OUT UINT64 *MaxiumCapsuleSize,
OUT EFI_RESET_TYPE *ResetType
IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
IN UINTN CapsuleCount,
OUT UINT64 *MaxiumCapsuleSize,
OUT EFI_RESET_TYPE *ResetType
)
{
EFI_STATUS Status;
UINTN ArrayNumber;
EFI_CAPSULE_HEADER *CapsuleHeader;
BOOLEAN NeedReset;
EFI_STATUS Status;
UINTN ArrayNumber;
EFI_CAPSULE_HEADER *CapsuleHeader;
BOOLEAN NeedReset;
//
// Capsule Count can't be less than one.
@@ -269,7 +273,7 @@ QueryCapsuleCapabilities (
//
// Check whether input parameter is valid
//
if ((MaxiumCapsuleSize == NULL) ||(ResetType == NULL)) {
if ((MaxiumCapsuleSize == NULL) || (ResetType == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -285,6 +289,7 @@ QueryCapsuleCapabilities (
if ((CapsuleHeader->Flags & (CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE)) == CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) {
return EFI_INVALID_PARAMETER;
}
//
// A capsule which has the CAPSULE_FLAGS_INITIATE_RESET flag must have
// CAPSULE_FLAGS_PERSIST_ACROSS_RESET set in its header as well.
@@ -296,9 +301,10 @@ QueryCapsuleCapabilities (
//
// Check FMP capsule flag
//
if (CompareGuid(&CapsuleHeader->CapsuleGuid, &gEfiFmpCapsuleGuid)
&& (CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0 ) {
return EFI_INVALID_PARAMETER;
if ( CompareGuid (&CapsuleHeader->CapsuleGuid, &gEfiFmpCapsuleGuid)
&& ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0))
{
return EFI_INVALID_PARAMETER;
}
//
@@ -306,7 +312,7 @@ QueryCapsuleCapabilities (
//
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) {
Status = SupportCapsuleImage (CapsuleHeader);
if (EFI_ERROR(Status)) {
if (EFI_ERROR (Status)) {
return Status;
}
}
@@ -315,7 +321,7 @@ QueryCapsuleCapabilities (
//
// Find out whether there is any capsule defined to persist across system reset.
//
for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
CapsuleHeader = CapsuleHeaderArray[ArrayNumber];
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
NeedReset = TRUE;
@@ -325,25 +331,25 @@ QueryCapsuleCapabilities (
if (NeedReset) {
//
//Check if the platform supports update capsule across a system reset
// Check if the platform supports update capsule across a system reset
//
if (!IsPersistAcrossResetCapsuleSupported ()) {
return EFI_UNSUPPORTED;
}
*ResetType = EfiResetWarm;
*MaxiumCapsuleSize = (UINT64) mMaxSizePopulateCapsule;
*ResetType = EfiResetWarm;
*MaxiumCapsuleSize = (UINT64)mMaxSizePopulateCapsule;
} else {
//
// For non-reset capsule image.
//
*ResetType = EfiResetCold;
*MaxiumCapsuleSize = (UINT64) mMaxSizeNonPopulateCapsule;
*ResetType = EfiResetCold;
*MaxiumCapsuleSize = (UINT64)mMaxSizeNonPopulateCapsule;
}
return EFI_SUCCESS;
}
/**
This code installs UEFI capsule runtime service.
@@ -357,14 +363,14 @@ QueryCapsuleCapabilities (
EFI_STATUS
EFIAPI
CapsuleServiceInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
mMaxSizePopulateCapsule = PcdGet32(PcdMaxSizePopulateCapsule);
mMaxSizeNonPopulateCapsule = PcdGet32(PcdMaxSizeNonPopulateCapsule);
mMaxSizePopulateCapsule = PcdGet32 (PcdMaxSizePopulateCapsule);
mMaxSizeNonPopulateCapsule = PcdGet32 (PcdMaxSizeNonPopulateCapsule);
//
// When PEI phase is IA32, DXE phase is X64, it is possible that capsule data are
@@ -378,8 +384,8 @@ CapsuleServiceInitialize (
//
// Install capsule runtime services into UEFI runtime service tables.
//
gRT->UpdateCapsule = UpdateCapsule;
gRT->QueryCapsuleCapabilities = QueryCapsuleCapabilities;
gRT->UpdateCapsule = UpdateCapsule;
gRT->QueryCapsuleCapabilities = QueryCapsuleCapabilities;
//
// Install the Capsule Architectural Protocol on a new handle

View File

@@ -64,7 +64,7 @@ IsPersistAcrossResetCapsuleSupported (
**/
VOID
CapsuleCacheWriteBack (
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
IN EFI_PHYSICAL_ADDRESS ScatterGatherList
);
#endif

View File

@@ -28,7 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// 8 extra pages for PF handler.
//
#define EXTRA_PAGE_TABLE_PAGES 8
#define EXTRA_PAGE_TABLE_PAGES 8
/**
Allocate EfiReservedMemoryType below 4G memory address.
@@ -40,28 +40,28 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
@return Allocated Address for output.
**/
VOID*
VOID *
AllocateReservedMemoryBelow4G (
IN UINTN Size
IN UINTN Size
)
{
UINTN Pages;
EFI_PHYSICAL_ADDRESS Address;
EFI_STATUS Status;
VOID* Buffer;
VOID *Buffer;
Pages = EFI_SIZE_TO_PAGES (Size);
Pages = EFI_SIZE_TO_PAGES (Size);
Address = 0xffffffff;
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&Address
);
Status = gBS->AllocatePages (
AllocateMaxAddress,
EfiReservedMemoryType,
Pages,
&Address
);
ASSERT_EFI_ERROR (Status);
Buffer = (VOID *) (UINTN) Address;
Buffer = (VOID *)(UINTN)Address;
ZeroMem (Buffer, Size);
return Buffer;
@@ -77,16 +77,17 @@ AllocateReservedMemoryBelow4G (
VOID
EFIAPI
VariableLockCapsuleLongModeBufferVariable (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
//
// Mark EFI_CAPSULE_LONG_MODE_BUFFER_NAME variable to read-only if the Variable Lock protocol exists
//
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLock);
if (!EFI_ERROR (Status)) {
Status = VariableLock->RequestToLock (VariableLock, EFI_CAPSULE_LONG_MODE_BUFFER_NAME, &gEfiCapsuleVendorGuid);
ASSERT_EFI_ERROR (Status);
@@ -104,23 +105,23 @@ PrepareContextForCapsulePei (
VOID
)
{
UINTN ExtraPageTablePages;
UINT32 RegEax;
UINT32 RegEdx;
UINTN TotalPagesNum;
UINT8 PhysicalAddressBits;
UINT32 NumberOfPml4EntriesNeeded;
UINT32 NumberOfPdpEntriesNeeded;
BOOLEAN Page1GSupport;
EFI_CAPSULE_LONG_MODE_BUFFER LongModeBuffer;
EFI_STATUS Status;
VOID *Registration;
UINTN ExtraPageTablePages;
UINT32 RegEax;
UINT32 RegEdx;
UINTN TotalPagesNum;
UINT8 PhysicalAddressBits;
UINT32 NumberOfPml4EntriesNeeded;
UINT32 NumberOfPdpEntriesNeeded;
BOOLEAN Page1GSupport;
EFI_CAPSULE_LONG_MODE_BUFFER LongModeBuffer;
EFI_STATUS Status;
VOID *Registration;
//
// Calculate the size of page table, allocate the memory.
//
Page1GSupport = FALSE;
if (PcdGetBool(PcdUse1GPageTable)) {
if (PcdGetBool (PcdUse1GPageTable)) {
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
@@ -142,10 +143,10 @@ PrepareContextForCapsulePei (
//
if (PhysicalAddressBits <= 39 ) {
NumberOfPml4EntriesNeeded = 1;
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
NumberOfPdpEntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 30));
} else {
NumberOfPml4EntriesNeeded = (UINT32)LShiftU64 (1, (PhysicalAddressBits - 39));
NumberOfPdpEntriesNeeded = 512;
NumberOfPdpEntriesNeeded = 512;
}
if (!Page1GSupport) {
@@ -153,6 +154,7 @@ PrepareContextForCapsulePei (
} else {
TotalPagesNum = NumberOfPml4EntriesNeeded + 1;
}
TotalPagesNum += ExtraPageTablePages;
DEBUG ((DEBUG_INFO, "CapsuleRuntimeDxe X64 TotalPagesNum - 0x%x pages\n", TotalPagesNum));
@@ -174,20 +176,20 @@ PrepareContextForCapsulePei (
&LongModeBuffer
);
if (!EFI_ERROR (Status)) {
//
// Register callback function upon VariableLockProtocol
// to lock EFI_CAPSULE_LONG_MODE_BUFFER_NAME variable to avoid malicious code to update it.
//
EfiCreateProtocolNotifyEvent (
&gEdkiiVariableLockProtocolGuid,
TPL_CALLBACK,
VariableLockCapsuleLongModeBufferVariable,
NULL,
&Registration
);
//
// Register callback function upon VariableLockProtocol
// to lock EFI_CAPSULE_LONG_MODE_BUFFER_NAME variable to avoid malicious code to update it.
//
EfiCreateProtocolNotifyEvent (
&gEdkiiVariableLockProtocolGuid,
TPL_CALLBACK,
VariableLockCapsuleLongModeBufferVariable,
NULL,
&Registration
);
} else {
DEBUG ((DEBUG_ERROR, "FATAL ERROR: CapsuleLongModeBuffer cannot be saved: %r. Capsule in PEI may fail!\n", Status));
gBS->FreePages (LongModeBuffer.StackBaseAddress, EFI_SIZE_TO_PAGES (LongModeBuffer.StackSize));
DEBUG ((DEBUG_ERROR, "FATAL ERROR: CapsuleLongModeBuffer cannot be saved: %r. Capsule in PEI may fail!\n", Status));
gBS->FreePages (LongModeBuffer.StackBaseAddress, EFI_SIZE_TO_PAGES (LongModeBuffer.StackSize));
}
}
@@ -200,7 +202,7 @@ SaveLongModeContext (
VOID
)
{
if ((FeaturePcdGet(PcdSupportUpdateCapsuleReset)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
if ((FeaturePcdGet (PcdSupportUpdateCapsuleReset)) && (FeaturePcdGet (PcdDxeIplSwitchToLongMode))) {
//
// Allocate memory for Capsule IA32 PEIM, it will create page table to transfer to long mode to access capsule above 4GB.
//

View File

@@ -20,14 +20,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponent
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConPlatformComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConPlatformComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)ConPlatformComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)ConPlatformComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConPlatformDriverNameTable[] = {
{
"eng;en",
L"Platform Console Management Driver"
@@ -150,11 +149,11 @@ ConPlatformComponentNameGetDriverName (
EFI_STATUS
EFIAPI
ConPlatformComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;

View File

@@ -9,8 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "ConPlatform.h"
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
ConPlatformTextInDriverBindingSupported,
ConPlatformTextInDriverBindingStart,
ConPlatformTextInDriverBindingStop,
@@ -19,7 +18,7 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding = {
NULL
};
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
ConPlatformTextOutDriverBindingSupported,
ConPlatformTextOutDriverBindingStart,
ConPlatformTextOutDriverBindingStop,
@@ -42,12 +41,12 @@ EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding = {
**/
EFI_STATUS
EFIAPI
InitializeConPlatform(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
InitializeConPlatform (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
@@ -72,7 +71,6 @@ InitializeConPlatform(
return EFI_SUCCESS;
}
/**
Test to see if EFI_SIMPLE_TEXT_INPUT_PROTOCOL is supported on ControllerHandle.
@@ -100,7 +98,6 @@ ConPlatformTextInDriverBindingSupported (
);
}
/**
Test to see if EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is supported on ControllerHandle.
@@ -128,7 +125,6 @@ ConPlatformTextOutDriverBindingSupported (
);
}
/**
Test to see if the specified protocol is supported on ControllerHandle.
@@ -165,13 +161,14 @@ ConPlatformDriverBindingSupported (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Test to see if this device supports the specified Protocol.
//
Status = gBS->OpenProtocol (
ControllerHandle,
ProtocolGuid,
(VOID **) &Interface,
(VOID **)&Interface,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -211,15 +208,15 @@ ConPlatformDriverBindingSupported (
EFI_STATUS
EFIAPI
ConPlatformTextInDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;
BOOLEAN IsInConInVariable;
EFI_STATUS Status;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;
BOOLEAN IsInConInVariable;
//
// Get the Device Path Protocol so the environment variables can be updated
@@ -227,7 +224,7 @@ ConPlatformTextInDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath,
(VOID **)&DevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -235,13 +232,14 @@ ConPlatformTextInDriverBindingStart (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open the Simple Text Input Protocol BY_DRIVER
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSimpleTextInProtocolGuid,
(VOID **) &TextIn,
(VOID **)&TextIn,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -249,15 +247,16 @@ ConPlatformTextInDriverBindingStart (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Check if the device path is in ConIn Variable
//
IsInConInVariable = FALSE;
Status = ConPlatformUpdateDeviceVariable (
L"ConIn",
DevicePath,
Check
);
Status = ConPlatformUpdateDeviceVariable (
L"ConIn",
DevicePath,
Check
);
if (!EFI_ERROR (Status)) {
IsInConInVariable = TRUE;
}
@@ -316,9 +315,9 @@ ConPlatformTextInDriverBindingStart (
EFI_STATUS
EFIAPI
ConPlatformTextOutDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
@@ -336,7 +335,7 @@ ConPlatformTextOutDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath,
(VOID **)&DevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -344,13 +343,14 @@ ConPlatformTextOutDriverBindingStart (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open the Simple Text Output Protocol BY_DRIVER
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSimpleTextOutProtocolGuid,
(VOID **) &TextOut,
(VOID **)&TextOut,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -358,25 +358,26 @@ ConPlatformTextOutDriverBindingStart (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Check if the device path is in ConOut & ErrOut Variable
//
IsInConOutVariable = FALSE;
Status = ConPlatformUpdateDeviceVariable (
L"ConOut",
DevicePath,
Check
);
Status = ConPlatformUpdateDeviceVariable (
L"ConOut",
DevicePath,
Check
);
if (!EFI_ERROR (Status)) {
IsInConOutVariable = TRUE;
}
IsInErrOutVariable = FALSE;
Status = ConPlatformUpdateDeviceVariable (
L"ErrOut",
DevicePath,
Check
);
Status = ConPlatformUpdateDeviceVariable (
L"ErrOut",
DevicePath,
Check
);
if (!EFI_ERROR (Status)) {
IsInErrOutVariable = TRUE;
}
@@ -407,13 +408,14 @@ ConPlatformTextOutDriverBindingStart (
//
if (IsInConOutVariable) {
NeedClose = FALSE;
Status = gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiConsoleOutDeviceGuid,
NULL,
NULL
);
Status = gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiConsoleOutDeviceGuid,
NULL,
NULL
);
}
//
// If the device path is an instance in the ErrOut environment variable,
// then install EfiStandardErrorDeviceGuid onto ControllerHandle
@@ -472,7 +474,7 @@ ConPlatformTextInDriverBindingStop (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath,
(VOID **)&DevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -513,7 +515,6 @@ ConPlatformTextInDriverBindingStop (
return EFI_SUCCESS;
}
/**
Stop this driver on ControllerHandle by removing Console Out Devcice GUID
and closing the Simple Text Output protocol on ControllerHandle.
@@ -546,7 +547,7 @@ ConPlatformTextOutDriverBindingStop (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath,
(VOID **)&DevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -586,16 +587,15 @@ ConPlatformTextOutDriverBindingStop (
// Close the Simple Text Output Protocol
//
gBS->CloseProtocol (
ControllerHandle,
&gEfiSimpleTextOutProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiSimpleTextOutProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
return EFI_SUCCESS;
}
/**
Uninstall the specified protocol.
@@ -631,7 +631,7 @@ ConPlatformUnInstallProtocol (
);
}
return ;
return;
}
/**
@@ -650,15 +650,15 @@ ConPlatformUnInstallProtocol (
**/
VOID *
ConPlatformGetVariable (
IN CHAR16 *Name
IN CHAR16 *Name
)
{
EFI_STATUS Status;
VOID *Buffer;
UINTN BufferSize;
BufferSize = 0;
Buffer = NULL;
BufferSize = 0;
Buffer = NULL;
//
// Test to see if the variable exists. If it doesn't, return NULL.
@@ -679,6 +679,7 @@ ConPlatformGetVariable (
if (Buffer == NULL) {
return NULL;
}
//
// Read variable into the allocated buffer.
//
@@ -722,9 +723,10 @@ IsGopSibling (
EFI_DEVICE_PATH_PROTOCOL *NodeRight;
for (NodeLeft = Left; !IsDevicePathEndType (NodeLeft); NodeLeft = NextDevicePathNode (NodeLeft)) {
if ((DevicePathType (NodeLeft) == ACPI_DEVICE_PATH && DevicePathSubType (NodeLeft) == ACPI_ADR_DP) ||
(DevicePathType (NodeLeft) == HARDWARE_DEVICE_PATH && DevicePathSubType (NodeLeft) == HW_CONTROLLER_DP &&
DevicePathType (NextDevicePathNode (NodeLeft)) == ACPI_DEVICE_PATH && DevicePathSubType (NextDevicePathNode (NodeLeft)) == ACPI_ADR_DP)) {
if (((DevicePathType (NodeLeft) == ACPI_DEVICE_PATH) && (DevicePathSubType (NodeLeft) == ACPI_ADR_DP)) ||
((DevicePathType (NodeLeft) == HARDWARE_DEVICE_PATH) && (DevicePathSubType (NodeLeft) == HW_CONTROLLER_DP) &&
(DevicePathType (NextDevicePathNode (NodeLeft)) == ACPI_DEVICE_PATH) && (DevicePathSubType (NextDevicePathNode (NodeLeft)) == ACPI_ADR_DP)))
{
break;
}
}
@@ -734,9 +736,10 @@ IsGopSibling (
}
for (NodeRight = Right; !IsDevicePathEndType (NodeRight); NodeRight = NextDevicePathNode (NodeRight)) {
if ((DevicePathType (NodeRight) == ACPI_DEVICE_PATH && DevicePathSubType (NodeRight) == ACPI_ADR_DP) ||
(DevicePathType (NodeRight) == HARDWARE_DEVICE_PATH && DevicePathSubType (NodeRight) == HW_CONTROLLER_DP &&
DevicePathType (NextDevicePathNode (NodeRight)) == ACPI_DEVICE_PATH && DevicePathSubType (NextDevicePathNode (NodeRight)) == ACPI_ADR_DP)) {
if (((DevicePathType (NodeRight) == ACPI_DEVICE_PATH) && (DevicePathSubType (NodeRight) == ACPI_ADR_DP)) ||
((DevicePathType (NodeRight) == HARDWARE_DEVICE_PATH) && (DevicePathSubType (NodeRight) == HW_CONTROLLER_DP) &&
(DevicePathType (NextDevicePathNode (NodeRight)) == ACPI_DEVICE_PATH) && (DevicePathSubType (NextDevicePathNode (NodeRight)) == ACPI_ADR_DP)))
{
break;
}
}
@@ -745,11 +748,11 @@ IsGopSibling (
return FALSE;
}
if (((UINTN) NodeLeft - (UINTN) Left) != ((UINTN) NodeRight - (UINTN) Right)) {
if (((UINTN)NodeLeft - (UINTN)Left) != ((UINTN)NodeRight - (UINTN)Right)) {
return FALSE;
}
return (BOOLEAN) (CompareMem (Left, Right, (UINTN) NodeLeft - (UINTN) Left) == 0);
return (BOOLEAN)(CompareMem (Left, Right, (UINTN)NodeLeft - (UINTN)Left) == 0);
}
/**
@@ -765,8 +768,8 @@ IsGopSibling (
**/
BOOLEAN
MatchUsbClass (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN USB_CLASS_DEVICE_PATH *UsbClass
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN USB_CLASS_DEVICE_PATH *UsbClass
)
{
EFI_STATUS Status;
@@ -777,7 +780,8 @@ MatchUsbClass (
UINT8 DeviceProtocol;
if ((DevicePathType (UsbClass) != MESSAGING_DEVICE_PATH) ||
(DevicePathSubType (UsbClass) != MSG_USB_CLASS_DP)){
(DevicePathSubType (UsbClass) != MSG_USB_CLASS_DP))
{
return FALSE;
}
@@ -790,12 +794,14 @@ MatchUsbClass (
}
if ((UsbClass->VendorId != 0xffff) &&
(UsbClass->VendorId != DevDesc.IdVendor)) {
(UsbClass->VendorId != DevDesc.IdVendor))
{
return FALSE;
}
if ((UsbClass->ProductId != 0xffff) &&
(UsbClass->ProductId != DevDesc.IdProduct)) {
(UsbClass->ProductId != DevDesc.IdProduct))
{
return FALSE;
}
@@ -821,17 +827,20 @@ MatchUsbClass (
// Check Class, SubClass and Protocol.
//
if ((UsbClass->DeviceClass != 0xff) &&
(UsbClass->DeviceClass != DeviceClass)) {
(UsbClass->DeviceClass != DeviceClass))
{
return FALSE;
}
if ((UsbClass->DeviceSubClass != 0xff) &&
(UsbClass->DeviceSubClass != DeviceSubClass)) {
(UsbClass->DeviceSubClass != DeviceSubClass))
{
return FALSE;
}
if ((UsbClass->DeviceProtocol != 0xff) &&
(UsbClass->DeviceProtocol != DeviceProtocol)) {
(UsbClass->DeviceProtocol != DeviceProtocol))
{
return FALSE;
}
@@ -851,23 +860,24 @@ MatchUsbClass (
**/
BOOLEAN
MatchUsbWwid (
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN USB_WWID_DEVICE_PATH *UsbWwid
IN EFI_USB_IO_PROTOCOL *UsbIo,
IN USB_WWID_DEVICE_PATH *UsbWwid
)
{
EFI_STATUS Status;
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
EFI_USB_INTERFACE_DESCRIPTOR IfDesc;
UINT16 *LangIdTable;
UINT16 TableSize;
UINT16 Index;
CHAR16 *CompareStr;
UINTN CompareLen;
CHAR16 *SerialNumberStr;
UINTN Length;
EFI_STATUS Status;
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
EFI_USB_INTERFACE_DESCRIPTOR IfDesc;
UINT16 *LangIdTable;
UINT16 TableSize;
UINT16 Index;
CHAR16 *CompareStr;
UINTN CompareLen;
CHAR16 *SerialNumberStr;
UINTN Length;
if ((DevicePathType (UsbWwid) != MESSAGING_DEVICE_PATH) ||
(DevicePathSubType (UsbWwid) != MSG_USB_WWID_DP)) {
(DevicePathSubType (UsbWwid) != MSG_USB_WWID_DP))
{
return FALSE;
}
@@ -878,8 +888,10 @@ MatchUsbWwid (
if (EFI_ERROR (Status)) {
return FALSE;
}
if ((DevDesc.IdVendor != UsbWwid->VendorId) ||
(DevDesc.IdProduct != UsbWwid->ProductId)) {
(DevDesc.IdProduct != UsbWwid->ProductId))
{
return FALSE;
}
@@ -890,6 +902,7 @@ MatchUsbWwid (
if (EFI_ERROR (Status)) {
return FALSE;
}
if (IfDesc.InterfaceNumber != UsbWwid->InterfaceNumber) {
return FALSE;
}
@@ -904,9 +917,9 @@ MatchUsbWwid (
//
// Get all supported languages.
//
TableSize = 0;
TableSize = 0;
LangIdTable = NULL;
Status = UsbIo->UsbGetSupportedLanguages (UsbIo, &LangIdTable, &TableSize);
Status = UsbIo->UsbGetSupportedLanguages (UsbIo, &LangIdTable, &TableSize);
if (EFI_ERROR (Status) || (TableSize == 0) || (LangIdTable == NULL)) {
return FALSE;
}
@@ -914,7 +927,7 @@ MatchUsbWwid (
//
// Serial number in USB WWID device path is the last 64-or-less UTF-16 characters.
//
CompareStr = (CHAR16 *) (UINTN) (UsbWwid + 1);
CompareStr = (CHAR16 *)(UINTN)(UsbWwid + 1);
CompareLen = (DevicePathNodeLength (UsbWwid) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16);
if (CompareStr[CompareLen - 1] == L'\0') {
CompareLen--;
@@ -925,19 +938,20 @@ MatchUsbWwid (
//
for (Index = 0; Index < TableSize / sizeof (UINT16); Index++) {
SerialNumberStr = NULL;
Status = UsbIo->UsbGetStringDescriptor (
UsbIo,
LangIdTable[Index],
DevDesc.StrSerialNumber,
&SerialNumberStr
);
Status = UsbIo->UsbGetStringDescriptor (
UsbIo,
LangIdTable[Index],
DevDesc.StrSerialNumber,
&SerialNumberStr
);
if (EFI_ERROR (Status) || (SerialNumberStr == NULL)) {
continue;
}
Length = StrLen (SerialNumberStr);
if ((Length >= CompareLen) &&
(CompareMem (SerialNumberStr + Length - CompareLen, CompareStr, CompareLen * sizeof (CHAR16)) == 0)) {
(CompareMem (SerialNumberStr + Length - CompareLen, CompareStr, CompareLen * sizeof (CHAR16)) == 0))
{
FreePool (SerialNumberStr);
return TRUE;
}
@@ -971,13 +985,15 @@ MatchUsbShortformDevicePath (
EFI_HANDLE Handle;
for ( ShortformNode = ShortformPath
; !IsDevicePathEnd (ShortformNode)
; ShortformNode = NextDevicePathNode (ShortformNode)
) {
; !IsDevicePathEnd (ShortformNode)
; ShortformNode = NextDevicePathNode (ShortformNode)
)
{
if ((DevicePathType (ShortformNode) == MESSAGING_DEVICE_PATH) &&
((DevicePathSubType (ShortformNode) == MSG_USB_CLASS_DP) ||
(DevicePathSubType (ShortformNode) == MSG_USB_WWID_DP))
) {
)
{
break;
}
}
@@ -992,15 +1008,17 @@ MatchUsbShortformDevicePath (
//
// Compare the parent device path when the ShortformPath doesn't start with short-form node.
//
ParentDevicePathSize = (UINTN) ShortformNode - (UINTN) ShortformPath;
ParentDevicePathSize = (UINTN)ShortformNode - (UINTN)ShortformPath;
RemainingDevicePath = FullPath;
Status = gBS->LocateDevicePath (&gEfiUsbIoProtocolGuid, &RemainingDevicePath, &Handle);
if (EFI_ERROR (Status)) {
return FALSE;
}
if (ParentDevicePathSize != 0) {
if ((ParentDevicePathSize > (UINTN) RemainingDevicePath - (UINTN) FullPath) ||
(CompareMem (FullPath, ShortformPath, ParentDevicePathSize) != 0)) {
if ((ParentDevicePathSize > (UINTN)RemainingDevicePath - (UINTN)FullPath) ||
(CompareMem (FullPath, ShortformPath, ParentDevicePathSize) != 0))
{
return FALSE;
}
}
@@ -1008,10 +1026,10 @@ MatchUsbShortformDevicePath (
//
// Compar the USB layer.
//
Status = gBS->HandleProtocol(
Status = gBS->HandleProtocol (
Handle,
&gEfiUsbIoProtocolGuid,
(VOID **) &UsbIo
(VOID **)&UsbIo
);
ASSERT_EFI_ERROR (Status);
@@ -1071,15 +1089,16 @@ ConPlatformMatchDevicePaths (
TempDevicePath1 = NULL;
DevicePath = Multi;
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
DevicePath = Multi;
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
//
// Search for the match of 'Single' in 'Multi'
//
while (DevicePathInst != NULL) {
if ((CompareMem (Single, DevicePathInst, Size) == 0) ||
IsGopSibling (Single, DevicePathInst) || MatchUsbShortformDevicePath (Single, DevicePathInst)) {
IsGopSibling (Single, DevicePathInst) || MatchUsbShortformDevicePath (Single, DevicePathInst))
{
if (!Delete) {
//
// If Delete is FALSE, return EFI_SUCCESS if Single is found in Multi.
@@ -1100,6 +1119,7 @@ ConPlatformMatchDevicePaths (
if (TempDevicePath1 != NULL) {
FreePool (TempDevicePath1);
}
TempDevicePath1 = TempDevicePath2;
}
}
@@ -1134,9 +1154,9 @@ ConPlatformMatchDevicePaths (
**/
EFI_STATUS
ConPlatformUpdateDeviceVariable (
IN CHAR16 *VariableName,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONPLATFORM_VAR_OPERATION Operation
IN CHAR16 *VariableName,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONPLATFORM_VAR_OPERATION Operation
)
{
EFI_STATUS Status;
@@ -1176,10 +1196,11 @@ ConPlatformUpdateDeviceVariable (
return Status;
}
//
// We reach here to append a device path that does not exist in variable.
//
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
NewVariableDevicePath = AppendDevicePathInstance (
VariableDevicePath,
DevicePath
@@ -1187,7 +1208,6 @@ ConPlatformUpdateDeviceVariable (
if (NewVariableDevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
}
} else {
//
// We reach here to remove DevicePath from the environment variable that
@@ -1239,22 +1259,23 @@ ConPlatformUpdateDeviceVariable (
**/
BOOLEAN
ConPlatformUpdateGopCandidate (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_STATUS Status;
EFI_HANDLE PciHandle;
EFI_HANDLE GopHandle;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EFI_STATUS Status;
EFI_HANDLE PciHandle;
EFI_HANDLE GopHandle;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
//
// Check whether it's a GOP device.
//
TempDevicePath = DevicePath;
Status = gBS->LocateDevicePath (&gEfiGraphicsOutputProtocolGuid, &TempDevicePath, &GopHandle);
Status = gBS->LocateDevicePath (&gEfiGraphicsOutputProtocolGuid, &TempDevicePath, &GopHandle);
if (EFI_ERROR (Status)) {
return FALSE;
}
//
// Get the parent PciIo handle in order to find all the children
//
@@ -1262,10 +1283,12 @@ ConPlatformUpdateGopCandidate (
if (EFI_ERROR (Status)) {
return FALSE;
}
TempDevicePath = EfiBootManagerGetGopDevicePath (PciHandle);
if (TempDevicePath != NULL) {
ConPlatformUpdateDeviceVariable (L"ConOutDev", TempDevicePath, Append);
ConPlatformUpdateDeviceVariable (L"ErrOutDev", TempDevicePath, Append);
}
return TRUE;
}

View File

@@ -36,13 +36,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Driver Binding Externs
//
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextInDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConPlatformTextOutDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConPlatformComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConPlatformComponentName2;
typedef enum {
Check,
@@ -129,9 +128,9 @@ ConPlatformTextOutDriverBindingSupported (
EFI_STATUS
EFIAPI
ConPlatformTextInDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Handle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Handle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -156,9 +155,9 @@ ConPlatformTextInDriverBindingStart (
EFI_STATUS
EFIAPI
ConPlatformTextOutDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Handle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Handle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -235,7 +234,7 @@ ConPlatformUnInstallProtocol (
**/
VOID *
ConPlatformGetVariable (
IN CHAR16 *Name
IN CHAR16 *Name
);
/**
@@ -282,14 +281,15 @@ ConPlatformMatchDevicePaths (
**/
EFI_STATUS
ConPlatformUpdateDeviceVariable (
IN CHAR16 *VariableName,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONPLATFORM_VAR_OPERATION Operation
IN CHAR16 *VariableName,
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONPLATFORM_VAR_OPERATION Operation
);
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -332,7 +332,6 @@ ConPlatformComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -394,11 +393,11 @@ ConPlatformComponentNameGetDriverName (
EFI_STATUS
EFIAPI
ConPlatformComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
@@ -413,7 +412,7 @@ ConPlatformComponentNameGetControllerName (
**/
BOOLEAN
ConPlatformUpdateGopCandidate (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
#endif

View File

@@ -20,13 +20,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComp
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConInComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)ConSplitterConInComponentNameGetControllerName,
"en"
};
//
// EFI Component Name Protocol
//
@@ -39,16 +38,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePoi
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterSimplePointerComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)ConSplitterSimplePointerComponentNameGetControllerName,
"en"
};
//
// EFI Component Name Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName = {
ConSplitterComponentNameGetDriverName,
ConSplitterAbsolutePointerComponentNameGetControllerName,
"eng"
@@ -57,9 +56,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePo
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterAbsolutePointerComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)ConSplitterAbsolutePointerComponentNameGetControllerName,
"en"
};
@@ -75,13 +74,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutCom
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterConOutComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)ConSplitterConOutComponentNameGetControllerName,
"en"
};
//
// EFI Component Name Protocol
//
@@ -94,17 +92,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrCom
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ConSplitterStdErrComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)ConSplitterComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)ConSplitterStdErrComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTable[] = {
{
"eng;en",
(CHAR16 *) L"Console Splitter Driver"
(CHAR16 *)L"Console Splitter Driver"
},
{
NULL,
@@ -112,10 +109,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterDriverNameTab
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControllerNameTable[] = {
{
"eng;en",
(CHAR16 *) L"Primary Console Input Device"
(CHAR16 *)L"Primary Console Input Device"
},
{
NULL,
@@ -123,10 +120,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConInControll
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointerControllerNameTable[] = {
{
"eng;en",
(CHAR16 *) L"Primary Simple Pointer Device"
(CHAR16 *)L"Primary Simple Pointer Device"
},
{
NULL,
@@ -134,7 +131,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterSimplePointer
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePointerControllerNameTable[] = {
{
"eng;en",
(CHAR16 *)L"Primary Absolute Pointer Device"
@@ -145,10 +142,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterAbsolutePoint
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControllerNameTable[] = {
{
"eng;en",
(CHAR16 *) L"Primary Console Output Device"
(CHAR16 *)L"Primary Console Output Device"
},
{
NULL,
@@ -156,10 +153,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterConOutControl
}
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mConSplitterStdErrControllerNameTable[] = {
{
"eng;en",
(CHAR16 *) L"Primary Standard Error Device"
(CHAR16 *)L"Primary Standard Error Device"
},
{
NULL,
@@ -252,14 +249,14 @@ ConSplitterComponentNameGetDriverName (
**/
EFI_STATUS
ConSplitterTestControllerHandles (
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE DriverBindingHandle,
IN CONST EFI_GUID *ProtocolGuid,
IN EFI_HANDLE ChildHandle,
IN CONST EFI_GUID *ConsumsedGuid
IN CONST EFI_HANDLE ControllerHandle,
IN CONST EFI_HANDLE DriverBindingHandle,
IN CONST EFI_GUID *ProtocolGuid,
IN EFI_HANDLE ChildHandle,
IN CONST EFI_GUID *ConsumsedGuid
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// here ChildHandle is not an Optional parameter.
@@ -363,14 +360,14 @@ ConSplitterTestControllerHandles (
EFI_STATUS
EFIAPI
ConSplitterConInComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = ConSplitterTestControllerHandles (
ControllerHandle,
@@ -463,14 +460,14 @@ ConSplitterConInComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = ConSplitterTestControllerHandles (
ControllerHandle,
@@ -492,7 +489,6 @@ ConSplitterSimplePointerComponentNameGetControllerName (
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by an EFI Driver.
@@ -540,14 +536,14 @@ ConSplitterSimplePointerComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = ConSplitterTestControllerHandles (
ControllerHandle,
@@ -640,14 +636,14 @@ ConSplitterAbsolutePointerComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterConOutComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = ConSplitterTestControllerHandles (
ControllerHandle,
@@ -740,14 +736,14 @@ ConSplitterConOutComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterStdErrComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = ConSplitterTestControllerHandles (
ControllerHandle,

File diff suppressed because it is too large Load Diff

View File

@@ -41,60 +41,57 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Driver Binding Externs
//
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConInDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConInComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConInComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterSimplePointerDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterSimplePointerComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterSimplePointerComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterAbsolutePointerDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterAbsolutePointerComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterAbsolutePointerComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterConOutDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterConOutComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterConOutComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gConSplitterStdErrDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gConSplitterStdErrComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gConSplitterStdErrComponentName2;
//
// These definitions were in the old Hii protocol, but are not in the new UEFI
// version. So they are defined locally.
//
#define UNICODE_NARROW_CHAR 0xFFF0
#define UNICODE_WIDE_CHAR 0xFFF1
#define UNICODE_NARROW_CHAR 0xFFF0
#define UNICODE_WIDE_CHAR 0xFFF1
//
// Private Data Structures
//
#define CONSOLE_SPLITTER_ALLOC_UNIT 32
typedef struct {
UINTN Column;
UINTN Row;
UINTN Column;
UINTN Row;
} CONSOLE_OUT_MODE;
typedef struct {
UINTN Columns;
UINTN Rows;
UINTN Columns;
UINTN Rows;
} TEXT_OUT_SPLITTER_QUERY_DATA;
#define KEY_STATE_VALID_EXPOSED (EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED)
#define KEY_STATE_VALID_EXPOSED (EFI_TOGGLE_STATE_VALID | EFI_KEY_STATE_EXPOSED)
#define TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'n')
#define TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'n')
//
// Private data for Text In Ex Splitter Notify
//
typedef struct _TEXT_IN_EX_SPLITTER_NOTIFY {
UINTN Signature;
VOID **NotifyHandleList;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
UINTN Signature;
VOID **NotifyHandleList;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
} TEXT_IN_EX_SPLITTER_NOTIFY;
#define TEXT_IN_EX_SPLITTER_NOTIFY_FROM_THIS(a) \
@@ -104,55 +101,54 @@ typedef struct _TEXT_IN_EX_SPLITTER_NOTIFY {
TEXT_IN_EX_SPLITTER_NOTIFY_SIGNATURE \
)
#define TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'p')
#define TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'i', 'S', 'p')
//
// Private data for the Console In splitter
//
typedef struct {
UINT64 Signature;
EFI_HANDLE VirtualHandle;
UINT64 Signature;
EFI_HANDLE VirtualHandle;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL TextIn;
UINTN CurrentNumberOfConsoles;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL **TextInList;
UINTN TextInListCount;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL TextIn;
UINTN CurrentNumberOfConsoles;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL **TextInList;
UINTN TextInListCount;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL TextInEx;
UINTN CurrentNumberOfExConsoles;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL **TextInExList;
UINTN TextInExListCount;
LIST_ENTRY NotifyList;
EFI_KEY_DATA *KeyQueue;
UINTN CurrentNumberOfKeys;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL TextInEx;
UINTN CurrentNumberOfExConsoles;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL **TextInExList;
UINTN TextInExListCount;
LIST_ENTRY NotifyList;
EFI_KEY_DATA *KeyQueue;
UINTN CurrentNumberOfKeys;
//
// It will be initialized and synced between console input devices
// for toggle state sync.
//
EFI_KEY_TOGGLE_STATE PhysicalKeyToggleState;
EFI_KEY_TOGGLE_STATE PhysicalKeyToggleState;
//
// It will be initialized and used to record if virtual KeyState
// has been required to be exposed.
//
BOOLEAN VirtualKeyStateExported;
BOOLEAN VirtualKeyStateExported;
EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
EFI_SIMPLE_POINTER_MODE SimplePointerMode;
UINTN CurrentNumberOfPointers;
EFI_SIMPLE_POINTER_PROTOCOL **PointerList;
UINTN PointerListCount;
EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
EFI_SIMPLE_POINTER_MODE SimplePointerMode;
UINTN CurrentNumberOfPointers;
EFI_SIMPLE_POINTER_PROTOCOL **PointerList;
UINTN PointerListCount;
EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointer;
EFI_ABSOLUTE_POINTER_MODE AbsolutePointerMode;
UINTN CurrentNumberOfAbsolutePointers;
EFI_ABSOLUTE_POINTER_PROTOCOL **AbsolutePointerList;
UINTN AbsolutePointerListCount;
BOOLEAN AbsoluteInputEventSignalState;
EFI_ABSOLUTE_POINTER_PROTOCOL AbsolutePointer;
EFI_ABSOLUTE_POINTER_MODE AbsolutePointerMode;
UINTN CurrentNumberOfAbsolutePointers;
EFI_ABSOLUTE_POINTER_PROTOCOL **AbsolutePointerList;
UINTN AbsolutePointerListCount;
BOOLEAN AbsoluteInputEventSignalState;
BOOLEAN KeyEventSignalState;
BOOLEAN InputEventSignalState;
EFI_EVENT ConnectConInEvent;
BOOLEAN KeyEventSignalState;
BOOLEAN InputEventSignalState;
EFI_EVENT ConnectConInEvent;
} TEXT_IN_SPLITTER_PRIVATE_DATA;
#define TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
@@ -182,44 +178,42 @@ typedef struct {
TEXT_IN_SPLITTER_PRIVATE_DATA_SIGNATURE \
)
#define TEXT_OUT_SPLITTER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'o', 'S', 'p')
typedef struct {
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
} TEXT_OUT_AND_GOP_DATA;
//
// Private data for the Console Out splitter
//
typedef struct {
UINT64 Signature;
EFI_HANDLE VirtualHandle;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL TextOut;
EFI_SIMPLE_TEXT_OUTPUT_MODE TextOutMode;
UINT64 Signature;
EFI_HANDLE VirtualHandle;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL TextOut;
EFI_SIMPLE_TEXT_OUTPUT_MODE TextOutMode;
EFI_UGA_DRAW_PROTOCOL UgaDraw;
UINT32 UgaHorizontalResolution;
UINT32 UgaVerticalResolution;
UINT32 UgaColorDepth;
UINT32 UgaRefreshRate;
EFI_UGA_DRAW_PROTOCOL UgaDraw;
UINT32 UgaHorizontalResolution;
UINT32 UgaVerticalResolution;
UINT32 UgaColorDepth;
UINT32 UgaRefreshRate;
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GraphicsOutputModeBuffer;
UINTN CurrentNumberOfGraphicsOutput;
UINTN CurrentNumberOfUgaDraw;
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *GraphicsOutputModeBuffer;
UINTN CurrentNumberOfGraphicsOutput;
UINTN CurrentNumberOfUgaDraw;
UINTN CurrentNumberOfConsoles;
TEXT_OUT_AND_GOP_DATA *TextOutList;
UINTN TextOutListCount;
TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
UINTN TextOutQueryDataCount;
INT32 *TextOutModeMap;
BOOLEAN AddingConOutDevice;
UINTN CurrentNumberOfConsoles;
TEXT_OUT_AND_GOP_DATA *TextOutList;
UINTN TextOutListCount;
TEXT_OUT_SPLITTER_QUERY_DATA *TextOutQueryData;
UINTN TextOutQueryDataCount;
INT32 *TextOutModeMap;
BOOLEAN AddingConOutDevice;
} TEXT_OUT_SPLITTER_PRIVATE_DATA;
#define TEXT_OUT_SPLITTER_PRIVATE_DATA_FROM_THIS(a) \
@@ -272,8 +266,8 @@ typedef struct {
EFI_STATUS
EFIAPI
ConSplitterDriverEntry (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -289,7 +283,7 @@ ConSplitterDriverEntry (
**/
EFI_STATUS
ConSplitterTextInConstructor (
TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate
TEXT_IN_SPLITTER_PRIVATE_DATA *ConInPrivate
);
/**
@@ -304,10 +298,9 @@ ConSplitterTextInConstructor (
**/
EFI_STATUS
ConSplitterTextOutConstructor (
TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate
TEXT_OUT_SPLITTER_PRIVATE_DATA *ConOutPrivate
);
/**
Test to see if Console In Device could be supported on the Controller.
@@ -323,9 +316,9 @@ ConSplitterTextOutConstructor (
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -343,9 +336,9 @@ ConSplitterConInDriverBindingSupported (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -363,9 +356,9 @@ ConSplitterSimplePointerDriverBindingSupported (
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -383,9 +376,9 @@ ConSplitterConOutDriverBindingSupported (
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -403,9 +396,9 @@ ConSplitterStdErrDriverBindingSupported (
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -423,9 +416,9 @@ ConSplitterConInDriverBindingStart (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -443,9 +436,9 @@ ConSplitterSimplePointerDriverBindingStart (
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -463,9 +456,9 @@ ConSplitterConOutDriverBindingStart (
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -484,10 +477,10 @@ ConSplitterStdErrDriverBindingStart (
EFI_STATUS
EFIAPI
ConSplitterConInDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -507,10 +500,10 @@ ConSplitterConInDriverBindingStop (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -529,10 +522,10 @@ ConSplitterSimplePointerDriverBindingStop (
EFI_STATUS
EFIAPI
ConSplitterConOutDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -551,13 +544,12 @@ ConSplitterConOutDriverBindingStop (
EFI_STATUS
EFIAPI
ConSplitterStdErrDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
Test to see if Absolute Pointer protocol could be supported on the Controller.
@@ -573,9 +565,9 @@ ConSplitterStdErrDriverBindingStop (
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -593,9 +585,9 @@ ConSplitterAbsolutePointerDriverBindingSupported (
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -615,10 +607,10 @@ ConSplitterAbsolutePointerDriverBindingStart (
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -633,8 +625,8 @@ ConSplitterAbsolutePointerDriverBindingStop (
**/
EFI_STATUS
ConSplitterAbsolutePointerAddDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
);
/**
@@ -649,15 +641,14 @@ ConSplitterAbsolutePointerAddDevice (
**/
EFI_STATUS
ConSplitterAbsolutePointerDeleteDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer
);
//
// Absolute Pointer protocol interfaces
//
/**
Resets the pointer device hardware.
@@ -672,11 +663,10 @@ ConSplitterAbsolutePointerDeleteDevice (
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerReset (
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_ABSOLUTE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
Retrieves the current state of a pointer device.
@@ -713,8 +703,8 @@ ConSplitterAbsolutePointerGetState (
VOID
EFIAPI
ConSplitterAbsolutePointerWaitForInput (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -764,7 +754,6 @@ ConSplitterComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -836,14 +825,13 @@ ConSplitterComponentNameGetDriverName (
EFI_STATUS
EFIAPI
ConSplitterConInComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -915,11 +903,11 @@ ConSplitterConInComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
@@ -969,11 +957,11 @@ ConSplitterSimplePointerComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterAbsolutePointerComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
@@ -1047,14 +1035,13 @@ ConSplitterAbsolutePointerComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterConOutComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -1126,14 +1113,13 @@ ConSplitterConOutComponentNameGetControllerName (
EFI_STATUS
EFIAPI
ConSplitterStdErrComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// TextIn Constructor/Destructor functions
//
@@ -1186,8 +1172,8 @@ ConSplitterTextInDeleteDevice (
**/
EFI_STATUS
ConSplitterSimplePointerAddDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
);
/**
@@ -1202,8 +1188,8 @@ ConSplitterSimplePointerAddDevice (
**/
EFI_STATUS
ConSplitterSimplePointerDeleteDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_POINTER_PROTOCOL *SimplePointer
);
//
@@ -1224,10 +1210,10 @@ ConSplitterSimplePointerDeleteDevice (
**/
EFI_STATUS
ConSplitterTextOutAddDevice (
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut,
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut,
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN EFI_UGA_DRAW_PROTOCOL *UgaDraw
);
/**
@@ -1242,8 +1228,8 @@ ConSplitterTextOutAddDevice (
**/
EFI_STATUS
ConSplitterTextOutDeleteDevice (
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut
IN TEXT_OUT_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut
);
//
@@ -1300,8 +1286,8 @@ ConSplitterTextInReadKeyStroke (
**/
EFI_STATUS
ConSplitterTextInExAddDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
);
/**
@@ -1316,8 +1302,8 @@ ConSplitterTextInExAddDevice (
**/
EFI_STATUS
ConSplitterTextInExDeleteDevice (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInEx
);
//
@@ -1342,7 +1328,6 @@ ConSplitterTextInResetEx (
IN BOOLEAN ExtendedVerification
);
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@@ -1362,11 +1347,10 @@ ConSplitterTextInResetEx (
EFI_STATUS
EFIAPI
ConSplitterTextInReadKeyStrokeEx (
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
);
/**
Set certain state for the input device.
@@ -1389,7 +1373,6 @@ ConSplitterTextInSetState (
IN EFI_KEY_TOGGLE_STATE *KeyToggleState
);
/**
Register a notification function for a particular keystroke for the input device.
@@ -1421,7 +1404,6 @@ ConSplitterTextInRegisterKeyNotify (
OUT VOID **NotifyHandle
);
/**
Remove a registered notification function from a particular keystroke.
@@ -1456,11 +1438,10 @@ ConSplitterTextInUnregisterKeyNotify (
VOID
EFIAPI
ConSplitterTextInWaitForKey (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
Reads the next keystroke from the input device. The WaitForKey Event can
be used to test for existance of a keystroke via WaitForEvent () call.
@@ -1477,8 +1458,8 @@ ConSplitterTextInWaitForKey (
EFI_STATUS
EFIAPI
ConSplitterTextInPrivateReadKeyStroke (
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
OUT EFI_INPUT_KEY *Key
IN TEXT_IN_SPLITTER_PRIVATE_DATA *Private,
OUT EFI_INPUT_KEY *Key
);
/**
@@ -1495,8 +1476,8 @@ ConSplitterTextInPrivateReadKeyStroke (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerReset (
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -1515,8 +1496,8 @@ ConSplitterSimplePointerReset (
EFI_STATUS
EFIAPI
ConSplitterSimplePointerGetState (
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
IN OUT EFI_SIMPLE_POINTER_STATE *State
IN EFI_SIMPLE_POINTER_PROTOCOL *This,
IN OUT EFI_SIMPLE_POINTER_STATE *State
);
/**
@@ -1532,8 +1513,8 @@ ConSplitterSimplePointerGetState (
VOID
EFIAPI
ConSplitterSimplePointerWaitForInput (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
//
@@ -1555,8 +1536,8 @@ ConSplitterSimplePointerWaitForInput (
EFI_STATUS
EFIAPI
ConSplitterTextOutReset (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -1581,8 +1562,8 @@ ConSplitterTextOutReset (
EFI_STATUS
EFIAPI
ConSplitterTextOutOutputString (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *WString
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *WString
);
/**
@@ -1603,8 +1584,8 @@ ConSplitterTextOutOutputString (
EFI_STATUS
EFIAPI
ConSplitterTextOutTestString (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *WString
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN CHAR16 *WString
);
/**
@@ -1627,10 +1608,10 @@ ConSplitterTextOutTestString (
EFI_STATUS
EFIAPI
ConSplitterTextOutQueryMode (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN ModeNumber,
OUT UINTN *Columns,
OUT UINTN *Rows
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN ModeNumber,
OUT UINTN *Columns,
OUT UINTN *Rows
);
/**
@@ -1648,8 +1629,8 @@ ConSplitterTextOutQueryMode (
EFI_STATUS
EFIAPI
ConSplitterTextOutSetMode (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN ModeNumber
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN ModeNumber
);
/**
@@ -1672,8 +1653,8 @@ ConSplitterTextOutSetMode (
EFI_STATUS
EFIAPI
ConSplitterTextOutSetAttribute (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN Attribute
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN Attribute
);
/**
@@ -1691,7 +1672,7 @@ ConSplitterTextOutSetAttribute (
EFI_STATUS
EFIAPI
ConSplitterTextOutClearScreen (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
);
/**
@@ -1716,12 +1697,11 @@ ConSplitterTextOutClearScreen (
EFI_STATUS
EFIAPI
ConSplitterTextOutSetCursorPosition (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN Column,
IN UINTN Row
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN UINTN Column,
IN UINTN Row
);
/**
Makes the cursor visible or invisible
@@ -1739,8 +1719,8 @@ ConSplitterTextOutSetCursorPosition (
EFI_STATUS
EFIAPI
ConSplitterTextOutEnableCursor (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN Visible
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN Visible
);
/**
@@ -1760,9 +1740,9 @@ ConSplitterTextOutEnableCursor (
**/
EFI_STATUS
ConSplitterGrowBuffer (
IN UINTN ElementSize,
IN OUT UINTN *Count,
IN OUT VOID **Buffer
IN UINTN ElementSize,
IN OUT UINTN *Count,
IN OUT VOID **Buffer
);
/**
@@ -1806,8 +1786,8 @@ ConSplitterGraphicsOutputQueryMode (
EFI_STATUS
EFIAPI
ConSplitterGraphicsOutputSetMode (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
IN UINT32 ModeNumber
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber
);
/**
@@ -1859,19 +1839,18 @@ ConSplitterGraphicsOutputSetMode (
EFI_STATUS
EFIAPI
ConSplitterGraphicsOutputBlt (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
);
/**
Return the current video mode information.
@@ -1889,11 +1868,11 @@ ConSplitterGraphicsOutputBlt (
EFI_STATUS
EFIAPI
ConSplitterUgaDrawGetMode (
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
OUT UINT32 *VerticalResolution,
OUT UINT32 *ColorDepth,
OUT UINT32 *RefreshRate
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
OUT UINT32 *VerticalResolution,
OUT UINT32 *ColorDepth,
OUT UINT32 *RefreshRate
);
/**
@@ -1913,11 +1892,11 @@ ConSplitterUgaDrawGetMode (
EFI_STATUS
EFIAPI
ConSplitterUgaDrawSetMode (
IN EFI_UGA_DRAW_PROTOCOL *This,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
IN EFI_UGA_DRAW_PROTOCOL *This,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
);
/**
@@ -1972,16 +1951,16 @@ ConSplitterUgaDrawSetMode (
EFI_STATUS
EFIAPI
ConSplitterUgaDrawBlt (
IN EFI_UGA_DRAW_PROTOCOL *This,
IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
IN EFI_UGA_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
IN EFI_UGA_DRAW_PROTOCOL *This,
IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
IN EFI_UGA_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
);
/**

View File

@@ -9,8 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "ConSplitter.h"
CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
CHAR16 mCrLfString[3] = { CHAR_CARRIAGE_RETURN, CHAR_LINEFEED, CHAR_NULL };
/**
Returns information for an available graphics mode that the graphics device
@@ -42,7 +41,7 @@ ConSplitterGraphicsOutputQueryMode (
EFI_STATUS Status;
UINTN Index;
if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
if ((This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode)) {
return EFI_INVALID_PARAMETER;
}
@@ -69,7 +68,7 @@ ConSplitterGraphicsOutputQueryMode (
//
// If only one physical GOP device exist, return its information.
//
Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) ModeNumber, SizeOfInfo, Info);
Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32)ModeNumber, SizeOfInfo, Info);
return Status;
} else {
//
@@ -80,6 +79,7 @@ ConSplitterGraphicsOutputQueryMode (
if (*Info == NULL) {
return EFI_OUT_OF_RESOURCES;
}
*SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
CopyMem (*Info, &Private->GraphicsOutputModeBuffer[ModeNumber], *SizeOfInfo);
}
@@ -87,7 +87,6 @@ ConSplitterGraphicsOutputQueryMode (
return EFI_SUCCESS;
}
/**
Set the video device into the specified mode and clears the visible portions of
the output display to black.
@@ -104,31 +103,31 @@ ConSplitterGraphicsOutputQueryMode (
EFI_STATUS
EFIAPI
ConSplitterGraphicsOutputSetMode (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
IN UINT32 ModeNumber
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber
)
{
EFI_STATUS Status;
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
EFI_STATUS ReturnStatus;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_GRAPHICS_OUTPUT_PROTOCOL *PhysicalGraphicsOutput;
UINTN NumberIndex;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_STATUS Status;
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
EFI_STATUS ReturnStatus;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Mode;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_GRAPHICS_OUTPUT_PROTOCOL *PhysicalGraphicsOutput;
UINTN NumberIndex;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
if (ModeNumber >= This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
Private = GRAPHICS_OUTPUT_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
Mode = &Private->GraphicsOutputModeBuffer[ModeNumber];
ReturnStatus = EFI_SUCCESS;
GraphicsOutput = NULL;
ReturnStatus = EFI_SUCCESS;
GraphicsOutput = NULL;
PhysicalGraphicsOutput = NULL;
//
// return the worst status met
@@ -140,19 +139,21 @@ ConSplitterGraphicsOutputSetMode (
//
// Find corresponding ModeNumber of this GraphicsOutput instance
//
for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {
Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) {
Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32)NumberIndex, &SizeOfInfo, &Info);
if (EFI_ERROR (Status)) {
return Status;
}
if ((Info->HorizontalResolution == Mode->HorizontalResolution) && (Info->VerticalResolution == Mode->VerticalResolution)) {
FreePool (Info);
break;
}
FreePool (Info);
}
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32)NumberIndex);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
}
@@ -180,7 +181,7 @@ ConSplitterGraphicsOutputSetMode (
// If only one physical GOP device exist, copy physical information to consplitter.
//
CopyMem (This->Mode->Info, PhysicalGraphicsOutput->Mode->Info, PhysicalGraphicsOutput->Mode->SizeOfInfo);
This->Mode->SizeOfInfo = PhysicalGraphicsOutput->Mode->SizeOfInfo;
This->Mode->SizeOfInfo = PhysicalGraphicsOutput->Mode->SizeOfInfo;
This->Mode->FrameBufferBase = PhysicalGraphicsOutput->Mode->FrameBufferBase;
This->Mode->FrameBufferSize = PhysicalGraphicsOutput->Mode->FrameBufferSize;
} else {
@@ -194,8 +195,6 @@ ConSplitterGraphicsOutputSetMode (
return ReturnStatus;
}
/**
The following table defines actions for BltOperations.
@@ -245,16 +244,16 @@ ConSplitterGraphicsOutputSetMode (
EFI_STATUS
EFIAPI
ConSplitterGraphicsOutputBlt (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
)
{
EFI_STATUS Status;
@@ -264,7 +263,7 @@ ConSplitterGraphicsOutputBlt (
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
if (This == NULL || ((UINTN) BltOperation) >= EfiGraphicsOutputBltOperationMax) {
if ((This == NULL) || (((UINTN)BltOperation) >= EfiGraphicsOutputBltOperationMax)) {
return EFI_INVALID_PARAMETER;
}
@@ -279,17 +278,17 @@ ConSplitterGraphicsOutputBlt (
GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
if (GraphicsOutput != NULL) {
Status = GraphicsOutput->Blt (
GraphicsOutput,
BltBuffer,
BltOperation,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
GraphicsOutput,
BltBuffer,
BltOperation,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
} else if (BltOperation == EfiBltVideoToBltBuffer) {
@@ -301,19 +300,19 @@ ConSplitterGraphicsOutputBlt (
}
UgaDraw = Private->TextOutList[Index].UgaDraw;
if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
if ((UgaDraw != NULL) && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = UgaDraw->Blt (
UgaDraw,
(EFI_UGA_PIXEL *) BltBuffer,
(EFI_UGA_BLT_OPERATION) BltOperation,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
UgaDraw,
(EFI_UGA_PIXEL *)BltBuffer,
(EFI_UGA_BLT_OPERATION)BltOperation,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
} else if (BltOperation == EfiBltVideoToBltBuffer) {
@@ -345,11 +344,11 @@ ConSplitterGraphicsOutputBlt (
EFI_STATUS
EFIAPI
ConSplitterUgaDrawGetMode (
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
OUT UINT32 *VerticalResolution,
OUT UINT32 *ColorDepth,
OUT UINT32 *RefreshRate
IN EFI_UGA_DRAW_PROTOCOL *This,
OUT UINT32 *HorizontalResolution,
OUT UINT32 *VerticalResolution,
OUT UINT32 *ColorDepth,
OUT UINT32 *RefreshRate
)
{
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
@@ -357,13 +356,15 @@ ConSplitterUgaDrawGetMode (
if ((HorizontalResolution == NULL) ||
(VerticalResolution == NULL) ||
(RefreshRate == NULL) ||
(ColorDepth == NULL)) {
(ColorDepth == NULL))
{
return EFI_INVALID_PARAMETER;
}
//
// retrieve private data
//
Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
*HorizontalResolution = Private->UgaHorizontalResolution;
*VerticalResolution = Private->UgaVerticalResolution;
@@ -373,7 +374,6 @@ ConSplitterUgaDrawGetMode (
return EFI_SUCCESS;
}
/**
Set the current video mode information.
@@ -391,22 +391,22 @@ ConSplitterUgaDrawGetMode (
EFI_STATUS
EFIAPI
ConSplitterUgaDrawSetMode (
IN EFI_UGA_DRAW_PROTOCOL *This,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
IN EFI_UGA_DRAW_PROTOCOL *This,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
)
{
EFI_STATUS Status;
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
EFI_STATUS ReturnStatus;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
UINTN NumberIndex;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_STATUS Status;
TEXT_OUT_SPLITTER_PRIVATE_DATA *Private;
UINTN Index;
EFI_STATUS ReturnStatus;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
UINTN NumberIndex;
UINTN SizeOfInfo;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
Private = UGA_DRAW_SPLITTER_PRIVATE_DATA_FROM_THIS (This);
@@ -415,47 +415,48 @@ ConSplitterUgaDrawSetMode (
//
// Update the Mode data
//
Private->UgaHorizontalResolution = HorizontalResolution;
Private->UgaVerticalResolution = VerticalResolution;
Private->UgaColorDepth = ColorDepth;
Private->UgaRefreshRate = RefreshRate;
Private->UgaHorizontalResolution = HorizontalResolution;
Private->UgaVerticalResolution = VerticalResolution;
Private->UgaColorDepth = ColorDepth;
Private->UgaRefreshRate = RefreshRate;
//
// return the worst status met
//
for (Index = 0; Index < Private->CurrentNumberOfConsoles; Index++) {
GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
if (GraphicsOutput != NULL) {
//
// Find corresponding ModeNumber of this GraphicsOutput instance
//
for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex ++) {
Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32) NumberIndex, &SizeOfInfo, &Info);
for (NumberIndex = 0; NumberIndex < GraphicsOutput->Mode->MaxMode; NumberIndex++) {
Status = GraphicsOutput->QueryMode (GraphicsOutput, (UINT32)NumberIndex, &SizeOfInfo, &Info);
if (EFI_ERROR (Status)) {
return Status;
}
if ((Info->HorizontalResolution == HorizontalResolution) && (Info->VerticalResolution == VerticalResolution)) {
FreePool (Info);
break;
}
FreePool (Info);
}
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32) NumberIndex);
Status = GraphicsOutput->SetMode (GraphicsOutput, (UINT32)NumberIndex);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
}
} else if (FeaturePcdGet (PcdUgaConsumeSupport)){
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
UgaDraw = Private->TextOutList[Index].UgaDraw;
if (UgaDraw != NULL) {
Status = UgaDraw->SetMode (
UgaDraw,
HorizontalResolution,
VerticalResolution,
ColorDepth,
RefreshRate
);
UgaDraw,
HorizontalResolution,
VerticalResolution,
ColorDepth,
RefreshRate
);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
}
@@ -466,7 +467,6 @@ ConSplitterUgaDrawSetMode (
return ReturnStatus;
}
/**
Blt a rectangle of pixels on the graphics screen.
@@ -519,16 +519,16 @@ ConSplitterUgaDrawSetMode (
EFI_STATUS
EFIAPI
ConSplitterUgaDrawBlt (
IN EFI_UGA_DRAW_PROTOCOL *This,
IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
IN EFI_UGA_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
IN EFI_UGA_DRAW_PROTOCOL *This,
IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
IN EFI_UGA_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
)
{
EFI_STATUS Status;
@@ -547,17 +547,17 @@ ConSplitterUgaDrawBlt (
GraphicsOutput = Private->TextOutList[Index].GraphicsOutput;
if (GraphicsOutput != NULL) {
Status = GraphicsOutput->Blt (
GraphicsOutput,
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) BltBuffer,
(EFI_GRAPHICS_OUTPUT_BLT_OPERATION) BltOperation,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
GraphicsOutput,
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)BltBuffer,
(EFI_GRAPHICS_OUTPUT_BLT_OPERATION)BltOperation,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
if (EFI_ERROR (Status)) {
ReturnStatus = Status;
} else if (BltOperation == EfiUgaVideoToBltBuffer) {
@@ -568,7 +568,7 @@ ConSplitterUgaDrawBlt (
}
}
if (Private->TextOutList[Index].UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
if ((Private->TextOutList[Index].UgaDraw != NULL) && FeaturePcdGet (PcdUgaConsumeSupport)) {
Status = Private->TextOutList[Index].UgaDraw->Blt (
Private->TextOutList[Index].UgaDraw,
BltBuffer,
@@ -613,7 +613,7 @@ TextOutSetMode (
// been checked in ConSplitterTextOutSetCursorPosition. And (0, 0) should
// always be supported.
//
Private->TextOutMode.Mode = (INT32) ModeNumber;
Private->TextOutMode.Mode = (INT32)ModeNumber;
Private->TextOutMode.CursorColumn = 0;
Private->TextOutMode.CursorRow = 0;
Private->TextOutMode.CursorVisible = TRUE;

View File

@@ -20,14 +20,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleCompo
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GraphicsConsoleComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GraphicsConsoleComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)GraphicsConsoleComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)GraphicsConsoleComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mGraphicsConsoleDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mGraphicsConsoleDriverNameTable[] = {
{
"eng;en",
(CHAR16 *)L"Graphics Console Driver"
@@ -165,11 +164,11 @@ GraphicsConsoleComponentNameGetDriverName (
EFI_STATUS
EFIAPI
GraphicsConsoleComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;

View File

@@ -29,17 +29,16 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Protocol/HiiFont.h>
#include <Protocol/HiiDatabase.h>
extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
extern EFI_NARROW_GLYPH gUsStdNarrowGlyphData[];
extern UINT32 mNarrowFontSize;
extern UINT32 mNarrowFontSize;
typedef union {
EFI_NARROW_GLYPH NarrowGlyph;
EFI_WIDE_GLYPH WideGlyph;
EFI_NARROW_GLYPH NarrowGlyph;
EFI_WIDE_GLYPH WideGlyph;
} GLYPH_UNION;
//
@@ -48,32 +47,32 @@ typedef union {
#define GRAPHICS_CONSOLE_DEV_SIGNATURE SIGNATURE_32 ('g', 's', 't', 'o')
typedef struct {
UINTN Columns;
UINTN Rows;
INTN DeltaX;
INTN DeltaY;
UINT32 GopWidth;
UINT32 GopHeight;
UINT32 GopModeNumber;
UINTN Columns;
UINTN Rows;
INTN DeltaX;
INTN DeltaY;
UINT32 GopWidth;
UINT32 GopHeight;
UINT32 GopModeNumber;
} GRAPHICS_CONSOLE_MODE_DATA;
typedef struct {
UINTN Signature;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
UINTN Signature;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_UGA_DRAW_PROTOCOL *UgaDraw;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
GRAPHICS_CONSOLE_MODE_DATA *ModeData;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
} GRAPHICS_CONSOLE_DEV;
#define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -121,7 +120,6 @@ GraphicsConsoleComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -193,14 +191,13 @@ GraphicsConsoleComponentNameGetDriverName (
EFI_STATUS
EFIAPI
GraphicsConsoleComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
Reset the text output device hardware and optionally run diagnostics.
@@ -222,8 +219,8 @@ GraphicsConsoleComponentNameGetControllerName (
EFI_STATUS
EFIAPI
GraphicsConsoleConOutReset (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -307,7 +304,6 @@ GraphicsConsoleConOutQueryMode (
OUT UINTN *Rows
);
/**
Sets the output device(s) to a specified mode.
@@ -399,7 +395,6 @@ GraphicsConsoleConOutSetCursorPosition (
IN UINTN Row
);
/**
Makes the cursor visible or invisible.
@@ -438,12 +433,11 @@ GraphicsConsoleConOutEnableCursor (
EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
Start this driver on Controller by opening Graphics Output protocol or
UGA Draw protocol, and installing Simple Text Out protocol on Controller.
@@ -461,9 +455,9 @@ GraphicsConsoleControllerDriverSupported (
EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -487,13 +481,12 @@ GraphicsConsoleControllerDriverStart (
EFI_STATUS
EFIAPI
GraphicsConsoleControllerDriverStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
Locate HII Database protocol and HII Font protocol.
@@ -508,7 +501,6 @@ EfiLocateHiiProtocol (
VOID
);
/**
Gets Graphics Console device's foreground color and background color.
@@ -586,9 +578,9 @@ FlushCursor (
EFI_STATUS
CheckModeSupported (
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
OUT UINT32 *CurrentModeNumber
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
OUT UINT32 *CurrentModeNumber
);
#endif

View File

@@ -8,264 +8,503 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "GraphicsConsole.h"
EFI_NARROW_GLYPH gUsStdNarrowGlyphData[] = {
//
// Unicode glyphs from 0x20 to 0x7e are the same as ASCII characters 0x20 to 0x7e
//
{ 0x0020, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x0021, 0x00, {0x00,0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x0022, 0x00, {0x00,0x00,0x00,0x6C,0x6C,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x0023, 0x00, {0x00,0x00,0x00,0x00,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00}},
{ 0x0024, 0x00, {0x00,0x00,0x18,0x18,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00}},
{ 0x0025, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x0026, 0x00, {0x00,0x00,0x00,0x78,0xCC,0xCC,0xCC,0x78,0x76,0xDC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x0027, 0x00, {0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x0028, 0x00, {0x00,0x00,0x00,0x06,0x0C,0x0C,0x18,0x18,0x18,0x18,0x18,0x18,0x0C,0x0C,0x06,0x00,0x00,0x00,0x00}},
{ 0x0029, 0x00, {0x00,0x00,0x00,0xC0,0x60,0x60,0x30,0x30,0x30,0x30,0x30,0x30,0x60,0x60,0xC0,0x00,0x00,0x00,0x00}},
{ 0x002a, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0x38,0xFE,0x38,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x002b, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x002c, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00}},
{ 0x002d, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x002e, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}},
{ 0x002f, 0x00, {0x00,0x00,0x00,0x06,0x06,0x0C,0x0C,0x18,0x18,0x30,0x30,0x60,0x60,0xC0,0xC0,0x00,0x00,0x00,0x00}},
{ 0x0030, 0x00, {0x00,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0xD6,0xD6,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00}},
{ 0x0031, 0x00, {0x00,0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00}},
{ 0x0032, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0x06,0x06,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC2,0xFE,0x00,0x00,0x00,0x00}},
{ 0x0033, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0x06,0x06,0x06,0x3C,0x06,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0034, 0x00, {0x00,0x00,0x00,0x1C,0x1C,0x3C,0x3C,0x6C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00}},
{ 0x0035, 0x00, {0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0036, 0x00, {0x00,0x00,0x00,0x3C,0x60,0xC0,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0037, 0x00, {0x00,0x00,0x00,0xFE,0xC6,0x06,0x06,0x06,0x0C,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x0038, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0039, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00}},
{ 0x003a, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00}},
{ 0x003b, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00}},
{ 0x003c, 0x00, {0x00,0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0xC0,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00}},
{ 0x003d, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x003e, 0x00, {0x00,0x00,0x00,0x00,0xC0,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0xC0,0x00,0x00,0x00,0x00}},
{ 0x003f, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x0040, 0x00, {0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0xC0,0x7E,0x00,0x00,0x00,0x00}},
{ 0x0020, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0021, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0022, 0x00, { 0x00, 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0023, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0024, 0x00, { 0x00, 0x00, 0x18, 0x18, 0x7C, 0xC6, 0xC6, 0x60, 0x38, 0x0C, 0x06, 0xC6, 0xC6, 0x7C, 0x18, 0x18, 0x00, 0x00, 0x00 }
},
{ 0x0025, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0026, 0x00, { 0x00, 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x76, 0xDC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0027, 0x00, { 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0028, 0x00, { 0x00, 0x00, 0x00, 0x06, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0029, 0x00, { 0x00, 0x00, 0x00, 0xC0, 0x60, 0x60, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x002a, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x38, 0xFE, 0x38, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x002b, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x002c, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x002d, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x002e, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x002f, 0x00, { 0x00, 0x00, 0x00, 0x06, 0x06, 0x0C, 0x0C, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0030, 0x00, { 0x00, 0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0031, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0032, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xC2, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0033, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0034, 0x00, { 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x3C, 0x3C, 0x6C, 0x6C, 0xCC, 0xFE, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0035, 0x00, { 0x00, 0x00, 0x00, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, 0xFC, 0x06, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0036, 0x00, { 0x00, 0x00, 0x00, 0x3C, 0x60, 0xC0, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0037, 0x00, { 0x00, 0x00, 0x00, 0xFE, 0xC6, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0038, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0039, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x06, 0x0C, 0x78, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x003a, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x003b, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x003c, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x003d, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x003e, 0x00, { 0x00, 0x00, 0x00, 0x00, 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x003f, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x0C, 0x0C, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0040, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xDE, 0xDE, 0xDE, 0xDC, 0xC0, 0xC0, 0x7E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0041, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x0041, 0x00, { 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0042, 0x00, {0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00}},
{ 0x0043, 0x00, {0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00}},
{ 0x0044, 0x00, {0x00,0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00}},
{ 0x0045, 0x00, {0x00,0x00,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
{ 0x0046, 0x00, {0x00,0x00,0x00,0xFE,0x66,0x62,0x60,0x64,0x7C,0x64,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00}},
{ 0x0047, 0x00, {0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xDE,0xC6,0xC6,0xC6,0x66,0x3C,0x00,0x00,0x00,0x00}},
{ 0x0048, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x0049, 0x00, {0x00,0x00,0x00,0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xFC,0x00,0x00,0x00,0x00}},
{ 0x004a, 0x00, {0x00,0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00}},
{ 0x004b, 0x00, {0x00,0x00,0x00,0xE6,0x66,0x6C,0x6C,0x78,0x70,0x78,0x6C,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00}},
{ 0x004c, 0x00, {0x00,0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
{ 0x004d, 0x00, {0x00,0x00,0x00,0xC6,0xEE,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x004e, 0x00, {0x00,0x00,0x00,0xC6,0xE6,0xF6,0xF6,0xF6,0xDE,0xCE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x004f, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0050, 0x00, {0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00}},
{ 0x0051, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0x7C,0x1C,0x0E,0x00,0x00}},
{ 0x0052, 0x00, {0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x7C,0x78,0x6C,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00}},
{ 0x0053, 0x00, {0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x60,0x38,0x0C,0x06,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0054, 0x00, {0x00,0x00,0x00,0xFC,0xFC,0xB4,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}},
{ 0x0055, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0056, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00}},
{ 0x0057, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00}},
{ 0x0058, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0xC6,0x6C,0x6C,0x38,0x6C,0x6C,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x0059, 0x00, {0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}},
{ 0x005a, 0x00, {0x00,0x00,0x00,0xFE,0xC6,0x86,0x0C,0x0C,0x18,0x30,0x60,0xC0,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00}},
{ 0x005b, 0x00, {0x00,0x00,0x00,0x1E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1E,0x00,0x00,0x00,0x00}},
{ 0x005c, 0x00, {0x00,0x00,0x00,0xC0,0xC0,0x60,0x60,0x30,0x30,0x18,0x18,0x0C,0x0C,0x06,0x06,0x00,0x00,0x00,0x00}},
{ 0x005d, 0x00, {0x00,0x00,0x00,0xF0,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0xF0,0x00,0x00,0x00,0x00}},
{ 0x005e, 0x00, {0x00,0x00,0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x005f, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00}},
{ 0x0060, 0x00, {0x00,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x0061, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x0062, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0063, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0064, 0x00, {0x00,0x00,0x00,0x1C,0x0C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0xCC,0x7E,0x00,0x00,0x00,0x00}},
{ 0x0065, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0066, 0x00, {0x00,0x00,0x00,0x1E,0x33,0x30,0x30,0x30,0x78,0x30,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}},
{ 0x0067, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0xCC,0x78,0x00}},
{ 0x0068, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x60,0x7C,0x76,0x66,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00}},
{ 0x0069, 0x00, {0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x006a, 0x00, {0x00,0x00,0x00,0x0C,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x6C,0x38,0x00}},
{ 0x006b, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x70,0x78,0x6C,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00}},
{ 0x006c, 0x00, {0x00,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x006d, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0xEE,0xFE,0xD6,0xD6,0xD6,0xD6,0xD6,0x00,0x00,0x00,0x00}},
{ 0x006e, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00}},
{ 0x006f, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0070, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}},
{ 0x0071, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00}},
{ 0x0072, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00}},
{ 0x0073, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0x7C,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x0074, 0x00, {0x00,0x00,0x00,0x10,0x30,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00}},
{ 0x0075, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x0076, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x78,0x30,0x00,0x00,0x00,0x00}},
{ 0x0077, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xD6,0xD6,0xFE,0xEE,0x6C,0x00,0x00,0x00,0x00}},
{ 0x0078, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x6C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x0079, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00}},
{ 0x007a, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x86,0x0C,0x18,0x30,0x60,0xC0,0xFE,0x00,0x00,0x00,0x00}},
{ 0x007b, 0x00, {0x00,0x00,0x00,0x0E,0x18,0x18,0x18,0x18,0x30,0x18,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00}},
{ 0x007c, 0x00, {0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x007d, 0x00, {0x00,0x00,0x00,0xE0,0x30,0x30,0x30,0x30,0x18,0x30,0x30,0x30,0x30,0x30,0xE0,0x00,0x00,0x00,0x00}},
{ 0x007e, 0x00, {0x00,0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x0042, 0x00, { 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0043, 0x00, { 0x00, 0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0044, 0x00, { 0x00, 0x00, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0045, 0x00, { 0x00, 0x00, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x68, 0x78, 0x68, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0046, 0x00, { 0x00, 0x00, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x64, 0x7C, 0x64, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0047, 0x00, { 0x00, 0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xDE, 0xC6, 0xC6, 0xC6, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0048, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0049, 0x00, { 0x00, 0x00, 0x00, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x004a, 0x00, { 0x00, 0x00, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x004b, 0x00, { 0x00, 0x00, 0x00, 0xE6, 0x66, 0x6C, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x6C, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x004c, 0x00, { 0x00, 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x004d, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xEE, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x004e, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xE6, 0xF6, 0xF6, 0xF6, 0xDE, 0xCE, 0xCE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x004f, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0050, 0x00, { 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0051, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0x7C, 0x1C, 0x0E, 0x00, 0x00 }
},
{ 0x0052, 0x00, { 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x6C, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0053, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x60, 0x38, 0x0C, 0x06, 0x06, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0054, 0x00, { 0x00, 0x00, 0x00, 0xFC, 0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0055, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0056, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0057, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xD6, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0058, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x38, 0x6C, 0x6C, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0059, 0x00, { 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x005a, 0x00, { 0x00, 0x00, 0x00, 0xFE, 0xC6, 0x86, 0x0C, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xC2, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x005b, 0x00, { 0x00, 0x00, 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x005c, 0x00, { 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0C, 0x0C, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x005d, 0x00, { 0x00, 0x00, 0x00, 0xF0, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0xF0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x005e, 0x00, { 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x005f, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0060, 0x00, { 0x00, 0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0061, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0062, 0x00, { 0x00, 0x00, 0x00, 0xE0, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0063, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0064, 0x00, { 0x00, 0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x3C, 0x6C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0065, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0066, 0x00, { 0x00, 0x00, 0x00, 0x1E, 0x33, 0x30, 0x30, 0x30, 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0067, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xCC, 0x78, 0x00 }
},
{ 0x0068, 0x00, { 0x00, 0x00, 0x00, 0xE0, 0x60, 0x60, 0x60, 0x7C, 0x76, 0x66, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0069, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x006a, 0x00, { 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x6C, 0x38, 0x00 }
},
{ 0x006b, 0x00, { 0x00, 0x00, 0x00, 0xE0, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x006c, 0x00, { 0x00, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x006d, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xEE, 0xFE, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x006e, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x006f, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0070, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00 }
},
{ 0x0071, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00 }
},
{ 0x0072, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0073, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x7C, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0074, 0x00, { 0x00, 0x00, 0x00, 0x10, 0x30, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0075, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0076, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0077, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0xEE, 0x6C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0078, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x6C, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x0079, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00 }
},
{ 0x007a, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x86, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x007b, 0x00, { 0x00, 0x00, 0x00, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x30, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x007c, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x007d, 0x00, { 0x00, 0x00, 0x00, 0xE0, 0x30, 0x30, 0x30, 0x30, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0xE0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x007e, 0x00, { 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a0, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00a1, 0x00, {0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00}},
{ 0x00a2, 0x00, {0x00,0x00,0x00,0x00,0x18,0x18,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x00a3, 0x00, {0x00,0x00,0x00,0x38,0x6C,0x64,0x60,0x60,0xF0,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00}},
{ 0x00a4, 0x00, {0x00,0x00,0x18,0x00,0x00,0x00,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0xC6,0x00,0x00,0x00,0x00,0x00}},
{ 0x00a5, 0x00, {0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x00a6, 0x00, {0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00}},
{ 0x00a7, 0x00, {0x00,0x00,0x18,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00a8, 0x00, {0x00,0x00,0x00,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00a9, 0x00, {0x00,0x00,0x00,0x00,0x7C,0x82,0x9A,0xA2,0xA2,0xA2,0x9A,0x82,0x7C,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00aa, 0x00, {0x00,0x00,0x00,0x00,0x3C,0x6C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00ab, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00ac, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00ad, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00ae, 0x00, {0x00,0x00,0x00,0x00,0x7C,0x82,0xB2,0xAA,0xAA,0xB2,0xAA,0xAA,0x82,0x7C,0x00,0x00,0x00,0x00,0x00}},
{ 0x00af, 0x00, {0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b0, 0x00, {0x00,0x00,0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b1, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b2, 0x00, {0x00,0x00,0x00,0x3C,0x66,0x0C,0x18,0x32,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b3, 0x00, {0x00,0x00,0x00,0x7C,0x06,0x3C,0x06,0x06,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b4, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b5, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xC0,0x00}},
{ 0x00b6, 0x00, {0x00,0x00,0x00,0x7F,0xDB,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00}},
{ 0x00b7, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00b8, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0x78,0x00,0x00,0x00}},
{ 0x00b9, 0x00, {0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00ba, 0x00, {0x00,0x00,0x00,0x00,0x38,0x6C,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00bb, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00bc, 0x00, {0x00,0x00,0x00,0x60,0xE0,0x62,0x66,0x6C,0x18,0x30,0x66,0xCE,0x9A,0x3F,0x06,0x06,0x00,0x00,0x00}},
{ 0x00bd, 0x00, {0x00,0x00,0x00,0x60,0xE0,0x62,0x66,0x6C,0x18,0x30,0x60,0xDC,0x86,0x0C,0x18,0x3E,0x00,0x00,0x00}},
{ 0x00be, 0x00, {0x00,0x00,0x00,0xE0,0x30,0x62,0x36,0xEC,0x18,0x30,0x66,0xCE,0x9A,0x3F,0x06,0x06,0x00,0x00,0x00}},
{ 0x00bf, 0x00, {0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00c0, 0x00, {0x60,0x30,0x18,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00c1, 0x00, {0x18,0x30,0x60,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00c2, 0x00, {0x10,0x38,0x6C,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00c3, 0x00, {0x76,0xDC,0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00c4, 0x00, {0xCC,0xCC,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00c5, 0x00, {0x38,0x6C,0x38,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00c6, 0x00, {0x00,0x00,0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00}},
{ 0x00c7, 0x00, {0x00,0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x18,0x70,0x00,0x00}},
{ 0x00c8, 0x00, {0x60,0x30,0x18,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
{ 0x00c9, 0x00, {0x18,0x30,0x60,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
{ 0x00ca, 0x00, {0x10,0x38,0x6C,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
{ 0x00cb, 0x00, {0xCC,0xCC,0x00,0x00,0xFE,0x66,0x62,0x60,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00}},
{ 0x00cc, 0x00, {0x60,0x30,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00cd, 0x00, {0x18,0x30,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00ce, 0x00, {0x10,0x38,0x6C,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00cf, 0x00, {0xCC,0xCC,0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00d0, 0x00, {0x00,0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0xF6,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00}},
{ 0x00d1, 0x00, {0x76,0xDC,0x00,0x00,0xC6,0xE6,0xE6,0xF6,0xF6,0xDE,0xDE,0xCE,0xCE,0xC6,0xC6,0x00,0x00,0x00,0x00}},
{ 0x00d2, 0x00, {0x60,0x30,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00d3, 0x00, {0x18,0x30,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00d4, 0x00, {0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00d5, 0x00, {0x76,0xDC,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00d6, 0x00, {0xCC,0xCC,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00d7, 0x00, {0x10,0x28,0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x6C,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00}},
{ 0x00d8, 0x00, {0x00,0x00,0x00,0x7C,0xCE,0xCE,0xDE,0xD6,0xD6,0xD6,0xD6,0xF6,0xE6,0xE6,0x7C,0x40,0x00,0x00,0x00}},
{ 0x00d9, 0x00, {0x60,0x30,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00da, 0x00, {0x18,0x30,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00db, 0x00, {0x10,0x38,0x6C,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00dc, 0x00, {0xCC,0xCC,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00dd, 0x00, {0x18,0x30,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00de, 0x00, {0x00,0x00,0x10,0x00,0xF0,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x60,0xF0,0x00,0x00,0x00,0x00}},
{ 0x00df, 0x00, {0x00,0x00,0x00,0x78,0xCC,0xCC,0xCC,0xCC,0xD8,0xCC,0xC6,0xC6,0xC6,0xC6,0xCC,0x00,0x00,0x00,0x00}},
{ 0x00e0, 0x00, {0x00,0x30,0x30,0x60,0x30,0x18,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00e1, 0x00, {0x00,0x00,0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00e2, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00e3, 0x00, {0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00e4, 0x00, {0x00,0x00,0x00,0xCC,0xCC,0x00,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00e5, 0x00, {0x00,0x00,0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00e6, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEC,0x36,0x36,0x7E,0xD8,0xD8,0xD8,0x6E,0x00,0x00,0x00,0x00}},
{ 0x00e7, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC0,0xC6,0x7C,0x18,0x70,0x00,0x00}},
{ 0x00e8, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00e9, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00ea, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00eb, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00ec, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00ed, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00ee, 0x00, {0x00,0x00,0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00ef, 0x00, {0x00,0x00,0x00,0x66,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00f0, 0x00, {0x00,0x00,0x00,0x34,0x18,0x2C,0x0C,0x06,0x3E,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00}},
{ 0x00f1, 0x00, {0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00}},
{ 0x00f2, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00f3, 0x00, {0x00,0x00,0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00f4, 0x00, {0x00,0x00,0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00f5, 0x00, {0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00f6, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00f7, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x7E,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ 0x00f8, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0xCE,0xDE,0xD6,0xF6,0xE6,0xC6,0x7C,0x00,0x00,0x00,0x00}},
{ 0x00f9, 0x00, {0x00,0x00,0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00fa, 0x00, {0x00,0x00,0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00fb, 0x00, {0x00,0x00,0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00fc, 0x00, {0x00,0x00,0x00,0xCC,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00}},
{ 0x00fd, 0x00, {0x00,0x00,0x00,0x0C,0x18,0x30,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00}},
{ 0x00fe, 0x00, {0x00,0x00,0x00,0xE0,0x60,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00}},
{ 0x00ff, 0x00, {0x00,0x00,0x00,0xC6,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00}},
{ 0x00a0, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a1, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a2, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a3, 0x00, { 0x00, 0x00, 0x00, 0x38, 0x6C, 0x64, 0x60, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xE6, 0xFC, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a4, 0x00, { 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a5, 0x00, { 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a6, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a7, 0x00, { 0x00, 0x00, 0x18, 0x7C, 0xC6, 0x60, 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a8, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00a9, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x7C, 0x82, 0x9A, 0xA2, 0xA2, 0xA2, 0x9A, 0x82, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00aa, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ab, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6C, 0xD8, 0x6C, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ac, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ad, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ae, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x7C, 0x82, 0xB2, 0xAA, 0xAA, 0xB2, 0xAA, 0xAA, 0x82, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00af, 0x00, { 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b0, 0x00, { 0x00, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b1, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b2, 0x00, { 0x00, 0x00, 0x00, 0x3C, 0x66, 0x0C, 0x18, 0x32, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b3, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0x06, 0x3C, 0x06, 0x06, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b4, 0x00, { 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b5, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xC0, 0x00 }
},
{ 0x00b6, 0x00, { 0x00, 0x00, 0x00, 0x7F, 0xDB, 0xDB, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b7, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00b8, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0C, 0x78, 0x00, 0x00, 0x00 }
},
{ 0x00b9, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ba, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x38, 0x6C, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00bb, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x6C, 0x36, 0x6C, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00bc, 0x00, { 0x00, 0x00, 0x00, 0x60, 0xE0, 0x62, 0x66, 0x6C, 0x18, 0x30, 0x66, 0xCE, 0x9A, 0x3F, 0x06, 0x06, 0x00, 0x00, 0x00 }
},
{ 0x00bd, 0x00, { 0x00, 0x00, 0x00, 0x60, 0xE0, 0x62, 0x66, 0x6C, 0x18, 0x30, 0x60, 0xDC, 0x86, 0x0C, 0x18, 0x3E, 0x00, 0x00, 0x00 }
},
{ 0x00be, 0x00, { 0x00, 0x00, 0x00, 0xE0, 0x30, 0x62, 0x36, 0xEC, 0x18, 0x30, 0x66, 0xCE, 0x9A, 0x3F, 0x06, 0x06, 0x00, 0x00, 0x00 }
},
{ 0x00bf, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0x60, 0xC0, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c0, 0x00, { 0x60, 0x30, 0x18, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c1, 0x00, { 0x18, 0x30, 0x60, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c2, 0x00, { 0x10, 0x38, 0x6C, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c3, 0x00, { 0x76, 0xDC, 0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c4, 0x00, { 0xCC, 0xCC, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c5, 0x00, { 0x38, 0x6C, 0x38, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c6, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x3E, 0x6C, 0xCC, 0xCC, 0xCC, 0xFE, 0xCC, 0xCC, 0xCC, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c7, 0x00, { 0x00, 0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x18, 0x70, 0x00, 0x00 }
},
{ 0x00c8, 0x00, { 0x60, 0x30, 0x18, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00c9, 0x00, { 0x18, 0x30, 0x60, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ca, 0x00, { 0x10, 0x38, 0x6C, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00cb, 0x00, { 0xCC, 0xCC, 0x00, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00cc, 0x00, { 0x60, 0x30, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00cd, 0x00, { 0x18, 0x30, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ce, 0x00, { 0x10, 0x38, 0x6C, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00cf, 0x00, { 0xCC, 0xCC, 0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d0, 0x00, { 0x00, 0x00, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0xF6, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d1, 0x00, { 0x76, 0xDC, 0x00, 0x00, 0xC6, 0xE6, 0xE6, 0xF6, 0xF6, 0xDE, 0xDE, 0xCE, 0xCE, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d2, 0x00, { 0x60, 0x30, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d3, 0x00, { 0x18, 0x30, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d4, 0x00, { 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d5, 0x00, { 0x76, 0xDC, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d6, 0x00, { 0xCC, 0xCC, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d7, 0x00, { 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x6C, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00d8, 0x00, { 0x00, 0x00, 0x00, 0x7C, 0xCE, 0xCE, 0xDE, 0xD6, 0xD6, 0xD6, 0xD6, 0xF6, 0xE6, 0xE6, 0x7C, 0x40, 0x00, 0x00, 0x00 }
},
{ 0x00d9, 0x00, { 0x60, 0x30, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00da, 0x00, { 0x18, 0x30, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00db, 0x00, { 0x10, 0x38, 0x6C, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00dc, 0x00, { 0xCC, 0xCC, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00dd, 0x00, { 0x18, 0x30, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00de, 0x00, { 0x00, 0x00, 0x10, 0x00, 0xF0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00df, 0x00, { 0x00, 0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xD8, 0xCC, 0xC6, 0xC6, 0xC6, 0xC6, 0xCC, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e0, 0x00, { 0x00, 0x30, 0x30, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e1, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e2, 0x00, { 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e3, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e4, 0x00, { 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e5, 0x00, { 0x00, 0x00, 0x00, 0x38, 0x6C, 0x38, 0x00, 0x78, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e6, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0x36, 0x36, 0x7E, 0xD8, 0xD8, 0xD8, 0x6E, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e7, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x18, 0x70, 0x00, 0x00 }
},
{ 0x00e8, 0x00, { 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00e9, 0x00, { 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ea, 0x00, { 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00eb, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ec, 0x00, { 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ed, 0x00, { 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ee, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x3C, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00ef, 0x00, { 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f0, 0x00, { 0x00, 0x00, 0x00, 0x34, 0x18, 0x2C, 0x0C, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f1, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f2, 0x00, { 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f3, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f4, 0x00, { 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f5, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f6, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f7, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f8, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xCE, 0xDE, 0xD6, 0xF6, 0xE6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00f9, 0x00, { 0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00fa, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x30, 0x60, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00fb, 0x00, { 0x00, 0x00, 0x00, 0x30, 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00fc, 0x00, { 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00 }
},
{ 0x00fd, 0x00, { 0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00 }
},
{ 0x00fe, 0x00, { 0x00, 0x00, 0x00, 0xE0, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00 }
},
{ 0x00ff, 0x00, { 0x00, 0x00, 0x00, 0xC6, 0xC6, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00 }
},
{ (CHAR16)BOXDRAW_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_VERTICAL, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOWN_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOWN_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_UP_RIGHT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_UP_LEFT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_VERTICAL_RIGHT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_VERTICAL_LEFT, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOWN_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_UP_HORIZONTAL, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_VERTICAL_HORIZONTAL, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOUBLE_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOWN_RIGHT_DOUBLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOWN_DOUBLE_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOUBLE_DOWN_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOWN_LEFT_DOUBLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOWN_DOUBLE_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOUBLE_DOWN_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_UP_RIGHT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_UP_DOUBLE_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_DOUBLE_UP_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_UP_LEFT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_UP_DOUBLE_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_DOUBLE_UP_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_VERTICAL_LEFT_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_VERTICAL_DOUBLE_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL_LEFT, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_UP_HORIZONTAL_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_UP_DOUBLE_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_DOUBLE_UP_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0x00, {0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}},
{ (CHAR16)BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0x00, {0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36}},
{ (CHAR16)BOXDRAW_HORIZONTAL, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_VERTICAL, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOWN_RIGHT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOWN_LEFT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_UP_RIGHT, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_UP_LEFT, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_VERTICAL_RIGHT, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_VERTICAL_LEFT, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOWN_HORIZONTAL, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_UP_HORIZONTAL, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_VERTICAL_HORIZONTAL, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOUBLE_HORIZONTAL, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOWN_RIGHT_DOUBLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOWN_DOUBLE_RIGHT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOUBLE_DOWN_RIGHT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOWN_LEFT_DOUBLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOWN_DOUBLE_LEFT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOUBLE_DOWN_LEFT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_UP_RIGHT_DOUBLE, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_UP_DOUBLE_RIGHT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_DOUBLE_UP_RIGHT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_UP_LEFT_DOUBLE, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_UP_DOUBLE_LEFT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_DOUBLE_UP_LEFT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_VERTICAL_LEFT_DOUBLE, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_VERTICAL_DOUBLE_LEFT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL_LEFT, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_UP_HORIZONTAL_DOUBLE, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_UP_DOUBLE_HORIZONTAL, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_DOUBLE_UP_HORIZONTAL, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0x00, { 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }
},
{ (CHAR16)BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0x00, { 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }
},
{ (CHAR16)BLOCKELEMENT_FULL_BLOCK, 0x00, {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}},
{ (CHAR16)BLOCKELEMENT_LIGHT_SHADE, 0x00, {0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22,0x88,0x22}},
{ (CHAR16)BLOCKELEMENT_FULL_BLOCK, 0x00, { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
},
{ (CHAR16)BLOCKELEMENT_LIGHT_SHADE, 0x00, { 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 }
},
{ (CHAR16)GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)GEOMETRICSHAPE_LEFT_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)GEOMETRICSHAPE_UP_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)GEOMETRICSHAPE_DOWN_TRIANGLE, 0x00, {0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)GEOMETRICSHAPE_RIGHT_TRIANGLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFE, 0xF8, 0xF0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)GEOMETRICSHAPE_LEFT_TRIANGLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0E, 0x1E, 0x3E, 0xFE, 0x3E, 0x1E, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)GEOMETRICSHAPE_UP_TRIANGLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7C, 0x7C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)GEOMETRICSHAPE_DOWN_TRIANGLE, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x7C, 0x7C, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)ARROW_UP, 0x00, {0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)ARROW_DOWN, 0x00, {0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)ARROW_LEFT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x20,0x60,0x60,0xFE,0xFE,0x60,0x60,0x20,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)ARROW_RIGHT, 0x00, {0x00,0x00,0x00,0x00,0x00,0x08,0x0C,0x0C,0xFE,0xFE,0x0C,0x0C,0x08,0x00,0x00,0x00,0x00,0x00,0x00}},
{ (CHAR16)ARROW_UP, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)ARROW_DOWN, 0x00, { 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)ARROW_LEFT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x60, 0x60, 0xFE, 0xFE, 0x60, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
},
{ (CHAR16)ARROW_RIGHT, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0C, 0x0C, 0xFE, 0xFE, 0x0C, 0x0C, 0x08, 0x00, 0x00, 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}} //EOL
{ 0x0000, 0x00, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
} // EOL
};
// Get available Unicode glyphs narrow fonts(8*19 pixels) size.
UINT32 mNarrowFontSize = sizeof (gUsStdNarrowGlyphData);
UINT32 mNarrowFontSize = sizeof (gUsStdNarrowGlyphData);

View File

@@ -10,14 +10,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <PiDxe.h>
#include <Library/UefiLib.h>
extern EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2;
//
// Driver name table for GraphicsOutput module.
// It is shared by the implementation of ComponentName & ComponentName2 Protocol.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mGraphicsOutputDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mGraphicsOutputDriverNameTable[] = {
{
"eng;en",
L"Generic Graphics Output Driver"
@@ -80,7 +80,7 @@ GraphicsOutputComponentNameGetDriverName (
This->SupportedLanguages,
mGraphicsOutputDriverNameTable,
DriverName,
(BOOLEAN) (This == &mGraphicsOutputComponentName)
(BOOLEAN)(This == &mGraphicsOutputComponentName)
);
}
@@ -155,11 +155,11 @@ GraphicsOutputComponentNameGetDriverName (
EFI_STATUS
EFIAPI
GraphicsOutputComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
@@ -177,8 +177,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputCompon
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) GraphicsOutputComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) GraphicsOutputComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)GraphicsOutputComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)GraphicsOutputComponentNameGetControllerName,
"en"
};

View File

@@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "GraphicsOutput.h"
CONST ACPI_ADR_DEVICE_PATH mGraphicsOutputAdrNode = {
CONST ACPI_ADR_DEVICE_PATH mGraphicsOutputAdrNode = {
{
ACPI_DEVICE_PATH,
ACPI_ADR_DP,
@@ -17,7 +17,7 @@ CONST ACPI_ADR_DEVICE_PATH mGraphicsOutputAdrNode = {
ACPI_DISPLAY_ADR (1, 0, 0, 1, 0, ACPI_ADR_DISPLAY_TYPE_VGA, 0, 0)
};
EFI_PEI_GRAPHICS_DEVICE_INFO_HOB mDefaultGraphicsDeviceInfo = {
EFI_PEI_GRAPHICS_DEVICE_INFO_HOB mDefaultGraphicsDeviceInfo = {
MAX_UINT16, MAX_UINT16, MAX_UINT16, MAX_UINT16, MAX_UINT8, MAX_UINT8
};
@@ -25,7 +25,7 @@ EFI_PEI_GRAPHICS_DEVICE_INFO_HOB mDefaultGraphicsDeviceInfo = {
// The driver should only start on one graphics controller.
// So a global flag is used to remember that the driver is already started.
//
BOOLEAN mDriverStarted = FALSE;
BOOLEAN mDriverStarted = FALSE;
/**
Returns information for an available graphics mode that the graphics device
@@ -50,7 +50,7 @@ GraphicsOutputQueryMode (
OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
)
{
if (This == NULL || Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
if ((This == NULL) || (Info == NULL) || (SizeOfInfo == NULL) || (ModeNumber >= This->Mode->MaxMode)) {
return EFI_INVALID_PARAMETER;
}
@@ -74,13 +74,13 @@ GraphicsOutputQueryMode (
EFI_STATUS
EFIAPI
GraphicsOutputSetMode (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber
)
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN UINT32 ModeNumber
)
{
RETURN_STATUS Status;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
RETURN_STATUS Status;
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Black;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
if (ModeNumber >= This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
@@ -88,17 +88,19 @@ GraphicsOutputSetMode (
Private = GRAPHICS_OUTPUT_PRIVATE_FROM_THIS (This);
Black.Blue = 0;
Black.Green = 0;
Black.Red = 0;
Black.Blue = 0;
Black.Green = 0;
Black.Red = 0;
Black.Reserved = 0;
Status = FrameBufferBlt (
Private->FrameBufferBltLibConfigure,
&Black,
EfiBltVideoFill,
0, 0,
0, 0,
0,
0,
0,
0,
This->Mode->Info->HorizontalResolution,
This->Mode->Info->VerticalResolution,
0
@@ -132,21 +134,21 @@ GraphicsOutputSetMode (
EFI_STATUS
EFIAPI
GraphicsOutputBlt (
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL,
IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
IN UINTN SourceX,
IN UINTN SourceY,
IN UINTN DestinationX,
IN UINTN DestinationY,
IN UINTN Width,
IN UINTN Height,
IN UINTN Delta OPTIONAL
)
{
RETURN_STATUS Status;
EFI_TPL Tpl;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
RETURN_STATUS Status;
EFI_TPL Tpl;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
Private = GRAPHICS_OUTPUT_PRIVATE_FROM_THIS (This);
//
@@ -154,13 +156,17 @@ GraphicsOutputBlt (
// We would not want a timer based event (Cursor, ...) to come in while we are
// doing this operation.
//
Tpl = gBS->RaiseTPL (TPL_NOTIFY);
Tpl = gBS->RaiseTPL (TPL_NOTIFY);
Status = FrameBufferBlt (
Private->FrameBufferBltLibConfigure,
BltBuffer,
BltOperation,
SourceX, SourceY,
DestinationX, DestinationY, Width, Height,
SourceX,
SourceY,
DestinationX,
DestinationY,
Width,
Height,
Delta
);
gBS->RestoreTPL (Tpl);
@@ -168,7 +174,7 @@ GraphicsOutputBlt (
return RETURN_ERROR (Status) ? EFI_INVALID_PARAMETER : EFI_SUCCESS;
}
CONST GRAPHICS_OUTPUT_PRIVATE_DATA mGraphicsOutputInstanceTemplate = {
CONST GRAPHICS_OUTPUT_PRIVATE_DATA mGraphicsOutputInstanceTemplate = {
GRAPHICS_OUTPUT_PRIVATE_DATA_SIGNATURE, // Signature
NULL, // GraphicsOutputHandle
{
@@ -206,14 +212,14 @@ CONST GRAPHICS_OUTPUT_PRIVATE_DATA mGraphicsOutputInstanceTemplate = {
EFI_STATUS
EFIAPI
GraphicsOutputDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
//
// Since there is only one GraphicsInfo HOB, the driver only manages one video device.
@@ -228,7 +234,7 @@ GraphicsOutputDriverBindingSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **) &PciIo,
(VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -236,9 +242,11 @@ GraphicsOutputDriverBindingSupported (
if (Status == EFI_ALREADY_STARTED) {
Status = EFI_SUCCESS;
}
if (EFI_ERROR (Status)) {
return Status;
}
gBS->CloseProtocol (
Controller,
&gEfiPciIoProtocolGuid,
@@ -252,7 +260,7 @@ GraphicsOutputDriverBindingSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &DevicePath,
(VOID **)&DevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -260,9 +268,11 @@ GraphicsOutputDriverBindingSupported (
if (Status == EFI_ALREADY_STARTED) {
Status = EFI_SUCCESS;
}
if (EFI_ERROR (Status)) {
return Status;
}
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
@@ -272,7 +282,8 @@ GraphicsOutputDriverBindingSupported (
if ((RemainingDevicePath == NULL) ||
IsDevicePathEnd (RemainingDevicePath) ||
CompareMem (RemainingDevicePath, &mGraphicsOutputAdrNode, sizeof (mGraphicsOutputAdrNode)) == 0) {
(CompareMem (RemainingDevicePath, &mGraphicsOutputAdrNode, sizeof (mGraphicsOutputAdrNode)) == 0))
{
return EFI_SUCCESS;
} else {
return EFI_INVALID_PARAMETER;
@@ -293,29 +304,29 @@ GraphicsOutputDriverBindingSupported (
EFI_STATUS
EFIAPI
GraphicsOutputDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
RETURN_STATUS ReturnStatus;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_DEVICE_PATH *PciDevicePath;
PCI_TYPE00 Pci;
UINT8 Index;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Resources;
VOID *HobStart;
EFI_PEI_GRAPHICS_INFO_HOB *GraphicsInfo;
EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *DeviceInfo;
EFI_PHYSICAL_ADDRESS FrameBufferBase;
EFI_STATUS Status;
RETURN_STATUS ReturnStatus;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_DEVICE_PATH *PciDevicePath;
PCI_TYPE00 Pci;
UINT8 Index;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Resources;
VOID *HobStart;
EFI_PEI_GRAPHICS_INFO_HOB *GraphicsInfo;
EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *DeviceInfo;
EFI_PHYSICAL_ADDRESS FrameBufferBase;
FrameBufferBase = 0;
HobStart = GetFirstGuidHob (&gEfiGraphicsInfoHobGuid);
ASSERT ((HobStart != NULL) && (GET_GUID_HOB_DATA_SIZE (HobStart) == sizeof (EFI_PEI_GRAPHICS_INFO_HOB)));
GraphicsInfo = (EFI_PEI_GRAPHICS_INFO_HOB *) (GET_GUID_HOB_DATA (HobStart));
GraphicsInfo = (EFI_PEI_GRAPHICS_INFO_HOB *)(GET_GUID_HOB_DATA (HobStart));
HobStart = GetFirstGuidHob (&gEfiGraphicsDeviceInfoHobGuid);
if ((HobStart == NULL) || (GET_GUID_HOB_DATA_SIZE (HobStart) < sizeof (*DeviceInfo))) {
@@ -325,15 +336,21 @@ GraphicsOutputDriverBindingStart (
DeviceInfo = &mDefaultGraphicsDeviceInfo;
DEBUG ((DEBUG_INFO, "[%a]: GraphicsDeviceInfo HOB doesn't exist!\n", gEfiCallerBaseName));
} else {
DeviceInfo = (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *) (GET_GUID_HOB_DATA (HobStart));
DEBUG ((DEBUG_INFO, "[%a]: GraphicsDeviceInfo HOB:\n"
" VendorId = %04x, DeviceId = %04x,\n"
" RevisionId = %02x, BarIndex = %x,\n"
" SubsystemVendorId = %04x, SubsystemId = %04x\n",
gEfiCallerBaseName,
DeviceInfo->VendorId, DeviceInfo->DeviceId,
DeviceInfo->RevisionId, DeviceInfo->BarIndex,
DeviceInfo->SubsystemVendorId, DeviceInfo->SubsystemId));
DeviceInfo = (EFI_PEI_GRAPHICS_DEVICE_INFO_HOB *)(GET_GUID_HOB_DATA (HobStart));
DEBUG ((
DEBUG_INFO,
"[%a]: GraphicsDeviceInfo HOB:\n"
" VendorId = %04x, DeviceId = %04x,\n"
" RevisionId = %02x, BarIndex = %x,\n"
" SubsystemVendorId = %04x, SubsystemId = %04x\n",
gEfiCallerBaseName,
DeviceInfo->VendorId,
DeviceInfo->DeviceId,
DeviceInfo->RevisionId,
DeviceInfo->BarIndex,
DeviceInfo->SubsystemVendorId,
DeviceInfo->SubsystemId
));
}
//
@@ -342,7 +359,7 @@ GraphicsOutputDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **) &PciIo,
(VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -350,12 +367,13 @@ GraphicsOutputDriverBindingStart (
if (Status == EFI_ALREADY_STARTED) {
Status = EFI_SUCCESS;
}
ASSERT_EFI_ERROR (Status);
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &PciDevicePath,
(VOID **)&PciDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -363,6 +381,7 @@ GraphicsOutputDriverBindingStart (
if (Status == EFI_ALREADY_STARTED) {
Status = EFI_SUCCESS;
}
ASSERT_EFI_ERROR (Status);
//
@@ -371,13 +390,14 @@ GraphicsOutputDriverBindingStart (
Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (Pci), &Pci);
if (!EFI_ERROR (Status)) {
if (!IS_PCI_DISPLAY (&Pci) || (
((DeviceInfo->VendorId != MAX_UINT16) && (DeviceInfo->VendorId != Pci.Hdr.VendorId)) ||
((DeviceInfo->DeviceId != MAX_UINT16) && (DeviceInfo->DeviceId != Pci.Hdr.DeviceId)) ||
((DeviceInfo->RevisionId != MAX_UINT8) && (DeviceInfo->RevisionId != Pci.Hdr.RevisionID)) ||
((DeviceInfo->SubsystemVendorId != MAX_UINT16) && (DeviceInfo->SubsystemVendorId != Pci.Device.SubsystemVendorID)) ||
((DeviceInfo->SubsystemId != MAX_UINT16) && (DeviceInfo->SubsystemId != Pci.Device.SubsystemID))
((DeviceInfo->VendorId != MAX_UINT16) && (DeviceInfo->VendorId != Pci.Hdr.VendorId)) ||
((DeviceInfo->DeviceId != MAX_UINT16) && (DeviceInfo->DeviceId != Pci.Hdr.DeviceId)) ||
((DeviceInfo->RevisionId != MAX_UINT8) && (DeviceInfo->RevisionId != Pci.Hdr.RevisionID)) ||
((DeviceInfo->SubsystemVendorId != MAX_UINT16) && (DeviceInfo->SubsystemVendorId != Pci.Device.SubsystemVendorID)) ||
((DeviceInfo->SubsystemId != MAX_UINT16) && (DeviceInfo->SubsystemId != Pci.Device.SubsystemID))
)
)
) {
{
//
// It's not a video device, or device infomation doesn't match.
//
@@ -393,21 +413,30 @@ GraphicsOutputDriverBindingStart (
if ((DeviceInfo->BarIndex != MAX_UINT8) && (DeviceInfo->BarIndex != Index)) {
continue;
}
Status = PciIo->GetBarAttributes (PciIo, Index, NULL, (VOID**) &Resources);
Status = PciIo->GetBarAttributes (PciIo, Index, NULL, (VOID **)&Resources);
if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "[%a]: BAR[%d]: Base = %lx, Length = %lx\n",
gEfiCallerBaseName, Index, Resources->AddrRangeMin, Resources->AddrLen));
DEBUG ((
DEBUG_INFO,
"[%a]: BAR[%d]: Base = %lx, Length = %lx\n",
gEfiCallerBaseName,
Index,
Resources->AddrRangeMin,
Resources->AddrLen
));
if ((Resources->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) &&
(Resources->Len == (UINT16) (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3)) &&
(Resources->Len == (UINT16)(sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3)) &&
(Resources->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) &&
(Resources->AddrLen >= GraphicsInfo->FrameBufferSize)
) {
)
{
FrameBufferBase = Resources->AddrRangeMin;
DEBUG ((DEBUG_INFO, "[%a]: ... matched!\n", gEfiCallerBaseName));
break;
}
}
}
if (Index == MAX_PCI_BAR) {
Status = EFI_UNSUPPORTED;
}
@@ -430,7 +459,7 @@ GraphicsOutputDriverBindingStart (
Private->GraphicsOutputMode.FrameBufferBase = FrameBufferBase;
Private->GraphicsOutputMode.FrameBufferSize = GraphicsInfo->FrameBufferSize;
Private->GraphicsOutputMode.Info = &GraphicsInfo->GraphicsMode;
Private->GraphicsOutputMode.Info = &GraphicsInfo->GraphicsMode;
//
// Fix up Mode pointer in GraphicsOutput
@@ -463,7 +492,7 @@ GraphicsOutputDriverBindingStart (
// Create the FrameBufferBltLib configuration.
//
ReturnStatus = FrameBufferBltConfigure (
(VOID *) (UINTN) Private->GraphicsOutput.Mode->FrameBufferBase,
(VOID *)(UINTN)Private->GraphicsOutput.Mode->FrameBufferBase,
Private->GraphicsOutput.Mode->Info,
Private->FrameBufferBltLibConfigure,
&Private->FrameBufferBltLibConfigureSize
@@ -472,19 +501,20 @@ GraphicsOutputDriverBindingStart (
Private->FrameBufferBltLibConfigure = AllocatePool (Private->FrameBufferBltLibConfigureSize);
if (Private->FrameBufferBltLibConfigure != NULL) {
ReturnStatus = FrameBufferBltConfigure (
(VOID *) (UINTN) Private->GraphicsOutput.Mode->FrameBufferBase,
(VOID *)(UINTN)Private->GraphicsOutput.Mode->FrameBufferBase,
Private->GraphicsOutput.Mode->Info,
Private->FrameBufferBltLibConfigure,
&Private->FrameBufferBltLibConfigureSize
);
}
}
if (RETURN_ERROR (ReturnStatus)) {
Status = EFI_OUT_OF_RESOURCES;
goto RestorePciAttributes;
}
Private->DevicePath = AppendDevicePathNode (PciDevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &mGraphicsOutputAdrNode);
Private->DevicePath = AppendDevicePathNode (PciDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&mGraphicsOutputAdrNode);
if (Private->DevicePath == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto RestorePciAttributes;
@@ -492,8 +522,10 @@ GraphicsOutputDriverBindingStart (
Status = gBS->InstallMultipleProtocolInterfaces (
&Private->GraphicsOutputHandle,
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
&gEfiDevicePathProtocolGuid, Private->DevicePath,
&gEfiGraphicsOutputProtocolGuid,
&Private->GraphicsOutput,
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
NULL
);
@@ -501,7 +533,7 @@ GraphicsOutputDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **) &Private->PciIo,
(VOID **)&Private->PciIo,
This->DriverBindingHandle,
Private->GraphicsOutputHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -511,8 +543,10 @@ GraphicsOutputDriverBindingStart (
} else {
gBS->UninstallMultipleProtocolInterfaces (
Private->GraphicsOutputHandle,
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
&gEfiDevicePathProtocolGuid, Private->DevicePath,
&gEfiGraphicsOutputProtocolGuid,
&Private->GraphicsOutput,
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
NULL
);
}
@@ -537,9 +571,11 @@ FreeMemory:
if (Private->DevicePath != NULL) {
FreePool (Private->DevicePath);
}
if (Private->FrameBufferBltLibConfigure != NULL) {
FreePool (Private->FrameBufferBltLibConfigure);
}
FreePool (Private);
}
}
@@ -566,6 +602,7 @@ CloseProtocols:
Controller
);
}
return Status;
}
@@ -584,18 +621,17 @@ CloseProtocols:
EFI_STATUS
EFIAPI
GraphicsOutputDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
EFI_STATUS Status;
EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
GRAPHICS_OUTPUT_PRIVATE_DATA *Private;
if (NumberOfChildren == 0) {
//
// Close the PCI I/O Protocol
//
@@ -621,7 +657,7 @@ GraphicsOutputDriverBindingStop (
Status = gBS->OpenProtocol (
ChildHandleBuffer[0],
&gEfiGraphicsOutputProtocolGuid,
(VOID **) &Gop,
(VOID **)&Gop,
This->DriverBindingHandle,
ChildHandleBuffer[0],
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -644,8 +680,10 @@ GraphicsOutputDriverBindingStop (
//
Status = gBS->UninstallMultipleProtocolInterfaces (
Private->GraphicsOutputHandle,
&gEfiGraphicsOutputProtocolGuid, &Private->GraphicsOutput,
&gEfiDevicePathProtocolGuid, Private->DevicePath,
&gEfiGraphicsOutputProtocolGuid,
&Private->GraphicsOutput,
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
NULL
);
if (!EFI_ERROR (Status)) {
@@ -667,17 +705,18 @@ GraphicsOutputDriverBindingStop (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
(VOID **) &Private->PciIo,
(VOID **)&Private->PciIo,
This->DriverBindingHandle,
Private->GraphicsOutputHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
ASSERT_EFI_ERROR (Status);
}
return Status;
}
EFI_DRIVER_BINDING_PROTOCOL mGraphicsOutputDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL mGraphicsOutputDriverBinding = {
GraphicsOutputDriverBindingSupported,
GraphicsOutputDriverBindingStart,
GraphicsOutputDriverBindingStop,
@@ -702,12 +741,12 @@ EFI_DRIVER_BINDING_PROTOCOL mGraphicsOutputDriverBinding = {
EFI_STATUS
EFIAPI
InitializeGraphicsOutput (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
VOID *HobStart;
EFI_STATUS Status;
VOID *HobStart;
HobStart = GetFirstGuidHob (&gEfiGraphicsInfoHobGuid);

View File

@@ -6,6 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _GRAPHICS_OUTPUT_DXE_H_
#define _GRAPHICS_OUTPUT_DXE_H_
#include <PiDxe.h>
@@ -33,21 +34,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define MAX_PCI_BAR 6
typedef struct {
UINT32 Signature;
EFI_HANDLE GraphicsOutputHandle;
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE GraphicsOutputMode;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 PciAttributes;
FRAME_BUFFER_CONFIGURE *FrameBufferBltLibConfigure;
UINTN FrameBufferBltLibConfigureSize;
UINT32 Signature;
EFI_HANDLE GraphicsOutputHandle;
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE GraphicsOutputMode;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 PciAttributes;
FRAME_BUFFER_CONFIGURE *FrameBufferBltLibConfigure;
UINTN FrameBufferBltLibConfigureSize;
} GRAPHICS_OUTPUT_PRIVATE_DATA;
#define GRAPHICS_OUTPUT_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('g', 'g', 'o', 'p')
#define GRAPHICS_OUTPUT_PRIVATE_FROM_THIS(a) \
CR(a, GRAPHICS_OUTPUT_PRIVATE_DATA, GraphicsOutput, GRAPHICS_OUTPUT_PRIVATE_DATA_SIGNATURE)
extern EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL mGraphicsOutputComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL mGraphicsOutputComponentName2;
#endif

View File

@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Terminal.h"
/**
@@ -18,10 +17,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
AnsiRawDataToUnicode (
IN TERMINAL_DEV *TerminalDevice
IN TERMINAL_DEV *TerminalDevice
)
{
UINT8 RawData;
UINT8 RawData;
//
// pop the raw data out from the raw fifo,
@@ -29,10 +28,9 @@ AnsiRawDataToUnicode (
// the unicode into unicode fifo, until the raw fifo is empty.
//
while (!IsRawFiFoEmpty (TerminalDevice) && !IsUnicodeFiFoFull (TerminalDevice)) {
RawFiFoRemoveOneKey (TerminalDevice, &RawData);
UnicodeFiFoInsertOneKey (TerminalDevice, (UINT16) RawData);
UnicodeFiFoInsertOneKey (TerminalDevice, (UINT16)RawData);
}
}
@@ -49,22 +47,21 @@ AnsiRawDataToUnicode (
**/
EFI_STATUS
AnsiTestString (
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
)
{
CHAR8 GraphicChar;
CHAR8 GraphicChar;
//
// support three kind of character:
// valid ascii, valid efi control char, valid text graphics.
//
for (; *WString != CHAR_NULL; WString++) {
for ( ; *WString != CHAR_NULL; WString++) {
if ( !(TerminalIsValidAscii (*WString) ||
TerminalIsValidEfiCntlChar (*WString) ||
TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL) )) {
TerminalIsValidEfiCntlChar (*WString) ||
TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL)))
{
return EFI_UNSUPPORTED;
}
}

View File

@@ -20,17 +20,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gTerminalComponentNam
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gTerminalComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) TerminalComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) TerminalComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gTerminalComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)TerminalComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)TerminalComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTerminalDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mTerminalDriverNameTable[] = {
{
"eng;en",
(CHAR16 *) L"Serial Terminal Driver"
(CHAR16 *)L"Serial Terminal Driver"
},
{
NULL,
@@ -165,11 +164,11 @@ TerminalComponentNameGetDriverName (
EFI_STATUS
EFIAPI
TerminalComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
@@ -210,7 +209,7 @@ TerminalComponentNameGetControllerName (
Status = gBS->OpenProtocol (
ChildHandle,
&gEfiSimpleTextOutProtocolGuid,
(VOID **) &SimpleTextOutput,
(VOID **)&SimpleTextOutput,
gTerminalDriverBinding.DriverBindingHandle,
ChildHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL

View File

@@ -7,13 +7,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Terminal.h"
//
// Globals
//
EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding = {
TerminalDriverBindingSupported,
TerminalDriverBindingStart,
TerminalDriverBindingStop,
@@ -22,7 +21,6 @@ EFI_DRIVER_BINDING_PROTOCOL gTerminalDriverBinding = {
NULL
};
EFI_GUID *mTerminalType[] = {
&gEfiPcAnsiGuid,
&gEfiVT100Guid,
@@ -35,8 +33,7 @@ EFI_GUID *mTerminalType[] = {
&gEdkiiSCOTermGuid
};
CHAR16 *mSerialConsoleNames[] = {
CHAR16 *mSerialConsoleNames[] = {
L"PC-ANSI Serial Console",
L"VT-100 Serial Console",
L"VT-100+ Serial Console",
@@ -71,16 +68,16 @@ TERMINAL_DEV mTerminalDevTemplate = {
TerminalConOutEnableCursor,
NULL
},
{ // SimpleTextOutputMode
1, // MaxMode
0, // Mode
EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK), // Attribute
0, // CursorColumn
0, // CursorRow
TRUE // CursorVisible
{ // SimpleTextOutputMode
1, // MaxMode
0, // Mode
EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK), // Attribute
0, // CursorColumn
0, // CursorRow
TRUE // CursorVisible
},
NULL, // TerminalConsoleModeData
0, // SerialInTimeOut
0, // SerialInTimeOut
NULL, // RawFifo
NULL, // UnicodeFiFo
@@ -93,9 +90,9 @@ TERMINAL_DEV mTerminalDevTemplate = {
INPUT_STATE_DEFAULT,
RESET_STATE_DEFAULT,
{
0,
0,
0
0,
0,
0
},
0,
FALSE,
@@ -114,10 +111,10 @@ TERMINAL_DEV mTerminalDevTemplate = {
NULL // KeyNotifyProcessEvent
};
TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = {
{80, 25},
{80, 50},
{100, 31},
TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = {
{ 80, 25 },
{ 80, 50 },
{ 100, 31 },
//
// New modes can be added here.
//
@@ -132,16 +129,17 @@ TERMINAL_CONSOLE_MODE_DATA mTerminalConsoleModeData[] = {
**/
TERMINAL_TYPE
TerminalTypeFromGuid (
IN EFI_GUID *Guid
)
IN EFI_GUID *Guid
)
{
TERMINAL_TYPE Type;
TERMINAL_TYPE Type;
for (Type = 0; Type < ARRAY_SIZE (mTerminalType); Type++) {
if (CompareGuid (Guid, mTerminalType[Type])) {
break;
}
}
return Type;
}
@@ -161,9 +159,9 @@ TerminalTypeFromGuid (
EFI_STATUS
EFIAPI
TerminalDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
@@ -185,15 +183,15 @@ TerminalDriverBindingSupported (
// If RemainingDevicePath isn't the End of Device Path Node,
// check its validation
//
Node = (VENDOR_DEVICE_PATH *) RemainingDevicePath;
if (Node->Header.Type != MESSAGING_DEVICE_PATH ||
Node->Header.SubType != MSG_VENDOR_DP ||
DevicePathNodeLength(&Node->Header) != sizeof(VENDOR_DEVICE_PATH)) {
Node = (VENDOR_DEVICE_PATH *)RemainingDevicePath;
if ((Node->Header.Type != MESSAGING_DEVICE_PATH) ||
(Node->Header.SubType != MSG_VENDOR_DP) ||
(DevicePathNodeLength (&Node->Header) != sizeof (VENDOR_DEVICE_PATH)))
{
return EFI_UNSUPPORTED;
}
//
// only supports PC ANSI, VT100, VT100+, VT-UTF8, TtyTerm
// Linux, XtermR6, VT400 and SCO terminal types
@@ -203,6 +201,7 @@ TerminalDriverBindingSupported (
}
}
}
//
// Open the IO Abstraction(s) needed to perform the supported test
// The Controller must support the Serial I/O Protocol.
@@ -212,7 +211,7 @@ TerminalDriverBindingSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
(VOID **) &SerialIo,
(VOID **)&SerialIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -229,11 +228,11 @@ TerminalDriverBindingSupported (
// Close the I/O Abstraction(s) used to perform the supported test
//
gBS->CloseProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
Controller,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
//
// Open the EFI Device Path protocol needed to perform the supported test
@@ -241,7 +240,7 @@ TerminalDriverBindingSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
(VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -258,16 +257,15 @@ TerminalDriverBindingSupported (
// Close protocol, don't use device path protocol in the Support() function
//
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
return Status;
}
/**
Free notify functions list.
@@ -279,14 +277,15 @@ TerminalDriverBindingSupported (
**/
EFI_STATUS
TerminalFreeNotifyList (
IN OUT LIST_ENTRY *ListHead
IN OUT LIST_ENTRY *ListHead
)
{
TERMINAL_CONSOLE_IN_EX_NOTIFY *NotifyNode;
TERMINAL_CONSOLE_IN_EX_NOTIFY *NotifyNode;
if (ListHead == NULL) {
return EFI_INVALID_PARAMETER;
}
while (!IsListEmpty (ListHead)) {
NotifyNode = CR (
ListHead->ForwardLink,
@@ -314,8 +313,8 @@ TerminalFreeNotifyList (
**/
TERMINAL_CONSOLE_MODE_DATA *
InitializeTerminalConsoleTextMode (
OUT INT32 *TextModeCount
)
OUT INT32 *TextModeCount
)
{
TERMINAL_CONSOLE_MODE_DATA *TextModeData;
@@ -325,14 +324,22 @@ InitializeTerminalConsoleTextMode (
if (TextModeData == NULL) {
return NULL;
}
*TextModeCount = ARRAY_SIZE (mTerminalConsoleModeData);
DEBUG_CODE_BEGIN ();
INT32 Index;
for (Index = 0; Index < *TextModeCount; Index++) {
DEBUG ((DEBUG_INFO, "Terminal - Mode %d, Column = %d, Row = %d\n",
Index, TextModeData[Index].Columns, TextModeData[Index].Rows));
}
INT32 Index;
for (Index = 0; Index < *TextModeCount; Index++) {
DEBUG ((
DEBUG_INFO,
"Terminal - Mode %d, Column = %d, Row = %d\n",
Index,
TextModeData[Index].Columns,
TextModeData[Index].Rows
));
}
DEBUG_CODE_END ();
return TextModeData;
}
@@ -344,10 +351,10 @@ InitializeTerminalConsoleTextMode (
**/
VOID
StopTerminalStateMachine (
TERMINAL_DEV *TerminalDevice
TERMINAL_DEV *TerminalDevice
)
{
EFI_TPL OriginalTpl;
EFI_TPL OriginalTpl;
OriginalTpl = gBS->RaiseTPL (TPL_NOTIFY);
@@ -364,10 +371,11 @@ StopTerminalStateMachine (
**/
VOID
StartTerminalStateMachine (
TERMINAL_DEV *TerminalDevice
TERMINAL_DEV *TerminalDevice
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = gBS->CreateEvent (
EVT_TIMER | EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
@@ -407,13 +415,13 @@ EFI_STATUS
InitializeControllerNameTable (
TERMINAL_TYPE TerminalType,
EFI_UNICODE_STRING_TABLE **ControllerNameTable
)
)
{
EFI_STATUS Status;
EFI_UNICODE_STRING_TABLE *Table;
ASSERT (TerminalType < ARRAY_SIZE (mTerminalType));
Table = NULL;
Table = NULL;
Status = AddUnicodeString2 (
"eng",
gTerminalComponentName.SupportedLanguages,
@@ -433,9 +441,11 @@ InitializeControllerNameTable (
FreeUnicodeStringTable (Table);
}
}
if (!EFI_ERROR (Status)) {
*ControllerNameTable = Table;
}
return Status;
}
@@ -458,26 +468,26 @@ InitializeControllerNameTable (
EFI_STATUS
EFIAPI
TerminalDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_DEVICE_PATH_PROTOCOL *Vendor;
EFI_HANDLE SerialIoHandle;
EFI_SERIAL_IO_MODE *Mode;
UINTN SerialInTimeOut;
TERMINAL_DEV *TerminalDevice;
UINT8 TerminalType;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
UINTN EntryCount;
UINTN Index;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOutput;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextInput;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_STATUS Status;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
EFI_DEVICE_PATH_PROTOCOL *Vendor;
EFI_HANDLE SerialIoHandle;
EFI_SERIAL_IO_MODE *Mode;
UINTN SerialInTimeOut;
TERMINAL_DEV *TerminalDevice;
UINT8 TerminalType;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
UINTN EntryCount;
UINTN Index;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOutput;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextInput;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
//
// Get the Device Path Protocol to build the device path of the child device
@@ -485,7 +495,7 @@ TerminalDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
(VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -501,7 +511,7 @@ TerminalDriverBindingStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
(VOID **) &SerialIo,
(VOID **)&SerialIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -529,7 +539,6 @@ TerminalDriverBindingStart (
}
if (Status == EFI_ALREADY_STARTED) {
if (RemainingDevicePath == NULL) {
//
// If RemainingDevicePath is NULL or is the End of Device Path Node
@@ -554,14 +563,14 @@ TerminalDriverBindingStart (
Status = gBS->OpenProtocol (
OpenInfoBuffer[Index].ControllerHandle,
&gEfiSimpleTextInProtocolGuid,
(VOID **) &SimpleTextInput,
(VOID **)&SimpleTextInput,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
TerminalDevice = TERMINAL_CON_IN_DEV_FROM_THIS (SimpleTextInput);
TerminalType = TerminalTypeFromGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid);
TerminalType = TerminalTypeFromGuid (&((VENDOR_DEVICE_PATH *)RemainingDevicePath)->Guid);
ASSERT (TerminalType < ARRAY_SIZE (mTerminalType));
if (TerminalDevice->TerminalType != TerminalType) {
Status = InitializeControllerNameTable (TerminalType, &ControllerNameTable);
@@ -573,7 +582,7 @@ TerminalDriverBindingStart (
Vendor = TerminalDevice->DevicePath;
Status = gBS->LocateDevicePath (&gEfiSerialIoProtocolGuid, &Vendor, &SerialIoHandle);
ASSERT_EFI_ERROR (Status);
CopyGuid (&((VENDOR_DEVICE_PATH *) Vendor)->Guid, mTerminalType[TerminalType]);
CopyGuid (&((VENDOR_DEVICE_PATH *)Vendor)->Guid, mTerminalType[TerminalType]);
Status = gBS->ReinstallProtocolInterface (
TerminalDevice->Handle,
&gEfiDevicePathProtocolGuid,
@@ -589,17 +598,20 @@ TerminalDriverBindingStart (
//
// Restore the device path on failure
//
CopyGuid (&((VENDOR_DEVICE_PATH *) Vendor)->Guid, mTerminalType[TerminalDevice->TerminalType]);
CopyGuid (&((VENDOR_DEVICE_PATH *)Vendor)->Guid, mTerminalType[TerminalDevice->TerminalType]);
FreeUnicodeStringTable (ControllerNameTable);
}
}
}
}
break;
}
}
FreePool (OpenInfoBuffer);
}
return Status;
}
@@ -626,8 +638,9 @@ TerminalDriverBindingStart (
// If RemainingDevicePath isn't the End of Device Path Node,
// Use the RemainingDevicePath to determine the terminal type
//
TerminalDevice->TerminalType = TerminalTypeFromGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid);
TerminalDevice->TerminalType = TerminalTypeFromGuid (&((VENDOR_DEVICE_PATH *)RemainingDevicePath)->Guid);
}
ASSERT (TerminalDevice->TerminalType < ARRAY_SIZE (mTerminalType));
TerminalDevice->SerialIo = SerialIo;
@@ -682,14 +695,17 @@ TerminalDriverBindingStart (
if (TerminalDevice->RawFiFo == NULL) {
goto FreeResources;
}
TerminalDevice->UnicodeFiFo = AllocateZeroPool (sizeof (UNICODE_FIFO));
if (TerminalDevice->UnicodeFiFo == NULL) {
goto FreeResources;
}
TerminalDevice->EfiKeyFiFo = AllocateZeroPool (sizeof (EFI_KEY_FIFO));
if (TerminalDevice->EfiKeyFiFo == NULL) {
goto FreeResources;
}
TerminalDevice->EfiKeyFiFoForNotify = AllocateZeroPool (sizeof (EFI_KEY_FIFO));
if (TerminalDevice->EfiKeyFiFoForNotify == NULL) {
goto FreeResources;
@@ -702,17 +718,17 @@ TerminalDriverBindingStart (
SerialInTimeOut = 0;
if (Mode->BaudRate != 0) {
SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN) Mode->BaudRate;
SerialInTimeOut = (1 + Mode->DataBits + Mode->StopBits) * 2 * 1000000 / (UINTN)Mode->BaudRate;
}
Status = TerminalDevice->SerialIo->SetAttributes (
TerminalDevice->SerialIo,
Mode->BaudRate,
Mode->ReceiveFifoDepth,
(UINT32) SerialInTimeOut,
(EFI_PARITY_TYPE) (Mode->Parity),
(UINT8) Mode->DataBits,
(EFI_STOP_BITS_TYPE) (Mode->StopBits)
(UINT32)SerialInTimeOut,
(EFI_PARITY_TYPE)(Mode->Parity),
(UINT8)Mode->DataBits,
(EFI_STOP_BITS_TYPE)(Mode->StopBits)
);
if (EFI_ERROR (Status)) {
//
@@ -728,26 +744,28 @@ TerminalDriverBindingStart (
}
SimpleTextOutput = &TerminalDevice->SimpleTextOutput;
SimpleTextInput = &TerminalDevice->SimpleInput;
SimpleTextInput = &TerminalDevice->SimpleInput;
//
// Initialize SimpleTextOut instance
//
SimpleTextOutput->Mode = &TerminalDevice->SimpleTextOutputMode;
SimpleTextOutput->Mode = &TerminalDevice->SimpleTextOutputMode;
TerminalDevice->TerminalConsoleModeData = InitializeTerminalConsoleTextMode (
&SimpleTextOutput->Mode->MaxMode
);
&SimpleTextOutput->Mode->MaxMode
);
if (TerminalDevice->TerminalConsoleModeData == NULL) {
goto FreeResources;
}
//
// For terminal devices, cursor is always visible
//
SimpleTextOutput->Mode->CursorVisible = TRUE;
Status = SimpleTextOutput->SetAttribute (SimpleTextOutput, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
Status = SimpleTextOutput->SetAttribute (SimpleTextOutput, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));
if (!EFI_ERROR (Status)) {
Status = SimpleTextOutput->Reset (SimpleTextOutput, FALSE);
}
if (EFI_ERROR (Status)) {
goto ReportError;
}
@@ -762,17 +780,21 @@ TerminalDriverBindingStart (
Status = gBS->InstallMultipleProtocolInterfaces (
&TerminalDevice->Handle,
&gEfiSimpleTextInProtocolGuid, &TerminalDevice->SimpleInput,
&gEfiSimpleTextInputExProtocolGuid, &TerminalDevice->SimpleInputEx,
&gEfiSimpleTextOutProtocolGuid, &TerminalDevice->SimpleTextOutput,
&gEfiDevicePathProtocolGuid, TerminalDevice->DevicePath,
&gEfiSimpleTextInProtocolGuid,
&TerminalDevice->SimpleInput,
&gEfiSimpleTextInputExProtocolGuid,
&TerminalDevice->SimpleInputEx,
&gEfiSimpleTextOutProtocolGuid,
&TerminalDevice->SimpleTextOutput,
&gEfiDevicePathProtocolGuid,
TerminalDevice->DevicePath,
NULL
);
if (!EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
(VOID **) &TerminalDevice->SerialIo,
(VOID **)&TerminalDevice->SerialIo,
This->DriverBindingHandle,
TerminalDevice->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -795,9 +817,11 @@ FreeResources:
if (TerminalDevice->SimpleInput.WaitForKey != NULL) {
gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
}
if (TerminalDevice->SimpleInputEx.WaitForKeyEx != NULL) {
gBS->CloseEvent (TerminalDevice->SimpleInputEx.WaitForKeyEx);
}
if (TerminalDevice->KeyNotifyProcessEvent != NULL) {
gBS->CloseEvent (TerminalDevice->KeyNotifyProcessEvent);
}
@@ -805,12 +829,15 @@ FreeResources:
if (TerminalDevice->RawFiFo != NULL) {
FreePool (TerminalDevice->RawFiFo);
}
if (TerminalDevice->UnicodeFiFo != NULL) {
FreePool (TerminalDevice->UnicodeFiFo);
}
if (TerminalDevice->EfiKeyFiFo != NULL) {
FreePool (TerminalDevice->EfiKeyFiFo);
}
if (TerminalDevice->EfiKeyFiFoForNotify != NULL) {
FreePool (TerminalDevice->EfiKeyFiFoForNotify);
}
@@ -875,10 +902,10 @@ CloseProtocols:
EFI_STATUS
EFIAPI
TerminalDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -900,7 +927,7 @@ TerminalDriverBindingStop (
Status = gBS->OpenProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
(VOID **)&ParentDevicePath,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -916,18 +943,18 @@ TerminalDriverBindingStop (
TerminalRemoveConsoleDevVariable (EFI_ERR_OUT_DEV_VARIABLE_NAME, ParentDevicePath);
gBS->CloseProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
Controller,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
Controller
);
gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
Controller
);
return EFI_SUCCESS;
}
@@ -935,25 +962,23 @@ TerminalDriverBindingStop (
AllChildrenStopped = TRUE;
for (Index = 0; Index < NumberOfChildren; Index++) {
Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiSimpleTextOutProtocolGuid,
(VOID **) &SimpleTextOutput,
(VOID **)&SimpleTextOutput,
This->DriverBindingHandle,
ChildHandleBuffer[Index],
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (SimpleTextOutput);
gBS->CloseProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ChildHandleBuffer[Index]
);
Controller,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ChildHandleBuffer[Index]
);
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandleBuffer[Index],
@@ -969,15 +994,14 @@ TerminalDriverBindingStop (
);
if (EFI_ERROR (Status)) {
gBS->OpenProtocol (
Controller,
&gEfiSerialIoProtocolGuid,
(VOID **) &SerialIo,
This->DriverBindingHandle,
ChildHandleBuffer[Index],
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
Controller,
&gEfiSerialIoProtocolGuid,
(VOID **)&SerialIo,
This->DriverBindingHandle,
ChildHandleBuffer[Index],
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
} else {
FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);
StopTerminalStateMachine (TerminalDevice);
gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
@@ -1023,8 +1047,8 @@ MatchDevicePaths (
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
UINTN Size;
DevicePath = Multi;
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
DevicePath = Multi;
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
//
// Search for the match of 'Single' in 'Multi'
//
@@ -1058,23 +1082,24 @@ TerminalUpdateConsoleDevVariable (
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath
)
{
EFI_STATUS Status;
UINTN NameSize;
UINTN VariableSize;
TERMINAL_TYPE TerminalType;
EFI_DEVICE_PATH_PROTOCOL *Variable;
EFI_DEVICE_PATH_PROTOCOL *NewVariable;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EDKII_SET_VARIABLE_STATUS *SetVariableStatus;
EFI_STATUS Status;
UINTN NameSize;
UINTN VariableSize;
TERMINAL_TYPE TerminalType;
EFI_DEVICE_PATH_PROTOCOL *Variable;
EFI_DEVICE_PATH_PROTOCOL *NewVariable;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
EDKII_SET_VARIABLE_STATUS *SetVariableStatus;
//
// Get global variable and its size according to the name given.
//
Status = GetEfiGlobalVariable2 (VariableName, (VOID**)&Variable, NULL);
Status = GetEfiGlobalVariable2 (VariableName, (VOID **)&Variable, NULL);
if (Status == EFI_NOT_FOUND) {
Status = EFI_SUCCESS;
Variable = NULL;
}
if (EFI_ERROR (Status)) {
return;
}
@@ -1092,13 +1117,13 @@ TerminalUpdateConsoleDevVariable (
if (Variable != NULL) {
FreePool (Variable);
}
Variable = NewVariable;
}
}
FreePool (TempDevicePath);
}
}
VariableSize = GetDevicePathSize (Variable);
@@ -1112,7 +1137,7 @@ TerminalUpdateConsoleDevVariable (
);
if (EFI_ERROR (Status)) {
NameSize = StrSize (VariableName);
NameSize = StrSize (VariableName);
SetVariableStatus = AllocatePool (sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + VariableSize);
if (SetVariableStatus != NULL) {
CopyGuid (&SetVariableStatus->Guid, &gEfiGlobalVariableGuid);
@@ -1120,8 +1145,8 @@ TerminalUpdateConsoleDevVariable (
SetVariableStatus->DataSize = VariableSize;
SetVariableStatus->SetStatus = Status;
SetVariableStatus->Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
CopyMem (SetVariableStatus + 1, VariableName, NameSize);
CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Variable, VariableSize);
CopyMem (SetVariableStatus + 1, VariableName, NameSize);
CopyMem (((UINT8 *)(SetVariableStatus + 1)) + NameSize, Variable, VariableSize);
REPORT_STATUS_CODE_EX (
EFI_ERROR_CODE,
@@ -1139,10 +1164,9 @@ TerminalUpdateConsoleDevVariable (
FreePool (Variable);
return ;
return;
}
/**
Remove terminal device path from Console Device Environment Variables.
@@ -1169,19 +1193,19 @@ TerminalRemoveConsoleDevVariable (
EFI_DEVICE_PATH_PROTOCOL *SavedNewVariable;
EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
Instance = NULL;
Instance = NULL;
//
// Get global variable and its size according to the name given.
//
GetEfiGlobalVariable2 (VariableName, (VOID**)&Variable, NULL);
GetEfiGlobalVariable2 (VariableName, (VOID **)&Variable, NULL);
if (Variable == NULL) {
return ;
return;
}
FoundOne = FALSE;
OriginalVariable = Variable;
NewVariable = NULL;
FoundOne = FALSE;
OriginalVariable = Variable;
NewVariable = NULL;
//
// Get first device path instance from Variable
@@ -1189,8 +1213,9 @@ TerminalRemoveConsoleDevVariable (
Instance = GetNextDevicePathInstance (&Variable, &InstanceSize);
if (Instance == NULL) {
FreePool (OriginalVariable);
return ;
return;
}
//
// Loop through all the device path instances of Variable
//
@@ -1200,7 +1225,6 @@ TerminalRemoveConsoleDevVariable (
//
Match = FALSE;
for (TerminalType = 0; TerminalType < ARRAY_SIZE (mTerminalType); TerminalType++) {
SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);
//
@@ -1208,23 +1232,25 @@ TerminalRemoveConsoleDevVariable (
//
if (TempDevicePath != NULL) {
if (CompareMem (Instance, TempDevicePath, InstanceSize) == 0) {
Match = TRUE;
FoundOne = TRUE;
Match = TRUE;
FoundOne = TRUE;
}
FreePool (TempDevicePath);
}
}
//
// If a match was not found, then keep the current device path instance
//
if (!Match) {
SavedNewVariable = NewVariable;
NewVariable = AppendDevicePathInstance (NewVariable, Instance);
SavedNewVariable = NewVariable;
NewVariable = AppendDevicePathInstance (NewVariable, Instance);
if (SavedNewVariable != NULL) {
FreePool (SavedNewVariable);
}
}
//
// Get next device path instance from Variable
//
@@ -1254,7 +1280,7 @@ TerminalRemoveConsoleDevVariable (
FreePool (NewVariable);
}
return ;
return;
}
/**
@@ -1271,9 +1297,9 @@ TerminalRemoveConsoleDevVariable (
**/
EFI_STATUS
SetTerminalDevicePath (
IN TERMINAL_TYPE TerminalType,
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
IN TERMINAL_TYPE TerminalType,
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
)
{
VENDOR_DEVICE_PATH Node;
@@ -1290,7 +1316,7 @@ SetTerminalDevicePath (
//
*TerminalDevicePath = AppendDevicePathNode (
ParentDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &Node
(EFI_DEVICE_PATH_PROTOCOL *)&Node
);
if (*TerminalDevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -1311,12 +1337,12 @@ SetTerminalDevicePath (
**/
EFI_STATUS
EFIAPI
InitializeTerminal(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
InitializeTerminal (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Install driver model protocol(s).
@@ -1348,10 +1374,10 @@ InitializeTerminal(
**/
BOOLEAN
IsHotPlugDevice (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath;
EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath;
CheckDevicePath = DevicePath;
while (!IsDevicePathEnd (CheckDevicePath)) {
@@ -1359,16 +1385,19 @@ IsHotPlugDevice (
// Check device whether is hot plug device or not throught Device Path
//
if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) &&
(DevicePathSubType (CheckDevicePath) == MSG_USB_DP ||
DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP ||
DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) {
((DevicePathSubType (CheckDevicePath) == MSG_USB_DP) ||
(DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP) ||
(DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)))
{
//
// If Device is USB device
//
return TRUE;
}
if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&
(DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {
(DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP))
{
//
// If Device is PCCard
//

View File

@@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _TERMINAL_H_
#define _TERMINAL_H_
#include <Uefi.h>
#include <Guid/GlobalVariable.h>
@@ -36,44 +35,43 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PcdLib.h>
#include <Library/BaseLib.h>
#define RAW_FIFO_MAX_NUMBER 255
#define FIFO_MAX_NUMBER 128
#define RAW_FIFO_MAX_NUMBER 255
#define FIFO_MAX_NUMBER 128
typedef struct {
UINT8 Head;
UINT8 Tail;
UINT8 Data[RAW_FIFO_MAX_NUMBER + 1];
UINT8 Head;
UINT8 Tail;
UINT8 Data[RAW_FIFO_MAX_NUMBER + 1];
} RAW_DATA_FIFO;
typedef struct {
UINT8 Head;
UINT8 Tail;
UINT16 Data[FIFO_MAX_NUMBER + 1];
UINT8 Head;
UINT8 Tail;
UINT16 Data[FIFO_MAX_NUMBER + 1];
} UNICODE_FIFO;
typedef struct {
UINT8 Head;
UINT8 Tail;
EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1];
UINT8 Head;
UINT8 Tail;
EFI_INPUT_KEY Data[FIFO_MAX_NUMBER + 1];
} EFI_KEY_FIFO;
typedef struct {
UINTN Columns;
UINTN Rows;
UINTN Columns;
UINTN Rows;
} TERMINAL_CONSOLE_MODE_DATA;
#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
#define TERMINAL_DEV_SIGNATURE SIGNATURE_32 ('t', 'm', 'n', 'l')
#define TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('t', 'm', 'e', 'n')
#define TERMINAL_CONSOLE_IN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('t', 'm', 'e', 'n')
typedef struct _TERMINAL_CONSOLE_IN_EX_NOTIFY {
UINTN Signature;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
UINTN Signature;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
LIST_ENTRY NotifyEntry;
} TERMINAL_CONSOLE_IN_EX_NOTIFY;
typedef enum {
@@ -89,27 +87,27 @@ typedef enum {
} TERMINAL_TYPE;
typedef struct {
UINTN Signature;
EFI_HANDLE Handle;
TERMINAL_TYPE TerminalType;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
TERMINAL_CONSOLE_MODE_DATA *TerminalConsoleModeData;
UINTN SerialInTimeOut;
RAW_DATA_FIFO *RawFiFo;
UNICODE_FIFO *UnicodeFiFo;
EFI_KEY_FIFO *EfiKeyFiFo;
EFI_KEY_FIFO *EfiKeyFiFoForNotify;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_EVENT TimerEvent;
EFI_EVENT TwoSecondTimeOut;
UINT32 InputState;
UINT32 ResetState;
UINT16 TtyEscapeStr[3];
INTN TtyEscapeIndex;
UINTN Signature;
EFI_HANDLE Handle;
TERMINAL_TYPE TerminalType;
EFI_SERIAL_IO_PROTOCOL *SerialIo;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleInput;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
TERMINAL_CONSOLE_MODE_DATA *TerminalConsoleModeData;
UINTN SerialInTimeOut;
RAW_DATA_FIFO *RawFiFo;
UNICODE_FIFO *UnicodeFiFo;
EFI_KEY_FIFO *EfiKeyFiFo;
EFI_KEY_FIFO *EfiKeyFiFoForNotify;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_EVENT TimerEvent;
EFI_EVENT TwoSecondTimeOut;
UINT32 InputState;
UINT32 ResetState;
UINT16 TtyEscapeStr[3];
INTN TtyEscapeIndex;
//
// Esc could not be output to the screen by user,
@@ -118,57 +116,57 @@ typedef struct {
// This boolean is used by the terminal driver only
// to indicate whether the Esc could be sent or not.
//
BOOLEAN OutputEscChar;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
LIST_ENTRY NotifyList;
EFI_EVENT KeyNotifyProcessEvent;
BOOLEAN OutputEscChar;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx;
LIST_ENTRY NotifyList;
EFI_EVENT KeyNotifyProcessEvent;
} TERMINAL_DEV;
#define INPUT_STATE_DEFAULT 0x00
#define INPUT_STATE_ESC 0x01
#define INPUT_STATE_CSI 0x02
#define INPUT_STATE_LEFTOPENBRACKET 0x04
#define INPUT_STATE_O 0x08
#define INPUT_STATE_2 0x10
#define INPUT_STATE_LEFTOPENBRACKET_TTY 0x20
#define INPUT_STATE_1 0x40
#define INPUT_STATE_LEFTOPENBRACKET_2ND 0x80
#define INPUT_STATE_DEFAULT 0x00
#define INPUT_STATE_ESC 0x01
#define INPUT_STATE_CSI 0x02
#define INPUT_STATE_LEFTOPENBRACKET 0x04
#define INPUT_STATE_O 0x08
#define INPUT_STATE_2 0x10
#define INPUT_STATE_LEFTOPENBRACKET_TTY 0x20
#define INPUT_STATE_1 0x40
#define INPUT_STATE_LEFTOPENBRACKET_2ND 0x80
#define RESET_STATE_DEFAULT 0x00
#define RESET_STATE_ESC_R 0x01
#define RESET_STATE_ESC_R_ESC_R 0x02
#define RESET_STATE_DEFAULT 0x00
#define RESET_STATE_ESC_R 0x01
#define RESET_STATE_ESC_R_ESC_R 0x02
#define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE)
#define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE)
#define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE)
#define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE)
#define TERMINAL_CON_IN_EX_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInputEx, TERMINAL_DEV_SIGNATURE)
typedef union {
UINT8 Utf8_1;
UINT8 Utf8_2[2];
UINT8 Utf8_3[3];
UINT8 Utf8_1;
UINT8 Utf8_2[2];
UINT8 Utf8_3[3];
} UTF8_CHAR;
#define LEFTOPENBRACKET 0x5b // '['
#define ACAP 0x41
#define BCAP 0x42
#define CCAP 0x43
#define DCAP 0x44
#define LEFTOPENBRACKET 0x5b // '['
#define ACAP 0x41
#define BCAP 0x42
#define CCAP 0x43
#define DCAP 0x44
#define BACKSPACE 8
#define ESC 27
#define CSI 0x9B
#define DEL 127
#define BRIGHT_CONTROL_OFFSET 2
#define FOREGROUND_CONTROL_OFFSET 6
#define BACKGROUND_CONTROL_OFFSET 11
#define ROW_OFFSET 2
#define COLUMN_OFFSET 5
#define FW_BACK_OFFSET 2
#define BACKSPACE 8
#define ESC 27
#define CSI 0x9B
#define DEL 127
#define BRIGHT_CONTROL_OFFSET 2
#define FOREGROUND_CONTROL_OFFSET 6
#define BACKGROUND_CONTROL_OFFSET 11
#define ROW_OFFSET 2
#define COLUMN_OFFSET 5
#define FW_BACK_OFFSET 2
typedef struct {
UINT16 Unicode;
CHAR8 PcAnsi;
CHAR8 Ascii;
UINT16 Unicode;
CHAR8 PcAnsi;
CHAR8 Ascii;
} UNICODE_TO_CHAR;
//
@@ -191,8 +189,8 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gTerminalComponentName2;
EFI_STATUS
EFIAPI
InitializeTerminal (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -210,11 +208,10 @@ InitializeTerminal (
EFI_STATUS
EFIAPI
TerminalConInReset (
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
Implements EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke().
@@ -266,8 +263,8 @@ IsKeyRegistered (
VOID
EFIAPI
TerminalConInWaitForKeyEx (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
//
@@ -311,8 +308,8 @@ TerminalConInResetEx (
EFI_STATUS
EFIAPI
TerminalConInReadKeyStrokeEx (
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
);
/**
@@ -399,8 +396,8 @@ TerminalConInUnregisterKeyNotify (
VOID
EFIAPI
TerminalConInWaitForKey (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -421,8 +418,8 @@ TerminalConInWaitForKey (
EFI_STATUS
EFIAPI
TerminalConOutReset (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -609,9 +606,9 @@ TerminalConOutEnableCursor (
EFI_STATUS
EFIAPI
TerminalDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -633,12 +630,11 @@ TerminalDriverBindingSupported (
EFI_STATUS
EFIAPI
TerminalDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
Stop this driver on Controller by closing Simple Text In, Simple Text
In Ex, Simple Text Out protocol, and removing parent device path from
@@ -657,10 +653,10 @@ TerminalDriverBindingStart (
EFI_STATUS
EFIAPI
TerminalDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
/**
@@ -674,7 +670,7 @@ TerminalDriverBindingStop (
**/
EFI_STATUS
TerminalFreeNotifyList (
IN OUT LIST_ENTRY *ListHead
IN OUT LIST_ENTRY *ListHead
);
/**
@@ -724,7 +720,6 @@ TerminalComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -796,14 +791,13 @@ TerminalComponentNameGetDriverName (
EFI_STATUS
EFIAPI
TerminalComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
//
// internal functions
//
@@ -866,9 +860,9 @@ TerminalRemoveConsoleDevVariable (
**/
EFI_STATUS
SetTerminalDevicePath (
IN TERMINAL_TYPE TerminalType,
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
IN TERMINAL_TYPE TerminalType,
IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,
OUT EFI_DEVICE_PATH_PROTOCOL **TerminalDevicePath
);
/**
@@ -963,8 +957,8 @@ IsRawFiFoFull (
**/
BOOLEAN
EfiKeyFiFoForNotifyInsertOneKey (
EFI_KEY_FIFO *EfiKeyFiFo,
EFI_INPUT_KEY *Input
EFI_KEY_FIFO *EfiKeyFiFo,
EFI_INPUT_KEY *Input
);
/**
@@ -979,8 +973,8 @@ EfiKeyFiFoForNotifyInsertOneKey (
**/
BOOLEAN
EfiKeyFiFoForNotifyRemoveOneKey (
EFI_KEY_FIFO *EfiKeyFiFo,
EFI_INPUT_KEY *Output
EFI_KEY_FIFO *EfiKeyFiFo,
EFI_INPUT_KEY *Output
);
/**
@@ -994,7 +988,7 @@ EfiKeyFiFoForNotifyRemoveOneKey (
**/
BOOLEAN
IsEfiKeyFiFoForNotifyEmpty (
IN EFI_KEY_FIFO *EfiKeyFiFo
IN EFI_KEY_FIFO *EfiKeyFiFo
);
/**
@@ -1008,7 +1002,7 @@ IsEfiKeyFiFoForNotifyEmpty (
**/
BOOLEAN
IsEfiKeyFiFoForNotifyFull (
EFI_KEY_FIFO *EfiKeyFiFo
EFI_KEY_FIFO *EfiKeyFiFo
);
/**
@@ -1024,8 +1018,8 @@ IsEfiKeyFiFoForNotifyFull (
**/
BOOLEAN
EfiKeyFiFoInsertOneKey (
TERMINAL_DEV *TerminalDevice,
EFI_INPUT_KEY *Key
TERMINAL_DEV *TerminalDevice,
EFI_INPUT_KEY *Key
);
/**
@@ -1040,8 +1034,8 @@ EfiKeyFiFoInsertOneKey (
**/
BOOLEAN
EfiKeyFiFoRemoveOneKey (
TERMINAL_DEV *TerminalDevice,
EFI_INPUT_KEY *Output
TERMINAL_DEV *TerminalDevice,
EFI_INPUT_KEY *Output
);
/**
@@ -1085,8 +1079,8 @@ IsEfiKeyFiFoFull (
**/
BOOLEAN
UnicodeFiFoInsertOneKey (
TERMINAL_DEV *TerminalDevice,
UINT16 Input
TERMINAL_DEV *TerminalDevice,
UINT16 Input
);
/**
@@ -1132,7 +1126,6 @@ IsUnicodeFiFoFull (
TERMINAL_DEV *TerminalDevice
);
/**
Translate raw data into Unicode (according to different encode), and
translate Unicode into key information. (according to different standard).
@@ -1142,7 +1135,7 @@ IsUnicodeFiFoFull (
**/
VOID
TranslateRawDataToEfiKey (
IN TERMINAL_DEV *TerminalDevice
IN TERMINAL_DEV *TerminalDevice
);
//
@@ -1158,7 +1151,7 @@ TranslateRawDataToEfiKey (
**/
VOID
AnsiRawDataToUnicode (
IN TERMINAL_DEV *TerminalDevice
IN TERMINAL_DEV *TerminalDevice
);
/**
@@ -1248,7 +1241,7 @@ Putty function key map:
**/
VOID
UnicodeToEfiKey (
IN TERMINAL_DEV *TerminalDevice
IN TERMINAL_DEV *TerminalDevice
);
/**
@@ -1264,8 +1257,8 @@ UnicodeToEfiKey (
**/
EFI_STATUS
AnsiTestString (
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
);
//
@@ -1281,7 +1274,7 @@ AnsiTestString (
**/
VOID
VTUTF8RawDataToUnicode (
IN TERMINAL_DEV *VtUtf8Device
IN TERMINAL_DEV *VtUtf8Device
);
/**
@@ -1295,8 +1288,8 @@ VTUTF8RawDataToUnicode (
**/
EFI_STATUS
VTUTF8TestString (
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
);
/**
@@ -1317,9 +1310,9 @@ VTUTF8TestString (
**/
VOID
UnicodeToUtf8 (
IN CHAR16 Unicode,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
IN CHAR16 Unicode,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
);
/**
@@ -1333,9 +1326,9 @@ UnicodeToUtf8 (
**/
VOID
GetOneValidUtf8Char (
IN TERMINAL_DEV *Utf8Device,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
IN TERMINAL_DEV *Utf8Device,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
);
/**
@@ -1355,9 +1348,9 @@ GetOneValidUtf8Char (
**/
VOID
Utf8ToUnicode (
IN UTF8_CHAR Utf8Char,
IN UINT8 ValidBytes,
OUT CHAR16 *UnicodeChar
IN UTF8_CHAR Utf8Char,
IN UINT8 ValidBytes,
OUT CHAR16 *UnicodeChar
);
//
@@ -1425,7 +1418,7 @@ TerminalIsValidEfiCntlChar (
**/
BOOLEAN
IsHotPlugDevice (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
@@ -1437,11 +1430,10 @@ IsHotPlugDevice (
VOID
EFIAPI
TerminalConInTimerHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
Process key notify.
@@ -1451,8 +1443,8 @@ TerminalConInTimerHandler (
VOID
EFIAPI
KeyNotifyProcessHandler (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -16,69 +16,69 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
//
UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] = {
{ BOXDRAW_HORIZONTAL, 0xc4, L'-' },
{ BOXDRAW_VERTICAL, 0xb3, L'|' },
{ BOXDRAW_DOWN_RIGHT, 0xda, L'/' },
{ BOXDRAW_HORIZONTAL, 0xc4, L'-' },
{ BOXDRAW_VERTICAL, 0xb3, L'|' },
{ BOXDRAW_DOWN_RIGHT, 0xda, L'/' },
{ BOXDRAW_DOWN_LEFT, 0xbf, L'\\' },
{ BOXDRAW_UP_RIGHT, 0xc0, L'\\' },
{ BOXDRAW_UP_LEFT, 0xd9, L'/' },
{ BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|' },
{ BOXDRAW_VERTICAL_LEFT, 0xb4, L'|' },
{ BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+' },
{ BOXDRAW_UP_HORIZONTAL, 0xc1, L'+' },
{ BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+' },
{ BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-' },
{ BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|' },
{ BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/' },
{ BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/' },
{ BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/' },
{ BOXDRAW_UP_LEFT, 0xd9, L'/' },
{ BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|' },
{ BOXDRAW_VERTICAL_LEFT, 0xb4, L'|' },
{ BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+' },
{ BOXDRAW_UP_HORIZONTAL, 0xc1, L'+' },
{ BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+' },
{ BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-' },
{ BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|' },
{ BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/' },
{ BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/' },
{ BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/' },
{ BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\' },
{ BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\' },
{ BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\' },
{ BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\' },
{ BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\' },
{ BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\' },
{ BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/' },
{ BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/' },
{ BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/' },
{ BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|' },
{ BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|' },
{ BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|' },
{ BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|' },
{ BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|' },
{ BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|' },
{ BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+' },
{ BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+' },
{ BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+' },
{ BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+' },
{ BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+' },
{ BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+' },
{ BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+' },
{ BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+' },
{ BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+' },
{ BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/' },
{ BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/' },
{ BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/' },
{ BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|' },
{ BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|' },
{ BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|' },
{ BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|' },
{ BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|' },
{ BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|' },
{ BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+' },
{ BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+' },
{ BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+' },
{ BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+' },
{ BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+' },
{ BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+' },
{ BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+' },
{ BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+' },
{ BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+' },
{ BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*' },
{ BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+' },
{ BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*' },
{ BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+' },
{ GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^' },
{ GEOMETRICSHAPE_RIGHT_TRIANGLE, '>', L'>' },
{ GEOMETRICSHAPE_DOWN_TRIANGLE, 'v', L'v' },
{ GEOMETRICSHAPE_LEFT_TRIANGLE, '<', L'<' },
{ GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^' },
{ GEOMETRICSHAPE_RIGHT_TRIANGLE, '>', L'>' },
{ GEOMETRICSHAPE_DOWN_TRIANGLE, 'v', L'v' },
{ GEOMETRICSHAPE_LEFT_TRIANGLE, '<', L'<' },
{ ARROW_LEFT, '<', L'<' },
{ ARROW_UP, '^', L'^' },
{ ARROW_RIGHT, '>', L'>' },
{ ARROW_DOWN, 'v', L'v' },
{ ARROW_LEFT, '<', L'<' },
{ ARROW_UP, '^', L'^' },
{ ARROW_RIGHT, '>', L'>' },
{ ARROW_DOWN, 'v', L'v' },
{ 0x0000, 0x00, L'\0' }
};
CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 };
CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };
CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 };
CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 };
CHAR16 mCursorForwardString[] = { ESC, '[', '0', '0', 'C', 0 };
CHAR16 mCursorBackwardString[] = { ESC, '[', '0', '0', 'D', 0 };
CHAR16 mSetModeString[] = { ESC, '[', '=', '3', 'h', 0 };
CHAR16 mSetAttributeString[] = { ESC, '[', '0', 'm', ESC, '[', '4', '0', 'm', ESC, '[', '4', '0', 'm', 0 };
CHAR16 mClearScreenString[] = { ESC, '[', '2', 'J', 0 };
CHAR16 mSetCursorPositionString[] = { ESC, '[', '0', '0', ';', '0', '0', 'H', 0 };
CHAR16 mCursorForwardString[] = { ESC, '[', '0', '0', 'C', 0 };
CHAR16 mCursorBackwardString[] = { ESC, '[', '0', '0', 'D', 0 };
//
// Body of the ConOut functions
@@ -147,7 +147,6 @@ TerminalConOutReset (
return Status;
}
/**
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().
@@ -172,26 +171,26 @@ TerminalConOutOutputString (
IN CHAR16 *WString
)
{
TERMINAL_DEV *TerminalDevice;
EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
UINTN MaxColumn;
UINTN MaxRow;
UINTN Length;
UTF8_CHAR Utf8Char;
CHAR8 GraphicChar;
CHAR8 AsciiChar;
EFI_STATUS Status;
UINT8 ValidBytes;
CHAR8 CrLfStr[2];
TERMINAL_DEV *TerminalDevice;
EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
UINTN MaxColumn;
UINTN MaxRow;
UINTN Length;
UTF8_CHAR Utf8Char;
CHAR8 GraphicChar;
CHAR8 AsciiChar;
EFI_STATUS Status;
UINT8 ValidBytes;
CHAR8 CrLfStr[2];
//
// flag used to indicate whether condition happens which will cause
// return EFI_WARN_UNKNOWN_GLYPH
//
BOOLEAN Warning;
BOOLEAN Warning;
ValidBytes = 0;
Warning = FALSE;
AsciiChar = 0;
ValidBytes = 0;
Warning = FALSE;
AsciiChar = 0;
//
// get Terminal device data structure pointer.
@@ -214,137 +213,134 @@ TerminalConOutOutputString (
&MaxRow
);
for (; *WString != CHAR_NULL; WString++) {
for ( ; *WString != CHAR_NULL; WString++) {
switch (TerminalDevice->TerminalType) {
case TerminalTypePcAnsi:
case TerminalTypeVt100:
case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm:
case TerminalTypeLinux:
case TerminalTypeXtermR6:
case TerminalTypeVt400:
case TerminalTypeSCO:
case TerminalTypePcAnsi:
case TerminalTypeVt100:
case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm:
case TerminalTypeLinux:
case TerminalTypeXtermR6:
case TerminalTypeVt400:
case TerminalTypeSCO:
if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
//
// If it's not a graphic character convert Unicode to ASCII.
//
GraphicChar = (CHAR8) *WString;
if (!(TerminalIsValidAscii (GraphicChar) || TerminalIsValidEfiCntlChar (GraphicChar))) {
if (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar)) {
//
// when this driver use the OutputString to output control string,
// TerminalDevice->OutputEscChar is set to let the Esc char
// to be output to the terminal emulation software.
// If it's not a graphic character convert Unicode to ASCII.
//
if ((GraphicChar == 27) && TerminalDevice->OutputEscChar) {
GraphicChar = 27;
} else {
GraphicChar = '?';
Warning = TRUE;
GraphicChar = (CHAR8)*WString;
if (!(TerminalIsValidAscii (GraphicChar) || TerminalIsValidEfiCntlChar (GraphicChar))) {
//
// when this driver use the OutputString to output control string,
// TerminalDevice->OutputEscChar is set to let the Esc char
// to be output to the terminal emulation software.
//
if ((GraphicChar == 27) && TerminalDevice->OutputEscChar) {
GraphicChar = 27;
} else {
GraphicChar = '?';
Warning = TRUE;
}
}
AsciiChar = GraphicChar;
}
AsciiChar = GraphicChar;
if (TerminalDevice->TerminalType != TerminalTypePcAnsi) {
GraphicChar = AsciiChar;
}
}
Length = 1;
if (TerminalDevice->TerminalType != TerminalTypePcAnsi) {
GraphicChar = AsciiChar;
}
Status = TerminalDevice->SerialIo->Write (
TerminalDevice->SerialIo,
&Length,
&GraphicChar
);
Length = 1;
if (EFI_ERROR (Status)) {
goto OutputError;
}
Status = TerminalDevice->SerialIo->Write (
TerminalDevice->SerialIo,
&Length,
&GraphicChar
);
break;
if (EFI_ERROR (Status)) {
goto OutputError;
}
case TerminalTypeVtUtf8:
UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes);
Length = ValidBytes;
Status = TerminalDevice->SerialIo->Write (
TerminalDevice->SerialIo,
&Length,
(UINT8 *)&Utf8Char
);
if (EFI_ERROR (Status)) {
goto OutputError;
}
break;
case TerminalTypeVtUtf8:
UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes);
Length = ValidBytes;
Status = TerminalDevice->SerialIo->Write (
TerminalDevice->SerialIo,
&Length,
(UINT8 *) &Utf8Char
);
if (EFI_ERROR (Status)) {
goto OutputError;
}
break;
break;
}
//
// Update cursor position.
//
switch (*WString) {
case CHAR_BACKSPACE:
if (Mode->CursorColumn > 0) {
Mode->CursorColumn--;
}
case CHAR_BACKSPACE:
if (Mode->CursorColumn > 0) {
Mode->CursorColumn--;
}
break;
break;
case CHAR_LINEFEED:
if (Mode->CursorRow < (INT32) (MaxRow - 1)) {
Mode->CursorRow++;
}
break;
case CHAR_CARRIAGE_RETURN:
Mode->CursorColumn = 0;
break;
default:
if (Mode->CursorColumn < (INT32) (MaxColumn - 1)) {
Mode->CursorColumn++;
} else {
Mode->CursorColumn = 0;
if (Mode->CursorRow < (INT32) (MaxRow - 1)) {
case CHAR_LINEFEED:
if (Mode->CursorRow < (INT32)(MaxRow - 1)) {
Mode->CursorRow++;
}
if (TerminalDevice->TerminalType == TerminalTypeTtyTerm &&
!TerminalDevice->OutputEscChar) {
//
// We've written the last character on the line. The
// terminal doesn't actually wrap its cursor until we print
// the next character, but the driver thinks it has wrapped
// already. Print CR LF to synchronize the terminal with
// the driver, but only if we're not in the middle of
// printing an escape sequence.
//
CrLfStr[0] = '\r';
CrLfStr[1] = '\n';
break;
Length = sizeof(CrLfStr);
case CHAR_CARRIAGE_RETURN:
Mode->CursorColumn = 0;
break;
Status = TerminalDevice->SerialIo->Write (
TerminalDevice->SerialIo,
&Length,
CrLfStr
);
default:
if (Mode->CursorColumn < (INT32)(MaxColumn - 1)) {
Mode->CursorColumn++;
} else {
Mode->CursorColumn = 0;
if (Mode->CursorRow < (INT32)(MaxRow - 1)) {
Mode->CursorRow++;
}
if (EFI_ERROR (Status)) {
goto OutputError;
if ((TerminalDevice->TerminalType == TerminalTypeTtyTerm) &&
!TerminalDevice->OutputEscChar)
{
//
// We've written the last character on the line. The
// terminal doesn't actually wrap its cursor until we print
// the next character, but the driver thinks it has wrapped
// already. Print CR LF to synchronize the terminal with
// the driver, but only if we're not in the middle of
// printing an escape sequence.
//
CrLfStr[0] = '\r';
CrLfStr[1] = '\n';
Length = sizeof (CrLfStr);
Status = TerminalDevice->SerialIo->Write (
TerminalDevice->SerialIo,
&Length,
CrLfStr
);
if (EFI_ERROR (Status)) {
goto OutputError;
}
}
}
}
break;
};
break;
}
}
if (Warning) {
@@ -363,7 +359,6 @@ OutputError:
return EFI_DEVICE_ERROR;
}
/**
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().
@@ -395,27 +390,25 @@ TerminalConOutTestString (
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
switch (TerminalDevice->TerminalType) {
case TerminalTypePcAnsi:
case TerminalTypeVt100:
case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm:
Status = AnsiTestString (TerminalDevice, WString);
break;
case TerminalTypePcAnsi:
case TerminalTypeVt100:
case TerminalTypeVt100Plus:
case TerminalTypeTtyTerm:
Status = AnsiTestString (TerminalDevice, WString);
break;
case TerminalTypeVtUtf8:
Status = VTUTF8TestString (TerminalDevice, WString);
break;
case TerminalTypeVtUtf8:
Status = VTUTF8TestString (TerminalDevice, WString);
break;
default:
Status = EFI_UNSUPPORTED;
break;
default:
Status = EFI_UNSUPPORTED;
break;
}
return Status;
}
/**
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().
@@ -442,7 +435,7 @@ TerminalConOutQueryMode (
{
TERMINAL_DEV *TerminalDevice;
if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
@@ -450,13 +443,12 @@ TerminalConOutQueryMode (
// Get Terminal device data structure pointer.
//
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
*Columns = TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns;
*Rows = TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows;
*Columns = TerminalDevice->TerminalConsoleModeData[ModeNumber].Columns;
*Rows = TerminalDevice->TerminalConsoleModeData[ModeNumber].Rows;
return EFI_SUCCESS;
}
/**
Implements EFI_SIMPLE_TEXT_OUT.SetMode().
@@ -487,14 +479,14 @@ TerminalConOutSetMode (
//
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
if (ModeNumber >= (UINTN) This->Mode->MaxMode) {
if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
//
// Set the current mode
//
This->Mode->Mode = (INT32) ModeNumber;
This->Mode->Mode = (INT32)ModeNumber;
This->ClearScreen (This);
@@ -506,18 +498,16 @@ TerminalConOutSetMode (
return EFI_DEVICE_ERROR;
}
This->Mode->Mode = (INT32) ModeNumber;
This->Mode->Mode = (INT32)ModeNumber;
Status = This->ClearScreen (This);
Status = This->ClearScreen (This);
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
return EFI_SUCCESS;
}
/**
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().
@@ -564,7 +554,7 @@ TerminalConOutSetAttribute (
// Skip outputting the command string for the same attribute
// It improves the terminal performance significantly
//
if (This->Mode->Attribute == (INT32) Attribute) {
if (This->Mode->Attribute == (INT32)Attribute) {
return EFI_SUCCESS;
}
@@ -573,103 +563,102 @@ TerminalConOutSetAttribute (
// understandable foreground color
//
switch (Attribute & 0x07) {
case EFI_BLACK:
ForegroundControl = 30;
break;
case EFI_BLACK:
ForegroundControl = 30;
break;
case EFI_BLUE:
ForegroundControl = 34;
break;
case EFI_BLUE:
ForegroundControl = 34;
break;
case EFI_GREEN:
ForegroundControl = 32;
break;
case EFI_GREEN:
ForegroundControl = 32;
break;
case EFI_CYAN:
ForegroundControl = 36;
break;
case EFI_CYAN:
ForegroundControl = 36;
break;
case EFI_RED:
ForegroundControl = 31;
break;
case EFI_RED:
ForegroundControl = 31;
break;
case EFI_MAGENTA:
ForegroundControl = 35;
break;
case EFI_MAGENTA:
ForegroundControl = 35;
break;
case EFI_BROWN:
ForegroundControl = 33;
break;
case EFI_BROWN:
ForegroundControl = 33;
break;
default:
case EFI_LIGHTGRAY:
ForegroundControl = 37;
break;
default:
case EFI_LIGHTGRAY:
ForegroundControl = 37;
break;
}
//
// bit4 of the Attribute indicates bright control
// of terminal emulator.
//
BrightControl = (UINT8) ((Attribute >> 3) & 1);
BrightControl = (UINT8)((Attribute >> 3) & 1);
//
// convert Attribute value to terminal emulator
// understandable background color.
//
switch ((Attribute >> 4) & 0x07) {
case EFI_BLACK:
BackgroundControl = 40;
break;
case EFI_BLACK:
BackgroundControl = 40;
break;
case EFI_BLUE:
BackgroundControl = 44;
break;
case EFI_BLUE:
BackgroundControl = 44;
break;
case EFI_GREEN:
BackgroundControl = 42;
break;
case EFI_GREEN:
BackgroundControl = 42;
break;
case EFI_CYAN:
BackgroundControl = 46;
break;
case EFI_CYAN:
BackgroundControl = 46;
break;
case EFI_RED:
BackgroundControl = 41;
break;
case EFI_RED:
BackgroundControl = 41;
break;
case EFI_MAGENTA:
BackgroundControl = 45;
break;
case EFI_MAGENTA:
BackgroundControl = 45;
break;
case EFI_BROWN:
BackgroundControl = 43;
break;
case EFI_BROWN:
BackgroundControl = 43;
break;
default:
default:
case EFI_LIGHTGRAY:
BackgroundControl = 47;
break;
case EFI_LIGHTGRAY:
BackgroundControl = 47;
break;
}
//
// terminal emulator's control sequence to set attributes
//
mSetAttributeString[BRIGHT_CONTROL_OFFSET] = (CHAR16) ('0' + BrightControl);
mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 0] = (CHAR16) ('0' + (ForegroundControl / 10));
mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 1] = (CHAR16) ('0' + (ForegroundControl % 10));
mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 0] = (CHAR16) ('0' + (BackgroundControl / 10));
mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 1] = (CHAR16) ('0' + (BackgroundControl % 10));
mSetAttributeString[BRIGHT_CONTROL_OFFSET] = (CHAR16)('0' + BrightControl);
mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 0] = (CHAR16)('0' + (ForegroundControl / 10));
mSetAttributeString[FOREGROUND_CONTROL_OFFSET + 1] = (CHAR16)('0' + (ForegroundControl % 10));
mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 0] = (CHAR16)('0' + (BackgroundControl / 10));
mSetAttributeString[BACKGROUND_CONTROL_OFFSET + 1] = (CHAR16)('0' + (BackgroundControl % 10));
//
// save current column and row
// for future scrolling back use.
//
SavedColumn = This->Mode->CursorColumn;
SavedRow = This->Mode->CursorRow;
SavedColumn = This->Mode->CursorColumn;
SavedRow = This->Mode->CursorRow;
TerminalDevice->OutputEscChar = TRUE;
Status = This->OutputString (This, mSetAttributeString);
@@ -678,19 +667,18 @@ TerminalConOutSetAttribute (
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
//
// scroll back to saved cursor position.
//
This->Mode->CursorColumn = SavedColumn;
This->Mode->CursorRow = SavedRow;
This->Mode->CursorColumn = SavedColumn;
This->Mode->CursorRow = SavedRow;
This->Mode->Attribute = (INT32) Attribute;
This->Mode->Attribute = (INT32)Attribute;
return EFI_SUCCESS;
}
/**
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().
It clears the ANSI terminal's display to the
@@ -730,7 +718,6 @@ TerminalConOutClearScreen (
return Status;
}
/**
Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().
@@ -752,12 +739,12 @@ TerminalConOutSetCursorPosition (
IN UINTN Row
)
{
EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
UINTN MaxColumn;
UINTN MaxRow;
EFI_STATUS Status;
TERMINAL_DEV *TerminalDevice;
CHAR16 *String;
EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;
UINTN MaxColumn;
UINTN MaxRow;
EFI_STATUS Status;
TERMINAL_DEV *TerminalDevice;
CHAR16 *String;
TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
@@ -770,18 +757,19 @@ TerminalConOutSetCursorPosition (
// get geometry of current mode
//
Status = This->QueryMode (
This,
Mode->Mode,
&MaxColumn,
&MaxRow
);
This,
Mode->Mode,
&MaxColumn,
&MaxRow
);
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
if (Column >= MaxColumn || Row >= MaxRow) {
if ((Column >= MaxColumn) || (Row >= MaxRow)) {
return EFI_UNSUPPORTED;
}
//
// control sequence to move the cursor
//
@@ -789,48 +777,46 @@ TerminalConOutSetCursorPosition (
// within the current line if possible, and don't output anyting if
// it isn't necessary.
//
if (TerminalDevice->TerminalType == TerminalTypeTtyTerm &&
(UINTN)Mode->CursorRow == Row) {
if ((TerminalDevice->TerminalType == TerminalTypeTtyTerm) &&
((UINTN)Mode->CursorRow == Row))
{
if ((UINTN)Mode->CursorColumn > Column) {
mCursorBackwardString[FW_BACK_OFFSET + 0] = (CHAR16) ('0' + ((Mode->CursorColumn - Column) / 10));
mCursorBackwardString[FW_BACK_OFFSET + 1] = (CHAR16) ('0' + ((Mode->CursorColumn - Column) % 10));
String = mCursorBackwardString;
}
else if (Column > (UINTN)Mode->CursorColumn) {
mCursorForwardString[FW_BACK_OFFSET + 0] = (CHAR16) ('0' + ((Column - Mode->CursorColumn) / 10));
mCursorForwardString[FW_BACK_OFFSET + 1] = (CHAR16) ('0' + ((Column - Mode->CursorColumn) % 10));
String = mCursorForwardString;
}
else {
mCursorBackwardString[FW_BACK_OFFSET + 0] = (CHAR16)('0' + ((Mode->CursorColumn - Column) / 10));
mCursorBackwardString[FW_BACK_OFFSET + 1] = (CHAR16)('0' + ((Mode->CursorColumn - Column) % 10));
String = mCursorBackwardString;
} else if (Column > (UINTN)Mode->CursorColumn) {
mCursorForwardString[FW_BACK_OFFSET + 0] = (CHAR16)('0' + ((Column - Mode->CursorColumn) / 10));
mCursorForwardString[FW_BACK_OFFSET + 1] = (CHAR16)('0' + ((Column - Mode->CursorColumn) % 10));
String = mCursorForwardString;
} else {
String = L""; // No cursor motion necessary
}
}
else {
mSetCursorPositionString[ROW_OFFSET + 0] = (CHAR16) ('0' + ((Row + 1) / 10));
mSetCursorPositionString[ROW_OFFSET + 1] = (CHAR16) ('0' + ((Row + 1) % 10));
mSetCursorPositionString[COLUMN_OFFSET + 0] = (CHAR16) ('0' + ((Column + 1) / 10));
mSetCursorPositionString[COLUMN_OFFSET + 1] = (CHAR16) ('0' + ((Column + 1) % 10));
String = mSetCursorPositionString;
} else {
mSetCursorPositionString[ROW_OFFSET + 0] = (CHAR16)('0' + ((Row + 1) / 10));
mSetCursorPositionString[ROW_OFFSET + 1] = (CHAR16)('0' + ((Row + 1) % 10));
mSetCursorPositionString[COLUMN_OFFSET + 0] = (CHAR16)('0' + ((Column + 1) / 10));
mSetCursorPositionString[COLUMN_OFFSET + 1] = (CHAR16)('0' + ((Column + 1) % 10));
String = mSetCursorPositionString;
}
TerminalDevice->OutputEscChar = TRUE;
Status = This->OutputString (This, String);
TerminalDevice->OutputEscChar = TRUE;
Status = This->OutputString (This, String);
TerminalDevice->OutputEscChar = FALSE;
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
//
// update current cursor position
// in the Mode data structure.
//
Mode->CursorColumn = (INT32) Column;
Mode->CursorRow = (INT32) Row;
Mode->CursorColumn = (INT32)Column;
Mode->CursorRow = (INT32)Row;
return EFI_SUCCESS;
}
/**
Implements SIMPLE_TEXT_OUTPUT.EnableCursor().
@@ -858,7 +844,6 @@ TerminalConOutEnableCursor (
return EFI_SUCCESS;
}
/**
Detects if a Unicode char is for Box Drawing text graphics.
@@ -878,7 +863,7 @@ TerminalIsValidTextGraphics (
OUT CHAR8 *Ascii OPTIONAL
)
{
UNICODE_TO_CHAR *Table;
UNICODE_TO_CHAR *Table;
if ((((Graphic & 0xff00) != 0x2500) && ((Graphic & 0xff00) != 0x2100))) {
//
@@ -946,12 +931,13 @@ TerminalIsValidEfiCntlChar (
//
// only support four control characters.
//
if (CharC == CHAR_NULL ||
CharC == CHAR_BACKSPACE ||
CharC == CHAR_LINEFEED ||
CharC == CHAR_CARRIAGE_RETURN ||
CharC == CHAR_TAB
) {
if ((CharC == CHAR_NULL) ||
(CharC == CHAR_BACKSPACE) ||
(CharC == CHAR_LINEFEED) ||
(CharC == CHAR_CARRIAGE_RETURN) ||
(CharC == CHAR_TAB)
)
{
return TRUE;
}

View File

@@ -17,12 +17,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
VOID
VTUTF8RawDataToUnicode (
IN TERMINAL_DEV *TerminalDevice
IN TERMINAL_DEV *TerminalDevice
)
{
UTF8_CHAR Utf8Char;
UINT8 ValidBytes;
UINT16 UnicodeChar;
UTF8_CHAR Utf8Char;
UINT8 ValidBytes;
UINT16 UnicodeChar;
ValidBytes = 0;
//
@@ -31,14 +31,13 @@ VTUTF8RawDataToUnicode (
// the unicode into unicode fifo, until the raw fifo is empty.
//
while (!IsRawFiFoEmpty (TerminalDevice) && !IsUnicodeFiFoFull (TerminalDevice)) {
GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes);
if (ValidBytes < 1 || ValidBytes > 3) {
if ((ValidBytes < 1) || (ValidBytes > 3)) {
continue;
}
Utf8ToUnicode (Utf8Char, ValidBytes, (CHAR16 *) &UnicodeChar);
Utf8ToUnicode (Utf8Char, ValidBytes, (CHAR16 *)&UnicodeChar);
UnicodeFiFoInsertOneKey (TerminalDevice, UnicodeChar);
}
@@ -55,14 +54,14 @@ VTUTF8RawDataToUnicode (
**/
VOID
GetOneValidUtf8Char (
IN TERMINAL_DEV *Utf8Device,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
IN TERMINAL_DEV *Utf8Device,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
)
{
UINT8 Temp;
UINT8 Index;
BOOLEAN FetchFlag;
UINT8 Temp;
UINT8 Index;
BOOLEAN FetchFlag;
Temp = 0;
Index = 0;
@@ -75,88 +74,82 @@ GetOneValidUtf8Char (
*ValidBytes = 0;
while (!IsRawFiFoEmpty (Utf8Device)) {
RawFiFoRemoveOneKey (Utf8Device, &Temp);
switch (*ValidBytes) {
case 0:
if ((Temp & 0x80) == 0) {
//
// one-byte utf8 char
//
*ValidBytes = 1;
case 0:
if ((Temp & 0x80) == 0) {
//
// one-byte utf8 char
//
*ValidBytes = 1;
Utf8Char->Utf8_1 = Temp;
Utf8Char->Utf8_1 = Temp;
FetchFlag = FALSE;
} else if ((Temp & 0xe0) == 0xc0) {
//
// two-byte utf8 char
//
*ValidBytes = 2;
FetchFlag = FALSE;
Utf8Char->Utf8_2[1] = Temp;
} else if ((Temp & 0xf0) == 0xe0) {
//
// three-byte utf8 char
//
*ValidBytes = 3;
} else if ((Temp & 0xe0) == 0xc0) {
//
// two-byte utf8 char
//
*ValidBytes = 2;
Utf8Char->Utf8_3[2] = Temp;
Utf8Char->Utf8_2[1] = Temp;
} else if ((Temp & 0xf0) == 0xe0) {
//
// three-byte utf8 char
//
*ValidBytes = 3;
Utf8Char->Utf8_3[2] = Temp;
Index++;
} else {
//
// reset *ValidBytes to zero, let valid utf8 char search restart
//
*ValidBytes = 0;
}
break;
case 2:
//
// two-byte utf8 char go on
//
if ((Temp & 0xc0) == 0x80) {
Utf8Char->Utf8_2[0] = Temp;
FetchFlag = FALSE;
} else {
*ValidBytes = 0;
}
break;
case 3:
//
// three-byte utf8 char go on
//
if ((Temp & 0xc0) == 0x80) {
if (Index == 1) {
Utf8Char->Utf8_3[1] = Temp;
Index++;
} else {
Utf8Char->Utf8_3[0] = Temp;
FetchFlag = FALSE;
//
// reset *ValidBytes to zero, let valid utf8 char search restart
//
*ValidBytes = 0;
}
} else {
//
// reset *ValidBytes and Index to zero, let valid utf8 char search restart
//
*ValidBytes = 0;
Index = 0;
}
break;
default:
break;
break;
case 2:
//
// two-byte utf8 char go on
//
if ((Temp & 0xc0) == 0x80) {
Utf8Char->Utf8_2[0] = Temp;
FetchFlag = FALSE;
} else {
*ValidBytes = 0;
}
break;
case 3:
//
// three-byte utf8 char go on
//
if ((Temp & 0xc0) == 0x80) {
if (Index == 1) {
Utf8Char->Utf8_3[1] = Temp;
Index++;
} else {
Utf8Char->Utf8_3[0] = Temp;
FetchFlag = FALSE;
}
} else {
//
// reset *ValidBytes and Index to zero, let valid utf8 char search restart
//
*ValidBytes = 0;
Index = 0;
}
break;
default:
break;
}
if (!FetchFlag) {
@@ -164,7 +157,7 @@ GetOneValidUtf8Char (
}
}
return ;
return;
}
/**
@@ -184,16 +177,16 @@ GetOneValidUtf8Char (
**/
VOID
Utf8ToUnicode (
IN UTF8_CHAR Utf8Char,
IN UINT8 ValidBytes,
OUT CHAR16 *UnicodeChar
IN UTF8_CHAR Utf8Char,
IN UINT8 ValidBytes,
OUT CHAR16 *UnicodeChar
)
{
UINT8 UnicodeByte0;
UINT8 UnicodeByte1;
UINT8 Byte0;
UINT8 Byte1;
UINT8 Byte2;
UINT8 UnicodeByte0;
UINT8 UnicodeByte1;
UINT8 Byte0;
UINT8 Byte1;
UINT8 Byte2;
*UnicodeChar = 0;
@@ -202,42 +195,42 @@ Utf8ToUnicode (
// up to 3 bytes utf8 code is supported.
//
switch (ValidBytes) {
case 1:
//
// one-byte utf8 code
//
*UnicodeChar = (UINT16) Utf8Char.Utf8_1;
break;
case 1:
//
// one-byte utf8 code
//
*UnicodeChar = (UINT16)Utf8Char.Utf8_1;
break;
case 2:
//
// two-byte utf8 code
//
Byte0 = Utf8Char.Utf8_2[0];
Byte1 = Utf8Char.Utf8_2[1];
case 2:
//
// two-byte utf8 code
//
Byte0 = Utf8Char.Utf8_2[0];
Byte1 = Utf8Char.Utf8_2[1];
UnicodeByte0 = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));
UnicodeByte1 = (UINT8) ((Byte1 >> 2) & 0x07);
*UnicodeChar = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));
break;
UnicodeByte0 = (UINT8)((Byte1 << 6) | (Byte0 & 0x3f));
UnicodeByte1 = (UINT8)((Byte1 >> 2) & 0x07);
*UnicodeChar = (UINT16)(UnicodeByte0 | (UnicodeByte1 << 8));
break;
case 3:
//
// three-byte utf8 code
//
Byte0 = Utf8Char.Utf8_3[0];
Byte1 = Utf8Char.Utf8_3[1];
Byte2 = Utf8Char.Utf8_3[2];
case 3:
//
// three-byte utf8 code
//
Byte0 = Utf8Char.Utf8_3[0];
Byte1 = Utf8Char.Utf8_3[1];
Byte2 = Utf8Char.Utf8_3[2];
UnicodeByte0 = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));
UnicodeByte1 = (UINT8) ((Byte2 << 4) | ((Byte1 >> 2) & 0x0f));
*UnicodeChar = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));
UnicodeByte0 = (UINT8)((Byte1 << 6) | (Byte0 & 0x3f));
UnicodeByte1 = (UINT8)((Byte2 << 4) | ((Byte1 >> 2) & 0x0f));
*UnicodeChar = (UINT16)(UnicodeByte0 | (UnicodeByte1 << 8));
default:
break;
default:
break;
}
return ;
return;
}
/**
@@ -258,48 +251,45 @@ Utf8ToUnicode (
**/
VOID
UnicodeToUtf8 (
IN CHAR16 Unicode,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
IN CHAR16 Unicode,
OUT UTF8_CHAR *Utf8Char,
OUT UINT8 *ValidBytes
)
{
UINT8 UnicodeByte0;
UINT8 UnicodeByte1;
UINT8 UnicodeByte0;
UINT8 UnicodeByte1;
//
// translate unicode to utf8 code
//
UnicodeByte0 = (UINT8) Unicode;
UnicodeByte1 = (UINT8) (Unicode >> 8);
UnicodeByte0 = (UINT8)Unicode;
UnicodeByte1 = (UINT8)(Unicode >> 8);
if (Unicode < 0x0080) {
Utf8Char->Utf8_1 = (UINT8) (UnicodeByte0 & 0x7f);
*ValidBytes = 1;
Utf8Char->Utf8_1 = (UINT8)(UnicodeByte0 & 0x7f);
*ValidBytes = 1;
} else if (Unicode < 0x0800) {
//
// byte sequence: high -> low
// Utf8_2[0], Utf8_2[1]
//
Utf8Char->Utf8_2[1] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);
Utf8Char->Utf8_2[0] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x1f) + 0xc0);
*ValidBytes = 2;
Utf8Char->Utf8_2[1] = (UINT8)((UnicodeByte0 & 0x3f) + 0x80);
Utf8Char->Utf8_2[0] = (UINT8)((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x1f) + 0xc0);
*ValidBytes = 2;
} else {
//
// byte sequence: high -> low
// Utf8_3[0], Utf8_3[1], Utf8_3[2]
//
Utf8Char->Utf8_3[2] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);
Utf8Char->Utf8_3[1] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x3f) + 0x80);
Utf8Char->Utf8_3[0] = (UINT8) (((UnicodeByte1 >> 4) & 0x0f) + 0xe0);
Utf8Char->Utf8_3[2] = (UINT8)((UnicodeByte0 & 0x3f) + 0x80);
Utf8Char->Utf8_3[1] = (UINT8)((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x3f) + 0x80);
Utf8Char->Utf8_3[0] = (UINT8)(((UnicodeByte1 >> 4) & 0x0f) + 0xe0);
*ValidBytes = 3;
*ValidBytes = 3;
}
}
/**
Check if input string is valid VT-UTF8 string.
@@ -311,8 +301,8 @@ UnicodeToUtf8 (
**/
EFI_STATUS
VTUTF8TestString (
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
IN TERMINAL_DEV *TerminalDevice,
IN CHAR16 *WString
)
{
//

View File

@@ -20,17 +20,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentNa
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DebugPortComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DebugPortComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)DebugPortComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)DebugPortComponentNameGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDebugPortDriverNameTable[] = {
{
"eng;en",
(CHAR16 *) L"DebugPort Driver"
(CHAR16 *)L"DebugPort Driver"
},
{
NULL,
@@ -165,11 +164,11 @@ DebugPortComponentNameGetDriverName (
EFI_STATUS
EFIAPI
DebugPortComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;

View File

@@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Globals
//
EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = {
DebugPortSupported,
DebugPortStart,
DebugPortStop,
@@ -23,25 +23,25 @@ EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = {
NULL
};
DEBUGPORT_DEVICE mDebugPortDevice = {
DEBUGPORT_DEVICE mDebugPortDevice = {
DEBUGPORT_DEVICE_SIGNATURE,
(EFI_HANDLE) 0,
(EFI_HANDLE) 0,
(EFI_DEVICE_PATH_PROTOCOL *) NULL,
(EFI_HANDLE)0,
(EFI_HANDLE)0,
(EFI_DEVICE_PATH_PROTOCOL *)NULL,
{
DebugPortReset,
DebugPortWrite,
DebugPortRead,
DebugPortPoll
},
(EFI_HANDLE) 0,
(EFI_SERIAL_IO_PROTOCOL *) NULL,
(EFI_HANDLE)0,
(EFI_SERIAL_IO_PROTOCOL *)NULL,
DEBUGPORT_UART_DEFAULT_BAUDRATE,
DEBUGPORT_UART_DEFAULT_FIFO_DEPTH,
DEBUGPORT_UART_DEFAULT_TIMEOUT,
(EFI_PARITY_TYPE) DEBUGPORT_UART_DEFAULT_PARITY,
(EFI_PARITY_TYPE)DEBUGPORT_UART_DEFAULT_PARITY,
DEBUGPORT_UART_DEFAULT_DATA_BITS,
(EFI_STOP_BITS_TYPE) DEBUGPORT_UART_DEFAULT_STOP_BITS
(EFI_STOP_BITS_TYPE)DEBUGPORT_UART_DEFAULT_STOP_BITS
};
/**
@@ -59,7 +59,7 @@ GetDebugPortVariable (
EFI_DEVICE_PATH_PROTOCOL *DebugPortVariable;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
GetVariable2 (EFI_DEBUGPORT_VARIABLE_NAME, &gEfiDebugPortVariableGuid, (VOID **) &DebugPortVariable, &DataSize);
GetVariable2 (EFI_DEBUGPORT_VARIABLE_NAME, &gEfiDebugPortVariableGuid, (VOID **)&DebugPortVariable, &DataSize);
if (DebugPortVariable == NULL) {
return NULL;
}
@@ -75,25 +75,25 @@ GetDebugPortVariable (
} else {
CopyMem (
&mDebugPortDevice.BaudRate,
&((UART_DEVICE_PATH *) DevicePath)->BaudRate,
sizeof (((UART_DEVICE_PATH *) DevicePath)->BaudRate)
&((UART_DEVICE_PATH *)DevicePath)->BaudRate,
sizeof (((UART_DEVICE_PATH *)DevicePath)->BaudRate)
);
mDebugPortDevice.ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;
mDebugPortDevice.Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT;
CopyMem (
&mDebugPortDevice.Parity,
&((UART_DEVICE_PATH *) DevicePath)->Parity,
sizeof (((UART_DEVICE_PATH *) DevicePath)->Parity)
&((UART_DEVICE_PATH *)DevicePath)->Parity,
sizeof (((UART_DEVICE_PATH *)DevicePath)->Parity)
);
CopyMem (
&mDebugPortDevice.DataBits,
&((UART_DEVICE_PATH *) DevicePath)->DataBits,
sizeof (((UART_DEVICE_PATH *) DevicePath)->DataBits)
&((UART_DEVICE_PATH *)DevicePath)->DataBits,
sizeof (((UART_DEVICE_PATH *)DevicePath)->DataBits)
);
CopyMem (
&mDebugPortDevice.StopBits,
&((UART_DEVICE_PATH *) DevicePath)->StopBits,
sizeof (((UART_DEVICE_PATH *) DevicePath)->StopBits)
&((UART_DEVICE_PATH *)DevicePath)->StopBits,
sizeof (((UART_DEVICE_PATH *)DevicePath)->StopBits)
);
return DebugPortVariable;
}
@@ -117,11 +117,11 @@ GetDebugPortVariable (
EFI_STATUS
EFIAPI
InitializeDebugPortDriver (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Install driver model protocol(s).
@@ -163,9 +163,9 @@ InitializeDebugPortDriver (
EFI_STATUS
EFIAPI
DebugPortSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
@@ -179,9 +179,10 @@ DebugPortSupported (
// Check to see that there's not a debugport protocol already published,
// since only one standard UART serial port could be supported by this driver.
//
if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **) &DebugPortInterface) != EFI_NOT_FOUND) {
if (gBS->LocateProtocol (&gEfiDebugPortProtocolGuid, NULL, (VOID **)&DebugPortInterface) != EFI_NOT_FOUND) {
return EFI_UNSUPPORTED;
}
//
// Read DebugPort variable to determine debug port selection and parameters
//
@@ -195,25 +196,25 @@ DebugPortSupported (
// device path only. Otherwise, it's a mismatch and EFI_UNSUPPORTED is returned.
//
DevicePath = DebugPortVariable;
Status = gBS->LocateDevicePath (
&gEfiSerialIoProtocolGuid,
&DevicePath,
&TempHandle
);
Status = gBS->LocateDevicePath (
&gEfiSerialIoProtocolGuid,
&DevicePath,
&TempHandle
);
if (Status == EFI_SUCCESS && TempHandle != ControllerHandle) {
if ((Status == EFI_SUCCESS) && (TempHandle != ControllerHandle)) {
Status = EFI_UNSUPPORTED;
}
if (Status == EFI_SUCCESS &&
(DevicePath->Type != MESSAGING_DEVICE_PATH ||
DevicePath->SubType != MSG_VENDOR_DP ||
*((UINT16 *) DevicePath->Length) != sizeof (DEBUGPORT_DEVICE_PATH))) {
if ((Status == EFI_SUCCESS) &&
((DevicePath->Type != MESSAGING_DEVICE_PATH) ||
(DevicePath->SubType != MSG_VENDOR_DP) ||
(*((UINT16 *)DevicePath->Length) != sizeof (DEBUGPORT_DEVICE_PATH))))
{
Status = EFI_UNSUPPORTED;
}
if (Status == EFI_SUCCESS && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *) (DevicePath + 1))) {
if ((Status == EFI_SUCCESS) && !CompareGuid (&gEfiDebugPortDevicePathGuid, (GUID *)(DevicePath + 1))) {
Status = EFI_UNSUPPORTED;
}
@@ -226,7 +227,7 @@ DebugPortSupported (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
(VOID **) &SerialIo,
(VOID **)&SerialIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
@@ -262,9 +263,9 @@ DebugPortSupported (
EFI_STATUS
EFIAPI
DebugPortStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
@@ -275,7 +276,7 @@ DebugPortStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
(VOID **) &mDebugPortDevice.SerialIoBinding,
(VOID **)&mDebugPortDevice.SerialIoBinding,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE
@@ -290,36 +291,36 @@ DebugPortStart (
// Initialize the Serial Io interface...
//
Status = mDebugPortDevice.SerialIoBinding->SetAttributes (
mDebugPortDevice.SerialIoBinding,
mDebugPortDevice.BaudRate,
mDebugPortDevice.ReceiveFifoDepth,
mDebugPortDevice.Timeout,
mDebugPortDevice.Parity,
mDebugPortDevice.DataBits,
mDebugPortDevice.StopBits
);
mDebugPortDevice.SerialIoBinding,
mDebugPortDevice.BaudRate,
mDebugPortDevice.ReceiveFifoDepth,
mDebugPortDevice.Timeout,
mDebugPortDevice.Parity,
mDebugPortDevice.DataBits,
mDebugPortDevice.StopBits
);
if (EFI_ERROR (Status)) {
mDebugPortDevice.BaudRate = 0;
mDebugPortDevice.Parity = DefaultParity;
mDebugPortDevice.DataBits = 0;
mDebugPortDevice.StopBits = DefaultStopBits;
mDebugPortDevice.ReceiveFifoDepth = 0;
Status = mDebugPortDevice.SerialIoBinding->SetAttributes (
mDebugPortDevice.SerialIoBinding,
mDebugPortDevice.BaudRate,
mDebugPortDevice.ReceiveFifoDepth,
mDebugPortDevice.Timeout,
mDebugPortDevice.Parity,
mDebugPortDevice.DataBits,
mDebugPortDevice.StopBits
);
mDebugPortDevice.BaudRate = 0;
mDebugPortDevice.Parity = DefaultParity;
mDebugPortDevice.DataBits = 0;
mDebugPortDevice.StopBits = DefaultStopBits;
mDebugPortDevice.ReceiveFifoDepth = 0;
Status = mDebugPortDevice.SerialIoBinding->SetAttributes (
mDebugPortDevice.SerialIoBinding,
mDebugPortDevice.BaudRate,
mDebugPortDevice.ReceiveFifoDepth,
mDebugPortDevice.Timeout,
mDebugPortDevice.Parity,
mDebugPortDevice.DataBits,
mDebugPortDevice.StopBits
);
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
return Status;
}
}
@@ -329,8 +330,8 @@ DebugPortStart (
//
// Create device path instance for DebugPort
//
DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH;
DebugPortDP.Header.SubType = MSG_VENDOR_DP;
DebugPortDP.Header.Type = MESSAGING_DEVICE_PATH;
DebugPortDP.Header.SubType = MSG_VENDOR_DP;
SetDevicePathNodeLength (&(DebugPortDP.Header), sizeof (DebugPortDP));
CopyGuid (&DebugPortDP.Guid, &gEfiDebugPortDevicePathGuid);
@@ -340,10 +341,11 @@ DebugPortStart (
SetDevicePathEndNode (Dp1);
}
mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *) &DebugPortDP);
mDebugPortDevice.DebugPortDevicePath = AppendDevicePathNode (Dp1, (EFI_DEVICE_PATH_PROTOCOL *)&DebugPortDP);
if (mDebugPortDevice.DebugPortDevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Publish DebugPort and Device Path protocols
//
@@ -358,20 +360,21 @@ DebugPortStart (
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
return Status;
}
//
// Connect debugport child to serial io
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
(VOID **) &mDebugPortDevice.SerialIoBinding,
(VOID **)&mDebugPortDevice.SerialIoBinding,
This->DriverBindingHandle,
mDebugPortDevice.DebugPortDeviceHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -379,11 +382,11 @@ DebugPortStart (
if (EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
return Status;
}
@@ -407,10 +410,10 @@ DebugPortStart (
EFI_STATUS
EFIAPI
DebugPortStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -420,20 +423,20 @@ DebugPortStop (
// Close the bus driver
//
gBS->CloseProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiSerialIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
mDebugPortDevice.SerialIoBinding = NULL;
gBS->CloseProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
FreePool (mDebugPortDevice.DebugPortDevicePath);
@@ -452,6 +455,7 @@ DebugPortStop (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Unpublish our protocols (DevicePath, DebugPort)
//
@@ -466,13 +470,13 @@ DebugPortStop (
if (EFI_ERROR (Status)) {
gBS->OpenProtocol (
ControllerHandle,
&gEfiSerialIoProtocolGuid,
(VOID **) &mDebugPortDevice.SerialIoBinding,
This->DriverBindingHandle,
mDebugPortDevice.DebugPortDeviceHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
ControllerHandle,
&gEfiSerialIoProtocolGuid,
(VOID **)&mDebugPortDevice.SerialIoBinding,
This->DriverBindingHandle,
mDebugPortDevice.DebugPortDeviceHandle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
} else {
mDebugPortDevice.DebugPortDeviceHandle = NULL;
}
@@ -497,11 +501,11 @@ DebugPortStop (
EFI_STATUS
EFIAPI
DebugPortReset (
IN EFI_DEBUGPORT_PROTOCOL *This
IN EFI_DEBUGPORT_PROTOCOL *This
)
{
UINTN BufferSize;
UINTN BitBucket;
UINTN BufferSize;
UINTN BitBucket;
while (This->Poll (This) == EFI_SUCCESS) {
BufferSize = 1;
@@ -528,10 +532,10 @@ DebugPortReset (
EFI_STATUS
EFIAPI
DebugPortRead (
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
)
{
DEBUGPORT_DEVICE *DebugPortDevice;
@@ -545,10 +549,10 @@ DebugPortRead (
do {
Status = DebugPortDevice->SerialIoBinding->Read (
DebugPortDevice->SerialIoBinding,
&LocalBufferSize,
BufferPtr
);
DebugPortDevice->SerialIoBinding,
&LocalBufferSize,
BufferPtr
);
if (Status == EFI_TIMEOUT) {
if (Timeout > DEBUGPORT_UART_DEFAULT_TIMEOUT) {
Timeout -= DEBUGPORT_UART_DEFAULT_TIMEOUT;
@@ -559,11 +563,11 @@ DebugPortRead (
break;
}
BufferPtr += LocalBufferSize;
LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *) Buffer);
BufferPtr += LocalBufferSize;
LocalBufferSize = *BufferSize - (BufferPtr - (UINT8 *)Buffer);
} while (LocalBufferSize != 0 && Timeout > 0);
*BufferSize = (UINTN) BufferPtr - (UINTN) Buffer;
*BufferSize = (UINTN)BufferPtr - (UINTN)Buffer;
return Status;
}
@@ -586,10 +590,10 @@ DebugPortRead (
EFI_STATUS
EFIAPI
DebugPortWrite (
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
)
{
DEBUGPORT_DEVICE *DebugPortDevice;
@@ -601,7 +605,7 @@ DebugPortWrite (
Status = EFI_SUCCESS;
DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
WriteSize = 8;
WriteSize = 8;
for (Position = 0; Position < *BufferSize && !EFI_ERROR (Status); Position += WriteSize) {
DebugPortDevice->SerialIoBinding->GetControl (
DebugPortDevice->SerialIoBinding,
@@ -612,10 +616,10 @@ DebugPortWrite (
}
Status = DebugPortDevice->SerialIoBinding->Write (
DebugPortDevice->SerialIoBinding,
&WriteSize,
&((UINT8 *) Buffer)[Position]
);
DebugPortDevice->SerialIoBinding,
&WriteSize,
&((UINT8 *)Buffer)[Position]
);
}
*BufferSize = Position;
@@ -638,7 +642,7 @@ DebugPortWrite (
EFI_STATUS
EFIAPI
DebugPortPoll (
IN EFI_DEBUGPORT_PROTOCOL *This
IN EFI_DEBUGPORT_PROTOCOL *This
)
{
EFI_STATUS Status;
@@ -648,9 +652,9 @@ DebugPortPoll (
DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);
Status = DebugPortDevice->SerialIoBinding->GetControl (
DebugPortDevice->SerialIoBinding,
&SerialControl
);
DebugPortDevice->SerialIoBinding,
&SerialControl
);
if (!EFI_ERROR (Status)) {
if ((SerialControl & EFI_SERIAL_INPUT_BUFFER_EMPTY) != 0) {
@@ -677,7 +681,7 @@ DebugPortPoll (
EFI_STATUS
EFIAPI
ImageUnloadHandler (
EFI_HANDLE ImageHandle
EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
@@ -705,14 +709,17 @@ ImageUnloadHandler (
if (ComponentName2 == NULL) {
Status = gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding,
&gEfiDriverBindingProtocolGuid,
&gDebugPortDriverBinding,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding,
&gEfiComponentName2ProtocolGuid, ComponentName2,
&gEfiDriverBindingProtocolGuid,
&gDebugPortDriverBinding,
&gEfiComponentName2ProtocolGuid,
ComponentName2,
NULL
);
}
@@ -720,16 +727,21 @@ ImageUnloadHandler (
if (ComponentName2 == NULL) {
Status = gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding,
&gEfiComponentNameProtocolGuid, ComponentName,
&gEfiDriverBindingProtocolGuid,
&gDebugPortDriverBinding,
&gEfiComponentNameProtocolGuid,
ComponentName,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
ImageHandle,
&gEfiDriverBindingProtocolGuid, &gDebugPortDriverBinding,
&gEfiComponentNameProtocolGuid, ComponentName,
&gEfiComponentName2ProtocolGuid, ComponentName2,
&gEfiDriverBindingProtocolGuid,
&gDebugPortDriverBinding,
&gEfiComponentNameProtocolGuid,
ComponentName,
&gEfiComponentName2ProtocolGuid,
ComponentName2,
NULL
);
}

View File

@@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __DEBUGPORT_H__
#define __DEBUGPORT_H__
#include <Uefi.h>
#include <Protocol/DevicePath.h>
@@ -30,9 +29,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Driver Binding Externs
//
extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2;
extern EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gDebugPortComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gDebugPortComponentName2;
//
// local type definitions
@@ -60,21 +59,21 @@ typedef struct {
EFI_STOP_BITS_TYPE StopBits;
} DEBUGPORT_DEVICE;
#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)
#define DEBUGPORT_DEVICE_FROM_THIS(a) CR (a, DEBUGPORT_DEVICE, DebugPortInterface, DEBUGPORT_DEVICE_SIGNATURE)
#define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)
#define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)
#define EFI_ACPI_PC_COMPORT_HID EISA_PNP_ID (0x0500)
#define EFI_ACPI_16550UART_HID EISA_PNP_ID (0x0501)
#define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200
#define DEBUGPORT_UART_DEFAULT_PARITY 0
#define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16
#define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000 ///< 5 ms
#define DEBUGPORT_UART_DEFAULT_DATA_BITS 8
#define DEBUGPORT_UART_DEFAULT_STOP_BITS 1
#define DEBUGPORT_UART_DEFAULT_BAUDRATE 115200
#define DEBUGPORT_UART_DEFAULT_PARITY 0
#define DEBUGPORT_UART_DEFAULT_FIFO_DEPTH 16
#define DEBUGPORT_UART_DEFAULT_TIMEOUT 50000///< 5 ms
#define DEBUGPORT_UART_DEFAULT_DATA_BITS 8
#define DEBUGPORT_UART_DEFAULT_STOP_BITS 1
#define DEBUGPORT_DRIVER_VERSION 1
#define DEBUGPORT_DRIVER_VERSION 1
#define IS_UART_DEVICEPATH(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)
#define IS_UART_DEVICEPATH(dp) (DevicePathType (dp) == MESSAGING_DEVICE_PATH && DevicePathSubType (dp) == MSG_UART_DP)
/**
Debug Port Driver entry point.
@@ -94,8 +93,8 @@ typedef struct {
EFI_STATUS
EFIAPI
InitializeDebugPortDriver (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -122,9 +121,9 @@ InitializeDebugPortDriver (
EFI_STATUS
EFIAPI
DebugPortSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -144,9 +143,9 @@ DebugPortSupported (
EFI_STATUS
EFIAPI
DebugPortStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -166,15 +165,16 @@ DebugPortStart (
EFI_STATUS
EFIAPI
DebugPortStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE Controller,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -222,7 +222,6 @@ DebugPortComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -294,14 +293,13 @@ DebugPortComponentNameGetDriverName (
EFI_STATUS
EFIAPI
DebugPortComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
DebugPort protocol member function. Calls SerialIo:GetControl to flush buffer.
We cannot call SerialIo:SetAttributes because it uses pool services, which use
@@ -318,7 +316,7 @@ DebugPortComponentNameGetControllerName (
EFI_STATUS
EFIAPI
DebugPortReset (
IN EFI_DEBUGPORT_PROTOCOL *This
IN EFI_DEBUGPORT_PROTOCOL *This
);
/**
@@ -338,10 +336,10 @@ DebugPortReset (
EFI_STATUS
EFIAPI
DebugPortRead (
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
IN VOID *Buffer
);
/**
@@ -362,10 +360,10 @@ DebugPortRead (
EFI_STATUS
EFIAPI
DebugPortWrite (
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
IN EFI_DEBUGPORT_PROTOCOL *This,
IN UINT32 Timeout,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
/**
@@ -384,7 +382,7 @@ DebugPortWrite (
EFI_STATUS
EFIAPI
DebugPortPoll (
IN EFI_DEBUGPORT_PROTOCOL *This
IN EFI_DEBUGPORT_PROTOCOL *This
);
#endif

View File

@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef __DEBUG_SERVICE_H__
#define __DEBUG_SERVICE_H__
@@ -22,10 +23,10 @@
**/
VOID
EFIAPI
PeiDebugBPrint(
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN BASE_LIST Marker
PeiDebugBPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN BASE_LIST Marker
);
/**
@@ -41,10 +42,10 @@ PeiDebugBPrint(
**/
VOID
EFIAPI
PeiDebugAssert(
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
PeiDebugAssert (
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
);
#endif

View File

@@ -17,12 +17,12 @@
#include "DebugService.h"
EDKII_DEBUG_PPI mDebugPpi = {
EDKII_DEBUG_PPI mDebugPpi = {
PeiDebugBPrint,
PeiDebugAssert
};
EFI_PEI_PPI_DESCRIPTOR mDebugServicePpi = {
EFI_PEI_PPI_DESCRIPTOR mDebugServicePpi = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEdkiiDebugPpiGuid,
(VOID *)&mDebugPpi
@@ -39,13 +39,13 @@ EFI_PEI_PPI_DESCRIPTOR mDebugServicePpi = {
**/
VOID
EFIAPI
PeiDebugBPrint(
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN BASE_LIST Marker
PeiDebugBPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
IN BASE_LIST Marker
)
{
DebugBPrint(ErrorLevel, Format, Marker);
DebugBPrint (ErrorLevel, Format, Marker);
}
/**
@@ -61,13 +61,13 @@ PeiDebugBPrint(
**/
VOID
EFIAPI
PeiDebugAssert(
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
PeiDebugAssert (
IN CONST CHAR8 *FileName,
IN UINTN LineNumber,
IN CONST CHAR8 *Description
)
{
DebugAssert(FileName, LineNumber, Description);
DebugAssert (FileName, LineNumber, Description);
}
/**
@@ -85,10 +85,9 @@ PeiDebugAssert(
EFI_STATUS
EFIAPI
DebugSerivceInitialize (
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
return PeiServicesInstallPpi (&mDebugServicePpi);
}

View File

@@ -16,7 +16,6 @@ EFI_DEBUG_SUPPORT_PROTOCOL mDebugSupportProtocolInterface = {
InvalidateInstructionCache
};
/**
Debug Support Driver entry point.
@@ -34,8 +33,8 @@ EFI_DEBUG_SUPPORT_PROTOCOL mDebugSupportProtocolInterface = {
EFI_STATUS
EFIAPI
InitializeDebugSupportDriver (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocolPtr;
@@ -63,7 +62,7 @@ InitializeDebugSupportDriver (
Status = gBS->OpenProtocol (
HandlePtr[NumHandles],
&gEfiDebugSupportProtocolGuid,
(VOID **) &DebugSupportProtocolPtr,
(VOID **)&DebugSupportProtocolPtr,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -77,6 +76,7 @@ InitializeDebugSupportDriver (
goto ErrExit;
}
} while (NumHandles > 0);
FreePool (HandlePtr);
}
@@ -86,7 +86,7 @@ InitializeDebugSupportDriver (
Status = gBS->OpenProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **) &LoadedImageProtocolPtr,
(VOID **)&LoadedImageProtocolPtr,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL

View File

@@ -21,8 +21,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#define NUM_IDT_ENTRIES 0x78
#define SYSTEM_TIMER_VECTOR 0x68
#define NUM_IDT_ENTRIES 0x78
#define SYSTEM_TIMER_VECTOR 0x68
typedef
VOID
@@ -32,20 +32,22 @@ VOID
typedef
VOID
(EFIAPI *CALLBACK_FUNC) (
(EFIAPI *CALLBACK_FUNC)(
);
typedef struct {
IA32_IDT_GATE_DESCRIPTOR OrigDesc;
DEBUG_PROC OrigVector;
IA32_IDT_GATE_DESCRIPTOR NewDesc;
DEBUG_PROC StubEntry;
CALLBACK_FUNC RegisteredCallback;
IA32_IDT_GATE_DESCRIPTOR OrigDesc;
DEBUG_PROC OrigVector;
IA32_IDT_GATE_DESCRIPTOR NewDesc;
DEBUG_PROC StubEntry;
CALLBACK_FUNC RegisteredCallback;
} IDT_ENTRY;
extern UINT8 InterruptEntryStub[];
extern UINT32 StubSize;
extern VOID (*OrigVector) (VOID);
extern UINT8 InterruptEntryStub[];
extern UINT32 StubSize;
extern VOID (*OrigVector) (
VOID
);
extern IDT_ENTRY *IdtEntryTable;
extern IA32_IDT_GATE_DESCRIPTOR NullDesc;
@@ -79,8 +81,8 @@ FxStorSupport (
**/
VOID
Vect2Desc (
IA32_IDT_GATE_DESCRIPTOR * DestDesc,
VOID (*Vector) (VOID)
IA32_IDT_GATE_DESCRIPTOR *DestDesc,
VOID ( *Vector )(VOID)
);
/**
@@ -113,7 +115,7 @@ PlInitializeDebugSupportDriver (
EFI_STATUS
EFIAPI
PlUnloadDebugSupportDriver (
IN EFI_HANDLE ImageHandle
IN EFI_HANDLE ImageHandle
);
/**
@@ -132,8 +134,8 @@ PlUnloadDebugSupportDriver (
EFI_STATUS
EFIAPI
GetMaximumProcessorIndex (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
OUT UINTN *MaxProcessorIndex
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
OUT UINTN *MaxProcessorIndex
);
/**
@@ -153,9 +155,9 @@ GetMaximumProcessorIndex (
EFI_STATUS
EFIAPI
RegisterPeriodicCallback (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_PERIODIC_CALLBACK PeriodicCallback
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_PERIODIC_CALLBACK PeriodicCallback
);
/**
@@ -178,10 +180,10 @@ RegisterPeriodicCallback (
EFI_STATUS
EFIAPI
RegisterExceptionCallback (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
IN EFI_EXCEPTION_TYPE ExceptionType
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
IN EFI_EXCEPTION_TYPE ExceptionType
);
/**
@@ -200,10 +202,10 @@ RegisterExceptionCallback (
EFI_STATUS
EFIAPI
InvalidateInstructionCache (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN VOID *Start,
IN UINT64 Length
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN VOID *Start,
IN UINT64 Length
);
/**
@@ -219,8 +221,8 @@ InvalidateInstructionCache (
**/
VOID
CreateEntryStub (
IN EFI_EXCEPTION_TYPE ExceptionType,
OUT VOID **Stub
IN EFI_EXCEPTION_TYPE ExceptionType,
OUT VOID **Stub
);
/**
@@ -256,8 +258,8 @@ GetInterruptHandleFromIdt (
**/
EFI_STATUS
ManageIdtEntryTable (
CALLBACK_FUNC NewCallback,
EFI_EXCEPTION_TYPE ExceptionType
CALLBACK_FUNC NewCallback,
EFI_EXCEPTION_TYPE ExceptionType
);
/**
@@ -274,8 +276,8 @@ ManageIdtEntryTable (
**/
VOID
HookEntry (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN CALLBACK_FUNC NewCallback
IN EFI_EXCEPTION_TYPE ExceptionType,
IN CALLBACK_FUNC NewCallback
);
/**
@@ -286,7 +288,7 @@ HookEntry (
**/
VOID
UnhookEntry (
IN EFI_EXCEPTION_TYPE ExceptionType
IN EFI_EXCEPTION_TYPE ExceptionType
);
#endif

View File

@@ -11,7 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// This the global main table to keep track of the interrupts
//
IDT_ENTRY *IdtEntryTable = NULL;
IDT_ENTRY *IdtEntryTable = NULL;
/**
Read IDT Gate Descriptor from IDT Table.
@@ -26,13 +26,13 @@ ReadIdtGateDescriptor (
OUT IA32_IDT_GATE_DESCRIPTOR *IdtGateDescriptor
)
{
IA32_DESCRIPTOR IdtrValue;
IA32_IDT_GATE_DESCRIPTOR *IdtTable;
IA32_DESCRIPTOR IdtrValue;
IA32_IDT_GATE_DESCRIPTOR *IdtTable;
AsmReadIdtr (&IdtrValue);
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *) IdtrValue.Base;
AsmReadIdtr (&IdtrValue);
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtrValue.Base;
CopyMem ((VOID *) IdtGateDescriptor, (VOID *) &(IdtTable)[Vector], sizeof (IA32_IDT_GATE_DESCRIPTOR));
CopyMem ((VOID *)IdtGateDescriptor, (VOID *)&(IdtTable)[Vector], sizeof (IA32_IDT_GATE_DESCRIPTOR));
}
/**
@@ -48,13 +48,13 @@ WriteIdtGateDescriptor (
IA32_IDT_GATE_DESCRIPTOR *IdtGateDescriptor
)
{
IA32_DESCRIPTOR IdtrValue;
IA32_IDT_GATE_DESCRIPTOR *IdtTable;
IA32_DESCRIPTOR IdtrValue;
IA32_IDT_GATE_DESCRIPTOR *IdtTable;
AsmReadIdtr (&IdtrValue);
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *) IdtrValue.Base;
AsmReadIdtr (&IdtrValue);
IdtTable = (IA32_IDT_GATE_DESCRIPTOR *)IdtrValue.Base;
CopyMem ((VOID *) &(IdtTable)[Vector], (VOID *) IdtGateDescriptor, sizeof (IA32_IDT_GATE_DESCRIPTOR));
CopyMem ((VOID *)&(IdtTable)[Vector], (VOID *)IdtGateDescriptor, sizeof (IA32_IDT_GATE_DESCRIPTOR));
}
/**
@@ -71,13 +71,13 @@ WriteIdtGateDescriptor (
**/
VOID
HookEntry (
IN EFI_EXCEPTION_TYPE ExceptionType,
IN CALLBACK_FUNC NewCallback
IN EFI_EXCEPTION_TYPE ExceptionType,
IN CALLBACK_FUNC NewCallback
)
{
BOOLEAN OldIntFlagState;
BOOLEAN OldIntFlagState;
CreateEntryStub (ExceptionType, (VOID **) &IdtEntryTable[ExceptionType].StubEntry);
CreateEntryStub (ExceptionType, (VOID **)&IdtEntryTable[ExceptionType].StubEntry);
//
// Disables CPU interrupts and returns the previous interrupt state
@@ -91,7 +91,7 @@ HookEntry (
//
// stores orignal interrupt handle
//
IdtEntryTable[ExceptionType].OrigVector = (DEBUG_PROC) GetInterruptHandleFromIdt (&(IdtEntryTable[ExceptionType].OrigDesc));
IdtEntryTable[ExceptionType].OrigVector = (DEBUG_PROC)GetInterruptHandleFromIdt (&(IdtEntryTable[ExceptionType].OrigDesc));
//
// encodes new IDT Gate descriptor by stub entry
@@ -112,7 +112,7 @@ HookEntry (
//
SetInterruptState (OldIntFlagState);
return ;
return;
}
/**
@@ -123,10 +123,10 @@ HookEntry (
**/
VOID
UnhookEntry (
IN EFI_EXCEPTION_TYPE ExceptionType
IN EFI_EXCEPTION_TYPE ExceptionType
)
{
BOOLEAN OldIntFlagState;
BOOLEAN OldIntFlagState;
//
// Disables CPU interrupts and returns the previous interrupt state
@@ -143,7 +143,7 @@ UnhookEntry (
//
SetInterruptState (OldIntFlagState);
return ;
return;
}
/**
@@ -162,8 +162,8 @@ UnhookEntry (
EFI_STATUS
EFIAPI
GetMaximumProcessorIndex (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
OUT UINTN *MaxProcessorIndex
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
OUT UINTN *MaxProcessorIndex
)
{
*MaxProcessorIndex = 0;
@@ -187,9 +187,9 @@ GetMaximumProcessorIndex (
EFI_STATUS
EFIAPI
RegisterPeriodicCallback (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_PERIODIC_CALLBACK PeriodicCallback
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_PERIODIC_CALLBACK PeriodicCallback
)
{
return ManageIdtEntryTable (PeriodicCallback, SYSTEM_TIMER_VECTOR);
@@ -215,16 +215,15 @@ RegisterPeriodicCallback (
EFI_STATUS
EFIAPI
RegisterExceptionCallback (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
IN EFI_EXCEPTION_TYPE ExceptionType
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
IN EFI_EXCEPTION_TYPE ExceptionType
)
{
return ManageIdtEntryTable (ExceptionCallback, ExceptionType);
}
/**
Invalidates processor instruction cache for a memory range. Subsequent execution in this range
causes a fresh memory fetch to retrieve code to be executed.
@@ -241,10 +240,10 @@ RegisterExceptionCallback (
EFI_STATUS
EFIAPI
InvalidateInstructionCache (
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN VOID *Start,
IN UINT64 Length
IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
IN UINTN ProcessorIndex,
IN VOID *Start,
IN UINT64 Length
)
{
AsmWbinvd ();
@@ -263,8 +262,8 @@ InvalidateInstructionCache (
**/
VOID
InterruptDistrubutionHub (
EFI_EXCEPTION_TYPE ExceptionType,
EFI_SYSTEM_CONTEXT_IA32 *ContextRecord
EFI_EXCEPTION_TYPE ExceptionType,
EFI_SYSTEM_CONTEXT_IA32 *ContextRecord
)
{
if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {
@@ -290,7 +289,7 @@ InterruptDistrubutionHub (
EFI_STATUS
EFIAPI
PlUnloadDebugSupportDriver (
IN EFI_HANDLE ImageHandle
IN EFI_HANDLE ImageHandle
)
{
EFI_EXCEPTION_TYPE ExceptionType;
@@ -341,8 +340,8 @@ PlInitializeDebugSupportDriver (
return EFI_OUT_OF_RESOURCES;
}
for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType ++) {
IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC) (UINTN) AllocatePool (StubSize);
for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
IdtEntryTable[ExceptionType].StubEntry = (DEBUG_PROC)(UINTN)AllocatePool (StubSize);
if (IdtEntryTable[ExceptionType].StubEntry == NULL) {
goto ErrorCleanup;
}
@@ -352,6 +351,7 @@ PlInitializeDebugSupportDriver (
//
CopyMem ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry, InterruptEntryStub, StubSize);
}
return EFI_SUCCESS;
ErrorCleanup:
@@ -361,6 +361,7 @@ ErrorCleanup:
FreePool ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry);
}
}
FreePool (IdtEntryTable);
return EFI_OUT_OF_RESOURCES;

View File

@@ -11,6 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Ia32/DebugSupport.h"
#define EFI_ISA IsaIa32
#define EFI_ISA IsaIa32
#endif

View File

@@ -8,7 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "PlDebugSupport.h"
IA32_IDT_GATE_DESCRIPTOR NullDesc = {{0}};
IA32_IDT_GATE_DESCRIPTOR NullDesc = {
{ 0 }
};
/**
Get Interrupt Handle from IDT Gate Descriptor.
@@ -23,14 +25,14 @@ GetInterruptHandleFromIdt (
IN IA32_IDT_GATE_DESCRIPTOR *IdtGateDescriptor
)
{
UINTN InterruptHandle;
UINTN InterruptHandle;
//
// InterruptHandle 0-15 : OffsetLow
// InterruptHandle 16-31 : OffsetHigh
//
((UINT16 *) &InterruptHandle)[0] = (UINT16) IdtGateDescriptor->Bits.OffsetLow;
((UINT16 *) &InterruptHandle)[1] = (UINT16) IdtGateDescriptor->Bits.OffsetHigh;
((UINT16 *)&InterruptHandle)[0] = (UINT16)IdtGateDescriptor->Bits.OffsetLow;
((UINT16 *)&InterruptHandle)[1] = (UINT16)IdtGateDescriptor->Bits.OffsetHigh;
return InterruptHandle;
}
@@ -48,11 +50,11 @@ GetInterruptHandleFromIdt (
**/
VOID
CreateEntryStub (
IN EFI_EXCEPTION_TYPE ExceptionType,
OUT VOID **Stub
IN EFI_EXCEPTION_TYPE ExceptionType,
OUT VOID **Stub
)
{
UINT8 *StubCopy;
UINT8 *StubCopy;
StubCopy = *Stub;
@@ -72,14 +74,14 @@ CreateEntryStub (
//
// poke in the exception type so the second push pushes the exception type
//
StubCopy[0x0c] = (UINT8) ExceptionType;
StubCopy[0x0c] = (UINT8)ExceptionType;
//
// fixup the jump target to point to the common entry
//
*(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize];
*(UINT32 *)&StubCopy[0x0e] = (UINT32)CommonIdtEntry - (UINT32)&StubCopy[StubSize];
return ;
return;
}
/**
@@ -101,8 +103,8 @@ CreateEntryStub (
**/
EFI_STATUS
ManageIdtEntryTable (
CALLBACK_FUNC NewCallback,
EFI_EXCEPTION_TYPE ExceptionType
CALLBACK_FUNC NewCallback,
EFI_EXCEPTION_TYPE ExceptionType
)
{
EFI_STATUS Status;

View File

@@ -11,6 +11,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Ia32/DebugSupport.h"
#define EFI_ISA IsaX64
#define EFI_ISA IsaX64
#endif

View File

@@ -8,7 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "PlDebugSupport.h"
IA32_IDT_GATE_DESCRIPTOR NullDesc = {{0,0}};
IA32_IDT_GATE_DESCRIPTOR NullDesc = {
{ 0, 0 }
};
/**
Get Interrupt Handle from IDT Gate Descriptor.
@@ -23,16 +25,16 @@ GetInterruptHandleFromIdt (
IN IA32_IDT_GATE_DESCRIPTOR *IdtGateDecriptor
)
{
UINTN InterruptHandle;
UINTN InterruptHandle;
//
// InterruptHandle 0-15 : OffsetLow
// InterruptHandle 16-31 : OffsetHigh
// InterruptHandle 32-63 : OffsetUpper
//
InterruptHandle = ((UINTN) IdtGateDecriptor->Bits.OffsetLow) |
(((UINTN) IdtGateDecriptor->Bits.OffsetHigh) << 16) |
(((UINTN) IdtGateDecriptor->Bits.OffsetUpper) << 32) ;
InterruptHandle = ((UINTN)IdtGateDecriptor->Bits.OffsetLow) |
(((UINTN)IdtGateDecriptor->Bits.OffsetHigh) << 16) |
(((UINTN)IdtGateDecriptor->Bits.OffsetUpper) << 32);
return InterruptHandle;
}
@@ -50,11 +52,11 @@ GetInterruptHandleFromIdt (
**/
VOID
CreateEntryStub (
IN EFI_EXCEPTION_TYPE ExceptionType,
OUT VOID **Stub
IN EFI_EXCEPTION_TYPE ExceptionType,
OUT VOID **Stub
)
{
UINT8 *StubCopy;
UINT8 *StubCopy;
StubCopy = *Stub;
@@ -72,12 +74,12 @@ CreateEntryStub (
//
// poke in the exception type so the second push pushes the exception type
//
StubCopy[0x1] = (UINT8) ExceptionType;
StubCopy[0x1] = (UINT8)ExceptionType;
//
// fixup the jump target to point to the common entry
//
*(UINT32 *) &StubCopy[0x3] = (UINT32)((UINTN) CommonIdtEntry - (UINTN) &StubCopy[StubSize]);
*(UINT32 *)&StubCopy[0x3] = (UINT32)((UINTN)CommonIdtEntry - (UINTN)&StubCopy[StubSize]);
return;
}
@@ -102,8 +104,8 @@ CreateEntryStub (
**/
EFI_STATUS
ManageIdtEntryTable (
CALLBACK_FUNC NewCallback,
EFI_EXCEPTION_TYPE ExceptionType
CALLBACK_FUNC NewCallback,
EFI_EXCEPTION_TYPE ExceptionType
)
{
EFI_STATUS Status;

View File

@@ -16,7 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
GetDevicePathSize,
DuplicateDevicePath,
AppendDevicePath,
@@ -27,12 +27,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePa
CreateDeviceNode
};
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
ConvertDeviceNodeToText,
ConvertDevicePathToText
};
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {
GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {
ConvertTextToDeviceNode,
ConvertTextToDevicePath
};
@@ -53,8 +53,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePa
EFI_STATUS
EFIAPI
DevicePathEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -66,16 +66,21 @@ DevicePathEntryPoint (
if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
&gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
&gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
&gEfiDevicePathUtilitiesProtocolGuid,
&mDevicePathUtilities,
&gEfiDevicePathToTextProtocolGuid,
&mDevicePathToText,
&gEfiDevicePathFromTextProtocolGuid,
&mDevicePathFromText,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
&gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
&gEfiDevicePathUtilitiesProtocolGuid,
&mDevicePathUtilities,
&gEfiDevicePathToTextProtocolGuid,
&mDevicePathToText,
NULL
);
}
@@ -83,17 +88,21 @@ DevicePathEntryPoint (
if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
&gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
&gEfiDevicePathUtilitiesProtocolGuid,
&mDevicePathUtilities,
&gEfiDevicePathFromTextProtocolGuid,
&mDevicePathFromText,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
&gEfiDevicePathUtilitiesProtocolGuid,
&mDevicePathUtilities,
NULL
);
}
}
return Status;
}

View File

@@ -9,9 +9,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "PeiCdExpress.h"
PEI_CD_EXPRESS_PRIVATE_DATA *mPrivateData = NULL;
CHAR8 *mRecoveryFileName;
UINTN mRecoveryFileNameSize;
PEI_CD_EXPRESS_PRIVATE_DATA *mPrivateData = NULL;
CHAR8 *mRecoveryFileName;
UINTN mRecoveryFileNameSize;
/**
Installs the Device Recovery Module PPI, Initialize BlockIo Ppi
@@ -27,12 +27,12 @@ UINTN mRecoveryFileNameSize;
EFI_STATUS
EFIAPI
CdExpressPeimEntry (
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
EFI_STATUS Status;
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
if (!EFI_ERROR (PeiServicesRegisterForShadow (FileHandle))) {
return EFI_SUCCESS;
@@ -43,13 +43,14 @@ CdExpressPeimEntry (
return EFI_OUT_OF_RESOURCES;
}
mRecoveryFileNameSize = PcdGetSize(PcdRecoveryFileName) / sizeof(CHAR16);
mRecoveryFileName = AllocatePool(mRecoveryFileNameSize);
mRecoveryFileNameSize = PcdGetSize (PcdRecoveryFileName) / sizeof (CHAR16);
mRecoveryFileName = AllocatePool (mRecoveryFileNameSize);
if (mRecoveryFileName == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = UnicodeStrToAsciiStrS(PcdGetPtr(PcdRecoveryFileName), mRecoveryFileName, mRecoveryFileNameSize);
if (EFI_ERROR(Status)) {
Status = UnicodeStrToAsciiStrS (PcdGetPtr (PcdRecoveryFileName), mRecoveryFileName, mRecoveryFileNameSize);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -57,23 +58,23 @@ CdExpressPeimEntry (
// Initialize Private Data (to zero, as is required by subsequent operations)
//
ZeroMem (PrivateData, sizeof (*PrivateData));
PrivateData->Signature = PEI_CD_EXPRESS_PRIVATE_DATA_SIGNATURE;
PrivateData->Signature = PEI_CD_EXPRESS_PRIVATE_DATA_SIGNATURE;
PrivateData->BlockBuffer = AllocatePages (EFI_SIZE_TO_PAGES (PEI_CD_BLOCK_SIZE));
PrivateData->BlockBuffer = AllocatePages (EFI_SIZE_TO_PAGES (PEI_CD_BLOCK_SIZE));
if (PrivateData->BlockBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
PrivateData->CapsuleCount = 0;
Status = UpdateBlocksAndVolumes (PrivateData, TRUE);
Status = UpdateBlocksAndVolumes (PrivateData, FALSE);
Status = UpdateBlocksAndVolumes (PrivateData, TRUE);
Status = UpdateBlocksAndVolumes (PrivateData, FALSE);
//
// Installs Ppi
//
PrivateData->DeviceRecoveryPpi.GetNumberRecoveryCapsules = GetNumberRecoveryCapsules;
PrivateData->DeviceRecoveryPpi.GetRecoveryCapsuleInfo = GetRecoveryCapsuleInfo;
PrivateData->DeviceRecoveryPpi.LoadRecoveryCapsule = LoadRecoveryCapsule;
PrivateData->DeviceRecoveryPpi.GetNumberRecoveryCapsules = GetNumberRecoveryCapsules;
PrivateData->DeviceRecoveryPpi.GetRecoveryCapsuleInfo = GetRecoveryCapsuleInfo;
PrivateData->DeviceRecoveryPpi.LoadRecoveryCapsule = LoadRecoveryCapsule;
PrivateData->PpiDescriptor.Flags = (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
PrivateData->PpiDescriptor.Guid = &gEfiPeiDeviceRecoveryModulePpiGuid;
@@ -83,6 +84,7 @@ CdExpressPeimEntry (
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
//
// PrivateData is allocated now, set it to the module variable
//
@@ -93,21 +95,20 @@ CdExpressPeimEntry (
//
PrivateData->NotifyDescriptor.Flags =
(
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK
);
PrivateData->NotifyDescriptor.Guid = &gEfiPeiVirtualBlockIoPpiGuid;
PrivateData->NotifyDescriptor.Notify = BlockIoNotifyEntry;
PrivateData->NotifyDescriptor.Guid = &gEfiPeiVirtualBlockIoPpiGuid;
PrivateData->NotifyDescriptor.Notify = BlockIoNotifyEntry;
PrivateData->NotifyDescriptor2.Flags =
(
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK |
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
);
PrivateData->NotifyDescriptor2.Guid = &gEfiPeiVirtualBlockIo2PpiGuid;
PrivateData->NotifyDescriptor2.Notify = BlockIoNotifyEntry;
PrivateData->NotifyDescriptor2.Guid = &gEfiPeiVirtualBlockIo2PpiGuid;
PrivateData->NotifyDescriptor2.Notify = BlockIoNotifyEntry;
return PeiServicesNotifyPpi (&PrivateData->NotifyDescriptor);
}
/**
@@ -151,8 +152,8 @@ BlockIoNotifyEntry (
**/
EFI_STATUS
UpdateBlocksAndVolumes (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN BOOLEAN BlockIo2
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN BOOLEAN BlockIo2
)
{
EFI_STATUS Status;
@@ -176,19 +177,20 @@ UpdateBlocksAndVolumes (
for (BlockIoPpiInstance = 0; BlockIoPpiInstance < PEI_CD_EXPRESS_MAX_BLOCK_IO_PPI; BlockIoPpiInstance++) {
if (BlockIo2) {
Status = PeiServicesLocatePpi (
&gEfiPeiVirtualBlockIo2PpiGuid,
BlockIoPpiInstance,
&TempPpiDescriptor,
(VOID **) &BlockIo2Ppi
);
&gEfiPeiVirtualBlockIo2PpiGuid,
BlockIoPpiInstance,
&TempPpiDescriptor,
(VOID **)&BlockIo2Ppi
);
} else {
Status = PeiServicesLocatePpi (
&gEfiPeiVirtualBlockIoPpiGuid,
BlockIoPpiInstance,
&TempPpiDescriptor,
(VOID **) &BlockIoPpi
);
&gEfiPeiVirtualBlockIoPpiGuid,
BlockIoPpiInstance,
&TempPpiDescriptor,
(VOID **)&BlockIoPpi
);
}
if (EFI_ERROR (Status)) {
//
// Done with all Block Io Ppis
@@ -196,7 +198,7 @@ UpdateBlocksAndVolumes (
break;
}
PeiServices = (EFI_PEI_SERVICES **) GetPeiServicesTablePointer ();
PeiServices = (EFI_PEI_SERVICES **)GetPeiServicesTablePointer ();
if (BlockIo2) {
Status = BlockIo2Ppi->GetNumberOfBlockDevices (
PeiServices,
@@ -205,18 +207,20 @@ UpdateBlocksAndVolumes (
);
} else {
Status = BlockIoPpi->GetNumberOfBlockDevices (
PeiServices,
BlockIoPpi,
&NumberBlockDevices
);
PeiServices,
BlockIoPpi,
&NumberBlockDevices
);
}
if (EFI_ERROR (Status) || (NumberBlockDevices == 0)) {
continue;
}
//
// Just retrieve the first block, should emulate all blocks.
//
for (IndexBlockDevice = 1; IndexBlockDevice <= NumberBlockDevices && PrivateData->CapsuleCount < PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER; IndexBlockDevice ++) {
for (IndexBlockDevice = 1; IndexBlockDevice <= NumberBlockDevices && PrivateData->CapsuleCount < PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER; IndexBlockDevice++) {
if (BlockIo2) {
Status = BlockIo2Ppi->GetBlockDeviceMediaInfo (
PeiServices,
@@ -226,28 +230,32 @@ UpdateBlocksAndVolumes (
);
if (EFI_ERROR (Status) ||
!Media2.MediaPresent ||
((Media2.InterfaceType != MSG_ATAPI_DP) && (Media2.InterfaceType != MSG_USB_DP)) ||
((Media2.InterfaceType != MSG_ATAPI_DP) && (Media2.InterfaceType != MSG_USB_DP)) ||
(Media2.BlockSize != PEI_CD_BLOCK_SIZE)
) {
)
{
continue;
}
DEBUG ((DEBUG_INFO, "PeiCdExpress InterfaceType is %d\n", Media2.InterfaceType));
DEBUG ((DEBUG_INFO, "PeiCdExpress MediaPresent is %d\n", Media2.MediaPresent));
DEBUG ((DEBUG_INFO, "PeiCdExpress BlockSize is 0x%x\n", Media2.BlockSize));
} else {
Status = BlockIoPpi->GetBlockDeviceMediaInfo (
PeiServices,
BlockIoPpi,
IndexBlockDevice,
&Media
);
PeiServices,
BlockIoPpi,
IndexBlockDevice,
&Media
);
if (EFI_ERROR (Status) ||
!Media.MediaPresent ||
((Media.DeviceType != IdeCDROM) && (Media.DeviceType != UsbMassStorage)) ||
((Media.DeviceType != IdeCDROM) && (Media.DeviceType != UsbMassStorage)) ||
(Media.BlockSize != PEI_CD_BLOCK_SIZE)
) {
)
{
continue;
}
DEBUG ((DEBUG_INFO, "PeiCdExpress DeviceType is %d\n", Media.DeviceType));
DEBUG ((DEBUG_INFO, "PeiCdExpress MediaPresent is %d\n", Media.MediaPresent));
DEBUG ((DEBUG_INFO, "PeiCdExpress BlockSize is 0x%x\n", Media.BlockSize));
@@ -260,8 +268,9 @@ UpdateBlocksAndVolumes (
if (BlockIo2) {
PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo2 = BlockIo2Ppi;
} else {
PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo = BlockIoPpi;
PrivateData->CapsuleData[PrivateData->CapsuleCount].BlockIo = BlockIoPpi;
}
Status = FindRecoveryCapsules (PrivateData);
DEBUG ((DEBUG_INFO, "Status is %d\n", Status));
@@ -271,7 +280,6 @@ UpdateBlocksAndVolumes (
PrivateData->CapsuleCount++;
}
}
return EFI_SUCCESS;
@@ -289,7 +297,7 @@ UpdateBlocksAndVolumes (
EFI_STATUS
EFIAPI
FindRecoveryCapsules (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData
)
{
EFI_STATUS Status;
@@ -307,10 +315,10 @@ FindRecoveryCapsules (
UINTN OriginalLBA;
UINTN IndexBlockDevice;
Buffer = PrivateData->BlockBuffer;
BufferSize = PEI_CD_BLOCK_SIZE;
Buffer = PrivateData->BlockBuffer;
BufferSize = PEI_CD_BLOCK_SIZE;
Lba = 16;
Lba = 16;
//
// The volume descriptor starts on Lba 16
//
@@ -326,29 +334,30 @@ FindRecoveryCapsules (
SetMem (Buffer, BufferSize, 0);
if (BlockIo2Ppi != NULL) {
Status = BlockIo2Ppi->ReadBlocks (
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
BlockIo2Ppi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
(EFI_PEI_SERVICES **)GetPeiServicesTablePointer (),
BlockIo2Ppi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
} else {
Status = BlockIoPpi->ReadBlocks (
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
BlockIoPpi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
(EFI_PEI_SERVICES **)GetPeiServicesTablePointer (),
BlockIoPpi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
}
if (EFI_ERROR (Status)) {
return Status;
}
StandardID = (UINT8 *) (Buffer + PEI_CD_EXPRESS_STANDARD_ID_OFFSET);
if (!StringCmp (StandardID, (UINT8 *) PEI_CD_STANDARD_ID, PEI_CD_EXPRESS_STANDARD_ID_SIZE, TRUE)) {
StandardID = (UINT8 *)(Buffer + PEI_CD_EXPRESS_STANDARD_ID_OFFSET);
if (!StringCmp (StandardID, (UINT8 *)PEI_CD_STANDARD_ID, PEI_CD_EXPRESS_STANDARD_ID_SIZE, TRUE)) {
break;
}
@@ -357,7 +366,7 @@ FindRecoveryCapsules (
StartOfVolume = FALSE;
}
Type = *(UINT8 *) (Buffer + PEI_CD_EXPRESS_VOLUME_TYPE_OFFSET);
Type = *(UINT8 *)(Buffer + PEI_CD_EXPRESS_VOLUME_TYPE_OFFSET);
if (Type == PEI_CD_EXPRESS_VOLUME_TYPE_TERMINATOR) {
if (VolumeSpaceSize == 0) {
break;
@@ -374,12 +383,12 @@ FindRecoveryCapsules (
continue;
}
VolumeSpaceSize = *(UINT32 *) (Buffer + PEI_CD_EXPRESS_VOLUME_SPACE_OFFSET);
VolumeSpaceSize = *(UINT32 *)(Buffer + PEI_CD_EXPRESS_VOLUME_SPACE_OFFSET);
RoorDirRecord = (PEI_CD_EXPRESS_DIR_FILE_RECORD *) (Buffer + PEI_CD_EXPRESS_ROOT_DIR_RECORD_OFFSET);
RootDirLBA = RoorDirRecord->LocationOfExtent[0];
RoorDirRecord = (PEI_CD_EXPRESS_DIR_FILE_RECORD *)(Buffer + PEI_CD_EXPRESS_ROOT_DIR_RECORD_OFFSET);
RootDirLBA = RoorDirRecord->LocationOfExtent[0];
Status = RetrieveCapsuleFileFromRoot (PrivateData, BlockIoPpi, BlockIo2Ppi, IndexBlockDevice, RootDirLBA);
Status = RetrieveCapsuleFileFromRoot (PrivateData, BlockIoPpi, BlockIo2Ppi, IndexBlockDevice, RootDirLBA);
if (!EFI_ERROR (Status)) {
//
// Just look for the first primary descriptor
@@ -410,11 +419,11 @@ FindRecoveryCapsules (
EFI_STATUS
EFIAPI
RetrieveCapsuleFileFromRoot (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi,
IN UINTN IndexBlockDevice,
IN UINT32 Lba
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi,
IN UINTN IndexBlockDevice,
IN UINT32 Lba
)
{
EFI_STATUS Status;
@@ -423,40 +432,42 @@ RetrieveCapsuleFileFromRoot (
PEI_CD_EXPRESS_DIR_FILE_RECORD *FileRecord;
UINTN Index;
Buffer = PrivateData->BlockBuffer;
BufferSize = PEI_CD_BLOCK_SIZE;
Buffer = PrivateData->BlockBuffer;
BufferSize = PEI_CD_BLOCK_SIZE;
SetMem (Buffer, BufferSize, 0);
if (BlockIo2Ppi != NULL) {
Status = BlockIo2Ppi->ReadBlocks (
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
BlockIo2Ppi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
(EFI_PEI_SERVICES **)GetPeiServicesTablePointer (),
BlockIo2Ppi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
} else {
Status = BlockIoPpi->ReadBlocks (
(EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),
BlockIoPpi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
(EFI_PEI_SERVICES **)GetPeiServicesTablePointer (),
BlockIoPpi,
IndexBlockDevice,
Lba,
BufferSize,
Buffer
);
}
if (EFI_ERROR (Status)) {
return Status;
}
while (1) {
FileRecord = (PEI_CD_EXPRESS_DIR_FILE_RECORD *) Buffer;
FileRecord = (PEI_CD_EXPRESS_DIR_FILE_RECORD *)Buffer;
if (FileRecord->Length == 0) {
break;
}
//
// Not intend to check other flag now
//
@@ -481,12 +492,12 @@ RetrieveCapsuleFileFromRoot (
continue;
}
PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleStartLBA = FileRecord->LocationOfExtent[0];
PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleStartLBA = FileRecord->LocationOfExtent[0];
PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleBlockAlignedSize =
(
FileRecord->DataLength[0] /
PEI_CD_BLOCK_SIZE +
1
FileRecord->DataLength[0] /
PEI_CD_BLOCK_SIZE +
1
) *
PEI_CD_BLOCK_SIZE;
PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize = FileRecord->DataLength[0];
@@ -523,12 +534,12 @@ RetrieveCapsuleFileFromRoot (
EFI_STATUS
EFIAPI
GetNumberRecoveryCapsules (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
OUT UINTN *NumberRecoveryCapsules
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
OUT UINTN *NumberRecoveryCapsules
)
{
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
PrivateData = PEI_CD_EXPRESS_PRIVATE_DATA_FROM_THIS (This);
UpdateBlocksAndVolumes (PrivateData, TRUE);
@@ -570,16 +581,16 @@ GetNumberRecoveryCapsules (
EFI_STATUS
EFIAPI
GetRecoveryCapsuleInfo (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT UINTN *Size,
OUT EFI_GUID *CapsuleType
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT UINTN *Size,
OUT EFI_GUID *CapsuleType
)
{
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
UINTN NumberRecoveryCapsules;
EFI_STATUS Status;
PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData;
UINTN NumberRecoveryCapsules;
EFI_STATUS Status;
Status = GetNumberRecoveryCapsules (PeiServices, This, &NumberRecoveryCapsules);
@@ -625,10 +636,10 @@ GetRecoveryCapsuleInfo (
EFI_STATUS
EFIAPI
LoadRecoveryCapsule (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT VOID *Buffer
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT VOID *Buffer
)
{
EFI_STATUS Status;
@@ -653,23 +664,24 @@ LoadRecoveryCapsule (
if (BlockIo2Ppi != NULL) {
Status = BlockIo2Ppi->ReadBlocks (
PeiServices,
BlockIo2Ppi,
PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleBlockAlignedSize,
Buffer
);
PeiServices,
BlockIo2Ppi,
PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleBlockAlignedSize,
Buffer
);
} else {
Status = BlockIoPpi->ReadBlocks (
PeiServices,
BlockIoPpi,
PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleBlockAlignedSize,
Buffer
);
PeiServices,
BlockIoPpi,
PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,
PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleBlockAlignedSize,
Buffer
);
}
return Status;
}
@@ -687,14 +699,14 @@ LoadRecoveryCapsule (
**/
BOOLEAN
StringCmp (
IN UINT8 *Source1,
IN UINT8 *Source2,
IN UINTN Size,
IN BOOLEAN CaseSensitive
IN UINT8 *Source1,
IN UINT8 *Source2,
IN UINTN Size,
IN BOOLEAN CaseSensitive
)
{
UINTN Index;
UINT8 Dif;
UINTN Index;
UINT8 Dif;
for (Index = 0; Index < Size; Index++) {
if (Source1[Index] == Source2[Index]) {
@@ -702,7 +714,7 @@ StringCmp (
}
if (!CaseSensitive) {
Dif = (UINT8) ((Source1[Index] > Source2[Index]) ? (Source1[Index] - Source2[Index]) : (Source2[Index] - Source1[Index]));
Dif = (UINT8)((Source1[Index] > Source2[Index]) ? (Source1[Index] - Source2[Index]) : (Source2[Index] - Source1[Index]));
if (Dif == ('a' - 'A')) {
continue;
}

View File

@@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef _PEI_CD_EXPRESS_H_
#define _PEI_CD_EXPRESS_H_
#include <PiPei.h>
#include <Ppi/BlockIo.h>
@@ -26,44 +25,42 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PeiServicesLib.h>
#include <Library/MemoryAllocationLib.h>
#pragma pack(1)
#define PEI_CD_EXPRESS_MAX_BLOCK_IO_PPI 8
#define PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER 16
#define PEI_CD_EXPRESS_MAX_BLOCK_IO_PPI 8
#define PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER 16
#define PEI_CD_BLOCK_SIZE 0x800
#define PEI_MEMMORY_PAGE_SIZE 0x1000
#define PEI_CD_BLOCK_SIZE 0x800
#define PEI_MEMMORY_PAGE_SIZE 0x1000
//
// Following are defined according to ISO-9660 specification
//
#define PEI_CD_STANDARD_ID "CD001"
#define PEI_CD_EXPRESS_STANDARD_ID_SIZE 5
#define PEI_CD_STANDARD_ID "CD001"
#define PEI_CD_EXPRESS_STANDARD_ID_SIZE 5
#define PEI_CD_EXPRESS_VOLUME_TYPE_OFFSET 0
#define PEI_CD_EXPRESS_STANDARD_ID_OFFSET 1
#define PEI_CD_EXPRESS_VOLUME_SPACE_OFFSET 80
#define PEI_CD_EXPRESS_ROOT_DIR_RECORD_OFFSET 156
#define PEI_CD_EXPRESS_VOLUME_TYPE_OFFSET 0
#define PEI_CD_EXPRESS_STANDARD_ID_OFFSET 1
#define PEI_CD_EXPRESS_VOLUME_SPACE_OFFSET 80
#define PEI_CD_EXPRESS_ROOT_DIR_RECORD_OFFSET 156
#define PEI_CD_EXPRESS_VOLUME_TYPE_PRIMARY 1
#define PEI_CD_EXPRESS_VOLUME_TYPE_TERMINATOR 255
#define PEI_CD_EXPRESS_VOLUME_TYPE_PRIMARY 1
#define PEI_CD_EXPRESS_VOLUME_TYPE_TERMINATOR 255
#define PEI_CD_EXPRESS_DIR_FILE_REC_FLAG_ISDIR 0x02
typedef struct {
UINTN CapsuleStartLBA;
UINTN CapsuleSize;
UINTN CapsuleBlockAlignedSize;
UINTN IndexBlock;
EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIo;
EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2;
UINTN CapsuleStartLBA;
UINTN CapsuleSize;
UINTN CapsuleBlockAlignedSize;
UINTN IndexBlock;
EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIo;
EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2;
} PEI_CD_EXPRESS_CAPSULE_DATA;
#define PEI_CD_EXPRESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('p', 'c', 'd', 'e')
#define PEI_CD_EXPRESS_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('p', 'c', 'd', 'e')
typedef struct {
UINTN Signature;
EFI_PEI_DEVICE_RECOVERY_MODULE_PPI DeviceRecoveryPpi;
EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
@@ -73,7 +70,6 @@ typedef struct {
UINT8 *BlockBuffer;
UINTN CapsuleCount;
PEI_CD_EXPRESS_CAPSULE_DATA CapsuleData[PEI_CD_EXPRESS_MAX_CAPSULE_NUMBER];
} PEI_CD_EXPRESS_PRIVATE_DATA;
#define PEI_CD_EXPRESS_PRIVATE_DATA_FROM_THIS(a) \
@@ -84,17 +80,17 @@ typedef struct {
)
typedef struct {
UINT8 Length;
UINT8 ExtendedAttributeRecordLength;
UINT32 LocationOfExtent[2];
UINT32 DataLength[2];
UINT8 DateTime[7];
UINT8 Flag;
UINT8 FileUnitSize;
UINT8 InterleaveGapSize;
UINT32 VolumeSequenceNumber;
UINT8 FileIDLength;
UINT8 FileID[1];
UINT8 Length;
UINT8 ExtendedAttributeRecordLength;
UINT32 LocationOfExtent[2];
UINT32 DataLength[2];
UINT8 DateTime[7];
UINT8 Flag;
UINT8 FileUnitSize;
UINT8 InterleaveGapSize;
UINT32 VolumeSequenceNumber;
UINT8 FileIDLength;
UINT8 FileID[1];
} PEI_CD_EXPRESS_DIR_FILE_RECORD;
/**
@@ -129,8 +125,8 @@ BlockIoNotifyEntry (
**/
EFI_STATUS
UpdateBlocksAndVolumes (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN BOOLEAN BlockIo2
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN BOOLEAN BlockIo2
);
/**
@@ -159,9 +155,9 @@ UpdateBlocksAndVolumes (
EFI_STATUS
EFIAPI
GetNumberRecoveryCapsules (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
OUT UINTN *NumberRecoveryCapsules
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
OUT UINTN *NumberRecoveryCapsules
);
/**
@@ -192,11 +188,11 @@ GetNumberRecoveryCapsules (
EFI_STATUS
EFIAPI
GetRecoveryCapsuleInfo (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT UINTN *Size,
OUT EFI_GUID *CapsuleType
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT UINTN *Size,
OUT EFI_GUID *CapsuleType
);
/**
@@ -221,10 +217,10 @@ GetRecoveryCapsuleInfo (
EFI_STATUS
EFIAPI
LoadRecoveryCapsule (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT VOID *Buffer
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_DEVICE_RECOVERY_MODULE_PPI *This,
IN UINTN CapsuleInstance,
OUT VOID *Buffer
);
/**
@@ -239,7 +235,7 @@ LoadRecoveryCapsule (
EFI_STATUS
EFIAPI
FindRecoveryCapsules (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData
);
/**
@@ -259,14 +255,13 @@ FindRecoveryCapsules (
EFI_STATUS
EFIAPI
RetrieveCapsuleFileFromRoot (
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi,
IN UINTN IndexBlockDevice,
IN UINT32 Lba
IN OUT PEI_CD_EXPRESS_PRIVATE_DATA *PrivateData,
IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIoPpi,
IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2Ppi,
IN UINTN IndexBlockDevice,
IN UINT32 Lba
);
/**
This function compares two ASCII strings in case sensitive/insensitive way.
@@ -281,10 +276,10 @@ RetrieveCapsuleFileFromRoot (
**/
BOOLEAN
StringCmp (
IN UINT8 *Source1,
IN UINT8 *Source2,
IN UINTN Size,
IN BOOLEAN CaseSensitive
IN UINT8 *Source1,
IN UINT8 *Source2,
IN UINTN Size,
IN BOOLEAN CaseSensitive
);
#pragma pack()

View File

@@ -20,9 +20,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DiskIoComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DiskIoComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)DiskIoComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)DiskIoComponentNameGetControllerName,
"en"
};
@@ -30,7 +30,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2
// Driver name table for DiskIo module.
// It is shared by the implementation of ComponentName & ComponentName2 Protocol.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {
{
"eng;en",
(CHAR16 *)L"Generic Disk I/O Driver"
@@ -41,8 +41,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[]
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -99,8 +97,6 @@ DiskIoComponentNameGetDriverName (
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -172,11 +168,11 @@ DiskIoComponentNameGetDriverName (
EFI_STATUS
EFIAPI
DiskIoComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;

View File

@@ -19,7 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
// Driver binding protocol implementation for DiskIo driver.
//
EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
DiskIoDriverBindingSupported,
DiskIoDriverBindingStart,
DiskIoDriverBindingStop,
@@ -32,7 +32,7 @@ EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
// Template for DiskIo private data structure.
// The pointer to BlockIo protocol interface is assigned dynamically.
//
DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate = {
DISK_IO_PRIVATE_DATA gDiskIoPrivateDataTemplate = {
DISK_IO_PRIVATE_DATA_SIGNATURE,
{
EFI_DISK_IO_PROTOCOL_REVISION,
@@ -69,8 +69,8 @@ DiskIoDriverBindingSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
//
// Open the IO Abstraction(s) needed to perform the supported test.
@@ -78,7 +78,7 @@ DiskIoDriverBindingSupported (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
(VOID **)&BlockIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -99,7 +99,6 @@ DiskIoDriverBindingSupported (
return EFI_SUCCESS;
}
/**
Start this driver on ControllerHandle by opening a Block IO protocol and
installing a Disk IO protocol on ControllerHandle.
@@ -136,7 +135,7 @@ DiskIoDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiBlockIoProtocolGuid,
(VOID **) &gDiskIoPrivateDataTemplate.BlockIo,
(VOID **)&gDiskIoPrivateDataTemplate.BlockIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -148,7 +147,7 @@ DiskIoDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiBlockIo2ProtocolGuid,
(VOID **) &gDiskIoPrivateDataTemplate.BlockIo2,
(VOID **)&gDiskIoPrivateDataTemplate.BlockIo2,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -169,10 +168,12 @@ DiskIoDriverBindingStart (
//
// The BlockSize and IoAlign of BlockIo and BlockIo2 should equal.
//
ASSERT ((Instance->BlockIo2 == NULL) ||
((Instance->BlockIo->Media->IoAlign == Instance->BlockIo2->Media->IoAlign) &&
(Instance->BlockIo->Media->BlockSize == Instance->BlockIo2->Media->BlockSize)
));
ASSERT (
(Instance->BlockIo2 == NULL) ||
((Instance->BlockIo->Media->IoAlign == Instance->BlockIo2->Media->IoAlign) &&
(Instance->BlockIo->Media->BlockSize == Instance->BlockIo2->Media->BlockSize)
)
);
InitializeListHead (&Instance->TaskQueue);
EfiInitializeLock (&Instance->TaskQueueLock, TPL_NOTIFY);
@@ -191,21 +192,24 @@ DiskIoDriverBindingStart (
if (Instance->BlockIo2 != NULL) {
Status = gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiDiskIoProtocolGuid, &Instance->DiskIo,
&gEfiDiskIo2ProtocolGuid, &Instance->DiskIo2,
&gEfiDiskIoProtocolGuid,
&Instance->DiskIo,
&gEfiDiskIo2ProtocolGuid,
&Instance->DiskIo2,
NULL
);
} else {
Status = gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiDiskIoProtocolGuid, &Instance->DiskIo,
&gEfiDiskIoProtocolGuid,
&Instance->DiskIo,
NULL
);
}
ErrorExit:
if (EFI_ERROR (Status)) {
if (Instance != NULL && Instance->SharedWorkingBuffer != NULL) {
if ((Instance != NULL) && (Instance->SharedWorkingBuffer != NULL)) {
FreeAlignedPages (
Instance->SharedWorkingBuffer,
EFI_SIZE_TO_PAGES (PcdGet32 (PcdDiskIoDataBufferBlockNum) * Instance->BlockIo->Media->BlockSize)
@@ -246,17 +250,17 @@ ErrorExit1:
EFI_STATUS
EFIAPI
DiskIoDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_DISK_IO_PROTOCOL *DiskIo;
EFI_DISK_IO2_PROTOCOL *DiskIo2;
DISK_IO_PRIVATE_DATA *Instance;
BOOLEAN AllTaskDone;
EFI_STATUS Status;
EFI_DISK_IO_PROTOCOL *DiskIo;
EFI_DISK_IO2_PROTOCOL *DiskIo2;
DISK_IO_PRIVATE_DATA *Instance;
BOOLEAN AllTaskDone;
//
// Get our context back.
@@ -264,7 +268,7 @@ DiskIoDriverBindingStop (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
(VOID **)&DiskIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -272,10 +276,11 @@ DiskIoDriverBindingStop (
if (EFI_ERROR (Status)) {
return Status;
}
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDiskIo2ProtocolGuid,
(VOID **) &DiskIo2,
(VOID **)&DiskIo2,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -295,21 +300,25 @@ DiskIoDriverBindingStop (
if (EFI_ERROR (Status)) {
return Status;
}
Status = gBS->UninstallMultipleProtocolInterfaces (
ControllerHandle,
&gEfiDiskIoProtocolGuid, &Instance->DiskIo,
&gEfiDiskIo2ProtocolGuid, &Instance->DiskIo2,
&gEfiDiskIoProtocolGuid,
&Instance->DiskIo,
&gEfiDiskIo2ProtocolGuid,
&Instance->DiskIo2,
NULL
);
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
ControllerHandle,
&gEfiDiskIoProtocolGuid, &Instance->DiskIo,
&gEfiDiskIoProtocolGuid,
&Instance->DiskIo,
NULL
);
}
if (!EFI_ERROR (Status)) {
if (!EFI_ERROR (Status)) {
do {
EfiAcquireLock (&Instance->TaskQueueLock);
AllTaskDone = IsListEmpty (&Instance->TaskQueue);
@@ -344,7 +353,6 @@ DiskIoDriverBindingStop (
return Status;
}
/**
Destroy the sub task.
@@ -355,15 +363,16 @@ DiskIoDriverBindingStop (
**/
LIST_ENTRY *
DiskIoDestroySubtask (
IN DISK_IO_PRIVATE_DATA *Instance,
IN DISK_IO_SUBTASK *Subtask
IN DISK_IO_PRIVATE_DATA *Instance,
IN DISK_IO_SUBTASK *Subtask
)
{
LIST_ENTRY *Link;
LIST_ENTRY *Link;
if (Subtask->Task != NULL) {
EfiAcquireLock (&Subtask->Task->SubtasksLock);
}
Link = RemoveEntryList (&Subtask->Link);
if (Subtask->Task != NULL) {
EfiReleaseLock (&Subtask->Task->SubtasksLock);
@@ -378,10 +387,12 @@ DiskIoDestroySubtask (
: EFI_SIZE_TO_PAGES (Subtask->Length)
);
}
if (Subtask->BlockIo2Token.Event != NULL) {
gBS->CloseEvent (Subtask->BlockIo2Token.Event);
}
}
FreePool (Subtask);
return Link;
@@ -396,8 +407,8 @@ DiskIoDestroySubtask (
VOID
EFIAPI
DiskIo2OnReadWriteComplete (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
DISK_IO_SUBTASK *Subtask;
@@ -405,7 +416,7 @@ DiskIo2OnReadWriteComplete (
EFI_STATUS TransactionStatus;
DISK_IO_PRIVATE_DATA *Instance;
Subtask = (DISK_IO_SUBTASK *) Context;
Subtask = (DISK_IO_SUBTASK *)Context;
TransactionStatus = Subtask->BlockIo2Token.TransactionStatus;
Task = Subtask->Task;
Instance = Task->Instance;
@@ -416,7 +427,8 @@ DiskIo2OnReadWriteComplete (
if ((Subtask->WorkingBuffer != NULL) && !EFI_ERROR (TransactionStatus) &&
(Task->Token != NULL) && !Subtask->Write
) {
)
{
CopyMem (Subtask->Buffer, Subtask->WorkingBuffer + Subtask->Offset, Subtask->Length);
}
@@ -454,22 +466,23 @@ DiskIo2OnReadWriteComplete (
**/
DISK_IO_SUBTASK *
DiskIoCreateSubtask (
IN BOOLEAN Write,
IN UINT64 Lba,
IN UINT32 Offset,
IN UINTN Length,
IN VOID *WorkingBuffer OPTIONAL,
IN VOID *Buffer,
IN BOOLEAN Blocking
IN BOOLEAN Write,
IN UINT64 Lba,
IN UINT32 Offset,
IN UINTN Length,
IN VOID *WorkingBuffer OPTIONAL,
IN VOID *Buffer,
IN BOOLEAN Blocking
)
{
DISK_IO_SUBTASK *Subtask;
EFI_STATUS Status;
DISK_IO_SUBTASK *Subtask;
EFI_STATUS Status;
Subtask = AllocateZeroPool (sizeof (DISK_IO_SUBTASK));
if (Subtask == NULL) {
return NULL;
}
Subtask->Signature = DISK_IO_SUBTASK_SIGNATURE;
Subtask->Write = Write;
Subtask->Lba = Lba;
@@ -491,10 +504,16 @@ DiskIoCreateSubtask (
return NULL;
}
}
DEBUG ((
DEBUG_BLKIO,
" %c:Lba/Offset/Length/WorkingBuffer/Buffer = %016lx/%08x/%08x/%08x/%08x\n",
Write ? 'W': 'R', Lba, Offset, Length, WorkingBuffer, Buffer
Write ? 'W' : 'R',
Lba,
Offset,
Length,
WorkingBuffer,
Buffer
));
return Subtask;
@@ -527,18 +546,18 @@ DiskIoCreateSubtaskList (
IN OUT LIST_ENTRY *Subtasks
)
{
UINT32 BlockSize;
UINT32 IoAlign;
UINT64 Lba;
UINT64 OverRunLba;
UINT32 UnderRun;
UINT32 OverRun;
UINT8 *BufferPtr;
UINTN Length;
UINTN DataBufferSize;
DISK_IO_SUBTASK *Subtask;
VOID *WorkingBuffer;
LIST_ENTRY *Link;
UINT32 BlockSize;
UINT32 IoAlign;
UINT64 Lba;
UINT64 OverRunLba;
UINT32 UnderRun;
UINT32 OverRun;
UINT8 *BufferPtr;
UINTN Length;
UINTN DataBufferSize;
DISK_IO_SUBTASK *Subtask;
VOID *WorkingBuffer;
LIST_ENTRY *Link;
DEBUG ((DEBUG_BLKIO, "DiskIo: Create subtasks for task: Offset/BufferSize/Buffer = %016lx/%08x/%08x\n", Offset, BufferSize, Buffer));
@@ -549,7 +568,7 @@ DiskIoCreateSubtaskList (
}
Lba = DivU64x32Remainder (Offset, BlockSize, &UnderRun);
BufferPtr = (UINT8 *) Buffer;
BufferPtr = (UINT8 *)Buffer;
//
// Special handling for zero BufferSize
@@ -559,6 +578,7 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
return TRUE;
}
@@ -573,6 +593,7 @@ DiskIoCreateSubtaskList (
goto Done;
}
}
if (Write) {
//
// A half write operation can be splitted to a blocking block-read and half write operation
@@ -582,6 +603,7 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
}
@@ -589,12 +611,13 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
BufferPtr += Length;
Offset += Length;
BufferSize -= Length;
Lba ++;
Lba++;
}
OverRunLba = Lba + DivU64x32Remainder (BufferSize, BlockSize, &OverRun);
@@ -609,6 +632,7 @@ DiskIoCreateSubtaskList (
goto Done;
}
}
if (Write) {
//
// A half write operation can be splitted to a blocking block-read and half write operation
@@ -618,6 +642,7 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
}
@@ -625,6 +650,7 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
}
@@ -637,25 +663,26 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
BufferPtr += BufferSize;
Offset += BufferSize;
BufferSize -= BufferSize;
} else {
if (Blocking) {
//
// Use the allocated buffer instead of the original buffer
// to avoid alignment issue.
//
for (; Lba < OverRunLba; Lba += PcdGet32 (PcdDiskIoDataBufferBlockNum)) {
for ( ; Lba < OverRunLba; Lba += PcdGet32 (PcdDiskIoDataBufferBlockNum)) {
DataBufferSize = MIN (BufferSize, PcdGet32 (PcdDiskIoDataBufferBlockNum) * BlockSize);
Subtask = DiskIoCreateSubtask (Write, Lba, 0, DataBufferSize, SharedWorkingBuffer, BufferPtr, Blocking);
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
BufferPtr += DataBufferSize;
@@ -677,6 +704,7 @@ DiskIoCreateSubtaskList (
if (Subtask == NULL) {
goto Done;
}
InsertTailList (Subtasks, &Subtask->Link);
}
@@ -697,8 +725,9 @@ Done:
//
for (Link = GetFirstNode (Subtasks); !IsNull (Subtasks, Link); ) {
Subtask = CR (Link, DISK_IO_SUBTASK, Link, DISK_IO_SUBTASK_SIGNATURE);
Link = DiskIoDestroySubtask (Instance, Subtask);
Link = DiskIoDestroySubtask (Instance, Subtask);
}
return FALSE;
}
@@ -714,7 +743,7 @@ Done:
EFI_STATUS
EFIAPI
DiskIo2Cancel (
IN EFI_DISK_IO2_PROTOCOL *This
IN EFI_DISK_IO2_PROTOCOL *This
)
{
DISK_IO_PRIVATE_DATA *Instance;
@@ -726,9 +755,10 @@ DiskIo2Cancel (
EfiAcquireLock (&Instance->TaskQueueLock);
for (Link = GetFirstNode (&Instance->TaskQueue)
; !IsNull (&Instance->TaskQueue, Link)
; Link = GetNextNode (&Instance->TaskQueue, Link)
) {
; !IsNull (&Instance->TaskQueue, Link)
; Link = GetNextNode (&Instance->TaskQueue, Link)
)
{
Task = CR (Link, DISK_IO2_TASK, Link, DISK_IO2_TASK_SIGNATURE);
if (Task->Token != NULL) {
@@ -756,12 +786,12 @@ DiskIo2Cancel (
**/
BOOLEAN
DiskIo2RemoveCompletedTask (
IN DISK_IO_PRIVATE_DATA *Instance
IN DISK_IO_PRIVATE_DATA *Instance
)
{
BOOLEAN QueueEmpty;
LIST_ENTRY *Link;
DISK_IO2_TASK *Task;
BOOLEAN QueueEmpty;
LIST_ENTRY *Link;
DISK_IO2_TASK *Task;
QueueEmpty = TRUE;
@@ -773,10 +803,11 @@ DiskIo2RemoveCompletedTask (
ASSERT (Task->Token == NULL);
FreePool (Task);
} else {
Link = GetNextNode (&Instance->TaskQueue, Link);
Link = GetNextNode (&Instance->TaskQueue, Link);
QueueEmpty = FALSE;
}
}
EfiReleaseLock (&Instance->TaskQueueLock);
return QueueEmpty;
@@ -797,41 +828,42 @@ DiskIo2RemoveCompletedTask (
**/
EFI_STATUS
DiskIo2ReadWriteDisk (
IN DISK_IO_PRIVATE_DATA *Instance,
IN BOOLEAN Write,
IN UINT32 MediaId,
IN UINT64 Offset,
IN EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN UINT8 *Buffer
IN DISK_IO_PRIVATE_DATA *Instance,
IN BOOLEAN Write,
IN UINT32 MediaId,
IN UINT64 Offset,
IN EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN UINT8 *Buffer
)
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
EFI_BLOCK_IO_MEDIA *Media;
LIST_ENTRY *Link;
LIST_ENTRY *NextLink;
LIST_ENTRY Subtasks;
DISK_IO_SUBTASK *Subtask;
DISK_IO2_TASK *Task;
EFI_TPL OldTpl;
BOOLEAN Blocking;
BOOLEAN SubtaskBlocking;
LIST_ENTRY *SubtasksPtr;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
EFI_BLOCK_IO_MEDIA *Media;
LIST_ENTRY *Link;
LIST_ENTRY *NextLink;
LIST_ENTRY Subtasks;
DISK_IO_SUBTASK *Subtask;
DISK_IO2_TASK *Task;
EFI_TPL OldTpl;
BOOLEAN Blocking;
BOOLEAN SubtaskBlocking;
LIST_ENTRY *SubtasksPtr;
Task = NULL;
BlockIo = Instance->BlockIo;
BlockIo2 = Instance->BlockIo2;
Media = BlockIo->Media;
Status = EFI_SUCCESS;
Blocking = (BOOLEAN) ((Token == NULL) || (Token->Event == NULL));
Task = NULL;
BlockIo = Instance->BlockIo;
BlockIo2 = Instance->BlockIo2;
Media = BlockIo->Media;
Status = EFI_SUCCESS;
Blocking = (BOOLEAN)((Token == NULL) || (Token->Event == NULL));
if (Blocking) {
//
// Wait till pending async task is completed.
//
while (!DiskIo2RemoveCompletedTask (Instance));
while (!DiskIo2RemoveCompletedTask (Instance)) {
}
SubtasksPtr = &Subtasks;
} else {
@@ -858,15 +890,18 @@ DiskIo2ReadWriteDisk (
if (Task != NULL) {
FreePool (Task);
}
return EFI_OUT_OF_RESOURCES;
}
ASSERT (!IsListEmpty (SubtasksPtr));
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
for ( Link = GetFirstNode (SubtasksPtr), NextLink = GetNextNode (SubtasksPtr, Link)
; !IsNull (SubtasksPtr, Link)
; Link = NextLink, NextLink = GetNextNode (SubtasksPtr, NextLink)
) {
; !IsNull (SubtasksPtr, Link)
; Link = NextLink, NextLink = GetNextNode (SubtasksPtr, NextLink)
)
{
Subtask = CR (Link, DISK_IO_SUBTASK, Link, DISK_IO_SUBTASK_SIGNATURE);
Subtask->Task = Task;
SubtaskBlocking = Subtask->Blocking;
@@ -902,7 +937,6 @@ DiskIo2ReadWriteDisk (
(Subtask->WorkingBuffer != NULL) ? Subtask->WorkingBuffer : Subtask->Buffer
);
}
} else {
//
// Read
@@ -951,7 +985,7 @@ DiskIo2ReadWriteDisk (
//
if (EFI_ERROR (Status)) {
while (!IsNull (SubtasksPtr, NextLink)) {
Subtask = CR (NextLink, DISK_IO_SUBTASK, Link, DISK_IO_SUBTASK_SIGNATURE);
Subtask = CR (NextLink, DISK_IO_SUBTASK, Link, DISK_IO_SUBTASK_SIGNATURE);
NextLink = DiskIoDestroySubtask (Instance, Subtask);
}
}
@@ -1008,17 +1042,22 @@ DiskIo2ReadWriteDisk (
EFI_STATUS
EFIAPI
DiskIo2ReadDiskEx (
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
return DiskIo2ReadWriteDisk (
DISK_IO_PRIVATE_DATA_FROM_DISK_IO2 (This),
FALSE, MediaId, Offset, Token, BufferSize, (UINT8 *) Buffer
FALSE,
MediaId,
Offset,
Token,
BufferSize,
(UINT8 *)Buffer
);
}
@@ -1047,17 +1086,22 @@ DiskIo2ReadDiskEx (
EFI_STATUS
EFIAPI
DiskIo2WriteDiskEx (
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
return DiskIo2ReadWriteDisk (
DISK_IO_PRIVATE_DATA_FROM_DISK_IO2 (This),
TRUE, MediaId, Offset, Token, BufferSize, (UINT8 *) Buffer
TRUE,
MediaId,
Offset,
Token,
BufferSize,
(UINT8 *)Buffer
);
}
@@ -1070,15 +1114,15 @@ DiskIo2WriteDiskEx (
VOID
EFIAPI
DiskIo2OnFlushComplete (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
DISK_IO2_FLUSH_TASK *Task;
DISK_IO2_FLUSH_TASK *Task;
gBS->CloseEvent (Event);
Task = (DISK_IO2_FLUSH_TASK *) Context;
Task = (DISK_IO2_FLUSH_TASK *)Context;
ASSERT (Task->Signature == DISK_IO2_FLUSH_TASK_SIGNATURE);
Task->Token->TransactionStatus = Task->BlockIo2Token.TransactionStatus;
gBS->SignalEvent (Task->Token->Event);
@@ -1104,13 +1148,13 @@ DiskIo2OnFlushComplete (
EFI_STATUS
EFIAPI
DiskIo2FlushDiskEx (
IN EFI_DISK_IO2_PROTOCOL *This,
IN OUT EFI_DISK_IO2_TOKEN *Token
IN EFI_DISK_IO2_PROTOCOL *This,
IN OUT EFI_DISK_IO2_TOKEN *Token
)
{
EFI_STATUS Status;
DISK_IO2_FLUSH_TASK *Task;
DISK_IO_PRIVATE_DATA *Private;
EFI_STATUS Status;
DISK_IO2_FLUSH_TASK *Task;
DISK_IO_PRIVATE_DATA *Private;
Private = DISK_IO_PRIVATE_DATA_FROM_DISK_IO2 (This);
@@ -1131,9 +1175,10 @@ DiskIo2FlushDiskEx (
FreePool (Task);
return Status;
}
Task->Signature = DISK_IO2_FLUSH_TASK_SIGNATURE;
Task->Token = Token;
Status = Private->BlockIo2->FlushBlocksEx (Private->BlockIo2, &Task->BlockIo2Token);
Status = Private->BlockIo2->FlushBlocksEx (Private->BlockIo2, &Task->BlockIo2Token);
if (EFI_ERROR (Status)) {
gBS->CloseEvent (Task->BlockIo2Token.Event);
FreePool (Task);
@@ -1180,11 +1225,15 @@ DiskIoReadDisk (
{
return DiskIo2ReadWriteDisk (
DISK_IO_PRIVATE_DATA_FROM_DISK_IO (This),
FALSE, MediaId, Offset, NULL, BufferSize, (UINT8 *) Buffer
FALSE,
MediaId,
Offset,
NULL,
BufferSize,
(UINT8 *)Buffer
);
}
/**
Writes BufferSize bytes from Buffer into Offset.
Writes may require a read modify write to support writes that are not
@@ -1222,7 +1271,12 @@ DiskIoWriteDisk (
{
return DiskIo2ReadWriteDisk (
DISK_IO_PRIVATE_DATA_FROM_DISK_IO (This),
TRUE, MediaId, Offset, NULL, BufferSize, (UINT8 *) Buffer
TRUE,
MediaId,
Offset,
NULL,
BufferSize,
(UINT8 *)Buffer
);
}
@@ -1239,11 +1293,11 @@ DiskIoWriteDisk (
EFI_STATUS
EFIAPI
InitializeDiskIo (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Install driver model protocol(s).

View File

@@ -26,60 +26,60 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define DISK_IO_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('d', 's', 'k', 'I')
typedef struct {
UINT32 Signature;
UINT32 Signature;
EFI_DISK_IO_PROTOCOL DiskIo;
EFI_DISK_IO2_PROTOCOL DiskIo2;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
EFI_DISK_IO_PROTOCOL DiskIo;
EFI_DISK_IO2_PROTOCOL DiskIo2;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
UINT8 *SharedWorkingBuffer;
UINT8 *SharedWorkingBuffer;
EFI_LOCK TaskQueueLock;
LIST_ENTRY TaskQueue;
EFI_LOCK TaskQueueLock;
LIST_ENTRY TaskQueue;
} DISK_IO_PRIVATE_DATA;
#define DISK_IO_PRIVATE_DATA_FROM_DISK_IO(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)
#define DISK_IO_PRIVATE_DATA_FROM_DISK_IO2(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo2, DISK_IO_PRIVATE_DATA_SIGNATURE)
#define DISK_IO_PRIVATE_DATA_FROM_DISK_IO(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)
#define DISK_IO_PRIVATE_DATA_FROM_DISK_IO2(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo2, DISK_IO_PRIVATE_DATA_SIGNATURE)
#define DISK_IO2_TASK_SIGNATURE SIGNATURE_32 ('d', 'i', 'a', 't')
#define DISK_IO2_TASK_SIGNATURE SIGNATURE_32 ('d', 'i', 'a', 't')
typedef struct {
UINT32 Signature;
LIST_ENTRY Link; /// < link to other task
EFI_LOCK SubtasksLock;
LIST_ENTRY Subtasks; /// < header of subtasks
EFI_DISK_IO2_TOKEN *Token;
DISK_IO_PRIVATE_DATA *Instance;
UINT32 Signature;
LIST_ENTRY Link; /// < link to other task
EFI_LOCK SubtasksLock;
LIST_ENTRY Subtasks; /// < header of subtasks
EFI_DISK_IO2_TOKEN *Token;
DISK_IO_PRIVATE_DATA *Instance;
} DISK_IO2_TASK;
#define DISK_IO2_FLUSH_TASK_SIGNATURE SIGNATURE_32 ('d', 'i', 'f', 't')
#define DISK_IO2_FLUSH_TASK_SIGNATURE SIGNATURE_32 ('d', 'i', 'f', 't')
typedef struct {
UINT32 Signature;
EFI_BLOCK_IO2_TOKEN BlockIo2Token;
EFI_DISK_IO2_TOKEN *Token;
UINT32 Signature;
EFI_BLOCK_IO2_TOKEN BlockIo2Token;
EFI_DISK_IO2_TOKEN *Token;
} DISK_IO2_FLUSH_TASK;
#define DISK_IO_SUBTASK_SIGNATURE SIGNATURE_32 ('d', 'i', 's', 't')
#define DISK_IO_SUBTASK_SIGNATURE SIGNATURE_32 ('d', 'i', 's', 't')
typedef struct {
//
// UnderRun: Offset != 0, Length < BlockSize
// OverRun: Offset == 0, Length < BlockSize
// Middle: Offset is block aligned, Length is multiple of block size
//
UINT32 Signature;
LIST_ENTRY Link;
BOOLEAN Write;
UINT64 Lba;
UINT32 Offset;
UINTN Length;
UINT8 *WorkingBuffer; /// < NULL indicates using "Buffer" directly
UINT8 *Buffer;
BOOLEAN Blocking;
UINT32 Signature;
LIST_ENTRY Link;
BOOLEAN Write;
UINT64 Lba;
UINT32 Offset;
UINTN Length;
UINT8 *WorkingBuffer; /// < NULL indicates using "Buffer" directly
UINT8 *Buffer;
BOOLEAN Blocking;
//
// Following fields are for DiskIo2
//
DISK_IO2_TASK *Task;
EFI_BLOCK_IO2_TOKEN BlockIo2Token;
DISK_IO2_TASK *Task;
EFI_BLOCK_IO2_TOKEN BlockIo2Token;
} DISK_IO_SUBTASK;
//
@@ -93,6 +93,7 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2;
// Prototypes
// Driver model protocol interface
//
/**
Test to see if this driver supports ControllerHandle.
@@ -153,15 +154,16 @@ DiskIoDriverBindingStart (
EFI_STATUS
EFIAPI
DiskIoDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// Disk I/O Protocol Interface
//
/**
Read BufferSize bytes from Offset into Buffer.
Reads may support reads that are not aligned on
@@ -230,7 +232,6 @@ DiskIoWriteDisk (
IN VOID *Buffer
);
/**
Terminate outstanding asynchronous requests to a device.
@@ -243,7 +244,7 @@ DiskIoWriteDisk (
EFI_STATUS
EFIAPI
DiskIo2Cancel (
IN EFI_DISK_IO2_PROTOCOL *This
IN EFI_DISK_IO2_PROTOCOL *This
);
/**
@@ -271,12 +272,12 @@ DiskIo2Cancel (
EFI_STATUS
EFIAPI
DiskIo2ReadDiskEx (
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN OUT EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
);
/**
@@ -304,12 +305,12 @@ DiskIo2ReadDiskEx (
EFI_STATUS
EFIAPI
DiskIo2WriteDiskEx (
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_DISK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN EFI_DISK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
);
/**
@@ -330,13 +331,14 @@ DiskIo2WriteDiskEx (
EFI_STATUS
EFIAPI
DiskIo2FlushDiskEx (
IN EFI_DISK_IO2_PROTOCOL *This,
IN OUT EFI_DISK_IO2_TOKEN *Token
IN EFI_DISK_IO2_PROTOCOL *This,
IN OUT EFI_DISK_IO2_TOKEN *Token
);
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -384,7 +386,6 @@ DiskIoComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -456,12 +457,11 @@ DiskIoComponentNameGetDriverName (
EFI_STATUS
EFIAPI
DiskIoComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
#endif

View File

@@ -20,9 +20,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentNa
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PartitionComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PartitionComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)PartitionComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)PartitionComponentNameGetControllerName,
"en"
};
@@ -30,7 +30,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentNa
// Driver name table for Partition module.
// It is shared by the implementation of ComponentName & ComponentName2 Protocol.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {
{
"eng;en",
L"Partition Driver(MBR/GPT/El Torito)"
@@ -41,8 +41,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable
}
};
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -99,7 +97,6 @@ PartitionComponentNameGetDriverName (
);
}
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -171,11 +168,11 @@ PartitionComponentNameGetDriverName (
EFI_STATUS
EFIAPI
PartitionComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;

View File

@@ -7,10 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Partition.h"
/**
Install child handles if the Handle supports El Torito format.
@@ -57,10 +55,10 @@ PartitionInstallElToritoChildHandles (
UINT32 VolSpaceSize;
EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
Found = EFI_NOT_FOUND;
Media = BlockIo->Media;
Found = EFI_NOT_FOUND;
Media = BlockIo->Media;
VolSpaceSize = 0;
VolSpaceSize = 0;
//
// CD_ROM has the fixed block size as 2048 bytes (SIZE_2KB)
@@ -79,7 +77,7 @@ PartitionInstallElToritoChildHandles (
return EFI_NOT_FOUND;
}
Catalog = (ELTORITO_CATALOG *) VolDescriptor;
Catalog = (ELTORITO_CATALOG *)VolDescriptor;
//
// Loop: handle one volume descriptor per time
@@ -87,7 +85,8 @@ PartitionInstallElToritoChildHandles (
//
for (VolDescriptorOffset = SIZE_32KB;
VolDescriptorOffset <= MultU64x32 (Media->LastBlock, Media->BlockSize);
VolDescriptorOffset += SIZE_2KB) {
VolDescriptorOffset += SIZE_2KB)
{
Status = DiskIo->ReadDisk (
DiskIo,
Media->MediaId,
@@ -99,17 +98,20 @@ PartitionInstallElToritoChildHandles (
Found = Status;
break;
}
//
// Check for valid volume descriptor signature
//
if (VolDescriptor->Unknown.Type == CDVOL_TYPE_END ||
CompareMem (VolDescriptor->Unknown.Id, CDVOL_ID, sizeof (VolDescriptor->Unknown.Id)) != 0
) {
if ((VolDescriptor->Unknown.Type == CDVOL_TYPE_END) ||
(CompareMem (VolDescriptor->Unknown.Id, CDVOL_ID, sizeof (VolDescriptor->Unknown.Id)) != 0)
)
{
//
// end of Volume descriptor list
//
break;
}
//
// Read the Volume Space Size from Primary Volume Descriptor 81-88 byte,
// the 32-bit numerical values is stored in Both-byte orders
@@ -117,12 +119,14 @@ PartitionInstallElToritoChildHandles (
if (VolDescriptor->PrimaryVolume.Type == CDVOL_TYPE_CODED) {
VolSpaceSize = VolDescriptor->PrimaryVolume.VolSpaceSize[0];
}
//
// Is it an El Torito volume descriptor?
//
if (CompareMem (VolDescriptor->BootRecordVolume.SystemId, CDVOL_ELTORITO_ID, sizeof (CDVOL_ELTORITO_ID) - 1) != 0) {
continue;
}
//
// Read in the boot El Torito boot catalog
// The LBA unit used by El Torito boot catalog is 2KB unit
@@ -144,17 +148,18 @@ PartitionInstallElToritoChildHandles (
DEBUG ((DEBUG_ERROR, "EltCheckDevice: error reading catalog %r\n", Status));
continue;
}
//
// We don't care too much about the Catalog header's contents, but we do want
// to make sure it looks like a Catalog header
//
if (Catalog->Catalog.Indicator != ELTORITO_ID_CATALOG || Catalog->Catalog.Id55AA != 0xAA55) {
if ((Catalog->Catalog.Indicator != ELTORITO_ID_CATALOG) || (Catalog->Catalog.Id55AA != 0xAA55)) {
DEBUG ((DEBUG_ERROR, "EltCheckBootCatalog: El Torito boot catalog header IDs not correct\n"));
continue;
}
Check = 0;
CheckBuffer = (UINT16 *) Catalog;
CheckBuffer = (UINT16 *)Catalog;
for (Index = 0; Index < sizeof (ELTORITO_CATALOG) / sizeof (UINT16); Index += 1) {
Check += CheckBuffer[Index];
}
@@ -174,45 +179,45 @@ PartitionInstallElToritoChildHandles (
//
// Check this entry
//
if (Catalog->Boot.Indicator != ELTORITO_ID_SECTION_BOOTABLE || Catalog->Boot.Lba == 0) {
if ((Catalog->Boot.Indicator != ELTORITO_ID_SECTION_BOOTABLE) || (Catalog->Boot.Lba == 0)) {
continue;
}
SubBlockSize = 512;
SectorCount = Catalog->Boot.SectorCount;
SubBlockSize = 512;
SectorCount = Catalog->Boot.SectorCount;
switch (Catalog->Boot.MediaType) {
case ELTORITO_NO_EMULATION:
SubBlockSize = Media->BlockSize;
break;
case ELTORITO_NO_EMULATION:
SubBlockSize = Media->BlockSize;
break;
case ELTORITO_HARD_DISK:
break;
case ELTORITO_HARD_DISK:
break;
case ELTORITO_12_DISKETTE:
SectorCount = 0x50 * 0x02 * 0x0F;
break;
case ELTORITO_12_DISKETTE:
SectorCount = 0x50 * 0x02 * 0x0F;
break;
case ELTORITO_14_DISKETTE:
SectorCount = 0x50 * 0x02 * 0x12;
break;
case ELTORITO_14_DISKETTE:
SectorCount = 0x50 * 0x02 * 0x12;
break;
case ELTORITO_28_DISKETTE:
SectorCount = 0x50 * 0x02 * 0x24;
break;
case ELTORITO_28_DISKETTE:
SectorCount = 0x50 * 0x02 * 0x24;
break;
default:
DEBUG ((DEBUG_INIT, "EltCheckDevice: unsupported El Torito boot media type %x\n", Catalog->Boot.MediaType));
SectorCount = 0;
SubBlockSize = Media->BlockSize;
break;
default:
DEBUG ((DEBUG_INIT, "EltCheckDevice: unsupported El Torito boot media type %x\n", Catalog->Boot.MediaType));
SectorCount = 0;
SubBlockSize = Media->BlockSize;
break;
}
//
// Create child device handle
//
CdDev.Header.Type = MEDIA_DEVICE_PATH;
CdDev.Header.SubType = MEDIA_CDROM_DP;
CdDev.Header.Type = MEDIA_DEVICE_PATH;
CdDev.Header.SubType = MEDIA_CDROM_DP;
SetDevicePathNodeLength (&CdDev.Header, sizeof (CdDev));
if (Index == 1) {
@@ -222,7 +227,7 @@ PartitionInstallElToritoChildHandles (
BootEntry = 0;
}
CdDev.BootEntry = (UINT32) BootEntry;
CdDev.BootEntry = (UINT32)BootEntry;
BootEntry++;
CdDev.PartitionStart = Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize);
if (SectorCount < 2) {
@@ -249,20 +254,20 @@ PartitionInstallElToritoChildHandles (
PartitionInfo.Type = PARTITION_TYPE_OTHER;
Status = PartitionInstallChildHandle (
This,
Handle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &CdDev,
&PartitionInfo,
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,
SubBlockSize,
NULL
);
This,
Handle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&CdDev,
&PartitionInfo,
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,
SubBlockSize,
NULL
);
if (!EFI_ERROR (Status)) {
Found = EFI_SUCCESS;
}

View File

@@ -19,7 +19,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Partition.h"
/**
@@ -65,7 +64,6 @@ PartitionCheckGptEntryArrayCRC (
IN EFI_PARTITION_TABLE_HEADER *PartHeader
);
/**
Restore Partition Table to its alternate place
(Primary -> Backup or Backup -> Primary).
@@ -85,7 +83,6 @@ PartitionRestoreGptTable (
IN EFI_PARTITION_TABLE_HEADER *PartHeader
);
/**
This routine will check GPT partition entry and return entry status.
@@ -106,7 +103,6 @@ PartitionCheckGptEntry (
OUT EFI_PARTITION_ENTRY_STATUS *PEntryStatus
);
/**
Checks the CRC32 value in the table header.
@@ -125,7 +121,6 @@ PartitionCheckCrcAltSize (
IN OUT EFI_TABLE_HEADER *Hdr
);
/**
Checks the CRC32 value in the table header.
@@ -142,7 +137,6 @@ PartitionCheckCrc (
IN OUT EFI_TABLE_HEADER *Hdr
);
/**
Updates the CRC32 value in the table header.
@@ -156,7 +150,6 @@ PartitionSetCrcAltSize (
IN OUT EFI_TABLE_HEADER *Hdr
);
/**
Updates the CRC32 value in the table header.
@@ -165,7 +158,7 @@ PartitionSetCrcAltSize (
**/
VOID
PartitionSetCrc (
IN OUT EFI_TABLE_HEADER *Hdr
IN OUT EFI_TABLE_HEADER *Hdr
);
/**
@@ -221,9 +214,9 @@ PartitionInstallGptChildHandles (
PartEntry = NULL;
PEntryStatus = NULL;
BlockSize = BlockIo->Media->BlockSize;
LastBlock = BlockIo->Media->LastBlock;
MediaId = BlockIo->Media->MediaId;
BlockSize = BlockIo->Media->BlockSize;
LastBlock = BlockIo->Media->LastBlock;
MediaId = BlockIo->Media->MediaId;
DEBUG ((DEBUG_INFO, " BlockSize : %d \n", BlockSize));
DEBUG ((DEBUG_INFO, " LastBlock : %lx \n", LastBlock));
@@ -264,12 +257,14 @@ PartitionInstallGptChildHandles (
// Verify that the Protective MBR is valid
//
for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
if (ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION &&
UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) == 1
) {
if ((ProtectiveMbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION) &&
(UNPACK_UINT32 (ProtectiveMbr->Partition[Index].StartingLBA) == 1)
)
{
break;
}
}
if (Index == MAX_MBR_PARTITIONS) {
goto Done;
}
@@ -317,7 +312,6 @@ PartitionInstallGptChildHandles (
if (PartitionValidGptTable (BlockIo, DiskIo, PrimaryHeader->AlternateLBA, BackupHeader)) {
DEBUG ((DEBUG_INFO, " Restore backup partition table success\n"));
}
}
DEBUG ((DEBUG_INFO, " Valid primary and Valid backup partition table\n"));
@@ -334,7 +328,7 @@ PartitionInstallGptChildHandles (
Status = DiskIo->ReadDisk (
DiskIo,
MediaId,
MultU64x32(PrimaryHeader->PartitionEntryLBA, BlockSize),
MultU64x32 (PrimaryHeader->PartitionEntryLBA, BlockSize),
PrimaryHeader->NumberOfPartitionEntries * (PrimaryHeader->SizeOfPartitionEntry),
PartEntry
);
@@ -368,12 +362,13 @@ PartitionInstallGptChildHandles (
// Create child device handles
//
for (Index = 0; Index < PrimaryHeader->NumberOfPartitionEntries; Index++) {
Entry = (EFI_PARTITION_ENTRY *) ((UINT8 *) PartEntry + Index * PrimaryHeader->SizeOfPartitionEntry);
Entry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartEntry + Index * PrimaryHeader->SizeOfPartitionEntry);
if (CompareGuid (&Entry->PartitionTypeGUID, &gEfiPartTypeUnusedGuid) ||
PEntryStatus[Index].OutOfRange ||
PEntryStatus[Index].Overlap ||
PEntryStatus[Index].OsSpecific
) {
)
{
//
// Don't use null EFI Partition Entries, Invalid Partition Entries or OS specific
// partition Entries
@@ -382,15 +377,15 @@ PartitionInstallGptChildHandles (
}
ZeroMem (&HdDev, sizeof (HdDev));
HdDev.Header.Type = MEDIA_DEVICE_PATH;
HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;
HdDev.Header.Type = MEDIA_DEVICE_PATH;
HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;
SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));
HdDev.PartitionNumber = (UINT32) Index + 1;
HdDev.MBRType = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;
HdDev.SignatureType = SIGNATURE_TYPE_GUID;
HdDev.PartitionStart = Entry->StartingLBA;
HdDev.PartitionSize = Entry->EndingLBA - Entry->StartingLBA + 1;
HdDev.PartitionNumber = (UINT32)Index + 1;
HdDev.MBRType = MBR_TYPE_EFI_PARTITION_TABLE_HEADER;
HdDev.SignatureType = SIGNATURE_TYPE_GUID;
HdDev.PartitionStart = Entry->StartingLBA;
HdDev.PartitionSize = Entry->EndingLBA - Entry->StartingLBA + 1;
CopyMem (HdDev.Signature, &Entry->UniquePartitionGUID, sizeof (EFI_GUID));
ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));
@@ -399,12 +394,13 @@ PartitionInstallGptChildHandles (
if (CompareGuid (&Entry->PartitionTypeGUID, &gEfiPartTypeSystemPartGuid)) {
PartitionInfo.System = 1;
}
CopyMem (&PartitionInfo.Info.Gpt, Entry, sizeof (EFI_PARTITION_ENTRY));
DEBUG ((DEBUG_INFO, " Index : %d\n", (UINT32) Index));
DEBUG ((DEBUG_INFO, " Start LBA : %lx\n", (UINT64) HdDev.PartitionStart));
DEBUG ((DEBUG_INFO, " End LBA : %lx\n", (UINT64) Entry->EndingLBA));
DEBUG ((DEBUG_INFO, " Partition size: %lx\n", (UINT64) HdDev.PartitionSize));
DEBUG ((DEBUG_INFO, " Index : %d\n", (UINT32)Index));
DEBUG ((DEBUG_INFO, " Start LBA : %lx\n", (UINT64)HdDev.PartitionStart));
DEBUG ((DEBUG_INFO, " End LBA : %lx\n", (UINT64)Entry->EndingLBA));
DEBUG ((DEBUG_INFO, " Partition size: %lx\n", (UINT64)HdDev.PartitionSize));
DEBUG ((DEBUG_INFO, " Start : %lx", MultU64x32 (Entry->StartingLBA, BlockSize)));
DEBUG ((DEBUG_INFO, " End : %lx\n", MultU64x32 (Entry->EndingLBA, BlockSize)));
@@ -416,7 +412,7 @@ PartitionInstallGptChildHandles (
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &HdDev,
(EFI_DEVICE_PATH_PROTOCOL *)&HdDev,
&PartitionInfo,
Entry->StartingLBA,
Entry->EndingLBA,
@@ -431,15 +427,19 @@ Done:
if (ProtectiveMbr != NULL) {
FreePool (ProtectiveMbr);
}
if (PrimaryHeader != NULL) {
FreePool (PrimaryHeader);
}
if (BackupHeader != NULL) {
FreePool (BackupHeader);
}
if (PartEntry != NULL) {
FreePool (PartEntry);
}
if (PEntryStatus != NULL) {
FreePool (PEntryStatus);
}
@@ -484,6 +484,7 @@ PartitionValidGptTable (
DEBUG ((DEBUG_ERROR, "Allocate pool error\n"));
return FALSE;
}
//
// Read the EFI Partition Table Header
//
@@ -501,9 +502,10 @@ PartitionValidGptTable (
if ((PartHdr->Header.Signature != EFI_PTAB_HEADER_ID) ||
!PartitionCheckCrc (BlockSize, &PartHdr->Header) ||
PartHdr->MyLBA != Lba ||
(PartHdr->MyLBA != Lba) ||
(PartHdr->SizeOfPartitionEntry < sizeof (EFI_PARTITION_ENTRY))
) {
)
{
DEBUG ((DEBUG_INFO, "Invalid efi partition table header\n"));
FreePool (PartHdr);
return FALSE;
@@ -562,20 +564,20 @@ PartitionCheckGptEntryArrayCRC (
}
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
MultU64x32(PartHeader->PartitionEntryLBA, BlockIo->Media->BlockSize),
PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
Ptr
);
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 (PartHeader->PartitionEntryLBA, BlockIo->Media->BlockSize),
PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
Ptr
);
if (EFI_ERROR (Status)) {
FreePool (Ptr);
return FALSE;
}
Size = PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry;
Size = PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry;
Status = gBS->CalculateCrc32 (Ptr, Size, &Crc);
Status = gBS->CalculateCrc32 (Ptr, Size, &Crc);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "CheckPEntryArrayCRC: Crc calculation failed\n"));
FreePool (Ptr);
@@ -584,10 +586,9 @@ PartitionCheckGptEntryArrayCRC (
FreePool (Ptr);
return (BOOLEAN) (PartHeader->PartitionEntryArrayCRC32 == Crc);
return (BOOLEAN)(PartHeader->PartitionEntryArrayCRC32 == Crc);
}
/**
Restore Partition Table to its alternate place
(Primary -> Backup or Backup -> Primary).
@@ -614,13 +615,13 @@ PartitionRestoreGptTable (
UINT8 *Ptr;
UINT32 MediaId;
PartHdr = NULL;
Ptr = NULL;
PartHdr = NULL;
Ptr = NULL;
BlockSize = BlockIo->Media->BlockSize;
MediaId = BlockIo->Media->MediaId;
PartHdr = AllocateZeroPool (BlockSize);
PartHdr = AllocateZeroPool (BlockSize);
if (PartHdr == NULL) {
DEBUG ((DEBUG_ERROR, "Allocate pool error\n"));
@@ -628,20 +629,20 @@ PartitionRestoreGptTable (
}
PEntryLBA = (PartHeader->MyLBA == PRIMARY_PART_HEADER_LBA) ? \
(PartHeader->LastUsableLBA + 1) : \
(PRIMARY_PART_HEADER_LBA + 1);
(PartHeader->LastUsableLBA + 1) : \
(PRIMARY_PART_HEADER_LBA + 1);
CopyMem (PartHdr, PartHeader, sizeof (EFI_PARTITION_TABLE_HEADER));
PartHdr->MyLBA = PartHeader->AlternateLBA;
PartHdr->AlternateLBA = PartHeader->MyLBA;
PartHdr->PartitionEntryLBA = PEntryLBA;
PartitionSetCrc ((EFI_TABLE_HEADER *) PartHdr);
PartHdr->MyLBA = PartHeader->AlternateLBA;
PartHdr->AlternateLBA = PartHeader->MyLBA;
PartHdr->PartitionEntryLBA = PEntryLBA;
PartitionSetCrc ((EFI_TABLE_HEADER *)PartHdr);
Status = DiskIo->WriteDisk (
DiskIo,
MediaId,
MultU64x32 (PartHdr->MyLBA, (UINT32) BlockSize),
MultU64x32 (PartHdr->MyLBA, (UINT32)BlockSize),
BlockSize,
PartHdr
);
@@ -657,23 +658,23 @@ PartitionRestoreGptTable (
}
Status = DiskIo->ReadDisk (
DiskIo,
MediaId,
MultU64x32(PartHeader->PartitionEntryLBA, (UINT32) BlockSize),
PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
Ptr
);
DiskIo,
MediaId,
MultU64x32 (PartHeader->PartitionEntryLBA, (UINT32)BlockSize),
PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
Ptr
);
if (EFI_ERROR (Status)) {
goto Done;
}
Status = DiskIo->WriteDisk (
DiskIo,
MediaId,
MultU64x32(PEntryLBA, (UINT32) BlockSize),
PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
Ptr
);
DiskIo,
MediaId,
MultU64x32 (PEntryLBA, (UINT32)BlockSize),
PartHeader->NumberOfPartitionEntries * PartHeader->SizeOfPartitionEntry,
Ptr
);
Done:
FreePool (PartHdr);
@@ -717,19 +718,20 @@ PartitionCheckGptEntry (
DEBUG ((DEBUG_INFO, " start check partition entries\n"));
for (Index1 = 0; Index1 < PartHeader->NumberOfPartitionEntries; Index1++) {
Entry = (EFI_PARTITION_ENTRY *) ((UINT8 *) PartEntry + Index1 * PartHeader->SizeOfPartitionEntry);
Entry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartEntry + Index1 * PartHeader->SizeOfPartitionEntry);
if (CompareGuid (&Entry->PartitionTypeGUID, &gEfiPartTypeUnusedGuid)) {
continue;
}
StartingLBA = Entry->StartingLBA;
EndingLBA = Entry->EndingLBA;
if (StartingLBA > EndingLBA ||
StartingLBA < PartHeader->FirstUsableLBA ||
StartingLBA > PartHeader->LastUsableLBA ||
EndingLBA < PartHeader->FirstUsableLBA ||
EndingLBA > PartHeader->LastUsableLBA
) {
if ((StartingLBA > EndingLBA) ||
(StartingLBA < PartHeader->FirstUsableLBA) ||
(StartingLBA > PartHeader->LastUsableLBA) ||
(EndingLBA < PartHeader->FirstUsableLBA) ||
(EndingLBA > PartHeader->LastUsableLBA)
)
{
PEntryStatus[Index1].OutOfRange = TRUE;
continue;
}
@@ -742,17 +744,17 @@ PartitionCheckGptEntry (
}
for (Index2 = Index1 + 1; Index2 < PartHeader->NumberOfPartitionEntries; Index2++) {
Entry = (EFI_PARTITION_ENTRY *) ((UINT8 *) PartEntry + Index2 * PartHeader->SizeOfPartitionEntry);
Entry = (EFI_PARTITION_ENTRY *)((UINT8 *)PartEntry + Index2 * PartHeader->SizeOfPartitionEntry);
if (CompareGuid (&Entry->PartitionTypeGUID, &gEfiPartTypeUnusedGuid)) {
continue;
}
if (Entry->EndingLBA >= StartingLBA && Entry->StartingLBA <= EndingLBA) {
if ((Entry->EndingLBA >= StartingLBA) && (Entry->StartingLBA <= EndingLBA)) {
//
// This region overlaps with the Index1'th region
//
PEntryStatus[Index1].Overlap = TRUE;
PEntryStatus[Index2].Overlap = TRUE;
PEntryStatus[Index1].Overlap = TRUE;
PEntryStatus[Index2].Overlap = TRUE;
continue;
}
}
@@ -761,7 +763,6 @@ PartitionCheckGptEntry (
DEBUG ((DEBUG_INFO, " End check partition entries\n"));
}
/**
Updates the CRC32 value in the table header.
@@ -770,13 +771,12 @@ PartitionCheckGptEntry (
**/
VOID
PartitionSetCrc (
IN OUT EFI_TABLE_HEADER *Hdr
IN OUT EFI_TABLE_HEADER *Hdr
)
{
PartitionSetCrcAltSize (Hdr->HeaderSize, Hdr);
}
/**
Updates the CRC32 value in the table header.
@@ -793,11 +793,10 @@ PartitionSetCrcAltSize (
UINT32 Crc;
Hdr->CRC32 = 0;
gBS->CalculateCrc32 ((UINT8 *) Hdr, Size, &Crc);
gBS->CalculateCrc32 ((UINT8 *)Hdr, Size, &Crc);
Hdr->CRC32 = Crc;
}
/**
Checks the CRC32 value in the table header.
@@ -817,7 +816,6 @@ PartitionCheckCrc (
return PartitionCheckCrcAltSize (MaxSize, Hdr->HeaderSize, Hdr);
}
/**
Checks the CRC32 value in the table header.
@@ -853,17 +851,19 @@ PartitionCheckCrcAltSize (
DEBUG ((DEBUG_ERROR, "CheckCrc32: Size > MaxSize\n"));
return FALSE;
}
//
// clear old crc from header
//
OrgCrc = Hdr->CRC32;
Hdr->CRC32 = 0;
OrgCrc = Hdr->CRC32;
Hdr->CRC32 = 0;
Status = gBS->CalculateCrc32 ((UINT8 *) Hdr, Size, &Crc);
Status = gBS->CalculateCrc32 ((UINT8 *)Hdr, Size, &Crc);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "CheckCrc32: Crc calculation failed\n"));
return FALSE;
}
//
// set results
//
@@ -873,10 +873,11 @@ PartitionCheckCrcAltSize (
// return status
//
DEBUG_CODE_BEGIN ();
if (OrgCrc != Crc) {
DEBUG ((DEBUG_ERROR, "CheckCrc32: Crc check failed\n"));
}
if (OrgCrc != Crc) {
DEBUG ((DEBUG_ERROR, "CheckCrc32: Crc check failed\n"));
}
DEBUG_CODE_END ();
return (BOOLEAN) (OrgCrc == Crc);
return (BOOLEAN)(OrgCrc == Crc);
}

View File

@@ -32,26 +32,27 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
BOOLEAN
PartitionValidMbr (
IN MASTER_BOOT_RECORD *Mbr,
IN EFI_LBA LastLba
IN MASTER_BOOT_RECORD *Mbr,
IN EFI_LBA LastLba
)
{
UINT32 StartingLBA;
UINT32 EndingLBA;
UINT32 NewEndingLBA;
INTN Index1;
INTN Index2;
BOOLEAN MbrValid;
UINT32 StartingLBA;
UINT32 EndingLBA;
UINT32 NewEndingLBA;
INTN Index1;
INTN Index2;
BOOLEAN MbrValid;
if (Mbr->Signature != MBR_SIGNATURE) {
return FALSE;
}
//
// The BPB also has this signature, so it can not be used alone.
//
MbrValid = FALSE;
for (Index1 = 0; Index1 < MAX_MBR_PARTITIONS; Index1++) {
if (Mbr->Partition[Index1].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) == 0) {
if ((Mbr->Partition[Index1].OSIndicator == 0x00) || (UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) == 0)) {
continue;
}
@@ -71,18 +72,18 @@ PartitionValidMbr (
// with INT 13h
//
DEBUG((DEBUG_INFO, "PartitionValidMbr: Bad MBR partition size EndingLBA(%1x) > LastLBA(%1x)\n", EndingLBA, LastLba));
DEBUG ((DEBUG_INFO, "PartitionValidMbr: Bad MBR partition size EndingLBA(%1x) > LastLBA(%1x)\n", EndingLBA, LastLba));
return FALSE;
}
for (Index2 = Index1 + 1; Index2 < MAX_MBR_PARTITIONS; Index2++) {
if (Mbr->Partition[Index2].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) == 0) {
if ((Mbr->Partition[Index2].OSIndicator == 0x00) || (UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) == 0)) {
continue;
}
NewEndingLBA = UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) + UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) - 1;
if (NewEndingLBA >= StartingLBA && UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) <= EndingLBA) {
if ((NewEndingLBA >= StartingLBA) && (UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) <= EndingLBA)) {
//
// This region overlaps with the Index1'th region
//
@@ -90,13 +91,13 @@ PartitionValidMbr (
}
}
}
//
// None of the regions overlapped so MBR is O.K.
//
return MbrValid;
}
/**
Install child handles if the Handle supports MBR format.
@@ -138,14 +139,14 @@ PartitionInstallMbrChildHandles (
EFI_LBA LastSector;
EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
Found = EFI_NOT_FOUND;
Found = EFI_NOT_FOUND;
BlockSize = BlockIo->Media->BlockSize;
MediaId = BlockIo->Media->MediaId;
LastSector = DivU64x32 (
MultU64x32 (BlockIo->Media->LastBlock + 1, BlockSize),
MBR_SIZE
) - 1;
BlockSize = BlockIo->Media->BlockSize;
MediaId = BlockIo->Media->MediaId;
LastSector = DivU64x32 (
MultU64x32 (BlockIo->Media->LastBlock + 1, BlockSize),
MBR_SIZE
) - 1;
//
// Ensure the block size can hold the MBR
@@ -170,9 +171,11 @@ PartitionInstallMbrChildHandles (
Found = Status;
goto Done;
}
if (!PartitionValidMbr (Mbr, LastSector)) {
goto Done;
}
//
// We have a valid mbr - add each partition
//
@@ -183,14 +186,15 @@ PartitionInstallMbrChildHandles (
ZeroMem (&ParentHdDev, sizeof (ParentHdDev));
DevicePathNode = DevicePath;
while (!IsDevicePathEnd (DevicePathNode)) {
LastDevicePathNode = DevicePathNode;
DevicePathNode = NextDevicePathNode (DevicePathNode);
LastDevicePathNode = DevicePathNode;
DevicePathNode = NextDevicePathNode (DevicePathNode);
}
if (LastDevicePathNode != NULL) {
if (DevicePathType (LastDevicePathNode) == MEDIA_DEVICE_PATH &&
DevicePathSubType (LastDevicePathNode) == MEDIA_HARDDRIVE_DP
) {
if ((DevicePathType (LastDevicePathNode) == MEDIA_DEVICE_PATH) &&
(DevicePathSubType (LastDevicePathNode) == MEDIA_HARDDRIVE_DP)
)
{
CopyMem (&ParentHdDev, LastDevicePathNode, sizeof (ParentHdDev));
} else {
LastDevicePathNode = NULL;
@@ -198,18 +202,18 @@ PartitionInstallMbrChildHandles (
}
ZeroMem (&HdDev, sizeof (HdDev));
HdDev.Header.Type = MEDIA_DEVICE_PATH;
HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;
HdDev.Header.Type = MEDIA_DEVICE_PATH;
HdDev.Header.SubType = MEDIA_HARDDRIVE_DP;
SetDevicePathNodeLength (&HdDev.Header, sizeof (HdDev));
HdDev.MBRType = MBR_TYPE_PCAT;
HdDev.SignatureType = SIGNATURE_TYPE_MBR;
HdDev.MBRType = MBR_TYPE_PCAT;
HdDev.SignatureType = SIGNATURE_TYPE_MBR;
if (LastDevicePathNode == NULL) {
//
// This is a MBR, add each partition
//
for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
if (Mbr->Partition[Index].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA) == 0) {
if ((Mbr->Partition[Index].OSIndicator == 0x00) || (UNPACK_UINT32 (Mbr->Partition[Index].SizeInLBA) == 0)) {
//
// Don't use null MBR entries
//
@@ -237,23 +241,24 @@ PartitionInstallMbrChildHandles (
if (Mbr->Partition[Index].OSIndicator == EFI_PARTITION) {
PartitionInfo.System = 1;
}
CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[Index], sizeof (MBR_PARTITION_RECORD));
Status = PartitionInstallChildHandle (
This,
Handle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &HdDev,
&PartitionInfo,
HdDev.PartitionStart,
HdDev.PartitionStart + HdDev.PartitionSize - 1,
MBR_SIZE,
((Mbr->Partition[Index].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid: NULL)
);
This,
Handle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&HdDev,
&PartitionInfo,
HdDev.PartitionStart,
HdDev.PartitionStart + HdDev.PartitionSize - 1,
MBR_SIZE,
((Mbr->Partition[Index].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid : NULL)
);
if (!EFI_ERROR (Status)) {
Found = EFI_SUCCESS;
@@ -268,7 +273,6 @@ PartitionInstallMbrChildHandles (
ExtMbrStartingLba = 0;
do {
Status = DiskIo->ReadDisk (
DiskIo,
MediaId,
@@ -286,22 +290,25 @@ PartitionInstallMbrChildHandles (
}
if ((Mbr->Partition[0].OSIndicator == EXTENDED_DOS_PARTITION) ||
(Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION)) {
(Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION))
{
ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA);
continue;
}
HdDev.PartitionNumber = ++Index;
HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart;
HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA);
if ((HdDev.PartitionStart + HdDev.PartitionSize - 1 >= ParentHdDev.PartitionStart + ParentHdDev.PartitionSize) ||
(HdDev.PartitionStart <= ParentHdDev.PartitionStart)) {
(HdDev.PartitionStart <= ParentHdDev.PartitionStart))
{
break;
}
//
// The signature in EBR(Extended Boot Record) should always be 0.
//
*((UINT32 *) &HdDev.Signature[0]) = 0;
*((UINT32 *)&HdDev.Signature[0]) = 0;
ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));
PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;
@@ -309,6 +316,7 @@ PartitionInstallMbrChildHandles (
if (Mbr->Partition[0].OSIndicator == EFI_PARTITION) {
PartitionInfo.System = 1;
}
CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[0], sizeof (MBR_PARTITION_RECORD));
Status = PartitionInstallChildHandle (
@@ -319,12 +327,12 @@ PartitionInstallMbrChildHandles (
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &HdDev,
(EFI_DEVICE_PATH_PROTOCOL *)&HdDev,
&PartitionInfo,
HdDev.PartitionStart - ParentHdDev.PartitionStart,
HdDev.PartitionStart - ParentHdDev.PartitionStart + HdDev.PartitionSize - 1,
MBR_SIZE,
((Mbr->Partition[0].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid: NULL)
((Mbr->Partition[0].OSIndicator == EFI_PARTITION) ? &gEfiPartTypeSystemPartGuid : NULL)
);
if (!EFI_ERROR (Status)) {
Found = EFI_SUCCESS;
@@ -332,7 +340,8 @@ PartitionInstallMbrChildHandles (
if ((Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION) &&
(Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION)
) {
)
{
break;
}

View File

@@ -10,13 +10,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "Partition.h"
//
// Partition Driver Global Variables.
//
EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
PartitionDriverBindingSupported,
PartitionDriverBindingStart,
PartitionDriverBindingStop,
@@ -44,7 +43,7 @@ EFI_DRIVER_BINDING_PROTOCOL gPartitionDriverBinding = {
// Note: UDF is using a same method as booting from CD-ROM, so put it along
// with CD-ROM check.
//
PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
PARTITION_DETECT_ROUTINE mPartitionDetectRoutineTable[] = {
PartitionInstallGptChildHandles,
PartitionInstallUdfChildHandles,
PartitionInstallMbrChildHandles,
@@ -92,10 +91,11 @@ PartitionDriverBindingSupported (
// If RemainingDevicePath isn't the End of Device Path Node,
// check its validation
//
Node = (EFI_DEV_PATH *) RemainingDevicePath;
if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||
Node->DevPath.SubType != MEDIA_HARDDRIVE_DP ||
DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)) {
Node = (EFI_DEV_PATH *)RemainingDevicePath;
if ((Node->DevPath.Type != MEDIA_DEVICE_PATH) ||
(Node->DevPath.SubType != MEDIA_HARDDRIVE_DP) ||
(DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)))
{
return EFI_UNSUPPORTED;
}
}
@@ -107,7 +107,7 @@ PartitionDriverBindingSupported (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
(VOID **)&DiskIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -115,9 +115,11 @@ PartitionDriverBindingSupported (
if (Status == EFI_ALREADY_STARTED) {
return EFI_SUCCESS;
}
if (EFI_ERROR (Status)) {
return Status;
}
//
// Close the I/O Abstraction(s) used to perform the supported test
//
@@ -134,7 +136,7 @@ PartitionDriverBindingSupported (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
(VOID **)&ParentDevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -151,11 +153,11 @@ PartitionDriverBindingSupported (
// Close protocol, don't use device path protocol in the Support() function
//
gBS->CloseProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
//
// Open the IO Abstraction(s) needed to perform the supported test
@@ -207,7 +209,7 @@ PartitionDriverBindingStart (
EFI_TPL OldTpl;
BlockIo2 = NULL;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
//
// Check RemainingDevicePath validation
//
@@ -229,7 +231,7 @@ PartitionDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
(VOID **)&BlockIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -241,7 +243,7 @@ PartitionDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiBlockIo2ProtocolGuid,
(VOID **) &BlockIo2,
(VOID **)&BlockIo2,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -256,12 +258,12 @@ PartitionDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
(VOID **) &ParentDevicePath,
(VOID **)&ParentDevicePath,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
goto Exit;
}
@@ -271,18 +273,18 @@ PartitionDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
(VOID **)&DiskIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
gBS->CloseProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
goto Exit;
}
@@ -291,12 +293,12 @@ PartitionDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiDiskIo2ProtocolGuid,
(VOID **) &DiskIo2,
(VOID **)&DiskIo2,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
if (EFI_ERROR (Status) && (Status != EFI_ALREADY_STARTED)) {
DiskIo2 = NULL;
}
@@ -306,7 +308,8 @@ PartitionDriverBindingStart (
Status = EFI_UNSUPPORTED;
MediaPresent = BlockIo->Media->MediaPresent;
if (BlockIo->Media->MediaPresent ||
(BlockIo->Media->RemovableMedia && !BlockIo->Media->LogicalPartition)) {
(BlockIo->Media->RemovableMedia && !BlockIo->Media->LogicalPartition))
{
//
// Try for GPT, then legacy MBR partition types, and then UDF and El Torito.
// If the media supports a given partition type install child handles to
@@ -314,21 +317,23 @@ PartitionDriverBindingStart (
//
Routine = &mPartitionDetectRoutineTable[0];
while (*Routine != NULL) {
Status = (*Routine) (
This,
ControllerHandle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
ParentDevicePath
);
if (!EFI_ERROR (Status) || Status == EFI_MEDIA_CHANGED || Status == EFI_NO_MEDIA) {
Status = (*Routine)(
This,
ControllerHandle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
ParentDevicePath
);
if (!EFI_ERROR (Status) || (Status == EFI_MEDIA_CHANGED) || (Status == EFI_NO_MEDIA)) {
break;
}
Routine++;
}
}
//
// In the case that the driver is already started (OpenStatus == EFI_ALREADY_STARTED),
// the DevicePathProtocol and the DiskIoProtocol are not actually opened by the
@@ -343,14 +348,15 @@ PartitionDriverBindingStart (
//
if (EFI_ERROR (Status) &&
!EFI_ERROR (OpenStatus) &&
Status != EFI_MEDIA_CHANGED &&
!(MediaPresent && Status == EFI_NO_MEDIA)) {
(Status != EFI_MEDIA_CHANGED) &&
!(MediaPresent && (Status == EFI_NO_MEDIA)))
{
gBS->CloseProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
//
// Close Parent DiskIo2 if has.
//
@@ -362,11 +368,11 @@ PartitionDriverBindingStart (
);
gBS->CloseProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
}
Exit:
@@ -391,10 +397,10 @@ Exit:
EFI_STATUS
EFIAPI
PartitionDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -408,7 +414,7 @@ PartitionDriverBindingStop (
BlockIo = NULL;
BlockIo2 = NULL;
Private = NULL;
Private = NULL;
if (NumberOfChildren == 0) {
//
@@ -417,7 +423,7 @@ PartitionDriverBindingStop (
// bus driver. Hence, additional check is needed here.
//
if (HasChildren (ControllerHandle)) {
DEBUG((DEBUG_ERROR, "PartitionDriverBindingStop: Still has child.\n"));
DEBUG ((DEBUG_ERROR, "PartitionDriverBindingStop: Still has child.\n"));
return EFI_DEVICE_ERROR;
}
@@ -425,11 +431,11 @@ PartitionDriverBindingStop (
// Close the bus driver
//
gBS->CloseProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDiskIoProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
//
// Close Parent BlockIO2 if has.
//
@@ -441,11 +447,11 @@ PartitionDriverBindingStop (
);
gBS->CloseProtocol (
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
ControllerHandle
);
return EFI_SUCCESS;
}
@@ -454,7 +460,7 @@ PartitionDriverBindingStop (
gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
(VOID **)&BlockIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -465,13 +471,12 @@ PartitionDriverBindingStop (
gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiBlockIo2ProtocolGuid,
(VOID **) &BlockIo2,
(VOID **)&BlockIo2,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (BlockIo);
if (Private->InStop) {
//
@@ -480,13 +485,14 @@ PartitionDriverBindingStop (
//
break;
}
Private->InStop = TRUE;
BlockIo->FlushBlocks (BlockIo);
if (BlockIo2 != NULL) {
Status = BlockIo2->FlushBlocksEx (BlockIo2, NULL);
DEBUG((DEBUG_ERROR, "PartitionDriverBindingStop: FlushBlocksEx returned with %r\n", Status));
DEBUG ((DEBUG_ERROR, "PartitionDriverBindingStop: FlushBlocksEx returned with %r\n", Status));
} else {
Status = EFI_SUCCESS;
}
@@ -518,33 +524,33 @@ PartitionDriverBindingStop (
//
if (Status != EFI_MEDIA_CHANGED) {
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
&gEfiBlockIoProtocolGuid,
&Private->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Private->BlockIo2,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
TypeGuid,
NULL,
NULL
);
ChildHandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
&gEfiBlockIoProtocolGuid,
&Private->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Private->BlockIo2,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
TypeGuid,
NULL,
NULL
);
}
} else {
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
&gEfiBlockIoProtocolGuid,
&Private->BlockIo,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
TypeGuid,
NULL,
NULL
);
ChildHandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
Private->DevicePath,
&gEfiBlockIoProtocolGuid,
&Private->BlockIo,
&gEfiPartitionInfoProtocolGuid,
&Private->PartitionInfo,
TypeGuid,
NULL,
NULL
);
}
if (EFI_ERROR (Status)) {
@@ -552,7 +558,7 @@ PartitionDriverBindingStop (
gBS->OpenProtocol (
ControllerHandle,
&gEfiDiskIoProtocolGuid,
(VOID **) &DiskIo,
(VOID **)&DiskIo,
This->DriverBindingHandle,
ChildHandleBuffer[Index],
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -577,7 +583,6 @@ PartitionDriverBindingStop (
return EFI_SUCCESS;
}
/**
Reset the Block Device.
@@ -601,9 +606,9 @@ PartitionReset (
Private = PARTITION_DEVICE_FROM_BLOCK_IO_THIS (This);
return Private->ParentBlockIo->Reset (
Private->ParentBlockIo,
ExtendedVerification
);
Private->ParentBlockIo,
ExtendedVerification
);
}
/**
@@ -621,13 +626,13 @@ PartitionReset (
**/
EFI_STATUS
ProbeMediaStatus (
IN EFI_DISK_IO_PROTOCOL *DiskIo,
IN UINT32 MediaId,
IN EFI_STATUS DefaultStatus
IN EFI_DISK_IO_PROTOCOL *DiskIo,
IN UINT32 MediaId,
IN EFI_STATUS DefaultStatus
)
{
EFI_STATUS Status;
UINT8 Buffer[1];
EFI_STATUS Status;
UINT8 Buffer[1];
//
// Read 1 byte from offset 0 to check if the MediaId is still valid.
@@ -635,10 +640,11 @@ ProbeMediaStatus (
// allocate a buffer from the pool. The destination buffer for the
// data is in the stack.
//
Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, (VOID*)Buffer);
Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, (VOID *)Buffer);
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
return Status;
}
return DefaultStatus;
}
@@ -684,6 +690,7 @@ PartitionReadBlocks (
if (Offset + BufferSize > Private->End) {
return ProbeMediaStatus (Private->DiskIo, MediaId, EFI_INVALID_PARAMETER);
}
//
// Because some kinds of partition have different block size from their parent
// device, we call the Disk IO protocol on the parent device, not the Block IO
@@ -719,7 +726,7 @@ PartitionWriteBlocks (
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID *Buffer
IN VOID *Buffer
)
{
PARTITION_PRIVATE_DATA *Private;
@@ -735,6 +742,7 @@ PartitionWriteBlocks (
if (Offset + BufferSize > Private->End) {
return ProbeMediaStatus (Private->DiskIo, MediaId, EFI_INVALID_PARAMETER);
}
//
// Because some kinds of partition have different block size from their parent
// device, we call the Disk IO protocol on the parent device, not the Block IO
@@ -743,7 +751,6 @@ PartitionWriteBlocks (
return Private->DiskIo->WriteDisk (Private->DiskIo, MediaId, Offset, BufferSize, Buffer);
}
/**
Flush the parent Block Device.
@@ -782,13 +789,13 @@ PartitionFlushBlocks (
**/
EFI_STATUS
ProbeMediaStatusEx (
IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
IN UINT32 MediaId,
IN EFI_STATUS DefaultStatus
IN EFI_DISK_IO2_PROTOCOL *DiskIo2,
IN UINT32 MediaId,
IN EFI_STATUS DefaultStatus
)
{
EFI_STATUS Status;
UINT8 Buffer[1];
EFI_STATUS Status;
UINT8 Buffer[1];
//
// Read 1 byte from offset 0 to check if the MediaId is still valid.
@@ -796,10 +803,11 @@ ProbeMediaStatusEx (
// allocate a buffer from the pool. The destination buffer for the
// data is in the stack.
//
Status = DiskIo2->ReadDiskEx (DiskIo2, MediaId, 0, NULL, 1, (VOID*)Buffer);
Status = DiskIo2->ReadDiskEx (DiskIo2, MediaId, 0, NULL, 1, (VOID *)Buffer);
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
return Status;
}
return DefaultStatus;
}
@@ -817,8 +825,8 @@ ProbeMediaStatusEx (
EFI_STATUS
EFIAPI
PartitionResetEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
PARTITION_PRIVATE_DATA *Private;
@@ -840,13 +848,13 @@ PartitionResetEx (
VOID
EFIAPI
PartitionOnAccessComplete (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
PARTITION_ACCESS_TASK *Task;
PARTITION_ACCESS_TASK *Task;
Task = (PARTITION_ACCESS_TASK *) Context;
Task = (PARTITION_ACCESS_TASK *)Context;
gBS->CloseEvent (Event);
@@ -865,11 +873,11 @@ PartitionOnAccessComplete (
**/
PARTITION_ACCESS_TASK *
PartitionCreateAccessTask (
IN EFI_BLOCK_IO2_TOKEN *Token
IN EFI_BLOCK_IO2_TOKEN *Token
)
{
EFI_STATUS Status;
PARTITION_ACCESS_TASK *Task;
EFI_STATUS Status;
PARTITION_ACCESS_TASK *Task;
Task = AllocatePool (sizeof (*Task));
if (Task == NULL) {
@@ -929,12 +937,12 @@ PartitionCreateAccessTask (
EFI_STATUS
EFIAPI
PartitionReadBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
EFI_STATUS Status;
@@ -1005,12 +1013,12 @@ PartitionReadBlocksEx (
EFI_STATUS
EFIAPI
PartitionWriteBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
EFI_STATUS Status;
@@ -1043,6 +1051,7 @@ PartitionWriteBlocksEx (
} else {
Status = Private->DiskIo2->WriteDiskEx (Private->DiskIo2, MediaId, Offset, NULL, BufferSize, Buffer);
}
return Status;
}
@@ -1071,8 +1080,8 @@ PartitionWriteBlocksEx (
EFI_STATUS
EFIAPI
PartitionFlushBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
)
{
EFI_STATUS Status;
@@ -1095,10 +1104,10 @@ PartitionFlushBlocksEx (
} else {
Status = Private->DiskIo2->FlushDiskEx (Private->DiskIo2, NULL);
}
return Status;
}
/**
Create a child handle for a logical block device that represents the
bytes Start to End of the Parent Block IO device.
@@ -1147,60 +1156,60 @@ PartitionInstallChildHandle (
return EFI_OUT_OF_RESOURCES;
}
Private->Signature = PARTITION_PRIVATE_DATA_SIGNATURE;
Private->Signature = PARTITION_PRIVATE_DATA_SIGNATURE;
Private->Start = MultU64x32 (Start, ParentBlockIo->Media->BlockSize);
Private->End = MultU64x32 (End + 1, ParentBlockIo->Media->BlockSize);
Private->Start = MultU64x32 (Start, ParentBlockIo->Media->BlockSize);
Private->End = MultU64x32 (End + 1, ParentBlockIo->Media->BlockSize);
Private->BlockSize = BlockSize;
Private->ParentBlockIo = ParentBlockIo;
Private->ParentBlockIo2 = ParentBlockIo2;
Private->DiskIo = ParentDiskIo;
Private->DiskIo2 = ParentDiskIo2;
Private->BlockSize = BlockSize;
Private->ParentBlockIo = ParentBlockIo;
Private->ParentBlockIo2 = ParentBlockIo2;
Private->DiskIo = ParentDiskIo;
Private->DiskIo2 = ParentDiskIo2;
//
// Set the BlockIO into Private Data.
//
Private->BlockIo.Revision = ParentBlockIo->Revision;
Private->BlockIo.Media = &Private->Media;
Private->BlockIo.Media = &Private->Media;
CopyMem (Private->BlockIo.Media, ParentBlockIo->Media, sizeof (EFI_BLOCK_IO_MEDIA));
Private->BlockIo.Reset = PartitionReset;
Private->BlockIo.ReadBlocks = PartitionReadBlocks;
Private->BlockIo.WriteBlocks = PartitionWriteBlocks;
Private->BlockIo.FlushBlocks = PartitionFlushBlocks;
Private->BlockIo.Reset = PartitionReset;
Private->BlockIo.ReadBlocks = PartitionReadBlocks;
Private->BlockIo.WriteBlocks = PartitionWriteBlocks;
Private->BlockIo.FlushBlocks = PartitionFlushBlocks;
//
// Set the BlockIO2 into Private Data.
//
if (Private->DiskIo2 != NULL) {
ASSERT (Private->ParentBlockIo2 != NULL);
Private->BlockIo2.Media = &Private->Media2;
Private->BlockIo2.Media = &Private->Media2;
CopyMem (Private->BlockIo2.Media, ParentBlockIo2->Media, sizeof (EFI_BLOCK_IO_MEDIA));
Private->BlockIo2.Reset = PartitionResetEx;
Private->BlockIo2.ReadBlocksEx = PartitionReadBlocksEx;
Private->BlockIo2.WriteBlocksEx = PartitionWriteBlocksEx;
Private->BlockIo2.FlushBlocksEx = PartitionFlushBlocksEx;
Private->BlockIo2.Reset = PartitionResetEx;
Private->BlockIo2.ReadBlocksEx = PartitionReadBlocksEx;
Private->BlockIo2.WriteBlocksEx = PartitionWriteBlocksEx;
Private->BlockIo2.FlushBlocksEx = PartitionFlushBlocksEx;
}
Private->Media.IoAlign = 0;
Private->Media.IoAlign = 0;
Private->Media.LogicalPartition = TRUE;
Private->Media.LastBlock = DivU64x32 (
MultU64x32 (
End - Start + 1,
ParentBlockIo->Media->BlockSize
),
BlockSize
) - 1;
Private->Media.LastBlock = DivU64x32 (
MultU64x32 (
End - Start + 1,
ParentBlockIo->Media->BlockSize
),
BlockSize
) - 1;
Private->Media.BlockSize = (UINT32) BlockSize;
Private->Media.BlockSize = (UINT32)BlockSize;
Private->Media2.IoAlign = 0;
Private->Media2.IoAlign = 0;
Private->Media2.LogicalPartition = TRUE;
Private->Media2.LastBlock = Private->Media.LastBlock;
Private->Media2.BlockSize = (UINT32) BlockSize;
Private->Media2.LastBlock = Private->Media.LastBlock;
Private->Media2.BlockSize = (UINT32)BlockSize;
//
// Per UEFI Spec, LowestAlignedLba, LogicalBlocksPerPhysicalBlock and OptimalTransferLengthGranularity must be 0
@@ -1217,7 +1226,7 @@ PartitionInstallChildHandle (
}
}
Private->DevicePath = AppendDevicePathNode (ParentDevicePath, DevicePathNode);
Private->DevicePath = AppendDevicePathNode (ParentDevicePath, DevicePathNode);
if (Private->DevicePath == NULL) {
FreePool (Private);
@@ -1230,7 +1239,7 @@ PartitionInstallChildHandle (
CopyMem (&Private->PartitionInfo, PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));
if (TypeGuid != NULL) {
CopyGuid(&(Private->TypeGuid), TypeGuid);
CopyGuid (&(Private->TypeGuid), TypeGuid);
} else {
ZeroMem ((VOID *)&(Private->TypeGuid), sizeof (EFI_GUID));
}
@@ -1276,7 +1285,7 @@ PartitionInstallChildHandle (
Status = gBS->OpenProtocol (
ParentHandle,
&gEfiDiskIoProtocolGuid,
(VOID **) &ParentDiskIo,
(VOID **)&ParentDiskIo,
This->DriverBindingHandle,
Private->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
@@ -1298,7 +1307,6 @@ PartitionInstallChildHandle (
return Status;
}
/**
The user Entry Point for module Partition. The user code starts with this function.
@@ -1312,11 +1320,11 @@ PartitionInstallChildHandle (
EFI_STATUS
EFIAPI
InitializePartition (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
//
// Install driver model protocol(s).
@@ -1331,11 +1339,9 @@ InitializePartition (
);
ASSERT_EFI_ERROR (Status);
return Status;
}
/**
Test to see if there is any child on ControllerHandle.
@@ -1347,7 +1353,7 @@ InitializePartition (
**/
BOOLEAN
HasChildren (
IN EFI_HANDLE ControllerHandle
IN EFI_HANDLE ControllerHandle
)
{
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer;
@@ -1368,7 +1374,8 @@ HasChildren (
break;
}
}
FreePool (OpenInfoBuffer);
return (BOOLEAN) (Index < EntryCount);
return (BOOLEAN)(Index < EntryCount);
}

View File

@@ -41,36 +41,35 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//
#define PARTITION_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('P', 'a', 'r', 't')
typedef struct {
UINT64 Signature;
UINT64 Signature;
EFI_HANDLE Handle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_BLOCK_IO_PROTOCOL BlockIo;
EFI_BLOCK_IO2_PROTOCOL BlockIo2;
EFI_BLOCK_IO_MEDIA Media;
EFI_BLOCK_IO_MEDIA Media2;//For BlockIO2
EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
EFI_HANDLE Handle;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_BLOCK_IO_PROTOCOL BlockIo;
EFI_BLOCK_IO2_PROTOCOL BlockIo2;
EFI_BLOCK_IO_MEDIA Media;
EFI_BLOCK_IO_MEDIA Media2;// For BlockIO2
EFI_PARTITION_INFO_PROTOCOL PartitionInfo;
EFI_DISK_IO_PROTOCOL *DiskIo;
EFI_DISK_IO2_PROTOCOL *DiskIo2;
EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;
EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2;
UINT64 Start;
UINT64 End;
UINT32 BlockSize;
BOOLEAN InStop;
EFI_GUID TypeGuid;
EFI_DISK_IO_PROTOCOL *DiskIo;
EFI_DISK_IO2_PROTOCOL *DiskIo2;
EFI_BLOCK_IO_PROTOCOL *ParentBlockIo;
EFI_BLOCK_IO2_PROTOCOL *ParentBlockIo2;
UINT64 Start;
UINT64 End;
UINT32 BlockSize;
BOOLEAN InStop;
EFI_GUID TypeGuid;
} PARTITION_PRIVATE_DATA;
typedef struct {
EFI_DISK_IO2_TOKEN DiskIo2Token;
EFI_BLOCK_IO2_TOKEN *BlockIo2Token;
EFI_DISK_IO2_TOKEN DiskIo2Token;
EFI_BLOCK_IO2_TOKEN *BlockIo2Token;
} PARTITION_ACCESS_TASK;
#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
#define PARTITION_DEVICE_FROM_BLOCK_IO2_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo2, PARTITION_PRIVATE_DATA_SIGNATURE)
#define PARTITION_DEVICE_FROM_BLOCK_IO_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo, PARTITION_PRIVATE_DATA_SIGNATURE)
#define PARTITION_DEVICE_FROM_BLOCK_IO2_THIS(a) CR (a, PARTITION_PRIVATE_DATA, BlockIo2, PARTITION_PRIVATE_DATA_SIGNATURE)
//
// Global Variables
@@ -82,7 +81,7 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2;
//
// Extract INT32 from char array
//
#define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
#define UNPACK_INT32(a) (INT32)( (((UINT8 *) a)[0] << 0) | \
(((UINT8 *) a)[1] << 8) | \
(((UINT8 *) a)[2] << 16) | \
(((UINT8 *) a)[3] << 24) )
@@ -90,24 +89,24 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2;
//
// Extract UINT32 from char array
//
#define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
#define UNPACK_UINT32(a) (UINT32)( (((UINT8 *) a)[0] << 0) | \
(((UINT8 *) a)[1] << 8) | \
(((UINT8 *) a)[2] << 16) | \
(((UINT8 *) a)[3] << 24) )
//
// GPT Partition Entry Status
//
typedef struct {
BOOLEAN OutOfRange;
BOOLEAN Overlap;
BOOLEAN OsSpecific;
BOOLEAN OutOfRange;
BOOLEAN Overlap;
BOOLEAN OsSpecific;
} EFI_PARTITION_ENTRY_STATUS;
//
// Function Prototypes
//
/**
Test to see if this driver supports ControllerHandle. Any ControllerHandle
than contains a BlockIo and DiskIo protocol can be supported.
@@ -170,15 +169,16 @@ PartitionDriverBindingStart (
EFI_STATUS
EFIAPI
PartitionDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
);
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -226,7 +226,6 @@ PartitionComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -298,14 +297,13 @@ PartitionComponentNameGetDriverName (
EFI_STATUS
EFIAPI
PartitionComponentNameGetControllerName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
);
/**
Create a child handle for a logical block device that represents the
bytes Start to End of the Parent Block IO device.
@@ -356,7 +354,7 @@ PartitionInstallChildHandle (
**/
BOOLEAN
HasChildren (
IN EFI_HANDLE ControllerHandle
IN EFI_HANDLE ControllerHandle
);
/**

View File

@@ -18,7 +18,7 @@
#include "Partition.h"
#define MAX_CORRECTION_BLOCKS_NUM 512u
#define MAX_CORRECTION_BLOCKS_NUM 512u
//
// C5BD4D42-1A76-4996-8956-73CDA326CD0A
@@ -29,25 +29,27 @@
}
typedef struct {
VENDOR_DEVICE_PATH DevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
VENDOR_DEVICE_PATH DevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
} UDF_DEVICE_PATH;
//
// Vendor-Defined Device Path GUID for UDF file system
//
EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;
EFI_GUID gUdfDevPathGuid = EFI_UDF_DEVICE_PATH_GUID;
//
// Vendor-Defined Media Device Path for UDF file system
//
UDF_DEVICE_PATH gUdfDevicePath = {
{ { MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
{ sizeof (VENDOR_DEVICE_PATH), 0 } },
UDF_DEVICE_PATH gUdfDevicePath = {
{
{ MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
{ sizeof (VENDOR_DEVICE_PATH), 0 }
},
EFI_UDF_DEVICE_PATH_GUID
},
{ END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
{ sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
{ END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
{ sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 }
}
};
@@ -99,10 +101,10 @@ FindAnchorVolumeDescriptorPointer (
// That said, we define a magic number of 512 blocks to be used as correction
// when attempting to find AVDP and define last block number.
//
BlockSize = BlockIo->Media->BlockSize;
EndLBA = BlockIo->Media->LastBlock;
BlockSize = BlockIo->Media->BlockSize;
EndLBA = BlockIo->Media->LastBlock;
*LastRecordedBlock = EndLBA;
AvdpsCount = 0;
AvdpsCount = 0;
//
// Check if the block size of the underlying media can hold the data of an
@@ -122,12 +124,12 @@ FindAnchorVolumeDescriptorPointer (
// Find AVDP at block 256
//
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 (256, BlockSize),
sizeof (*AnchorPoint),
AnchorPoint
);
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 (256, BlockSize),
sizeof (*AnchorPoint),
AnchorPoint
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -146,12 +148,12 @@ FindAnchorVolumeDescriptorPointer (
// Find AVDP at block N - 256
//
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 ((UINT64)EndLBA - 256, BlockSize),
sizeof (*AnchorPoint),
AnchorPoint
);
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 ((UINT64)EndLBA - 256, BlockSize),
sizeof (*AnchorPoint),
AnchorPoint
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -159,10 +161,15 @@ FindAnchorVolumeDescriptorPointer (
//
// Check if read block is a valid AVDP descriptor
//
if (DescriptorTag->TagIdentifier == UdfAnchorVolumeDescriptorPointer &&
++AvdpsCount == 2) {
DEBUG ((DEBUG_INFO, "%a: found AVDP at block %Ld\n", __FUNCTION__,
EndLBA - 256));
if ((DescriptorTag->TagIdentifier == UdfAnchorVolumeDescriptorPointer) &&
(++AvdpsCount == 2))
{
DEBUG ((
DEBUG_INFO,
"%a: found AVDP at block %Ld\n",
__FUNCTION__,
EndLBA - 256
));
return EFI_SUCCESS;
}
@@ -177,12 +184,12 @@ FindAnchorVolumeDescriptorPointer (
// Find AVDP at block N
//
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 ((UINT64)EndLBA, BlockSize),
sizeof (*AnchorPoint),
AnchorPoint
);
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 ((UINT64)EndLBA, BlockSize),
sizeof (*AnchorPoint),
AnchorPoint
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -213,12 +220,12 @@ FindAnchorVolumeDescriptorPointer (
// Read consecutive MAX_CORRECTION_BLOCKS_NUM disk blocks
//
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 ((UINT64)EndLBA - MAX_CORRECTION_BLOCKS_NUM, BlockSize),
Size,
AnchorPoints
);
DiskIo,
BlockIo->Media->MediaId,
MultU64x32 ((UINT64)EndLBA - MAX_CORRECTION_BLOCKS_NUM, BlockSize),
Size,
AnchorPoints
);
if (EFI_ERROR (Status)) {
goto Out_Free;
}
@@ -241,10 +248,19 @@ FindAnchorVolumeDescriptorPointer (
// Calculate last recorded block number
//
LastAvdpBlockNum = EndLBA - (MAX_CORRECTION_BLOCKS_NUM - Index);
DEBUG ((DEBUG_WARN, "%a: found AVDP at block %Ld\n", __FUNCTION__,
LastAvdpBlockNum));
DEBUG ((DEBUG_WARN, "%a: correcting last block from %Ld to %Ld\n",
__FUNCTION__, EndLBA, LastAvdpBlockNum));
DEBUG ((
DEBUG_WARN,
"%a: found AVDP at block %Ld\n",
__FUNCTION__,
LastAvdpBlockNum
));
DEBUG ((
DEBUG_WARN,
"%a: correcting last block from %Ld to %Ld\n",
__FUNCTION__,
EndLBA,
LastAvdpBlockNum
));
//
// Save read AVDP from last block
//
@@ -253,7 +269,7 @@ FindAnchorVolumeDescriptorPointer (
// Set last recorded block number
//
*LastRecordedBlock = LastAvdpBlockNum;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
break;
}
}
@@ -280,49 +296,60 @@ FindUdfVolumeIdentifiers (
IN EFI_DISK_IO_PROTOCOL *DiskIo
)
{
EFI_STATUS Status;
UINT64 Offset;
UINT64 EndDiskOffset;
CDROM_VOLUME_DESCRIPTOR VolDescriptor;
CDROM_VOLUME_DESCRIPTOR TerminatingVolDescriptor;
EFI_STATUS Status;
UINT64 Offset;
UINT64 EndDiskOffset;
CDROM_VOLUME_DESCRIPTOR VolDescriptor;
CDROM_VOLUME_DESCRIPTOR TerminatingVolDescriptor;
ZeroMem ((VOID *)&TerminatingVolDescriptor, sizeof (CDROM_VOLUME_DESCRIPTOR));
//
// Start Volume Recognition Sequence
//
EndDiskOffset = MultU64x32 (BlockIo->Media->LastBlock,
BlockIo->Media->BlockSize);
EndDiskOffset = MultU64x32 (
BlockIo->Media->LastBlock,
BlockIo->Media->BlockSize
);
for (Offset = UDF_VRS_START_OFFSET; Offset < EndDiskOffset;
Offset += UDF_LOGICAL_SECTOR_SIZE) {
Offset += UDF_LOGICAL_SECTOR_SIZE)
{
//
// Check if block device has a Volume Structure Descriptor and an Extended
// Area.
//
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
Offset,
sizeof (CDROM_VOLUME_DESCRIPTOR),
(VOID *)&VolDescriptor
);
DiskIo,
BlockIo->Media->MediaId,
Offset,
sizeof (CDROM_VOLUME_DESCRIPTOR),
(VOID *)&VolDescriptor
);
if (EFI_ERROR (Status)) {
return Status;
}
if (CompareMem ((VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_BEA_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)) == 0) {
if (CompareMem (
(VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_BEA_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)
) == 0)
{
break;
}
if ((CompareMem ((VOID *)VolDescriptor.Unknown.Id,
(VOID *)CDVOL_ID,
sizeof (VolDescriptor.Unknown.Id)) != 0) ||
(CompareMem ((VOID *)&VolDescriptor,
(VOID *)&TerminatingVolDescriptor,
sizeof (CDROM_VOLUME_DESCRIPTOR)) == 0)) {
if ((CompareMem (
(VOID *)VolDescriptor.Unknown.Id,
(VOID *)CDVOL_ID,
sizeof (VolDescriptor.Unknown.Id)
) != 0) ||
(CompareMem (
(VOID *)&VolDescriptor,
(VOID *)&TerminatingVolDescriptor,
sizeof (CDROM_VOLUME_DESCRIPTOR)
) == 0))
{
return EFI_NOT_FOUND;
}
}
@@ -336,22 +363,27 @@ FindUdfVolumeIdentifiers (
}
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
Offset,
sizeof (CDROM_VOLUME_DESCRIPTOR),
(VOID *)&VolDescriptor
);
DiskIo,
BlockIo->Media->MediaId,
Offset,
sizeof (CDROM_VOLUME_DESCRIPTOR),
(VOID *)&VolDescriptor
);
if (EFI_ERROR (Status)) {
return Status;
}
if ((CompareMem ((VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_NSR2_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)) != 0) &&
(CompareMem ((VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_NSR3_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)) != 0)) {
if ((CompareMem (
(VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_NSR2_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)
) != 0) &&
(CompareMem (
(VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_NSR3_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)
) != 0))
{
return EFI_NOT_FOUND;
}
@@ -364,19 +396,22 @@ FindUdfVolumeIdentifiers (
}
Status = DiskIo->ReadDisk (
DiskIo,
BlockIo->Media->MediaId,
Offset,
sizeof (CDROM_VOLUME_DESCRIPTOR),
(VOID *)&VolDescriptor
);
DiskIo,
BlockIo->Media->MediaId,
Offset,
sizeof (CDROM_VOLUME_DESCRIPTOR),
(VOID *)&VolDescriptor
);
if (EFI_ERROR (Status)) {
return Status;
}
if (CompareMem ((VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_TEA_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)) != 0) {
if (CompareMem (
(VOID *)VolDescriptor.Unknown.Id,
(VOID *)UDF_TEA_IDENTIFIER,
sizeof (VolDescriptor.Unknown.Id)
) != 0)
{
return EFI_NOT_FOUND;
}
@@ -395,22 +430,22 @@ FindUdfVolumeIdentifiers (
**/
BOOLEAN
IsLogicalVolumeDescriptorSupported (
UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc
UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc
)
{
//
// Check for a valid UDF revision range
//
switch (LogicalVolDesc->DomainIdentifier.Suffix.Domain.UdfRevision) {
case 0x0102:
case 0x0150:
case 0x0200:
case 0x0201:
case 0x0250:
case 0x0260:
break;
default:
return FALSE;
case 0x0102:
case 0x0150:
case 0x0200:
case 0x0201:
case 0x0250:
case 0x0260:
break;
default:
return FALSE;
}
//
@@ -419,6 +454,7 @@ IsLogicalVolumeDescriptorSupported (
if (LogicalVolDesc->NumberOfPartitionMaps > 1) {
return FALSE;
}
//
// UDF 1.02 revision supports only Type 1 (Physical) partitions, but
// let's check it any way.
@@ -426,8 +462,9 @@ IsLogicalVolumeDescriptorSupported (
// PartitionMap[0] -> type
// PartitionMap[1] -> length (in bytes)
//
if (LogicalVolDesc->PartitionMaps[0] != 1 ||
LogicalVolDesc->PartitionMaps[1] != 6) {
if ((LogicalVolDesc->PartitionMaps[0] != 1) ||
(LogicalVolDesc->PartitionMaps[1] != 6))
{
return FALSE;
}
@@ -475,7 +512,7 @@ FindLogicalVolumeLocation (
UDF_DESCRIPTOR_TAG *DescriptorTag;
BlockSize = BlockIo->Media->BlockSize;
ExtentAd = &AnchorPoint->MainVolumeDescriptorSequenceExtent;
ExtentAd = &AnchorPoint->MainVolumeDescriptorSequenceExtent;
//
// UDF 2.60, 2.2.3.1 struct MainVolumeDescriptorSequenceExtent
@@ -486,7 +523,7 @@ FindLogicalVolumeLocation (
// Also make sure it does not exceed maximum number of blocks in the disk.
//
SeqBlocksNum = DivU64x32 ((UINT64)ExtentAd->ExtentLength, BlockSize);
if (SeqBlocksNum < 16 || (EFI_LBA)SeqBlocksNum > LastRecordedBlock + 1) {
if ((SeqBlocksNum < 16) || ((EFI_LBA)SeqBlocksNum > LastRecordedBlock + 1)) {
return EFI_VOLUME_CORRUPTED;
}
@@ -494,8 +531,9 @@ FindLogicalVolumeLocation (
// Check for valid Volume Descriptor Sequence starting block number
//
SeqStartBlock = (UINT64)ExtentAd->ExtentLocation;
if (SeqStartBlock > LastRecordedBlock ||
SeqStartBlock + SeqBlocksNum - 1 > LastRecordedBlock) {
if ((SeqStartBlock > LastRecordedBlock) ||
(SeqStartBlock + SeqBlocksNum - 1 > LastRecordedBlock))
{
return EFI_VOLUME_CORRUPTED;
}
@@ -509,24 +547,24 @@ FindLogicalVolumeLocation (
return EFI_OUT_OF_RESOURCES;
}
SeqEndBlock = SeqStartBlock + SeqBlocksNum;
SeqEndBlock = SeqStartBlock + SeqBlocksNum;
StopSequence = FALSE;
LvdsCount = 0;
Status = EFI_VOLUME_CORRUPTED;
LvdsCount = 0;
Status = EFI_VOLUME_CORRUPTED;
//
// Start Main Volume Descriptor Sequence
//
for (; SeqStartBlock < SeqEndBlock && !StopSequence; SeqStartBlock++) {
for ( ; SeqStartBlock < SeqEndBlock && !StopSequence; SeqStartBlock++) {
//
// Read disk block
//
Status = BlockIo->ReadBlocks (
BlockIo,
BlockIo->Media->MediaId,
SeqStartBlock,
BlockSize,
Buffer
);
BlockIo,
BlockIo->Media->MediaId,
SeqStartBlock,
BlockSize,
Buffer
);
if (EFI_ERROR (Status)) {
goto Out_Free;
}
@@ -548,50 +586,51 @@ FindLogicalVolumeLocation (
// Space Descriptors.
//
switch (DescriptorTag->TagIdentifier) {
case UdfPrimaryVolumeDescriptor:
case UdfImplemenationUseVolumeDescriptor:
case UdfPartitionDescriptor:
case UdfUnallocatedSpaceDescriptor:
break;
case UdfPrimaryVolumeDescriptor:
case UdfImplemenationUseVolumeDescriptor:
case UdfPartitionDescriptor:
case UdfUnallocatedSpaceDescriptor:
break;
case UdfLogicalVolumeDescriptor:
LogicalVolDesc = Buffer;
case UdfLogicalVolumeDescriptor:
LogicalVolDesc = Buffer;
//
// Check for existence of a single LVD and whether it is supported by
// current EDK2 UDF file system implementation.
//
if (++LvdsCount > 1 ||
!IsLogicalVolumeDescriptorSupported (LogicalVolDesc)) {
Status = EFI_UNSUPPORTED;
//
// Check for existence of a single LVD and whether it is supported by
// current EDK2 UDF file system implementation.
//
if ((++LvdsCount > 1) ||
!IsLogicalVolumeDescriptorSupported (LogicalVolDesc))
{
Status = EFI_UNSUPPORTED;
StopSequence = TRUE;
}
break;
case UdfTerminatingDescriptor:
//
// Stop the sequence when we find a Terminating Descriptor
// (aka Unallocated Sector), se we don't have to walk all the unallocated
// area unnecessarily.
//
StopSequence = TRUE;
}
break;
break;
case UdfTerminatingDescriptor:
//
// Stop the sequence when we find a Terminating Descriptor
// (aka Unallocated Sector), se we don't have to walk all the unallocated
// area unnecessarily.
//
StopSequence = TRUE;
break;
default:
//
// An invalid Volume Descriptor has been found in the sequece. Volume is
// corrupted.
//
Status = EFI_VOLUME_CORRUPTED;
goto Out_Free;
default:
//
// An invalid Volume Descriptor has been found in the sequece. Volume is
// corrupted.
//
Status = EFI_VOLUME_CORRUPTED;
goto Out_Free;
}
}
//
// Check if LVD was found
//
if (!EFI_ERROR (Status) && LvdsCount == 1) {
if (!EFI_ERROR (Status) && (LvdsCount == 1)) {
*MainVdsStartBlock = GuardMainVdsStartBlock;
//
// We do not need to read either LVD or PD descriptors to know the last
@@ -654,11 +693,11 @@ FindUdfFileSystem (
// Find Anchor Volume Descriptor Pointer
//
Status = FindAnchorVolumeDescriptorPointer (
BlockIo,
DiskIo,
&AnchorPoint,
&LastRecordedBlock
);
BlockIo,
DiskIo,
&AnchorPoint,
&LastRecordedBlock
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -667,13 +706,13 @@ FindUdfFileSystem (
// Find Logical Volume location
//
Status = FindLogicalVolumeLocation (
BlockIo,
DiskIo,
&AnchorPoint,
LastRecordedBlock,
(UINT64 *)StartingLBA,
(UINT64 *)EndingLBA
);
BlockIo,
DiskIo,
&AnchorPoint,
LastRecordedBlock,
(UINT64 *)StartingLBA,
(UINT64 *)EndingLBA
);
return Status;
}
@@ -714,7 +753,7 @@ PartitionInstallUdfChildHandles (
EFI_LBA EndingLBA;
BOOLEAN ChildCreated;
Media = BlockIo->Media;
Media = BlockIo->Media;
ChildCreated = FALSE;
//
@@ -760,26 +799,26 @@ PartitionInstallUdfChildHandles (
//
ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));
PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;
PartitionInfo.Type = PARTITION_TYPE_OTHER;
PartitionInfo.Type = PARTITION_TYPE_OTHER;
//
// Install partition child handle for UDF file system
//
Status = PartitionInstallChildHandle (
This,
Handle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&gUdfDevicePath,
&PartitionInfo,
StartingLBA,
EndingLBA,
Media->BlockSize,
NULL
);
This,
Handle,
DiskIo,
DiskIo2,
BlockIo,
BlockIo2,
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)&gUdfDevicePath,
&PartitionInfo,
StartingLBA,
EndingLBA,
Media->BlockSize,
NULL
);
if (EFI_ERROR (Status)) {
return (ChildCreated ? EFI_SUCCESS : Status);
}

View File

@@ -14,7 +14,7 @@
//
EFI_BLOCK_IO_PROTOCOL mRamDiskBlockIoTemplate = {
EFI_BLOCK_IO_PROTOCOL_REVISION,
(EFI_BLOCK_IO_MEDIA *) 0,
(EFI_BLOCK_IO_MEDIA *)0,
RamDiskBlkIoReset,
RamDiskBlkIoReadBlocks,
RamDiskBlkIoWriteBlocks,
@@ -26,14 +26,13 @@ EFI_BLOCK_IO_PROTOCOL mRamDiskBlockIoTemplate = {
// for newly registered RAM disks
//
EFI_BLOCK_IO2_PROTOCOL mRamDiskBlockIo2Template = {
(EFI_BLOCK_IO_MEDIA *) 0,
(EFI_BLOCK_IO_MEDIA *)0,
RamDiskBlkIo2Reset,
RamDiskBlkIo2ReadBlocksEx,
RamDiskBlkIo2WriteBlocksEx,
RamDiskBlkIo2FlushBlocksEx
};
/**
Initialize the BlockIO & BlockIO2 protocol of a RAM disk device.
@@ -42,13 +41,13 @@ EFI_BLOCK_IO2_PROTOCOL mRamDiskBlockIo2Template = {
**/
VOID
RamDiskInitBlockIo (
IN RAM_DISK_PRIVATE_DATA *PrivateData
IN RAM_DISK_PRIVATE_DATA *PrivateData
)
{
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
EFI_BLOCK_IO_MEDIA *Media;
UINT32 Remainder;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_BLOCK_IO2_PROTOCOL *BlockIo2;
EFI_BLOCK_IO_MEDIA *Media;
UINT32 Remainder;
BlockIo = &PrivateData->BlockIo;
BlockIo2 = &PrivateData->BlockIo2;
@@ -67,18 +66,19 @@ RamDiskInitBlockIo (
for (Media->BlockSize = RAM_DISK_DEFAULT_BLOCK_SIZE;
Media->BlockSize >= 1;
Media->BlockSize = Media->BlockSize >> 1) {
Media->BlockSize = Media->BlockSize >> 1)
{
Media->LastBlock = DivU64x32Remainder (PrivateData->Size, Media->BlockSize, &Remainder) - 1;
if (Remainder == 0) {
break;
}
}
ASSERT (Media->BlockSize != 0);
return;
}
/**
Reset the Block Device.
@@ -93,14 +93,13 @@ RamDiskInitBlockIo (
EFI_STATUS
EFIAPI
RamDiskBlkIoReset (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
return EFI_SUCCESS;
}
/**
Read BufferSize bytes from Lba into Buffer.
@@ -129,15 +128,15 @@ RamDiskBlkIoReset (
EFI_STATUS
EFIAPI
RamDiskBlkIoReadBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
RAM_DISK_PRIVATE_DATA *PrivateData;
UINTN NumberOfBlocks;
RAM_DISK_PRIVATE_DATA *PrivateData;
UINTN NumberOfBlocks;
PrivateData = RAM_DISK_PRIVATE_FROM_BLKIO (This);
@@ -175,7 +174,6 @@ RamDiskBlkIoReadBlocks (
return EFI_SUCCESS;
}
/**
Write BufferSize bytes from Lba into Buffer.
@@ -204,15 +202,15 @@ RamDiskBlkIoReadBlocks (
EFI_STATUS
EFIAPI
RamDiskBlkIoWriteBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
RAM_DISK_PRIVATE_DATA *PrivateData;
UINTN NumberOfBlocks;
RAM_DISK_PRIVATE_DATA *PrivateData;
UINTN NumberOfBlocks;
PrivateData = RAM_DISK_PRIVATE_FROM_BLKIO (This);
@@ -254,7 +252,6 @@ RamDiskBlkIoWriteBlocks (
return EFI_SUCCESS;
}
/**
Flush the Block Device.
@@ -269,13 +266,12 @@ RamDiskBlkIoWriteBlocks (
EFI_STATUS
EFIAPI
RamDiskBlkIoFlushBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This
IN EFI_BLOCK_IO_PROTOCOL *This
)
{
return EFI_SUCCESS;
}
/**
Resets the block device hardware.
@@ -290,14 +286,13 @@ RamDiskBlkIoFlushBlocks (
EFI_STATUS
EFIAPI
RamDiskBlkIo2Reset (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
return EFI_SUCCESS;
}
/**
Reads the requested number of blocks from the device.
@@ -334,26 +329,26 @@ RamDiskBlkIo2Reset (
EFI_STATUS
EFIAPI
RamDiskBlkIo2ReadBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
)
{
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
PrivateData = RAM_DISK_PRIVATE_FROM_BLKIO2 (This);
Status = RamDiskBlkIoReadBlocks (
&PrivateData->BlockIo,
MediaId,
Lba,
BufferSize,
Buffer
);
&PrivateData->BlockIo,
MediaId,
Lba,
BufferSize,
Buffer
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -369,7 +364,6 @@ RamDiskBlkIo2ReadBlocksEx (
return EFI_SUCCESS;
}
/**
Writes a specified number of blocks to the device.
@@ -405,26 +399,26 @@ RamDiskBlkIo2ReadBlocksEx (
EFI_STATUS
EFIAPI
RamDiskBlkIo2WriteBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
PrivateData = RAM_DISK_PRIVATE_FROM_BLKIO2 (This);
Status = RamDiskBlkIoWriteBlocks (
&PrivateData->BlockIo,
MediaId,
Lba,
BufferSize,
Buffer
);
&PrivateData->BlockIo,
MediaId,
Lba,
BufferSize,
Buffer
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -440,7 +434,6 @@ RamDiskBlkIo2WriteBlocksEx (
return EFI_SUCCESS;
}
/**
Flushes all modified data to a physical block device.
@@ -463,11 +456,11 @@ RamDiskBlkIo2WriteBlocksEx (
EFI_STATUS
EFIAPI
RamDiskBlkIo2FlushBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
)
{
RAM_DISK_PRIVATE_DATA *PrivateData;
RAM_DISK_PRIVATE_DATA *PrivateData;
PrivateData = RAM_DISK_PRIVATE_FROM_BLKIO2 (This);

View File

@@ -34,7 +34,6 @@ LIST_ENTRY RegisteredRamDisks;
EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol = NULL;
EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol = NULL;
/**
Check whether EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL are produced.
If both protocols are produced, publish all the reserved memory type RAM
@@ -48,13 +47,13 @@ EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol = NULL;
VOID
EFIAPI
RamDiskAcpiCheck (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
LIST_ENTRY *Entry;
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_STATUS Status;
LIST_ENTRY *Entry;
RAM_DISK_PRIVATE_DATA *PrivateData;
gBS->CloseEvent (Event);
@@ -99,7 +98,6 @@ RamDiskAcpiCheck (
}
}
/**
The entry point for RamDiskDxe driver.
@@ -116,14 +114,14 @@ RamDiskAcpiCheck (
EFI_STATUS
EFIAPI
RamDiskDxeEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
VOID *DummyInterface;
EFI_EVENT Event;
EFI_STATUS Status;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
VOID *DummyInterface;
EFI_EVENT Event;
//
// If already started, return.
@@ -194,7 +192,6 @@ ErrorExit:
return Status;
}
/**
Unload the RamDiskDxe driver and its configuration form.
@@ -208,16 +205,16 @@ ErrorExit:
EFI_STATUS
EFIAPI
RamDiskDxeUnload (
IN EFI_HANDLE ImageHandle
IN EFI_HANDLE ImageHandle
)
{
EFI_STATUS Status;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
EFI_STATUS Status;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
Status = gBS->HandleProtocol (
mRamDiskHandle,
&gEfiCallerIdGuid,
(VOID **) &ConfigPrivate
(VOID **)&ConfigPrivate
);
if (EFI_ERROR (Status)) {
return Status;

View File

@@ -8,7 +8,6 @@
#include "RamDiskImpl.h"
/**
Helper function called as part of the code needed to allocate the proper
sized buffer for various EFI interfaces.
@@ -24,12 +23,12 @@
**/
BOOLEAN
GrowBuffer (
IN OUT EFI_STATUS *Status,
IN OUT VOID **Buffer,
IN UINTN BufferSize
IN OUT EFI_STATUS *Status,
IN OUT VOID **Buffer,
IN UINTN BufferSize
)
{
BOOLEAN TryAgain;
BOOLEAN TryAgain;
//
// If this is an initial request, buffer will be null with a new buffer size
@@ -37,12 +36,12 @@ GrowBuffer (
if ((*Buffer == NULL) && (BufferSize != 0)) {
*Status = EFI_BUFFER_TOO_SMALL;
}
//
// If the status code is "buffer too small", resize the buffer
//
TryAgain = FALSE;
if (*Status == EFI_BUFFER_TOO_SMALL) {
if (*Buffer != NULL) {
FreePool (*Buffer);
}
@@ -55,6 +54,7 @@ GrowBuffer (
*Status = EFI_OUT_OF_RESOURCES;
}
}
//
// If there's an error, free the buffer
//
@@ -66,7 +66,6 @@ GrowBuffer (
return TryAgain;
}
/**
This function gets the file information from an open file descriptor,
and stores it in a buffer allocated from pool.
@@ -78,23 +77,23 @@ GrowBuffer (
**/
EFI_FILE_INFO *
FileInfo (
IN EFI_FILE_HANDLE FHand
IN EFI_FILE_HANDLE FHand
)
{
EFI_STATUS Status;
EFI_FILE_INFO *Buffer;
UINTN BufferSize;
EFI_STATUS Status;
EFI_FILE_INFO *Buffer;
UINTN BufferSize;
//
// Initialize for GrowBuffer loop
//
Buffer = NULL;
BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
Buffer = NULL;
BufferSize = SIZE_OF_EFI_FILE_INFO + 200;
//
// Call the real function
//
while (GrowBuffer (&Status, (VOID **) &Buffer, BufferSize)) {
while (GrowBuffer (&Status, (VOID **)&Buffer, BufferSize)) {
Status = FHand->GetInfo (
FHand,
&gEfiFileInfoGuid,

View File

@@ -12,7 +12,7 @@
CHAR16 mRamDiskStorageName[] = L"RAM_DISK_CONFIGURATION";
RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate = {
RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate = {
RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE,
{
EFI_PAGE_SIZE,
@@ -25,14 +25,14 @@ RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate = {
}
};
HII_VENDOR_DEVICE_PATH mRamDiskHiiVendorDevicePath = {
HII_VENDOR_DEVICE_PATH mRamDiskHiiVendorDevicePath = {
{
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
(UINT8) (sizeof (VENDOR_DEVICE_PATH)),
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
(UINT8)(sizeof (VENDOR_DEVICE_PATH)),
(UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
RAM_DISK_FORM_SET_GUID
@@ -41,13 +41,12 @@ HII_VENDOR_DEVICE_PATH mRamDiskHiiVendorDevicePath = {
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
(UINT8) (END_DEVICE_PATH_LENGTH),
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
(UINT8)(END_DEVICE_PATH_LENGTH),
(UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
}
}
};
/**
This function publish the RAM disk configuration Form.
@@ -61,7 +60,7 @@ HII_VENDOR_DEVICE_PATH mRamDiskHiiVendorDevicePath = {
**/
EFI_STATUS
InstallRamDiskConfigForm (
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
)
{
EFI_STATUS Status;
@@ -71,14 +70,14 @@ InstallRamDiskConfigForm (
DriverHandle = NULL;
ConfigAccess = &ConfigPrivateData->ConfigAccess;
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverHandle,
&gEfiDevicePathProtocolGuid,
&mRamDiskHiiVendorDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
ConfigAccess,
NULL
);
Status = gBS->InstallMultipleProtocolInterfaces (
&DriverHandle,
&gEfiDevicePathProtocolGuid,
&mRamDiskHiiVendorDevicePath,
&gEfiHiiConfigAccessProtocolGuid,
ConfigAccess,
NULL
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -112,7 +111,6 @@ InstallRamDiskConfigForm (
return EFI_SUCCESS;
}
/**
This function removes RAM disk configuration Form.
@@ -122,7 +120,7 @@ InstallRamDiskConfigForm (
**/
VOID
UninstallRamDiskConfigForm (
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
)
{
//
@@ -151,7 +149,6 @@ UninstallRamDiskConfigForm (
FreePool (ConfigPrivateData);
}
/**
Unregister all registered RAM disks.
@@ -161,11 +158,11 @@ UnregisterAllRamDisks (
VOID
)
{
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
RAM_DISK_PRIVATE_DATA *PrivateData;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
RAM_DISK_PRIVATE_DATA *PrivateData;
if (!IsListEmpty(&RegisteredRamDisks)) {
if (!IsListEmpty (&RegisteredRamDisks)) {
BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
@@ -176,7 +173,7 @@ UnregisterAllRamDisks (
&gEfiBlockIo2ProtocolGuid,
&PrivateData->BlockIo2,
&gEfiDevicePathProtocolGuid,
(EFI_DEVICE_PATH_PROTOCOL *) PrivateData->DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)PrivateData->DevicePath,
NULL
);
@@ -188,7 +185,7 @@ UnregisterAllRamDisks (
// driver is responsible for freeing the allocated memory for the
// RAM disk.
//
FreePool ((VOID *)(UINTN) PrivateData->StartingAddr);
FreePool ((VOID *)(UINTN)PrivateData->StartingAddr);
}
FreePool (PrivateData->DevicePath);
@@ -197,7 +194,6 @@ UnregisterAllRamDisks (
}
}
/**
This function allows a caller to extract the current configuration for one
or more named elements from the target driver.
@@ -228,20 +224,20 @@ UnregisterAllRamDisks (
EFI_STATUS
EFIAPI
RamDiskExtractConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
)
{
if (Progress == NULL || Results == NULL) {
if ((Progress == NULL) || (Results == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Request;
return EFI_NOT_FOUND;
}
/**
This function processes the results of changes in configuration.
@@ -263,12 +259,12 @@ RamDiskExtractConfig (
EFI_STATUS
EFIAPI
RamDiskRouteConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
)
{
if (Configuration == NULL || Progress == NULL) {
if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -277,7 +273,6 @@ RamDiskRouteConfig (
return EFI_NOT_FOUND;
}
/**
Allocate memory and register the RAM disk created within RamDiskDxe
driver HII.
@@ -295,18 +290,18 @@ RamDiskRouteConfig (
**/
EFI_STATUS
HiiCreateRamDisk (
IN UINT64 Size,
IN EFI_FILE_HANDLE FileHandle,
IN UINT8 MemoryType
IN UINT64 Size,
IN EFI_FILE_HANDLE FileHandle,
IN UINT8 MemoryType
)
{
EFI_STATUS Status;
UINTN BufferSize;
UINT64 *StartingAddr;
EFI_INPUT_KEY Key;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_FILE_INFO *FileInformation;
EFI_STATUS Status;
UINTN BufferSize;
UINT64 *StartingAddr;
EFI_INPUT_KEY Key;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
RAM_DISK_PRIVATE_DATA *PrivateData;
EFI_FILE_INFO *FileInformation;
FileInformation = NULL;
StartingAddr = NULL;
@@ -338,7 +333,7 @@ HiiCreateRamDisk (
Size = FileInformation->FileSize;
}
if (Size > (UINTN) -1) {
if (Size > (UINTN)-1) {
do {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
@@ -358,19 +353,19 @@ HiiCreateRamDisk (
Status = gBS->AllocatePool (
EfiBootServicesData,
(UINTN)Size,
(VOID**)&StartingAddr
(VOID **)&StartingAddr
);
} else if (MemoryType == RAM_DISK_RESERVED_MEMORY) {
Status = gBS->AllocatePool (
EfiReservedMemoryType,
(UINTN)Size,
(VOID**)&StartingAddr
(VOID **)&StartingAddr
);
} else {
Status = EFI_INVALID_PARAMETER;
}
if ((StartingAddr == NULL) || EFI_ERROR(Status)) {
if ((StartingAddr == NULL) || EFI_ERROR (Status)) {
do {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
@@ -390,11 +385,11 @@ HiiCreateRamDisk (
//
// Copy the file content to the RAM disk.
//
BufferSize = (UINTN) Size;
BufferSize = (UINTN)Size;
FileHandle->Read (
FileHandle,
&BufferSize,
(VOID *)(UINTN) StartingAddr
(VOID *)(UINTN)StartingAddr
);
if (BufferSize != FileInformation->FileSize) {
do {
@@ -417,7 +412,7 @@ HiiCreateRamDisk (
// Register the newly created RAM disk.
//
Status = RamDiskRegister (
((UINT64)(UINTN) StartingAddr),
((UINT64)(UINTN)StartingAddr),
Size,
&gEfiVirtualDiskGuid,
NULL,
@@ -443,13 +438,12 @@ HiiCreateRamDisk (
// If RAM disk is created within HII, memory should be freed when the
// RAM disk is unregisterd.
//
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (RegisteredRamDisks.BackLink);
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (RegisteredRamDisks.BackLink);
PrivateData->CreateMethod = RamDiskCreateHii;
return EFI_SUCCESS;
}
/**
This function updates the registered RAM disks list on the main form.
@@ -460,19 +454,19 @@ HiiCreateRamDisk (
**/
VOID
UpdateMainForm (
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate
)
{
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
LIST_ENTRY *Entry;
UINTN Index;
RAM_DISK_PRIVATE_DATA *PrivateData;
CHAR16 *String;
CHAR16 RamDiskStr[128];
EFI_STRING_ID StringId;
VOID *StartOpCodeHandle;
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
LIST_ENTRY *Entry;
UINTN Index;
RAM_DISK_PRIVATE_DATA *PrivateData;
CHAR16 *String;
CHAR16 RamDiskStr[128];
EFI_STRING_ID StringId;
//
// Init OpCode Handle
@@ -486,32 +480,32 @@ UpdateMainForm (
//
// Create Hii Extend Label OpCode as the start opcode
//
StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
StartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
StartOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
StartLabel->Number = MAIN_LABEL_LIST_START;
//
// Create Hii Extend Label OpCode as the end opcode
//
EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (
EndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
EndOpCodeHandle,
&gEfiIfrTianoGuid,
NULL,
sizeof (EFI_IFR_GUID_LABEL)
);
EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
EndLabel->Number = MAIN_LABEL_LIST_END;
Index = 0;
BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
PrivateData->CheckBoxId = (EFI_QUESTION_ID)
(MAIN_CHECKBOX_QUESTION_ID_START + Index);
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
PrivateData->CheckBoxId = (EFI_QUESTION_ID)
(MAIN_CHECKBOX_QUESTION_ID_START + Index);
//
// CheckBox is unchecked by default.
//
@@ -557,7 +551,6 @@ UpdateMainForm (
HiiFreeOpCodeHandle (EndOpCodeHandle);
}
/**
This function processes the results of changes in configuration.
@@ -583,21 +576,21 @@ UpdateMainForm (
EFI_STATUS
EFIAPI
RamDiskCallback (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
)
{
EFI_STATUS Status;
RAM_DISK_PRIVATE_DATA *PrivateData;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
EFI_FILE_HANDLE FileHandle;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
EFI_STATUS Status;
RAM_DISK_PRIVATE_DATA *PrivateData;
RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
EFI_FILE_HANDLE FileHandle;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -608,20 +601,22 @@ RamDiskCallback (
if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
Status = EFI_UNSUPPORTED;
if (QuestionId == CREATE_RAW_SIZE_QUESTION_ID) {
Value->u64 = EFI_PAGE_SIZE;
Value->u64 = EFI_PAGE_SIZE;
ConfigPrivate->ConfigStore.Size = EFI_PAGE_SIZE;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
} else if (QuestionId == CREATE_RAW_MEMORY_TYPE_QUESTION_ID) {
Value->u8 = RAM_DISK_BOOT_SERVICE_DATA_MEMORY;
Value->u8 = RAM_DISK_BOOT_SERVICE_DATA_MEMORY;
ConfigPrivate->ConfigStore.MemType = RAM_DISK_BOOT_SERVICE_DATA_MEMORY;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
}
return Status;
}
if ((Action != EFI_BROWSER_ACTION_CHANGED) &&
(Action != EFI_BROWSER_ACTION_CHANGING) &&
(Action != EFI_BROWSER_ACTION_FORM_OPEN)) {
(Action != EFI_BROWSER_ACTION_FORM_OPEN))
{
return EFI_UNSUPPORTED;
}
@@ -634,6 +629,7 @@ RamDiskCallback (
UpdateMainForm (ConfigPrivate);
Status = EFI_SUCCESS;
}
return Status;
}
@@ -641,33 +637,85 @@ RamDiskCallback (
if (Action == EFI_BROWSER_ACTION_CHANGING) {
switch (QuestionId) {
case MAIN_GOTO_FILE_EXPLORER_ID:
Status = ChooseFile (NULL, NULL, NULL, &FileDevPath);
if (EFI_ERROR (Status)) {
break;
}
if (FileDevPath != NULL) {
//
// Open the file.
//
Status = EfiOpenFileByDevicePath (
&FileDevPath,
&FileHandle,
EFI_FILE_MODE_READ,
0
);
case MAIN_GOTO_FILE_EXPLORER_ID:
Status = ChooseFile (NULL, NULL, NULL, &FileDevPath);
if (EFI_ERROR (Status)) {
break;
}
if (FileDevPath != NULL) {
//
// Open the file.
//
Status = EfiOpenFileByDevicePath (
&FileDevPath,
&FileHandle,
EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
break;
}
//
// Create from file, RAM disk size is zero. It will be updated
// according to the file size.
//
Status = HiiCreateRamDisk (
0,
FileHandle,
ConfigPrivate->ConfigStore.MemType
);
if (EFI_ERROR (Status)) {
break;
}
//
// Refresh the registered RAM disks list.
//
UpdateMainForm (ConfigPrivate);
}
break;
default:
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case MAIN_REMOVE_RD_QUESTION_ID:
//
// Create from file, RAM disk size is zero. It will be updated
// according to the file size.
// Remove the selected RAM disks
//
BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxChecked) {
RamDiskUnregister (
(EFI_DEVICE_PATH_PROTOCOL *)PrivateData->DevicePath
);
}
}
UpdateMainForm (ConfigPrivate);
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
case CREATE_RAW_SIZE_QUESTION_ID:
ConfigPrivate->ConfigStore.Size = Value->u64;
break;
case CREATE_RAW_MEMORY_TYPE_QUESTION_ID:
ConfigPrivate->ConfigStore.MemType = Value->u8;
break;
case CREATE_RAW_SUBMIT_QUESTION_ID:
//
// Create raw, FileHandle is NULL.
//
Status = HiiCreateRamDisk (
0,
FileHandle,
ConfigPrivate->ConfigStore.Size,
NULL,
ConfigPrivate->ConfigStore.MemType
);
if (EFI_ERROR (Status)) {
@@ -678,79 +726,30 @@ RamDiskCallback (
// Refresh the registered RAM disks list.
//
UpdateMainForm (ConfigPrivate);
}
break;
default:
break;
}
} else if (Action == EFI_BROWSER_ACTION_CHANGED) {
switch (QuestionId) {
case MAIN_REMOVE_RD_QUESTION_ID:
//
// Remove the selected RAM disks
//
BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxChecked) {
RamDiskUnregister (
(EFI_DEVICE_PATH_PROTOCOL *) PrivateData->DevicePath
);
}
}
UpdateMainForm (ConfigPrivate);
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
break;
case CREATE_RAW_SIZE_QUESTION_ID:
ConfigPrivate->ConfigStore.Size = Value->u64;
break;
case CREATE_RAW_MEMORY_TYPE_QUESTION_ID:
ConfigPrivate->ConfigStore.MemType = Value->u8;
break;
case CREATE_RAW_SUBMIT_QUESTION_ID:
//
// Create raw, FileHandle is NULL.
//
Status = HiiCreateRamDisk (
ConfigPrivate->ConfigStore.Size,
NULL,
ConfigPrivate->ConfigStore.MemType
);
if (EFI_ERROR (Status)) {
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
}
//
// Refresh the registered RAM disks list.
//
UpdateMainForm (ConfigPrivate);
case CREATE_RAW_DISCARD_QUESTION_ID:
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
case CREATE_RAW_DISCARD_QUESTION_ID:
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
break;
default:
//
// QuestionIds for checkboxes
//
if ((QuestionId >= MAIN_CHECKBOX_QUESTION_ID_START) &&
(QuestionId < CREATE_RAW_RAM_DISK_FORM_ID)) {
BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxId == QuestionId) {
PrivateData->CheckBoxChecked = (BOOLEAN) (Value->u8 != 0);
default:
//
// QuestionIds for checkboxes
//
if ((QuestionId >= MAIN_CHECKBOX_QUESTION_ID_START) &&
(QuestionId < CREATE_RAW_RAM_DISK_FORM_ID))
{
BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxId == QuestionId) {
PrivateData->CheckBoxChecked = (BOOLEAN)(Value->u8 != 0);
}
}
}
}
break;
break;
}
}

View File

@@ -46,24 +46,24 @@
//
// Default block size for RAM disk
//
#define RAM_DISK_DEFAULT_BLOCK_SIZE 512
#define RAM_DISK_DEFAULT_BLOCK_SIZE 512
//
// RamDiskDxe driver maintains a list of registered RAM disks.
//
extern LIST_ENTRY RegisteredRamDisks;
extern LIST_ENTRY RegisteredRamDisks;
//
// Pointers to the EFI_ACPI_TABLE_PROTOCOL and EFI_ACPI_SDT_PROTOCOL.
//
extern EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol;
extern EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol;
extern EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol;
extern EFI_ACPI_SDT_PROTOCOL *mAcpiSdtProtocol;
//
// RAM Disk create method.
//
typedef enum _RAM_DISK_CREATE_METHOD {
RamDiskCreateOthers = 0,
RamDiskCreateOthers = 0,
RamDiskCreateHii
} RAM_DISK_CREATE_METHOD;
@@ -73,31 +73,31 @@ typedef enum _RAM_DISK_CREATE_METHOD {
// disk
//
typedef struct {
UINTN Signature;
UINTN Signature;
EFI_HANDLE Handle;
EFI_HANDLE Handle;
EFI_BLOCK_IO_PROTOCOL BlockIo;
EFI_BLOCK_IO2_PROTOCOL BlockIo2;
EFI_BLOCK_IO_MEDIA Media;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_BLOCK_IO_PROTOCOL BlockIo;
EFI_BLOCK_IO2_PROTOCOL BlockIo2;
EFI_BLOCK_IO_MEDIA Media;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINT64 StartingAddr;
UINT64 Size;
EFI_GUID TypeGuid;
UINT16 InstanceNumber;
RAM_DISK_CREATE_METHOD CreateMethod;
BOOLEAN InNfit;
EFI_QUESTION_ID CheckBoxId;
BOOLEAN CheckBoxChecked;
UINT64 StartingAddr;
UINT64 Size;
EFI_GUID TypeGuid;
UINT16 InstanceNumber;
RAM_DISK_CREATE_METHOD CreateMethod;
BOOLEAN InNfit;
EFI_QUESTION_ID CheckBoxId;
BOOLEAN CheckBoxChecked;
LIST_ENTRY ThisInstance;
LIST_ENTRY ThisInstance;
} RAM_DISK_PRIVATE_DATA;
#define RAM_DISK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'D', 'S', 'K')
#define RAM_DISK_PRIVATE_FROM_BLKIO(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo, RAM_DISK_PRIVATE_DATA_SIGNATURE)
#define RAM_DISK_PRIVATE_FROM_BLKIO2(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo2, RAM_DISK_PRIVATE_DATA_SIGNATURE)
#define RAM_DISK_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_PRIVATE_DATA, ThisInstance, RAM_DISK_PRIVATE_DATA_SIGNATURE)
#define RAM_DISK_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'D', 'S', 'K')
#define RAM_DISK_PRIVATE_FROM_BLKIO(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo, RAM_DISK_PRIVATE_DATA_SIGNATURE)
#define RAM_DISK_PRIVATE_FROM_BLKIO2(a) CR (a, RAM_DISK_PRIVATE_DATA, BlockIo2, RAM_DISK_PRIVATE_DATA_SIGNATURE)
#define RAM_DISK_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_PRIVATE_DATA, ThisInstance, RAM_DISK_PRIVATE_DATA_SIGNATURE)
///
/// RAM disk HII-related definitions and declarations
@@ -106,28 +106,28 @@ typedef struct {
//
// Tool generated IFR binary data and String package data
//
extern UINT8 RamDiskHiiBin[];
extern UINT8 RamDiskDxeStrings[];
extern UINT8 RamDiskHiiBin[];
extern UINT8 RamDiskDxeStrings[];
typedef struct {
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
typedef struct {
UINTN Signature;
UINTN Signature;
RAM_DISK_CONFIGURATION ConfigStore;
RAM_DISK_CONFIGURATION ConfigStore;
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
EFI_HANDLE DriverHandle;
EFI_HII_HANDLE HiiHandle;
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
EFI_HANDLE DriverHandle;
EFI_HII_HANDLE HiiHandle;
} RAM_DISK_CONFIG_PRIVATE_DATA;
extern RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate;
extern RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate;
#define RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'C', 'F', 'G')
#define RAM_DISK_CONFIG_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_CONFIG_PRIVATE_DATA, ConfigAccess, RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE)
#define RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('R', 'C', 'F', 'G')
#define RAM_DISK_CONFIG_PRIVATE_FROM_THIS(a) CR (a, RAM_DISK_CONFIG_PRIVATE_DATA, ConfigAccess, RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE)
/**
Register a RAM disk with specified address, size and type.
@@ -162,11 +162,11 @@ extern RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate;
EFI_STATUS
EFIAPI
RamDiskRegister (
IN UINT64 RamDiskBase,
IN UINT64 RamDiskSize,
IN EFI_GUID *RamDiskType,
IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
IN UINT64 RamDiskBase,
IN UINT64 RamDiskSize,
IN EFI_GUID *RamDiskType,
IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
@@ -187,7 +187,7 @@ RamDiskRegister (
EFI_STATUS
EFIAPI
RamDiskUnregister (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
/**
@@ -198,7 +198,7 @@ RamDiskUnregister (
**/
VOID
RamDiskInitBlockIo (
IN RAM_DISK_PRIVATE_DATA *PrivateData
IN RAM_DISK_PRIVATE_DATA *PrivateData
);
/**
@@ -216,8 +216,8 @@ RamDiskInitBlockIo (
EFI_STATUS
EFIAPI
RamDiskBlkIoReset (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -248,11 +248,11 @@ RamDiskBlkIoReset (
EFI_STATUS
EFIAPI
RamDiskBlkIoReadBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
OUT VOID *Buffer
);
/**
@@ -283,11 +283,11 @@ RamDiskBlkIoReadBlocks (
EFI_STATUS
EFIAPI
RamDiskBlkIoWriteBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN UINTN BufferSize,
IN VOID *Buffer
);
/**
@@ -304,7 +304,7 @@ RamDiskBlkIoWriteBlocks (
EFI_STATUS
EFIAPI
RamDiskBlkIoFlushBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This
IN EFI_BLOCK_IO_PROTOCOL *This
);
/**
@@ -321,8 +321,8 @@ RamDiskBlkIoFlushBlocks (
EFI_STATUS
EFIAPI
RamDiskBlkIo2Reset (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
);
/**
@@ -361,12 +361,12 @@ RamDiskBlkIo2Reset (
EFI_STATUS
EFIAPI
RamDiskBlkIo2ReadBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
OUT VOID *Buffer
);
/**
@@ -404,12 +404,12 @@ RamDiskBlkIo2ReadBlocksEx (
EFI_STATUS
EFIAPI
RamDiskBlkIo2WriteBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN UINT32 MediaId,
IN EFI_LBA Lba,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
);
/**
@@ -434,8 +434,8 @@ RamDiskBlkIo2WriteBlocksEx (
EFI_STATUS
EFIAPI
RamDiskBlkIo2FlushBlocksEx (
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
IN EFI_BLOCK_IO2_PROTOCOL *This,
IN OUT EFI_BLOCK_IO2_TOKEN *Token
);
/**
@@ -451,7 +451,7 @@ RamDiskBlkIo2FlushBlocksEx (
**/
EFI_STATUS
InstallRamDiskConfigForm (
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
);
/**
@@ -463,7 +463,7 @@ InstallRamDiskConfigForm (
**/
VOID
UninstallRamDiskConfigForm (
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
);
/**
@@ -505,10 +505,10 @@ UnregisterAllRamDisks (
EFI_STATUS
EFIAPI
RamDiskExtractConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Request,
OUT EFI_STRING *Progress,
OUT EFI_STRING *Results
);
/**
@@ -532,9 +532,9 @@ RamDiskExtractConfig (
EFI_STATUS
EFIAPI
RamDiskRouteConfig (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN CONST EFI_STRING Configuration,
OUT EFI_STRING *Progress
);
/**
@@ -562,15 +562,14 @@ RamDiskRouteConfig (
EFI_STATUS
EFIAPI
RamDiskCallback (
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
IN EFI_BROWSER_ACTION Action,
IN EFI_QUESTION_ID QuestionId,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE *Value,
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
);
/**
This function gets the file information from an open file descriptor,
and stores it in a buffer allocated from pool.
@@ -582,10 +581,9 @@ RamDiskCallback (
**/
EFI_FILE_INFO *
FileInfo (
IN EFI_FILE_HANDLE FHand
IN EFI_FILE_HANDLE FHand
);
/**
Publish the RAM disk NVDIMM Firmware Interface Table (NFIT) to the ACPI
table.
@@ -598,7 +596,7 @@ FileInfo (
**/
EFI_STATUS
RamDiskPublishNfit (
IN RAM_DISK_PRIVATE_DATA *PrivateData
IN RAM_DISK_PRIVATE_DATA *PrivateData
);
#endif

View File

@@ -13,12 +13,12 @@
#include <Guid/HiiPlatformSetupFormset.h>
#include <Guid/RamDiskHii.h>
#define MAIN_FORM_ID 0x1000
#define MAIN_GOTO_FILE_EXPLORER_ID 0x1001
#define MAIN_REMOVE_RD_QUESTION_ID 0x1002
#define MAIN_LABEL_LIST_START 0x1003
#define MAIN_LABEL_LIST_END 0x1004
#define MAIN_CHECKBOX_QUESTION_ID_START 0x1100
#define MAIN_FORM_ID 0x1000
#define MAIN_GOTO_FILE_EXPLORER_ID 0x1001
#define MAIN_REMOVE_RD_QUESTION_ID 0x1002
#define MAIN_LABEL_LIST_START 0x1003
#define MAIN_LABEL_LIST_END 0x1004
#define MAIN_CHECKBOX_QUESTION_ID_START 0x1100
#define CREATE_RAW_RAM_DISK_FORM_ID 0x2000
#define CREATE_RAW_SIZE_QUESTION_ID 0x2001
@@ -26,19 +26,19 @@
#define CREATE_RAW_DISCARD_QUESTION_ID 0x2003
#define CREATE_RAW_MEMORY_TYPE_QUESTION_ID 0x2004
#define RAM_DISK_BOOT_SERVICE_DATA_MEMORY 0x00
#define RAM_DISK_RESERVED_MEMORY 0x01
#define RAM_DISK_MEMORY_TYPE_MAX 0x02
#define RAM_DISK_BOOT_SERVICE_DATA_MEMORY 0x00
#define RAM_DISK_RESERVED_MEMORY 0x01
#define RAM_DISK_MEMORY_TYPE_MAX 0x02
typedef struct {
//
// The size of the RAM disk to be created.
//
UINT64 Size;
UINT64 Size;
//
// Selected RAM Disk Memory Type
//
UINT8 MemType;
UINT8 MemType;
} RAM_DISK_CONFIGURATION;
#endif

View File

@@ -10,7 +10,7 @@
#include "RamDiskImpl.h"
RAM_DISK_PRIVATE_DATA mRamDiskPrivateDataTemplate = {
RAM_DISK_PRIVATE_DATA mRamDiskPrivateDataTemplate = {
RAM_DISK_PRIVATE_DATA_SIGNATURE,
NULL
};
@@ -20,8 +20,8 @@ MEDIA_RAM_DISK_DEVICE_PATH mRamDiskDeviceNodeTemplate = {
MEDIA_DEVICE_PATH,
MEDIA_RAM_DISK_DP,
{
(UINT8) (sizeof (MEDIA_RAM_DISK_DEVICE_PATH)),
(UINT8) ((sizeof (MEDIA_RAM_DISK_DEVICE_PATH)) >> 8)
(UINT8)(sizeof (MEDIA_RAM_DISK_DEVICE_PATH)),
(UINT8)((sizeof (MEDIA_RAM_DISK_DEVICE_PATH)) >> 8)
}
}
};
@@ -29,7 +29,6 @@ MEDIA_RAM_DISK_DEVICE_PATH mRamDiskDeviceNodeTemplate = {
BOOLEAN mRamDiskSsdtTableKeyValid = FALSE;
UINTN mRamDiskSsdtTableKey;
/**
Initialize the RAM disk device node.
@@ -39,23 +38,22 @@ UINTN mRamDiskSsdtTableKey;
**/
VOID
RamDiskInitDeviceNode (
IN RAM_DISK_PRIVATE_DATA *PrivateData,
IN OUT MEDIA_RAM_DISK_DEVICE_PATH *RamDiskDevNode
IN RAM_DISK_PRIVATE_DATA *PrivateData,
IN OUT MEDIA_RAM_DISK_DEVICE_PATH *RamDiskDevNode
)
{
WriteUnaligned64 (
(UINT64 *) &(RamDiskDevNode->StartingAddr[0]),
(UINT64) PrivateData->StartingAddr
(UINT64 *)&(RamDiskDevNode->StartingAddr[0]),
(UINT64)PrivateData->StartingAddr
);
WriteUnaligned64 (
(UINT64 *) &(RamDiskDevNode->EndingAddr[0]),
(UINT64) PrivateData->StartingAddr + PrivateData->Size - 1
(UINT64 *)&(RamDiskDevNode->EndingAddr[0]),
(UINT64)PrivateData->StartingAddr + PrivateData->Size - 1
);
CopyGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid);
RamDiskDevNode->Instance = PrivateData->InstanceNumber;
}
/**
Initialize and publish NVDIMM root device SSDT in ACPI table.
@@ -68,10 +66,10 @@ RamDiskPublishSsdt (
VOID
)
{
EFI_STATUS Status;
EFI_ACPI_DESCRIPTION_HEADER *Table;
UINTN SectionInstance;
UINTN TableSize;
EFI_STATUS Status;
EFI_ACPI_DESCRIPTION_HEADER *Table;
UINTN SectionInstance;
UINTN TableSize;
Status = EFI_SUCCESS;
SectionInstance = 0;
@@ -85,7 +83,7 @@ RamDiskPublishSsdt (
&gEfiCallerIdGuid,
EFI_SECTION_RAW,
SectionInstance,
(VOID **) &Table,
(VOID **)&Table,
&TableSize
);
if (EFI_ERROR (Status)) {
@@ -116,7 +114,6 @@ RamDiskPublishSsdt (
return Status;
}
/**
Publish the RAM disk NVDIMM Firmware Interface Table (NFIT) to the ACPI
table.
@@ -129,29 +126,29 @@ RamDiskPublishSsdt (
**/
EFI_STATUS
RamDiskPublishNfit (
IN RAM_DISK_PRIVATE_DATA *PrivateData
IN RAM_DISK_PRIVATE_DATA *PrivateData
)
{
EFI_STATUS Status;
EFI_MEMORY_DESCRIPTOR *MemoryMap;
EFI_MEMORY_DESCRIPTOR *MemoryMapEntry;
EFI_MEMORY_DESCRIPTOR *MemoryMapEnd;
UINTN TableIndex;
VOID *TableHeader;
EFI_ACPI_TABLE_VERSION TableVersion;
UINTN TableKey;
EFI_ACPI_DESCRIPTION_HEADER *NfitHeader;
EFI_STATUS Status;
EFI_MEMORY_DESCRIPTOR *MemoryMap;
EFI_MEMORY_DESCRIPTOR *MemoryMapEntry;
EFI_MEMORY_DESCRIPTOR *MemoryMapEnd;
UINTN TableIndex;
VOID *TableHeader;
EFI_ACPI_TABLE_VERSION TableVersion;
UINTN TableKey;
EFI_ACPI_DESCRIPTION_HEADER *NfitHeader;
EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE
*SpaRange;
VOID *Nfit;
UINT32 NfitLen;
UINTN MemoryMapSize;
UINTN MapKey;
UINTN DescriptorSize;
UINT32 DescriptorVersion;
UINT64 CurrentData;
UINT8 Checksum;
BOOLEAN MemoryFound;
*SpaRange;
VOID *Nfit;
UINT32 NfitLen;
UINTN MemoryMapSize;
UINTN MapKey;
UINTN DescriptorSize;
UINT32 DescriptorVersion;
UINT64 CurrentData;
UINT8 Checksum;
BOOLEAN MemoryFound;
//
// Get the EFI memory map.
@@ -169,7 +166,7 @@ RamDiskPublishNfit (
);
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
do {
MemoryMap = (EFI_MEMORY_DESCRIPTOR *) AllocatePool (MemoryMapSize);
MemoryMap = (EFI_MEMORY_DESCRIPTOR *)AllocatePool (MemoryMapSize);
ASSERT (MemoryMap != NULL);
Status = gBS->GetMemoryMap (
&MemoryMapSize,
@@ -182,16 +179,18 @@ RamDiskPublishNfit (
FreePool (MemoryMap);
}
} while (Status == EFI_BUFFER_TOO_SMALL);
ASSERT_EFI_ERROR (Status);
MemoryMapEntry = MemoryMap;
MemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) MemoryMap + MemoryMapSize);
while ((UINTN) MemoryMapEntry < (UINTN) MemoryMapEnd) {
MemoryMapEnd = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)MemoryMap + MemoryMapSize);
while ((UINTN)MemoryMapEntry < (UINTN)MemoryMapEnd) {
if ((MemoryMapEntry->Type == EfiReservedMemoryType) &&
(MemoryMapEntry->PhysicalStart <= PrivateData->StartingAddr) &&
(MemoryMapEntry->PhysicalStart +
MultU64x32 (MemoryMapEntry->NumberOfPages, EFI_PAGE_SIZE)
>= PrivateData->StartingAddr + PrivateData->Size)) {
>= PrivateData->StartingAddr + PrivateData->Size))
{
MemoryFound = TRUE;
DEBUG ((
DEBUG_INFO,
@@ -199,8 +198,10 @@ RamDiskPublishNfit (
));
break;
}
MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
}
FreePool (MemoryMap);
if (!MemoryFound) {
@@ -226,7 +227,8 @@ RamDiskPublishNfit (
TableIndex++;
if (((EFI_ACPI_SDT_HEADER *)TableHeader)->Signature ==
EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE_STRUCTURE_SIGNATURE) {
EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE_STRUCTURE_SIGNATURE)
{
break;
}
}
@@ -247,6 +249,7 @@ RamDiskPublishNfit (
if (Nfit == NULL) {
return EFI_OUT_OF_RESOURCES;
}
CopyMem (Nfit, TableHeader, NfitHeader->Length);
//
@@ -272,13 +275,13 @@ RamDiskPublishNfit (
// Append the System Physical Address (SPA) Range Structure at the end
// of the origin NFIT.
//
SpaRange = (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *)
((UINT8 *)Nfit + NfitHeader->Length);
SpaRange = (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *)
((UINT8 *)Nfit + NfitHeader->Length);
//
// Update the length field of the NFIT
//
NfitHeader->Length = NfitLen;
NfitHeader->Length = NfitLen;
//
// The checksum will be updated after the new contents are appended.
@@ -306,7 +309,7 @@ RamDiskPublishNfit (
NfitLen = sizeof (EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE) +
sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE);
Nfit = AllocateZeroPool (NfitLen);
Nfit = AllocateZeroPool (NfitLen);
if (Nfit == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -330,13 +333,13 @@ RamDiskPublishNfit (
//
// Fill in the content of the SPA Range Structure.
//
SpaRange->Type = EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE_TYPE;
SpaRange->Length = sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE);
SpaRange->Type = EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE_TYPE;
SpaRange->Length = sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE);
SpaRange->SystemPhysicalAddressRangeBase = PrivateData->StartingAddr;
SpaRange->SystemPhysicalAddressRangeLength = PrivateData->Size;
CopyGuid (&SpaRange->AddressRangeTypeGUID, &PrivateData->TypeGuid);
Checksum = CalculateCheckSum8((UINT8 *)Nfit, NfitHeader->Length);
Checksum = CalculateCheckSum8 ((UINT8 *)Nfit, NfitHeader->Length);
NfitHeader->Checksum = Checksum;
//
@@ -363,7 +366,6 @@ RamDiskPublishNfit (
return EFI_SUCCESS;
}
/**
Unpublish the RAM disk NVDIMM Firmware Interface Table (NFIT) from the
ACPI table.
@@ -376,23 +378,23 @@ RamDiskPublishNfit (
**/
EFI_STATUS
RamDiskUnpublishNfit (
IN RAM_DISK_PRIVATE_DATA *PrivateData
IN RAM_DISK_PRIVATE_DATA *PrivateData
)
{
EFI_STATUS Status;
UINTN TableIndex;
VOID *TableHeader;
EFI_ACPI_TABLE_VERSION TableVersion;
UINTN TableKey;
EFI_ACPI_DESCRIPTION_HEADER *NewNfitHeader;
EFI_STATUS Status;
UINTN TableIndex;
VOID *TableHeader;
EFI_ACPI_TABLE_VERSION TableVersion;
UINTN TableKey;
EFI_ACPI_DESCRIPTION_HEADER *NewNfitHeader;
EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE
*SpaRange;
VOID *NewNfit;
VOID *NewNfitPtr;
EFI_ACPI_6_1_NFIT_STRUCTURE_HEADER *NfitStructHeader;
UINT32 NewNfitLen;
UINT32 RemainLen;
UINT8 Checksum;
*SpaRange;
VOID *NewNfit;
VOID *NewNfitPtr;
EFI_ACPI_6_1_NFIT_STRUCTURE_HEADER *NfitStructHeader;
UINT32 NewNfitLen;
UINT32 RemainLen;
UINT8 Checksum;
//
// Find the NFIT in the ACPI table.
@@ -413,7 +415,8 @@ RamDiskUnpublishNfit (
TableIndex++;
if (((EFI_ACPI_SDT_HEADER *)TableHeader)->Signature ==
EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE_STRUCTURE_SIGNATURE) {
EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE_STRUCTURE_SIGNATURE)
{
break;
}
}
@@ -426,8 +429,8 @@ RamDiskUnpublishNfit (
return EFI_NOT_FOUND;
}
NewNfitLen = ((EFI_ACPI_DESCRIPTION_HEADER *)TableHeader)->Length -
sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE);
NewNfitLen = ((EFI_ACPI_DESCRIPTION_HEADER *)TableHeader)->Length -
sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE);
//
// After removing this RAM disk from the NFIT, if no other structure is in
@@ -488,12 +491,14 @@ RamDiskUnpublishNfit (
((UINT8 *)TableHeader + sizeof (EFI_ACPI_6_1_NVDIMM_FIRMWARE_INTERFACE_TABLE));
while (RemainLen > 0) {
if ((NfitStructHeader->Type == EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE_TYPE) &&
(NfitStructHeader->Length == sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE))) {
(NfitStructHeader->Length == sizeof (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE)))
{
SpaRange = (EFI_ACPI_6_1_NFIT_SYSTEM_PHYSICAL_ADDRESS_RANGE_STRUCTURE *)NfitStructHeader;
if ((SpaRange->SystemPhysicalAddressRangeBase == PrivateData->StartingAddr) &&
(SpaRange->SystemPhysicalAddressRangeLength == PrivateData->Size) &&
(CompareGuid (&SpaRange->AddressRangeTypeGUID, &PrivateData->TypeGuid))) {
(CompareGuid (&SpaRange->AddressRangeTypeGUID, &PrivateData->TypeGuid)))
{
//
// Skip the SPA Range Structure for the RAM disk to be unpublished
// from NFIT.
@@ -518,7 +523,7 @@ RamDiskUnpublishNfit (
((UINT8 *)NfitStructHeader + NfitStructHeader->Length);
}
Checksum = CalculateCheckSum8((UINT8 *)NewNfit, NewNfitHeader->Length);
Checksum = CalculateCheckSum8 ((UINT8 *)NewNfit, NewNfitHeader->Length);
NewNfitHeader->Checksum = Checksum;
Status = mAcpiTableProtocol->UninstallAcpiTable (
@@ -553,7 +558,6 @@ RamDiskUnpublishNfit (
return EFI_SUCCESS;
}
/**
Register a RAM disk with specified address, size and type.
@@ -587,19 +591,19 @@ RamDiskUnpublishNfit (
EFI_STATUS
EFIAPI
RamDiskRegister (
IN UINT64 RamDiskBase,
IN UINT64 RamDiskSize,
IN EFI_GUID *RamDiskType,
IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
IN UINT64 RamDiskBase,
IN UINT64 RamDiskSize,
IN EFI_GUID *RamDiskType,
IN EFI_DEVICE_PATH *ParentDevicePath OPTIONAL,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
)
{
EFI_STATUS Status;
RAM_DISK_PRIVATE_DATA *PrivateData;
RAM_DISK_PRIVATE_DATA *RegisteredPrivateData;
MEDIA_RAM_DISK_DEVICE_PATH *RamDiskDevNode;
UINTN DevicePathSize;
LIST_ENTRY *Entry;
EFI_STATUS Status;
RAM_DISK_PRIVATE_DATA *PrivateData;
RAM_DISK_PRIVATE_DATA *RegisteredPrivateData;
MEDIA_RAM_DISK_DEVICE_PATH *RamDiskDevNode;
UINTN DevicePathSize;
LIST_ENTRY *Entry;
if ((0 == RamDiskSize) || (NULL == RamDiskType) || (NULL == DevicePath)) {
return EFI_INVALID_PARAMETER;
@@ -609,7 +613,8 @@ RamDiskRegister (
// Add check to prevent data read across the memory boundary
//
if ((RamDiskSize > MAX_UINTN) ||
(RamDiskBase > MAX_UINTN - RamDiskSize + 1)) {
(RamDiskBase > MAX_UINTN - RamDiskSize + 1))
{
return EFI_INVALID_PARAMETER;
}
@@ -647,7 +652,7 @@ RamDiskRegister (
*DevicePath = AppendDevicePathNode (
ParentDevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) RamDiskDevNode
(EFI_DEVICE_PATH_PROTOCOL *)RamDiskDevNode
);
if (NULL == *DevicePath) {
Status = EFI_OUT_OF_RESOURCES;
@@ -660,7 +665,7 @@ RamDiskRegister (
// Check whether the created device path is already present in the handle
// database
//
if (!IsListEmpty(&RegisteredRamDisks)) {
if (!IsListEmpty (&RegisteredRamDisks)) {
DevicePathSize = GetDevicePathSize (PrivateData->DevicePath);
BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
@@ -672,7 +677,9 @@ RamDiskRegister (
if ((CompareMem (
PrivateData->DevicePath,
RegisteredPrivateData->DevicePath,
DevicePathSize)) == 0) {
DevicePathSize
)) == 0)
{
*DevicePath = NULL;
Status = EFI_ALREADY_STARTED;
goto ErrorExit;
@@ -735,7 +742,6 @@ ErrorExit:
return Status;
}
/**
Unregister a RAM disk specified by DevicePath.
@@ -754,17 +760,17 @@ ErrorExit:
EFI_STATUS
EFIAPI
RamDiskUnregister (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
BOOLEAN Found;
UINT64 StartingAddr;
UINT64 EndingAddr;
EFI_DEVICE_PATH_PROTOCOL *Header;
MEDIA_RAM_DISK_DEVICE_PATH *RamDiskDevNode;
RAM_DISK_PRIVATE_DATA *PrivateData;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
BOOLEAN Found;
UINT64 StartingAddr;
UINT64 EndingAddr;
EFI_DEVICE_PATH_PROTOCOL *Header;
MEDIA_RAM_DISK_DEVICE_PATH *RamDiskDevNode;
RAM_DISK_PRIVATE_DATA *PrivateData;
if (NULL == DevicePath) {
return EFI_INVALID_PARAMETER;
@@ -780,8 +786,9 @@ RamDiskUnregister (
// Test if the current device node is a RAM disk.
//
if ((MEDIA_DEVICE_PATH == Header->Type) &&
(MEDIA_RAM_DISK_DP == Header->SubType)) {
RamDiskDevNode = (MEDIA_RAM_DISK_DEVICE_PATH *) Header;
(MEDIA_RAM_DISK_DP == Header->SubType))
{
RamDiskDevNode = (MEDIA_RAM_DISK_DEVICE_PATH *)Header;
break;
}
@@ -793,11 +800,11 @@ RamDiskUnregister (
return EFI_UNSUPPORTED;
}
Found = FALSE;
StartingAddr = ReadUnaligned64 ((UINT64 *) &(RamDiskDevNode->StartingAddr[0]));
EndingAddr = ReadUnaligned64 ((UINT64 *) &(RamDiskDevNode->EndingAddr[0]));
Found = FALSE;
StartingAddr = ReadUnaligned64 ((UINT64 *)&(RamDiskDevNode->StartingAddr[0]));
EndingAddr = ReadUnaligned64 ((UINT64 *)&(RamDiskDevNode->EndingAddr[0]));
if (!IsListEmpty(&RegisteredRamDisks)) {
if (!IsListEmpty (&RegisteredRamDisks)) {
BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
@@ -807,7 +814,8 @@ RamDiskUnregister (
//
if ((StartingAddr == PrivateData->StartingAddr) &&
(EndingAddr == PrivateData->StartingAddr + PrivateData->Size - 1) &&
(CompareGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid))) {
(CompareGuid (&RamDiskDevNode->TypeGuid, &PrivateData->TypeGuid)))
{
//
// Remove the content for this RAM disk in NFIT.
//
@@ -825,7 +833,7 @@ RamDiskUnregister (
&gEfiBlockIo2ProtocolGuid,
&PrivateData->BlockIo2,
&gEfiDevicePathProtocolGuid,
(EFI_DEVICE_PATH_PROTOCOL *) PrivateData->DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *)PrivateData->DevicePath,
NULL
);
@@ -837,7 +845,7 @@ RamDiskUnregister (
// driver is responsible for freeing the allocated memory for the
// RAM disk.
//
FreePool ((VOID *)(UINTN) PrivateData->StartingAddr);
FreePool ((VOID *)(UINTN)PrivateData->StartingAddr);
}
FreePool (PrivateData->DevicePath);

View File

@@ -20,9 +20,9 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gUdfComponentName = {
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdfComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) UdfComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) UdfComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdfComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)UdfComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)UdfComponentNameGetControllerName,
"en"
};
@@ -30,7 +30,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gUdfComponentName2 =
// Driver name table for Udf module.
// It is shared by the implementation of ComponentName & ComponentName2 Protocol.
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdfDriverNameTable[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mUdfDriverNameTable[] = {
{
"eng;en",
L"UDF File System Driver"
@@ -89,12 +89,12 @@ UdfComponentNameGetDriverName (
)
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mUdfDriverNameTable,
DriverName,
(BOOLEAN)(This == &gUdfComponentName)
);
Language,
This->SupportedLanguages,
mUdfDriverNameTable,
DriverName,
(BOOLEAN)(This == &gUdfComponentName)
);
}
/**

View File

@@ -9,7 +9,7 @@
#include "Udf.h"
EFI_FILE_PROTOCOL gUdfFileIoOps = {
EFI_FILE_PROTOCOL gUdfFileIoOps = {
EFI_FILE_PROTOCOL_REVISION,
UdfOpen,
UdfClose,
@@ -27,10 +27,10 @@ EFI_FILE_PROTOCOL gUdfFileIoOps = {
NULL
};
#define _ROOT_FILE(_PrivData) (_PrivData)->Root
#define _ROOT_FILE(_PrivData) (_PrivData)->Root
#define _PARENT_FILE(_PrivData) \
((_PrivData)->IsRootDirectory ? (_PrivData)->Root : &(_PrivData)->File)
#define _FILE(_PrivData) _PARENT_FILE(_PrivData)
#define _FILE(_PrivData) _PARENT_FILE(_PrivData)
/**
Open the root directory on a volume.
@@ -62,7 +62,7 @@ UdfOpenVolume (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (This == NULL || Root == NULL) {
if ((This == NULL) || (Root == NULL)) {
Status = EFI_INVALID_PARAMETER;
goto Error_Invalid_Params;
}
@@ -75,10 +75,10 @@ UdfOpenVolume (
// cleaned up on the last UdfClose() call.
//
Status = ReadUdfVolumeInformation (
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume
);
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume
);
if (EFI_ERROR (Status)) {
goto Error_Read_Udf_Volume;
}
@@ -90,29 +90,32 @@ UdfOpenVolume (
// Find root directory file.
//
Status = FindRootDirectory (
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
&PrivFsData->Root
);
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
&PrivFsData->Root
);
if (EFI_ERROR (Status)) {
goto Error_Find_Root_Dir;
}
PrivFileData =
(PRIVATE_UDF_FILE_DATA *) AllocateZeroPool (sizeof (PRIVATE_UDF_FILE_DATA));
(PRIVATE_UDF_FILE_DATA *)AllocateZeroPool (sizeof (PRIVATE_UDF_FILE_DATA));
if (PrivFileData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Error_Alloc_Priv_File_Data;
}
PrivFileData->Signature = PRIVATE_UDF_FILE_DATA_SIGNATURE;
PrivFileData->SimpleFs = This;
PrivFileData->Root = &PrivFsData->Root;
PrivFileData->IsRootDirectory = TRUE;
PrivFileData->Signature = PRIVATE_UDF_FILE_DATA_SIGNATURE;
PrivFileData->SimpleFs = This;
PrivFileData->Root = &PrivFsData->Root;
PrivFileData->IsRootDirectory = TRUE;
CopyMem ((VOID *)&PrivFileData->FileIo, (VOID *)&gUdfFileIoOps,
sizeof (EFI_FILE_PROTOCOL));
CopyMem (
(VOID *)&PrivFileData->FileIo,
(VOID *)&gUdfFileIoOps,
sizeof (EFI_FILE_PROTOCOL)
);
*Root = &PrivFileData->FileIo;
@@ -178,7 +181,7 @@ UdfOpen (
ZeroMem (FilePath, sizeof FilePath);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (This == NULL || NewHandle == NULL || FileName == NULL) {
if ((This == NULL) || (NewHandle == NULL) || (FileName == NULL)) {
Status = EFI_INVALID_PARAMETER;
goto Error_Invalid_Params;
}
@@ -210,15 +213,15 @@ UdfOpen (
}
Status = FindFile (
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
FilePath,
_ROOT_FILE (PrivFileData),
_PARENT_FILE (PrivFileData),
&_PARENT_FILE(PrivFileData)->FileIdentifierDesc->Icb,
&File
);
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
FilePath,
_ROOT_FILE (PrivFileData),
_PARENT_FILE (PrivFileData),
&_PARENT_FILE (PrivFileData)->FileIdentifierDesc->Icb,
&File
);
if (EFI_ERROR (Status)) {
goto Error_Find_File;
}
@@ -230,8 +233,11 @@ UdfOpen (
goto Error_Alloc_New_Priv_File_Data;
}
CopyMem ((VOID *)NewPrivFileData, (VOID *)PrivFileData,
sizeof (PRIVATE_UDF_FILE_DATA));
CopyMem (
(VOID *)NewPrivFileData,
(VOID *)PrivFileData,
sizeof (PRIVATE_UDF_FILE_DATA)
);
CopyMem ((VOID *)&NewPrivFileData->File, &File, sizeof (UDF_FILE_INFO));
NewPrivFileData->IsRootDirectory = FALSE;
@@ -246,24 +252,27 @@ UdfOpen (
StrCpyS (NewPrivFileData->FileName, UDF_FILENAME_LENGTH, FileName);
Status = GetFileSize (
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
&NewPrivFileData->File,
&NewPrivFileData->FileSize
);
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
&NewPrivFileData->File,
&NewPrivFileData->FileSize
);
if (EFI_ERROR (Status)) {
DEBUG ((
DEBUG_ERROR,
"%a: GetFileSize() fails with status - %r.\n",
__FUNCTION__, Status
__FUNCTION__,
Status
));
goto Error_Get_File_Size;
}
NewPrivFileData->FilePosition = 0;
ZeroMem ((VOID *)&NewPrivFileData->ReadDirInfo,
sizeof (UDF_READ_DIRECTORY_INFO));
ZeroMem (
(VOID *)&NewPrivFileData->ReadDirInfo,
sizeof (UDF_READ_DIRECTORY_INFO)
);
*NewHandle = &NewPrivFileData->FileIo;
@@ -330,21 +339,22 @@ UdfRead (
ZeroMem (FileName, sizeof FileName);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
if (This == NULL || BufferSize == NULL || (*BufferSize != 0 &&
Buffer == NULL)) {
if ((This == NULL) || (BufferSize == NULL) || ((*BufferSize != 0) &&
(Buffer == NULL)))
{
Status = EFI_INVALID_PARAMETER;
goto Error_Invalid_Params;
}
PrivFileData = PRIVATE_UDF_FILE_DATA_FROM_THIS (This);
PrivFsData = PRIVATE_UDF_SIMPLE_FS_DATA_FROM_THIS (PrivFileData->SimpleFs);
PrivFsData = PRIVATE_UDF_SIMPLE_FS_DATA_FROM_THIS (PrivFileData->SimpleFs);
BlockIo = PrivFsData->BlockIo;
DiskIo = PrivFsData->DiskIo;
Volume = &PrivFsData->Volume;
ReadDirInfo = &PrivFileData->ReadDirInfo;
NewFileIdentifierDesc = NULL;
NewFileEntryData = NULL;
BlockIo = PrivFsData->BlockIo;
DiskIo = PrivFsData->DiskIo;
Volume = &PrivFsData->Volume;
ReadDirInfo = &PrivFileData->ReadDirInfo;
NewFileIdentifierDesc = NULL;
NewFileEntryData = NULL;
Parent = _PARENT_FILE (PrivFileData);
@@ -361,52 +371,53 @@ UdfRead (
if (PrivFileData->FilePosition == PrivFileData->FileSize) {
*BufferSize = 0;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
goto Done;
}
BufferSizeUint64 = *BufferSize;
Status = ReadFileData (
BlockIo,
DiskIo,
Volume,
Parent,
PrivFileData->FileSize,
&PrivFileData->FilePosition,
Buffer,
&BufferSizeUint64
);
BlockIo,
DiskIo,
Volume,
Parent,
PrivFileData->FileSize,
&PrivFileData->FilePosition,
Buffer,
&BufferSizeUint64
);
ASSERT (BufferSizeUint64 <= MAX_UINTN);
*BufferSize = (UINTN)BufferSizeUint64;
} else if (IS_FID_DIRECTORY_FILE (Parent->FileIdentifierDesc)) {
if (ReadDirInfo->FidOffset == 0 && PrivFileData->FilePosition > 0) {
Status = EFI_DEVICE_ERROR;
if ((ReadDirInfo->FidOffset == 0) && (PrivFileData->FilePosition > 0)) {
Status = EFI_DEVICE_ERROR;
*BufferSize = 0;
goto Done;
}
for (;;) {
for ( ; ;) {
Status = ReadDirectoryEntry (
BlockIo,
DiskIo,
Volume,
&Parent->FileIdentifierDesc->Icb,
Parent->FileEntry,
ReadDirInfo,
&NewFileIdentifierDesc
);
BlockIo,
DiskIo,
Volume,
&Parent->FileIdentifierDesc->Icb,
Parent->FileEntry,
ReadDirInfo,
&NewFileIdentifierDesc
);
if (EFI_ERROR (Status)) {
if (Status == EFI_DEVICE_ERROR) {
FreePool (ReadDirInfo->DirectoryData);
ZeroMem ((VOID *)ReadDirInfo, sizeof (UDF_READ_DIRECTORY_INFO));
*BufferSize = 0;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
}
goto Done;
}
//
// After calling function ReadDirectoryEntry(), if 'NewFileIdentifierDesc'
// is NULL, then the 'Status' must be EFI_OUT_OF_RESOURCES. Hence, if the
@@ -425,26 +436,27 @@ UdfRead (
}
Status = FindFileEntry (
BlockIo,
DiskIo,
Volume,
&NewFileIdentifierDesc->Icb,
&NewFileEntryData
);
BlockIo,
DiskIo,
Volume,
&NewFileIdentifierDesc->Icb,
&NewFileEntryData
);
if (EFI_ERROR (Status)) {
goto Error_Find_Fe;
}
ASSERT (NewFileEntryData != NULL);
if (FE_ICB_FILE_TYPE (NewFileEntryData) == UdfFileEntrySymlink) {
Status = ResolveSymlink (
BlockIo,
DiskIo,
Volume,
Parent,
NewFileEntryData,
&FoundFile
);
BlockIo,
DiskIo,
Volume,
Parent,
NewFileEntryData,
&FoundFile
);
if (EFI_ERROR (Status)) {
goto Error_Resolve_Symlink;
}
@@ -461,8 +473,8 @@ UdfRead (
FreePool ((VOID *)NewFileIdentifierDesc);
NewFileIdentifierDesc = FoundFile.FileIdentifierDesc;
} else {
FoundFile.FileIdentifierDesc = NewFileIdentifierDesc;
FoundFile.FileEntry = NewFileEntryData;
FoundFile.FileIdentifierDesc = NewFileIdentifierDesc;
FoundFile.FileEntry = NewFileEntryData;
Status = GetFileNameFromFid (FoundFile.FileIdentifierDesc, ARRAY_SIZE (FileName), FileName);
if (EFI_ERROR (Status)) {
@@ -471,23 +483,23 @@ UdfRead (
}
Status = GetFileSize (
BlockIo,
DiskIo,
Volume,
&FoundFile,
&FileSize
);
BlockIo,
DiskIo,
Volume,
&FoundFile,
&FileSize
);
if (EFI_ERROR (Status)) {
goto Error_Get_File_Size;
}
Status = SetFileInfo (
&FoundFile,
FileSize,
FileName,
BufferSize,
Buffer
);
&FoundFile,
FileSize,
FileName,
BufferSize,
Buffer
);
if (EFI_ERROR (Status)) {
goto Error_Set_File_Info;
}
@@ -534,12 +546,12 @@ Error_Invalid_Params:
EFI_STATUS
EFIAPI
UdfClose (
IN EFI_FILE_PROTOCOL *This
IN EFI_FILE_PROTOCOL *This
)
{
EFI_TPL OldTpl;
EFI_STATUS Status;
PRIVATE_UDF_FILE_DATA *PrivFileData;
EFI_TPL OldTpl;
EFI_STATUS Status;
PRIVATE_UDF_FILE_DATA *PrivFileData;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
@@ -584,7 +596,7 @@ UdfDelete (
IN EFI_FILE_PROTOCOL *This
)
{
PRIVATE_UDF_FILE_DATA *PrivFileData;
PRIVATE_UDF_FILE_DATA *PrivFileData;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
@@ -592,7 +604,7 @@ UdfDelete (
PrivFileData = PRIVATE_UDF_FILE_DATA_FROM_THIS (This);
(VOID)PrivFileData->FileIo.Close(This);
(VOID)PrivFileData->FileIo.Close (This);
return EFI_WARN_DELETE_FAILURE;
}
@@ -644,9 +656,9 @@ UdfGetPosition (
OUT UINT64 *Position
)
{
PRIVATE_UDF_FILE_DATA *PrivFileData;
PRIVATE_UDF_FILE_DATA *PrivFileData;
if (This == NULL || Position == NULL) {
if ((This == NULL) || (Position == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -657,7 +669,7 @@ UdfGetPosition (
// position has no meaning and the operation is not supported.
//
if (IS_FID_DIRECTORY_FILE (PrivFileData->File.FileIdentifierDesc)) {
return EFI_UNSUPPORTED;
return EFI_UNSUPPORTED;
}
//
@@ -706,9 +718,9 @@ UdfSetPosition (
// entries over.
//
if (Position == 0) {
PrivFileData->FilePosition = Position;
PrivFileData->FilePosition = Position;
PrivFileData->ReadDirInfo.FidOffset = 0;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
}
} else if (IS_FID_NORMAL_FILE (FileIdentifierDesc)) {
//
@@ -767,8 +779,9 @@ UdfGetInfo (
UINTN FileSystemVolumeLabelLength;
CHAR16 VolumeLabel[64];
if (This == NULL || InformationType == NULL || BufferSize == NULL ||
(*BufferSize != 0 && Buffer == NULL)) {
if ((This == NULL) || (InformationType == NULL) || (BufferSize == NULL) ||
((*BufferSize != 0) && (Buffer == NULL)))
{
return EFI_INVALID_PARAMETER;
}
@@ -780,12 +793,12 @@ UdfGetInfo (
if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {
Status = SetFileInfo (
_FILE (PrivFileData),
PrivFileData->FileSize,
PrivFileData->FileName,
BufferSize,
Buffer
);
_FILE (PrivFileData),
PrivFileData->FileSize,
PrivFileData->FileName,
BufferSize,
Buffer
);
} else if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
Status = GetVolumeLabel (&PrivFsData->Volume, ARRAY_SIZE (VolumeLabel), VolumeLabel);
if (EFI_ERROR (Status)) {
@@ -806,25 +819,25 @@ UdfGetInfo (
VolumeLabel
);
Status = GetVolumeSize (
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
&VolumeSize,
&FreeSpaceSize
);
PrivFsData->BlockIo,
PrivFsData->DiskIo,
&PrivFsData->Volume,
&VolumeSize,
&FreeSpaceSize
);
if (EFI_ERROR (Status)) {
return Status;
}
FileSystemInfo->Size = FileSystemInfoLength;
FileSystemInfo->ReadOnly = TRUE;
FileSystemInfo->BlockSize =
FileSystemInfo->Size = FileSystemInfoLength;
FileSystemInfo->ReadOnly = TRUE;
FileSystemInfo->BlockSize =
PrivFsData->Volume.LogicalVolDesc.LogicalBlockSize;
FileSystemInfo->VolumeSize = VolumeSize;
FileSystemInfo->FreeSpace = FreeSpaceSize;
FileSystemInfo->VolumeSize = VolumeSize;
FileSystemInfo->FreeSpace = FreeSpaceSize;
*BufferSize = FileSystemInfoLength;
Status = EFI_SUCCESS;
Status = EFI_SUCCESS;
} else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
Status = GetVolumeLabel (&PrivFsData->Volume, ARRAY_SIZE (VolumeLabel), VolumeLabel);
if (EFI_ERROR (Status)) {
@@ -897,7 +910,7 @@ UdfSetInfo (
EFI_STATUS
EFIAPI
UdfFlush (
IN EFI_FILE_PROTOCOL *This
IN EFI_FILE_PROTOCOL *This
)
{
return EFI_WRITE_PROTECTED;

Some files were not shown because too many files have changed in this diff Show More