]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / XenPvBlkDxe / XenPvBlkDxe.c
index 1440e1d23b66fdebdd82483bb0281be8cc99b2c2..dfc40bffaada14f97bfb870e6c8603d6668a67c1 100644 (file)
 \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
@@ -29,7 +28,6 @@ EFI_DRIVER_BINDING_PROTOCOL gXenPvBlkDxeDriverBinding = {
   NULL\r
 };\r
 \r
-\r
 /**\r
   Unloads an image.\r
 \r
@@ -51,7 +49,6 @@ XenPvBlkDxeUnload (
   UINTN       HandleCount;\r
   UINTN       Index;\r
 \r
-\r
   //\r
   // Retrieve array of all handles in the handle database\r
   //\r
@@ -78,15 +75,17 @@ XenPvBlkDxeUnload (
   //\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
@@ -132,7 +131,6 @@ XenPvBlkDxeDriverEntryPoint (
   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
@@ -183,28 +181,33 @@ XenPvBlkDxeDriverBindingSupported (
   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
@@ -252,19 +255,19 @@ XenPvBlkDxeDriverBindingStart (
   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
@@ -275,13 +278,16 @@ XenPvBlkDxeDriverBindingStart (
   }\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
@@ -289,20 +295,24 @@ XenPvBlkDxeDriverBindingStart (
     //    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
@@ -314,8 +324,12 @@ UninitBlockFront:
   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
@@ -354,35 +368,44 @@ XenPvBlkDxeDriverBindingStop (
   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