VirtualBox

Ignore:
Timestamp:
Apr 14, 2023 3:17:44 PM (23 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156854
Message:

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.c

    r85718 r99404  
    1717#include "BlockFront.h"
    1818
    19 
    2019///
    2120/// Driver Binding Protocol instance
    2221///
    23 EFI_DRIVER_BINDING_PROTOCOL gXenPvBlkDxeDriverBinding = {
     22EFI_DRIVER_BINDING_PROTOCOL  gXenPvBlkDxeDriverBinding = {
    2423  XenPvBlkDxeDriverBindingSupported,
    2524  XenPvBlkDxeDriverBindingStart,
     
    3029};
    3130
    32 
    3331/**
    3432  Unloads an image.
     
    5250  UINTN       Index;
    5351
    54 
    5552  //
    5653  // Retrieve array of all handles in the handle database
     
    7976  FreePool (HandleBuffer);
    8077
    81 
    8278  //
    8379  // Uninstall protocols installed in the driver entry point
     
    8581  Status = gBS->UninstallMultipleProtocolInterfaces (
    8682                  ImageHandle,
    87                   &gEfiDriverBindingProtocolGuid, &gXenPvBlkDxeDriverBinding,
    88                   &gEfiComponentNameProtocolGuid,  &gXenPvBlkDxeComponentName,
    89                   &gEfiComponentName2ProtocolGuid, &gXenPvBlkDxeComponentName2,
     83                  &gEfiDriverBindingProtocolGuid,
     84                  &gXenPvBlkDxeDriverBinding,
     85                  &gEfiComponentNameProtocolGuid,
     86                  &gXenPvBlkDxeComponentName,
     87                  &gEfiComponentName2ProtocolGuid,
     88                  &gXenPvBlkDxeComponentName2,
    9089                  NULL
    9190                  );
     
    132131  return Status;
    133132}
    134 
    135133
    136134/**
     
    184182  )
    185183{
    186   EFI_STATUS Status;
    187   XENBUS_PROTOCOL *XenBusIo;
     184  EFI_STATUS       Status;
     185  XENBUS_PROTOCOL  *XenBusIo;
    188186
    189187  Status = gBS->OpenProtocol (
    190                 ControllerHandle,
    191                 &gXenBusProtocolGuid,
    192                 (VOID **)&XenBusIo,
    193                 This->DriverBindingHandle,
    194                 ControllerHandle,
    195                 EFI_OPEN_PROTOCOL_BY_DRIVER
    196                 );
    197   if (EFI_ERROR (Status)) {
    198     return Status;
    199   }
     188                  ControllerHandle,
     189                  &gXenBusProtocolGuid,
     190                  (VOID **)&XenBusIo,
     191                  This->DriverBindingHandle,
     192                  ControllerHandle,
     193                  EFI_OPEN_PROTOCOL_BY_DRIVER
     194                  );
     195  if (EFI_ERROR (Status)) {
     196    return Status;
     197  }
     198
    200199  if (AsciiStrCmp (XenBusIo->Type, "vbd") == 0) {
    201200    Status = EFI_SUCCESS;
     
    204203  }
    205204
    206   gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid,
    207                       This->DriverBindingHandle, ControllerHandle);
     205  gBS->CloseProtocol (
     206         ControllerHandle,
     207         &gXenBusProtocolGuid,
     208         This->DriverBindingHandle,
     209         ControllerHandle
     210         );
    208211
    209212  return Status;
     
    253256  )
    254257{
    255   EFI_STATUS Status;
    256   XENBUS_PROTOCOL *XenBusIo;
    257   XEN_BLOCK_FRONT_DEVICE *Dev;
    258   EFI_BLOCK_IO_MEDIA *Media;
     258  EFI_STATUS              Status;
     259  XENBUS_PROTOCOL         *XenBusIo;
     260  XEN_BLOCK_FRONT_DEVICE  *Dev;
     261  EFI_BLOCK_IO_MEDIA      *Media;
    259262
    260263  Status = gBS->OpenProtocol (
    261                 ControllerHandle,
    262                 &gXenBusProtocolGuid,
    263                 (VOID **)&XenBusIo,
    264                 This->DriverBindingHandle,
    265                 ControllerHandle,
    266                 EFI_OPEN_PROTOCOL_BY_DRIVER
    267                 );
     264                  ControllerHandle,
     265                  &gXenBusProtocolGuid,
     266                  (VOID **)&XenBusIo,
     267                  This->DriverBindingHandle,
     268                  ControllerHandle,
     269                  EFI_OPEN_PROTOCOL_BY_DRIVER
     270                  );
    268271  if (EFI_ERROR (Status)) {
    269272    return Status;
     
    276279
    277280  CopyMem (&Dev->BlockIo, &gXenPvBlkDxeBlockIo, sizeof (EFI_BLOCK_IO_PROTOCOL));
    278   Media = AllocateCopyPool (sizeof (EFI_BLOCK_IO_MEDIA),
    279                             &gXenPvBlkDxeBlockIoMedia);
     281  Media = AllocateCopyPool (
     282            sizeof (EFI_BLOCK_IO_MEDIA),
     283            &gXenPvBlkDxeBlockIoMedia
     284            );
    280285  if (Dev->MediaInfo.VDiskInfo & VDISK_REMOVABLE) {
    281286    Media->RemovableMedia = TRUE;
    282287  }
     288
    283289  Media->MediaPresent = TRUE;
    284   Media->ReadOnly = !Dev->MediaInfo.ReadWrite;
     290  Media->ReadOnly     = !Dev->MediaInfo.ReadWrite;
    285291  if (Dev->MediaInfo.CdRom) {
    286292    //
     
    290296    //
    291297    Media->BlockSize = 2048;
    292     Media->LastBlock = DivU64x32 (Dev->MediaInfo.Sectors,
    293                                   Media->BlockSize / Dev->MediaInfo.SectorSize) - 1;
     298    Media->LastBlock = DivU64x32 (
     299                         Dev->MediaInfo.Sectors,
     300                         Media->BlockSize / Dev->MediaInfo.SectorSize
     301                         ) - 1;
    294302  } else {
    295303    Media->BlockSize = Dev->MediaInfo.SectorSize;
    296304    Media->LastBlock = Dev->MediaInfo.Sectors - 1;
    297305  }
     306
    298307  ASSERT (Media->BlockSize % 512 == 0);
    299308  Dev->BlockIo.Media = Media;
    300309
    301310  Status = gBS->InstallMultipleProtocolInterfaces (
    302                     &ControllerHandle,
    303                     &gEfiBlockIoProtocolGuid, &Dev->BlockIo,
    304                     NULL
    305                     );
     311                  &ControllerHandle,
     312                  &gEfiBlockIoProtocolGuid,
     313                  &Dev->BlockIo,
     314                  NULL
     315                  );
    306316  if (EFI_ERROR (Status)) {
    307317    DEBUG ((DEBUG_ERROR, "XenPvBlk: install protocol fail: %r\n", Status));
     
    315325  XenPvBlockFrontShutdown (Dev);
    316326CloseProtocol:
    317   gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid,
    318                       This->DriverBindingHandle, ControllerHandle);
     327  gBS->CloseProtocol (
     328         ControllerHandle,
     329         &gXenBusProtocolGuid,
     330         This->DriverBindingHandle,
     331         ControllerHandle
     332         );
    319333  return Status;
    320334}
     
    355369  )
    356370{
    357   EFI_BLOCK_IO_PROTOCOL *BlockIo;
    358   XEN_BLOCK_FRONT_DEVICE *Dev;
    359   EFI_BLOCK_IO_MEDIA *Media;
    360   EFI_STATUS Status;
     371  EFI_BLOCK_IO_PROTOCOL   *BlockIo;
     372  XEN_BLOCK_FRONT_DEVICE  *Dev;
     373  EFI_BLOCK_IO_MEDIA      *Media;
     374  EFI_STATUS              Status;
    361375
    362376  Status = gBS->OpenProtocol (
    363                   ControllerHandle, &gEfiBlockIoProtocolGuid,
     377                  ControllerHandle,
     378                  &gEfiBlockIoProtocolGuid,
    364379                  (VOID **)&BlockIo,
    365                   This->DriverBindingHandle, ControllerHandle,
     380                  This->DriverBindingHandle,
     381                  ControllerHandle,
    366382                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
    367383                  );
     
    370386  }
    371387
    372   Status = gBS->UninstallProtocolInterface (ControllerHandle,
    373                   &gEfiBlockIoProtocolGuid, BlockIo);
     388  Status = gBS->UninstallProtocolInterface (
     389                  ControllerHandle,
     390                  &gEfiBlockIoProtocolGuid,
     391                  BlockIo
     392                  );
    374393  if (EFI_ERROR (Status)) {
    375394    return Status;
     
    377396
    378397  Media = BlockIo->Media;
    379   Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (BlockIo);
     398  Dev   = XEN_BLOCK_FRONT_FROM_BLOCK_IO (BlockIo);
    380399  XenPvBlockFrontShutdown (Dev);
    381400
    382401  FreePool (Media);
    383402
    384   gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid,
    385          This->DriverBindingHandle, ControllerHandle);
     403  gBS->CloseProtocol (
     404         ControllerHandle,
     405         &gXenBusProtocolGuid,
     406         This->DriverBindingHandle,
     407         ControllerHandle
     408         );
    386409
    387410  return EFI_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette