Changeset 99404 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.c
- Timestamp:
- Apr 14, 2023 3:17:44 PM (23 months ago)
- svn:sync-xref-src-repo-rev:
- 156854
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-145445 /vendor/edk2/current 103735-103757,103769-103776,129194-156846
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.c
r85718 r99404 17 17 #include "BlockFront.h" 18 18 19 20 19 /// 21 20 /// Driver Binding Protocol instance 22 21 /// 23 EFI_DRIVER_BINDING_PROTOCOL gXenPvBlkDxeDriverBinding = {22 EFI_DRIVER_BINDING_PROTOCOL gXenPvBlkDxeDriverBinding = { 24 23 XenPvBlkDxeDriverBindingSupported, 25 24 XenPvBlkDxeDriverBindingStart, … … 30 29 }; 31 30 32 33 31 /** 34 32 Unloads an image. … … 52 50 UINTN Index; 53 51 54 55 52 // 56 53 // Retrieve array of all handles in the handle database … … 79 76 FreePool (HandleBuffer); 80 77 81 82 78 // 83 79 // Uninstall protocols installed in the driver entry point … … 85 81 Status = gBS->UninstallMultipleProtocolInterfaces ( 86 82 ImageHandle, 87 &gEfiDriverBindingProtocolGuid, &gXenPvBlkDxeDriverBinding, 88 &gEfiComponentNameProtocolGuid, &gXenPvBlkDxeComponentName, 89 &gEfiComponentName2ProtocolGuid, &gXenPvBlkDxeComponentName2, 83 &gEfiDriverBindingProtocolGuid, 84 &gXenPvBlkDxeDriverBinding, 85 &gEfiComponentNameProtocolGuid, 86 &gXenPvBlkDxeComponentName, 87 &gEfiComponentName2ProtocolGuid, 88 &gXenPvBlkDxeComponentName2, 90 89 NULL 91 90 ); … … 132 131 return Status; 133 132 } 134 135 133 136 134 /** … … 184 182 ) 185 183 { 186 EFI_STATUS Status;187 XENBUS_PROTOCOL *XenBusIo;184 EFI_STATUS Status; 185 XENBUS_PROTOCOL *XenBusIo; 188 186 189 187 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 200 199 if (AsciiStrCmp (XenBusIo->Type, "vbd") == 0) { 201 200 Status = EFI_SUCCESS; … … 204 203 } 205 204 206 gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid, 207 This->DriverBindingHandle, ControllerHandle); 205 gBS->CloseProtocol ( 206 ControllerHandle, 207 &gXenBusProtocolGuid, 208 This->DriverBindingHandle, 209 ControllerHandle 210 ); 208 211 209 212 return Status; … … 253 256 ) 254 257 { 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; 259 262 260 263 Status = gBS->OpenProtocol ( 261 ControllerHandle,262 &gXenBusProtocolGuid,263 (VOID **)&XenBusIo,264 This->DriverBindingHandle,265 ControllerHandle,266 EFI_OPEN_PROTOCOL_BY_DRIVER267 );264 ControllerHandle, 265 &gXenBusProtocolGuid, 266 (VOID **)&XenBusIo, 267 This->DriverBindingHandle, 268 ControllerHandle, 269 EFI_OPEN_PROTOCOL_BY_DRIVER 270 ); 268 271 if (EFI_ERROR (Status)) { 269 272 return Status; … … 276 279 277 280 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 ); 280 285 if (Dev->MediaInfo.VDiskInfo & VDISK_REMOVABLE) { 281 286 Media->RemovableMedia = TRUE; 282 287 } 288 283 289 Media->MediaPresent = TRUE; 284 Media->ReadOnly = !Dev->MediaInfo.ReadWrite;290 Media->ReadOnly = !Dev->MediaInfo.ReadWrite; 285 291 if (Dev->MediaInfo.CdRom) { 286 292 // … … 290 296 // 291 297 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; 294 302 } else { 295 303 Media->BlockSize = Dev->MediaInfo.SectorSize; 296 304 Media->LastBlock = Dev->MediaInfo.Sectors - 1; 297 305 } 306 298 307 ASSERT (Media->BlockSize % 512 == 0); 299 308 Dev->BlockIo.Media = Media; 300 309 301 310 Status = gBS->InstallMultipleProtocolInterfaces ( 302 &ControllerHandle, 303 &gEfiBlockIoProtocolGuid, &Dev->BlockIo, 304 NULL 305 ); 311 &ControllerHandle, 312 &gEfiBlockIoProtocolGuid, 313 &Dev->BlockIo, 314 NULL 315 ); 306 316 if (EFI_ERROR (Status)) { 307 317 DEBUG ((DEBUG_ERROR, "XenPvBlk: install protocol fail: %r\n", Status)); … … 315 325 XenPvBlockFrontShutdown (Dev); 316 326 CloseProtocol: 317 gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid, 318 This->DriverBindingHandle, ControllerHandle); 327 gBS->CloseProtocol ( 328 ControllerHandle, 329 &gXenBusProtocolGuid, 330 This->DriverBindingHandle, 331 ControllerHandle 332 ); 319 333 return Status; 320 334 } … … 355 369 ) 356 370 { 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; 361 375 362 376 Status = gBS->OpenProtocol ( 363 ControllerHandle, &gEfiBlockIoProtocolGuid, 377 ControllerHandle, 378 &gEfiBlockIoProtocolGuid, 364 379 (VOID **)&BlockIo, 365 This->DriverBindingHandle, ControllerHandle, 380 This->DriverBindingHandle, 381 ControllerHandle, 366 382 EFI_OPEN_PROTOCOL_GET_PROTOCOL 367 383 ); … … 370 386 } 371 387 372 Status = gBS->UninstallProtocolInterface (ControllerHandle, 373 &gEfiBlockIoProtocolGuid, BlockIo); 388 Status = gBS->UninstallProtocolInterface ( 389 ControllerHandle, 390 &gEfiBlockIoProtocolGuid, 391 BlockIo 392 ); 374 393 if (EFI_ERROR (Status)) { 375 394 return Status; … … 377 396 378 397 Media = BlockIo->Media; 379 Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (BlockIo);398 Dev = XEN_BLOCK_FRONT_FROM_BLOCK_IO (BlockIo); 380 399 XenPvBlockFrontShutdown (Dev); 381 400 382 401 FreePool (Media); 383 402 384 gBS->CloseProtocol (ControllerHandle, &gXenBusProtocolGuid, 385 This->DriverBindingHandle, ControllerHandle); 403 gBS->CloseProtocol ( 404 ControllerHandle, 405 &gXenBusProtocolGuid, 406 This->DriverBindingHandle, 407 ControllerHandle 408 ); 386 409 387 410 return EFI_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.