summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioFsDxe/DriverBinding.c
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/VirtioFsDxe/DriverBinding.c')
-rw-r--r--OvmfPkg/VirtioFsDxe/DriverBinding.c166
1 files changed, 104 insertions, 62 deletions
diff --git a/OvmfPkg/VirtioFsDxe/DriverBinding.c b/OvmfPkg/VirtioFsDxe/DriverBinding.c
index e273c9f362..86eb9cf0ba 100644
--- a/OvmfPkg/VirtioFsDxe/DriverBinding.c
+++ b/OvmfPkg/VirtioFsDxe/DriverBinding.c
@@ -17,8 +17,8 @@
//
// UEFI Driver Model protocol instances.
//
-STATIC EFI_DRIVER_BINDING_PROTOCOL mDriverBinding;
-STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2;
+STATIC EFI_DRIVER_BINDING_PROTOCOL mDriverBinding;
+STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2;
//
// UEFI Driver Model protocol member functions.
@@ -26,18 +26,23 @@ STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2;
EFI_STATUS
EFIAPI
VirtioFsBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
- EFI_STATUS Status;
- VIRTIO_DEVICE_PROTOCOL *Virtio;
- EFI_STATUS CloseStatus;
-
- Status = gBS->OpenProtocol (ControllerHandle, &gVirtioDeviceProtocolGuid,
- (VOID **)&Virtio, This->DriverBindingHandle,
- ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
+ EFI_STATUS Status;
+ VIRTIO_DEVICE_PROTOCOL *Virtio;
+ EFI_STATUS CloseStatus;
+
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gVirtioDeviceProtocolGuid,
+ (VOID **)&Virtio,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -46,9 +51,12 @@ VirtioFsBindingSupported (
Status = EFI_UNSUPPORTED;
}
- CloseStatus = gBS->CloseProtocol (ControllerHandle,
- &gVirtioDeviceProtocolGuid, This->DriverBindingHandle,
- ControllerHandle);
+ CloseStatus = gBS->CloseProtocol (
+ ControllerHandle,
+ &gVirtioDeviceProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
ASSERT_EFI_ERROR (CloseStatus);
return Status;
@@ -57,24 +65,30 @@ VirtioFsBindingSupported (
EFI_STATUS
EFIAPI
VirtioFsBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
- VIRTIO_FS *VirtioFs;
- EFI_STATUS Status;
- EFI_STATUS CloseStatus;
+ VIRTIO_FS *VirtioFs;
+ EFI_STATUS Status;
+ EFI_STATUS CloseStatus;
VirtioFs = AllocatePool (sizeof *VirtioFs);
if (VirtioFs == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
VirtioFs->Signature = VIRTIO_FS_SIG;
- Status = gBS->OpenProtocol (ControllerHandle, &gVirtioDeviceProtocolGuid,
- (VOID **)&VirtioFs->Virtio, This->DriverBindingHandle,
- ControllerHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gVirtioDeviceProtocolGuid,
+ (VOID **)&VirtioFs->Virtio,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
if (EFI_ERROR (Status)) {
goto FreeVirtioFs;
}
@@ -89,8 +103,13 @@ VirtioFsBindingStart (
goto UninitVirtioFs;
}
- Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_CALLBACK,
- VirtioFsExitBoot, VirtioFs, &VirtioFs->ExitBoot);
+ Status = gBS->CreateEvent (
+ EVT_SIGNAL_EXIT_BOOT_SERVICES,
+ TPL_CALLBACK,
+ VirtioFsExitBoot,
+ VirtioFs,
+ &VirtioFs->ExitBoot
+ );
if (EFI_ERROR (Status)) {
goto UninitVirtioFs;
}
@@ -99,9 +118,12 @@ VirtioFsBindingStart (
VirtioFs->SimpleFs.Revision = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION;
VirtioFs->SimpleFs.OpenVolume = VirtioFsOpenVolume;
- Status = gBS->InstallProtocolInterface (&ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, EFI_NATIVE_INTERFACE,
- &VirtioFs->SimpleFs);
+ Status = gBS->InstallProtocolInterface (
+ &ControllerHandle,
+ &gEfiSimpleFileSystemProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &VirtioFs->SimpleFs
+ );
if (EFI_ERROR (Status)) {
goto CloseExitBoot;
}
@@ -116,9 +138,12 @@ UninitVirtioFs:
VirtioFsUninit (VirtioFs);
CloseVirtio:
- CloseStatus = gBS->CloseProtocol (ControllerHandle,
- &gVirtioDeviceProtocolGuid, This->DriverBindingHandle,
- ControllerHandle);
+ CloseStatus = gBS->CloseProtocol (
+ ControllerHandle,
+ &gVirtioDeviceProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
ASSERT_EFI_ERROR (CloseStatus);
FreeVirtioFs:
@@ -130,20 +155,24 @@ FreeVirtioFs:
EFI_STATUS
EFIAPI
VirtioFsBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
{
- EFI_STATUS Status;
- EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;
- VIRTIO_FS *VirtioFs;
-
- Status = gBS->OpenProtocol (ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, (VOID **)&SimpleFs,
- This->DriverBindingHandle, ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+ EFI_STATUS Status;
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;
+ VIRTIO_FS *VirtioFs;
+
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiSimpleFileSystemProtocolGuid,
+ (VOID **)&SimpleFs,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -154,8 +183,11 @@ VirtioFsBindingStop (
return EFI_ACCESS_DENIED;
}
- Status = gBS->UninstallProtocolInterface (ControllerHandle,
- &gEfiSimpleFileSystemProtocolGuid, SimpleFs);
+ Status = gBS->UninstallProtocolInterface (
+ ControllerHandle,
+ &gEfiSimpleFileSystemProtocolGuid,
+ SimpleFs
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -165,8 +197,12 @@ VirtioFsBindingStop (
VirtioFsUninit (VirtioFs);
- Status = gBS->CloseProtocol (ControllerHandle, &gVirtioDeviceProtocolGuid,
- This->DriverBindingHandle, ControllerHandle);
+ Status = gBS->CloseProtocol (
+ ControllerHandle,
+ &gVirtioDeviceProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
ASSERT_EFI_ERROR (Status);
FreePool (VirtioFs);
@@ -177,14 +213,15 @@ VirtioFsBindingStop (
EFI_STATUS
EFIAPI
VirtioFsGetDriverName (
- IN EFI_COMPONENT_NAME2_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
+ IN EFI_COMPONENT_NAME2_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
)
{
if (AsciiStrCmp (Language, "en") != 0) {
return EFI_UNSUPPORTED;
}
+
*DriverName = L"Virtio Filesystem Driver";
return EFI_SUCCESS;
}
@@ -192,11 +229,11 @@ VirtioFsGetDriverName (
EFI_STATUS
EFIAPI
VirtioFsGetControllerName (
- IN EFI_COMPONENT_NAME2_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME2_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
@@ -208,11 +245,11 @@ VirtioFsGetControllerName (
EFI_STATUS
EFIAPI
VirtioFsEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
mDriverBinding.Supported = VirtioFsBindingSupported;
mDriverBinding.Start = VirtioFsBindingStart;
@@ -225,8 +262,13 @@ VirtioFsEntryPoint (
mComponentName2.GetControllerName = VirtioFsGetControllerName;
mComponentName2.SupportedLanguages = "en";
- Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,
- &gEfiDriverBindingProtocolGuid, &mDriverBinding,
- &gEfiComponentName2ProtocolGuid, &mComponentName2, NULL);
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &ImageHandle,
+ &gEfiDriverBindingProtocolGuid,
+ &mDriverBinding,
+ &gEfiComponentName2ProtocolGuid,
+ &mComponentName2,
+ NULL
+ );
return Status;
}