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:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user