EmulatorPkg: Apply uncrustify changes

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

Apply uncrustify changes to .c/.h files in the EmulatorPkg 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: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:53:57 -08:00
committed by mergify[bot]
parent e7108d0e96
commit a550d468a6
111 changed files with 6170 additions and 6345 deletions

View File

@@ -16,6 +16,7 @@ Abstract:
//
// EFI Component Name Functions
//
/**
Retrieves a Unicode string that is the user readable name of the driver.
@@ -63,7 +64,6 @@ EmuBlockIoComponentNameGetDriverName (
OUT CHAR16 **DriverName
);
/**
Retrieves a Unicode string that is the user readable name of the controller
that is being managed by a driver.
@@ -135,17 +135,17 @@ EmuBlockIoComponentNameGetDriverName (
EFI_STATUS
EFIAPI
EmuBlockIoComponentNameGetControllerName (
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 Component Name Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmuBlockIoComponentName = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmuBlockIoComponentName = {
EmuBlockIoComponentNameGetDriverName,
EmuBlockIoComponentNameGetControllerName,
"eng"
@@ -154,16 +154,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gEmuBlockIoCompon
//
// EFI Component Name 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) EmuBlockIoComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) EmuBlockIoComponentNameGetControllerName,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gEmuBlockIoComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)EmuBlockIoComponentNameGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)EmuBlockIoComponentNameGetControllerName,
"en"
};
EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
EFI_UNICODE_STRING_TABLE mEmuBlockIoDriverNameTable[] = {
{ "eng;en", L"Emu Block I/O Driver" },
{ NULL , NULL }
{ NULL, NULL }
};
/**
@@ -214,12 +213,12 @@ EmuBlockIoComponentNameGetDriverName (
)
{
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mEmuBlockIoDriverNameTable,
DriverName,
Language,
This->SupportedLanguages,
mEmuBlockIoDriverNameTable,
DriverName,
(BOOLEAN)(This == &gEmuBlockIoComponentName)
);
);
}
/**
@@ -293,16 +292,16 @@ EmuBlockIoComponentNameGetDriverName (
EFI_STATUS
EFIAPI
EmuBlockIoComponentNameGetControllerName (
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_BLOCK_IO_PROTOCOL *BlockIo;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EMU_BLOCK_IO_PRIVATE *Private;
//
// This is a device driver, so ChildHandle must be NULL.
@@ -310,6 +309,7 @@ EmuBlockIoComponentNameGetControllerName (
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
}
//
// Make sure this driver is currently managing ControllerHandle
//
@@ -321,6 +321,7 @@ EmuBlockIoComponentNameGetControllerName (
if (EFI_ERROR (Status)) {
return EFI_UNSUPPORTED;
}
//
// Get our context back
//
@@ -339,10 +340,10 @@ EmuBlockIoComponentNameGetControllerName (
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (BlockIo);
return LookupUnicodeString2 (
Language,
Language,
This->SupportedLanguages,
Private->ControllerNameTable,
ControllerName,
(BOOLEAN)(This == &gEmuBlockIoComponentName)
);
);
}

View File

@@ -19,35 +19,35 @@ Abstract:
EFI_STATUS
EFIAPI
EmuBlockIoDriverConfigurationSetOptions (
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
);
EFI_STATUS
EFIAPI
EmuBlockIoDriverConfigurationOptionsValid (
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL
);
EFI_STATUS
EFIAPI
EmuBlockIoDriverConfigurationForceDefaults (
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN UINT32 DefaultType,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN UINT32 DefaultType,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
);
//
// EFI Driver Configuration Protocol
//
EFI_DRIVER_CONFIGURATION_PROTOCOL gEmuBlockIoDriverConfiguration = {
EFI_DRIVER_CONFIGURATION_PROTOCOL gEmuBlockIoDriverConfiguration = {
EmuBlockIoDriverConfigurationSetOptions,
EmuBlockIoDriverConfigurationOptionsValid,
EmuBlockIoDriverConfigurationForceDefaults,
@@ -103,20 +103,20 @@ EFI_DRIVER_CONFIGURATION_PROTOCOL gEmuBlockIoDriverConfiguration = {
EFI_STATUS
EFIAPI
EmuBlockIoDriverConfigurationSetOptions (
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN CHAR8 *Language,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
)
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
CHAR8 *SupportedLanguage;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
CHAR8 *SupportedLanguage;
SupportedLanguage = This->SupportedLanguages;
Status = EFI_UNSUPPORTED;
Status = EFI_UNSUPPORTED;
while (*SupportedLanguage != 0) {
if (AsciiStrnCmp (Language, SupportedLanguage, 3) == 0) {
Status = EFI_SUCCESS;
@@ -129,7 +129,7 @@ EmuBlockIoDriverConfigurationSetOptions (
return Status;
}
if (ActionRequired == NULL || ControllerHandle == NULL) {
if ((ActionRequired == NULL) || (ControllerHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -151,11 +151,11 @@ EmuBlockIoDriverConfigurationSetOptions (
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
return EFI_UNSUPPORTED;
}
@@ -206,13 +206,13 @@ EmuBlockIoDriverConfigurationSetOptions (
EFI_STATUS
EFIAPI
EmuBlockIoDriverConfigurationOptionsValid (
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL
)
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
@@ -236,11 +236,11 @@ EmuBlockIoDriverConfigurationOptionsValid (
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
return EFI_UNSUPPORTED;
}
@@ -280,21 +280,21 @@ EmuBlockIoDriverConfigurationOptionsValid (
EFI_STATUS
EFIAPI
EmuBlockIoDriverConfigurationForceDefaults (
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN UINT32 DefaultType,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN UINT32 DefaultType,
OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired
)
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
if (ChildHandle != NULL) {
return EFI_UNSUPPORTED;
}
if (ActionRequired == NULL || ControllerHandle == NULL) {
if ((ActionRequired == NULL) || (ControllerHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -312,11 +312,11 @@ EmuBlockIoDriverConfigurationForceDefaults (
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
return EFI_UNSUPPORTED;
}

View File

@@ -19,20 +19,20 @@ Abstract:
EFI_STATUS
EFIAPI
EmuBlockIoDriverDiagnosticsRunDiagnostics (
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
IN CHAR8 *Language,
OUT EFI_GUID **ErrorType,
OUT UINTN *BufferSize,
OUT CHAR16 **Buffer
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
IN CHAR8 *Language,
OUT EFI_GUID **ErrorType,
OUT UINTN *BufferSize,
OUT CHAR16 **Buffer
);
//
// EFI Driver Diagnostics Protocol
//
EFI_DRIVER_DIAGNOSTICS_PROTOCOL gEmuBlockIoDriverDiagnostics = {
EFI_DRIVER_DIAGNOSTICS_PROTOCOL gEmuBlockIoDriverDiagnostics = {
EmuBlockIoDriverDiagnosticsRunDiagnostics,
"eng"
};
@@ -40,23 +40,24 @@ EFI_DRIVER_DIAGNOSTICS_PROTOCOL gEmuBlockIoDriverDiagnostics = {
//
// EFI Driver Diagnostics 2 Protocol
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gEmuBlockIoDriverDiagnostics2 = {
(EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS) EmuBlockIoDriverDiagnosticsRunDiagnostics,
GLOBAL_REMOVE_IF_UNREFERENCED EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gEmuBlockIoDriverDiagnostics2 = {
(EFI_DRIVER_DIAGNOSTICS2_RUN_DIAGNOSTICS)EmuBlockIoDriverDiagnosticsRunDiagnostics,
"en"
};
EFI_STATUS
EFIAPI
EmuBlockIoDriverDiagnosticsRunDiagnostics (
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
IN CHAR8 *Language,
OUT EFI_GUID **ErrorType,
OUT UINTN *BufferSize,
OUT CHAR16 **Buffer
IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_HANDLE ChildHandle OPTIONAL,
IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,
IN CHAR8 *Language,
OUT EFI_GUID **ErrorType,
OUT UINTN *BufferSize,
OUT CHAR16 **Buffer
)
/*++
Routine Description:
@@ -117,24 +118,24 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
--*/
{
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
CHAR8 *SupportedLanguages;
BOOLEAN Iso639Language;
BOOLEAN Found;
UINTN Index;
if (Language == NULL ||
ErrorType == NULL ||
Buffer == NULL ||
ControllerHandle == NULL ||
BufferSize == NULL) {
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
CHAR8 *SupportedLanguages;
BOOLEAN Iso639Language;
BOOLEAN Found;
UINTN Index;
if ((Language == NULL) ||
(ErrorType == NULL) ||
(Buffer == NULL) ||
(ControllerHandle == NULL) ||
(BufferSize == NULL))
{
return EFI_INVALID_PARAMETER;
}
SupportedLanguages = This->SupportedLanguages;
Iso639Language = (BOOLEAN)(This == &gEmuBlockIoDriverDiagnostics);
Iso639Language = (BOOLEAN)(This == &gEmuBlockIoDriverDiagnostics);
//
// Make sure Language is in the set of Supported Languages
//
@@ -143,19 +144,25 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
if (Iso639Language) {
if (CompareMem (Language, SupportedLanguages, 3) == 0) {
Found = TRUE;
break;
}
break;
}
SupportedLanguages += 3;
} else {
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);
if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++) {
}
if ((AsciiStrnCmp (SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {
Found = TRUE;
break;
}
}
SupportedLanguages += Index;
for (; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++);
for ( ; *SupportedLanguages != 0 && *SupportedLanguages == ';'; SupportedLanguages++) {
}
}
}
//
// If Language is not a member of SupportedLanguages, then return EFI_UNSUPPORTED
//
@@ -168,7 +175,7 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {
*ErrorType = &gEfiBlockIoProtocolGuid;
*BufferSize = 0x60;
Buffer = AllocatePool ((UINTN) (*BufferSize));
Buffer = AllocatePool ((UINTN)(*BufferSize));
CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);
return EFI_DEVICE_ERROR;
}
@@ -194,11 +201,11 @@ EmuBlockIoDriverDiagnosticsRunDiagnostics (
if (!EFI_ERROR (Status)) {
gBS->CloseProtocol (
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
ControllerHandle,
&gEmuIoThunkProtocolGuid,
gEmuBlockIoDriverBinding.DriverBindingHandle,
ControllerHandle
);
return EFI_UNSUPPORTED;
}

View File

@@ -7,7 +7,6 @@ bbe
#include "EmuBlockIo.h"
/**
Reset the block device hardware.
@@ -28,9 +27,9 @@ EmuBlockIo2Reset (
IN BOOLEAN ExtendedVerification
)
{
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
@@ -78,17 +77,17 @@ EmuBlockIo2Reset (
EFI_STATUS
EFIAPI
EmuBlockIo2ReadBlocksEx (
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;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
@@ -100,7 +99,6 @@ EmuBlockIo2ReadBlocksEx (
return Status;
}
/**
Write BufferSize bytes from Lba into Buffer.
@@ -136,16 +134,16 @@ EFI_STATUS
EFIAPI
EmuBlockIo2WriteBlocksEx (
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 UINT32 MediaId,
IN EFI_LBA LBA,
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
IN UINTN BufferSize,
IN VOID *Buffer
)
{
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
@@ -157,8 +155,6 @@ EmuBlockIo2WriteBlocksEx (
return Status;
}
/**
Flush the Block Device.
@@ -184,13 +180,13 @@ EmuBlockIo2WriteBlocksEx (
EFI_STATUS
EFIAPI
EmuBlockIo2Flush (
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;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
Private = EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS (This);
@@ -202,8 +198,6 @@ EmuBlockIo2Flush (
return Status;
}
/**
Reset the Block Device.
@@ -218,13 +212,13 @@ EmuBlockIo2Flush (
EFI_STATUS
EFIAPI
EmuBlockIoReset (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
)
{
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
@@ -236,7 +230,6 @@ EmuBlockIoReset (
return Status;
}
/**
Read BufferSize bytes from Lba into Buffer.
@@ -259,30 +252,29 @@ EmuBlockIoReset (
EFI_STATUS
EFIAPI
EmuBlockIoReadBlocks (
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
)
{
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_BLOCK_IO2_TOKEN Token;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_BLOCK_IO2_TOKEN Token;
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Token.Event = NULL;
Status = Private->Io->ReadBlocks (Private->Io, MediaId, Lba, &Token, BufferSize, Buffer);
Status = Private->Io->ReadBlocks (Private->Io, MediaId, Lba, &Token, BufferSize, Buffer);
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Write BufferSize bytes from Lba into Buffer.
@@ -306,24 +298,24 @@ EmuBlockIoReadBlocks (
EFI_STATUS
EFIAPI
EmuBlockIoWriteBlocks (
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
)
{
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_BLOCK_IO2_TOKEN Token;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_BLOCK_IO2_TOKEN Token;
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Token.Event = NULL;
Status = Private->Io->WriteBlocks (Private->Io, MediaId, Lba, &Token, BufferSize, Buffer);
Status = Private->Io->WriteBlocks (Private->Io, MediaId, Lba, &Token, BufferSize, Buffer);
gBS->RestoreTPL (OldTpl);
return Status;
@@ -345,24 +337,22 @@ EmuBlockIoFlushBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This
)
{
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_BLOCK_IO2_TOKEN Token;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_TPL OldTpl;
EFI_BLOCK_IO2_TOKEN Token;
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Token.Event = NULL;
Status = Private->Io->FlushBlocks (Private->Io, &Token);
Status = Private->Io->FlushBlocks (Private->Io, &Token);
gBS->RestoreTPL (OldTpl);
return Status;
}
/**
Tests to see if this driver supports a given controller. If a child device is provided,
it further tests to see if this driver supports creating a handle for the specified child device.
@@ -413,8 +403,8 @@ EmuBlockIoDriverBindingSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
EFI_STATUS Status;
EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
//
// Open the IO Abstraction(s) needed to perform the supported test
@@ -443,15 +433,14 @@ EmuBlockIoDriverBindingSupported (
// Close the I/O Abstraction(s) used to perform the supported test
//
gBS->CloseProtocol (
Handle,
&gEmuIoThunkProtocolGuid,
This->DriverBindingHandle,
Handle
);
Handle,
&gEmuIoThunkProtocolGuid,
This->DriverBindingHandle,
Handle
);
return Status;
}
/**
Starts a device controller or a bus controller.
@@ -490,14 +479,14 @@ EmuBlockIoDriverBindingSupported (
EFI_STATUS
EFIAPI
EmuBlockIoDriverBindingStart (
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
)
{
EFI_STATUS Status;
EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
EMU_BLOCK_IO_PRIVATE *Private = NULL;
EFI_STATUS Status;
EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
EMU_BLOCK_IO_PRIVATE *Private = NULL;
//
// Grab the protocols we need
@@ -573,8 +562,10 @@ EmuBlockIoDriverBindingStart (
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiBlockIoProtocolGuid, &Private->BlockIo,
&gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
&gEfiBlockIoProtocolGuid,
&Private->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Private->BlockIo2,
NULL
);
@@ -586,21 +577,19 @@ Done:
}
gBS->FreePool (Private);
}
gBS->CloseProtocol (
Handle,
&gEmuIoThunkProtocolGuid,
This->DriverBindingHandle,
Handle
);
Handle,
&gEmuIoThunkProtocolGuid,
This->DriverBindingHandle,
Handle
);
}
return Status;
}
/**
Stops a device controller or a bus controller.
@@ -636,9 +625,9 @@ EmuBlockIoDriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_STATUS Status;
EMU_BLOCK_IO_PRIVATE *Private;
//
// Get our context back
@@ -659,8 +648,10 @@ EmuBlockIoDriverBindingStop (
Status = gBS->UninstallMultipleProtocolInterfaces (
Private->EfiHandle,
&gEfiBlockIoProtocolGuid, &Private->BlockIo,
&gEfiBlockIo2ProtocolGuid, &Private->BlockIo2,
&gEfiBlockIoProtocolGuid,
&Private->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Private->BlockIo2,
NULL
);
if (!EFI_ERROR (Status)) {
@@ -686,11 +677,7 @@ EmuBlockIoDriverBindingStop (
return Status;
}
EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
EmuBlockIoDriverBindingSupported,
EmuBlockIoDriverBindingStart,
EmuBlockIoDriverBindingStop,
@@ -699,9 +686,6 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
NULL
};
/**
The user Entry Point for module EmuBlockIo . The user code starts with this function.
@@ -715,11 +699,11 @@ EFI_DRIVER_BINDING_PROTOCOL gEmuBlockIoDriverBinding = {
EFI_STATUS
EFIAPI
InitializeEmuBlockIo (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = EfiLibInstallAllDriverProtocols2 (
ImageHandle,
@@ -735,9 +719,5 @@ InitializeEmuBlockIo (
);
ASSERT_EFI_ERROR (Status);
return Status;
}

View File

@@ -38,12 +38,11 @@ Abstract:
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
//
// Language supported for driverconfiguration protocol
//
#define EMU_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'b', 'k')
#define EMU_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'b', 'k')
typedef struct {
UINTN Signature;
EMU_IO_THUNK_PROTOCOL *IoThunk;
@@ -55,7 +54,6 @@ typedef struct {
EFI_BLOCK_IO_MEDIA Media;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
} EMU_BLOCK_IO_PRIVATE;
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
@@ -64,7 +62,6 @@ typedef struct {
#define EMU_BLOCK_IO2_PRIVATE_DATA_FROM_THIS(a) \
CR(a, EMU_BLOCK_IO_PRIVATE, BlockIo2, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
//
// Block I/O Global Variables
//