\r
#include "BlockFront.h"\r
\r
-\r
///\r
/// Driver Binding Protocol instance\r
///\r
-EFI_DRIVER_BINDING_PROTOCOL gXenPvBlkDxeDriverBinding = {\r
+EFI_DRIVER_BINDING_PROTOCOL gXenPvBlkDxeDriverBinding = {\r
XenPvBlkDxeDriverBindingSupported,\r
XenPvBlkDxeDriverBindingStart,\r
XenPvBlkDxeDriverBindingStop,\r
NULL\r
};\r
\r
-\r
/**\r
Unloads an image.\r
\r
UINTN HandleCount;\r
UINTN Index;\r
\r
-\r
//\r
// Retrieve array of all handles in the handle database\r
//\r
//\r
FreePool (HandleBuffer);\r
\r
-\r
//\r
// Uninstall protocols installed in the driver entry point\r
//\r
Status = gBS->UninstallMultipleProtocolInterfaces (\r
ImageHandle,\r
- &gEfiDriverBindingProtocolGuid, &gXenPvBlkDxeDriverBinding,\r
- &gEfiComponentNameProtocolGuid, &gXenPvBlkDxeComponentName,\r
- &gEfiComponentName2ProtocolGuid, &gXenPvBlkDxeComponentName2,\r
+ &gEfiDriverBindingProtocolGuid,\r
+ &gXenPvBlkDxeDriverBinding,\r
+ &gEfiComponentNameProtocolGuid,\r
+ &gXenPvBlkDxeComponentName,\r
+ &gEfiComponentName2ProtocolGuid,\r
+ &gXenPvBlkDxeComponentName2,\r
NULL\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
-\r
/**\r
Tests to see if this driver supports a given controller. If a child device is provided,\r
it further tests to see if this driver supports creating a handle for the specified child device.\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
)\r
{\r
- EFI_STATUS Status;\r
- XENBUS_PROTOCOL *XenBusIo;\r
+ EFI_STATUS Status;\r
+ XENBUS_PROTOCOL *XenBusIo;\r
\r
Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gXenBusProtocolGuid,\r
- (VOID **)&XenBusIo,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
+ ControllerHandle,\r
+ &gXenBusProtocolGuid,\r
+ (VOID **)&XenBusIo,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
+\r
if (AsciiStrCmp (XenBusIo->Type, "vbd") == 0) {\r
Status = EFI_SUCCESS;\r
} else {\r
Status = EFI_UNSUPPORTED;\r
}\r
\r
- gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid,\r
- This->DriverBindingHandle, ControllerHandle);\r
+ gBS->CloseProtocol (\r
+ ControllerHandle,\r
+ &gXenBusProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
\r
return Status;\r
}\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
)\r
{\r
- EFI_STATUS Status;\r
- XENBUS_PROTOCOL *XenBusIo;\r
- XEN_BLOCK_FRONT_DEVICE *Dev;\r
- EFI_BLOCK_IO_MEDIA *Media;\r
+ EFI_STATUS Status;\r
+ XENBUS_PROTOCOL *XenBusIo;\r
+ XEN_BLOCK_FRONT_DEVICE *Dev;\r
+ EFI_BLOCK_IO_MEDIA *Media;\r
\r
Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gXenBusProtocolGuid,\r
- (VOID **)&XenBusIo,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_BY_DRIVER\r
- );\r
+ ControllerHandle,\r
+ &gXenBusProtocolGuid,\r
+ (VOID **)&XenBusIo,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
}\r
\r
CopyMem (&Dev->BlockIo, &gXenPvBlkDxeBlockIo, sizeof (EFI_BLOCK_IO_PROTOCOL));\r
- Media = AllocateCopyPool (sizeof (EFI_BLOCK_IO_MEDIA),\r
- &gXenPvBlkDxeBlockIoMedia);\r
+ Media = AllocateCopyPool (\r
+ sizeof (EFI_BLOCK_IO_MEDIA),\r
+ &gXenPvBlkDxeBlockIoMedia\r
+ );\r
if (Dev->MediaInfo.VDiskInfo & VDISK_REMOVABLE) {\r
Media->RemovableMedia = TRUE;\r
}\r
+\r
Media->MediaPresent = TRUE;\r
- Media->ReadOnly = !Dev->MediaInfo.ReadWrite;\r
+ Media->ReadOnly = !Dev->MediaInfo.ReadWrite;\r
if (Dev->MediaInfo.CdRom) {\r
//\r
// If it's a cdrom, the blocksize value need to be 2048 for OVMF to\r
// MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c\r
//\r
Media->BlockSize = 2048;\r
- Media->LastBlock = DivU64x32 (Dev->MediaInfo.Sectors,\r
- Media->BlockSize / Dev->MediaInfo.SectorSize) - 1;\r
+ Media->LastBlock = DivU64x32 (\r
+ Dev->MediaInfo.Sectors,\r
+ Media->BlockSize / Dev->MediaInfo.SectorSize\r
+ ) - 1;\r
} else {\r
Media->BlockSize = Dev->MediaInfo.SectorSize;\r
Media->LastBlock = Dev->MediaInfo.Sectors - 1;\r
}\r
+\r
ASSERT (Media->BlockSize % 512 == 0);\r
Dev->BlockIo.Media = Media;\r
\r
Status = gBS->InstallMultipleProtocolInterfaces (\r
- &ControllerHandle,\r
- &gEfiBlockIoProtocolGuid, &Dev->BlockIo,\r
- NULL\r
- );\r
+ &ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ &Dev->BlockIo,\r
+ NULL\r
+ );\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "XenPvBlk: install protocol fail: %r\n", Status));\r
goto UninitBlockFront;\r
FreePool (Media);\r
XenPvBlockFrontShutdown (Dev);\r
CloseProtocol:\r
- gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid,\r
- This->DriverBindingHandle, ControllerHandle);\r
+ gBS->CloseProtocol (\r
+ ControllerHandle,\r
+ &gXenBusProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
return Status;\r
}\r
\r
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
)\r
{\r
- EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
- XEN_BLOCK_FRONT_DEVICE *Dev;\r
- EFI_BLOCK_IO_MEDIA *Media;\r
- EFI_STATUS Status;\r
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
+ XEN_BLOCK_FRONT_DEVICE *Dev;\r
+ EFI_BLOCK_IO_MEDIA *Media;\r
+ EFI_STATUS Status;\r
\r
Status = gBS->OpenProtocol (\r
- ControllerHandle, &gEfiBlockIoProtocolGuid,\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
(VOID **)&BlockIo,\r
- This->DriverBindingHandle, ControllerHandle,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
);\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
- Status = gBS->UninstallProtocolInterface (ControllerHandle,\r
- &gEfiBlockIoProtocolGuid, BlockIo);\r
+ Status = gBS->UninstallProtocolInterface (\r
+ ControllerHandle,\r
+ &gEfiBlockIoProtocolGuid,\r
+ BlockIo\r
+ );\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
\r
Media = BlockIo->Media;\r
- Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (BlockIo);\r
+ Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (BlockIo);\r
XenPvBlockFrontShutdown (Dev);\r
\r
FreePool (Media);\r
\r
- gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid,\r
- This->DriverBindingHandle, ControllerHandle);\r
+ gBS->CloseProtocol (\r
+ ControllerHandle,\r
+ &gXenBusProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle\r
+ );\r
\r
return EFI_SUCCESS;\r
}\r