TianoCore EDK2 master
Loading...
Searching...
No Matches
DriverBinding.c File Reference

Go to the source code of this file.

Functions

STATIC EFI_STATUS EFIAPI VirtioGpuGetDriverName (IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
 
STATIC EFI_STATUS EFIAPI VirtioGpuGetControllerName (IN EFI_COMPONENT_NAME2_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
 
STATIC EFI_STATUS FormatVgpuDevName (IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE AgentHandle, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **ControllerName)
 
STATIC EFI_STATUS InitVgpuGop (IN OUT VGPU_DEV *ParentBus, IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, IN EFI_HANDLE ParentBusController, IN EFI_HANDLE DriverBindingHandle)
 
STATIC VOID UninitVgpuGop (IN OUT VGPU_DEV *ParentBus, IN EFI_HANDLE ParentBusController, IN EFI_HANDLE DriverBindingHandle)
 
STATIC EFI_STATUS EFIAPI VirtioGpuDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
 
STATIC EFI_STATUS EFIAPI VirtioGpuDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
 
STATIC EFI_STATUS EFIAPI VirtioGpuDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
 
EFI_STATUS EFIAPI VirtioGpuEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

STATIC CONST ACPI_ADR_DEVICE_PATH mAcpiAdr
 
STATIC CONST EFI_UNICODE_STRING_TABLE mDriverNameTable []
 
STATIC CONST EFI_COMPONENT_NAME2_PROTOCOL mComponentName2
 
STATIC EFI_DRIVER_BINDING_PROTOCOL mDriverBinding
 

Detailed Description

Implement the Driver Binding Protocol and the Component Name 2 Protocol for the Virtio GPU hybrid driver.

Copyright (C) 2016, Red Hat, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DriverBinding.c.

Function Documentation

◆ FormatVgpuDevName()

STATIC EFI_STATUS FormatVgpuDevName ( IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE  AgentHandle,
IN EFI_DEVICE_PATH_PROTOCOL DevicePath,
OUT CHAR16 **  ControllerName 
)

Format the VGPU_DEV controller name, to be looked up and returned by VirtioGpuGetControllerName().

Parameters
[in]ControllerHandleThe handle that identifies the VGPU_DEV controller.
[in]AgentHandleThe handle of the agent that will attempt to temporarily open the PciIo protocol. This is the DriverBindingHandle member of the EFI_DRIVER_BINDING_PROTOCOL whose Start() function is calling this function.
[in]DevicePathThe device path that is installed on ControllerHandle.
[out]ControllerNameA dynamically allocated unicode string that unconditionally says "Virtio GPU Device", with a PCI Segment:Bus:Device.Function location optionally appended. The latter part is only produced if DevicePath contains at least one PciIo node; in that case, the most specific such node is used for retrieving the location info. The caller is responsible for freeing ControllerName after use.
Return values
EFI_SUCCESSControllerName has been formatted.
EFI_OUT_OF_RESOURCESFailed to allocate memory for ControllerName.

Definition at line 205 of file DriverBinding.c.

◆ InitVgpuGop()

STATIC EFI_STATUS InitVgpuGop ( IN OUT VGPU_DEV ParentBus,
IN EFI_DEVICE_PATH_PROTOCOL ParentDevicePath,
IN EFI_HANDLE  ParentBusController,
IN EFI_HANDLE  DriverBindingHandle 
)

Dynamically allocate and initialize the VGPU_GOP child object within an otherwise configured parent VGPU_DEV object.

This function adds a BY_CHILD_CONTROLLER reference to ParentBusController's VIRTIO_DEVICE_PROTOCOL interface.

Parameters
[in,out]ParentBusThe pre-initialized VGPU_DEV object that the newly created VGPU_GOP object will be the child of.
[in]ParentDevicePathThe device path protocol instance that is installed on ParentBusController.
[in]ParentBusControllerThe UEFI controller handle on which the ParentBus VGPU_DEV object and the ParentDevicePath device path protocol are installed.
[in]DriverBindingHandleThe DriverBindingHandle member of EFI_DRIVER_BINDING_PROTOCOL whose Start() function is calling this function. It is passed as AgentHandle to gBS->OpenProtocol() when creating the BY_CHILD_CONTROLLER reference.
Return values
EFI_SUCCESSParentBus->Child has been created and populated, and ParentBus->Child->GopHandle now references ParentBusController->VirtIo BY_CHILD_CONTROLLER.
EFI_OUT_OF_RESOURCESMemory allocation failed.
Returns
Error codes from underlying functions.

Definition at line 319 of file DriverBinding.c.

◆ UninitVgpuGop()

STATIC VOID UninitVgpuGop ( IN OUT VGPU_DEV ParentBus,
IN EFI_HANDLE  ParentBusController,
IN EFI_HANDLE  DriverBindingHandle 
)

Tear down and release the VGPU_GOP child object within the VGPU_DEV parent object.

This function removes the BY_CHILD_CONTROLLER reference from ParentBusController's VIRTIO_DEVICE_PROTOCOL interface.

Parameters
[in,out]ParentBusThe VGPU_DEV object that the VGPU_GOP child object will be removed from.
[in]ParentBusControllerThe UEFI controller handle on which the ParentBus VGPU_DEV object is installed.
[in]DriverBindingHandleThe DriverBindingHandle member of EFI_DRIVER_BINDING_PROTOCOL whose Stop() function is calling this function. It is passed as AgentHandle to gBS->CloseProtocol() when removing the BY_CHILD_CONTROLLER reference.

Definition at line 509 of file DriverBinding.c.

◆ VirtioGpuDriverBindingStart()

STATIC EFI_STATUS EFIAPI VirtioGpuDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath  OPTIONAL 
)

Definition at line 666 of file DriverBinding.c.

◆ VirtioGpuDriverBindingStop()

STATIC EFI_STATUS EFIAPI VirtioGpuDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer  OPTIONAL 
)

Definition at line 902 of file DriverBinding.c.

◆ VirtioGpuDriverBindingSupported()

STATIC EFI_STATUS EFIAPI VirtioGpuDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath  OPTIONAL 
)

Definition at line 559 of file DriverBinding.c.

◆ VirtioGpuEntryPoint()

EFI_STATUS EFIAPI VirtioGpuEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Definition at line 1044 of file DriverBinding.c.

◆ VirtioGpuGetControllerName()

STATIC EFI_STATUS EFIAPI VirtioGpuGetControllerName ( IN EFI_COMPONENT_NAME2_PROTOCOL This,
IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE ChildHandle  OPTIONAL,
IN CHAR8 *  Language,
OUT CHAR16 **  ControllerName 
)

Definition at line 81 of file DriverBinding.c.

◆ VirtioGpuGetDriverName()

STATIC EFI_STATUS EFIAPI VirtioGpuGetDriverName ( IN EFI_COMPONENT_NAME2_PROTOCOL This,
IN CHAR8 *  Language,
OUT CHAR16 **  DriverName 
)

Definition at line 63 of file DriverBinding.c.

Variable Documentation

◆ mAcpiAdr

Initial value:
= {
{
{ sizeof mAcpiAdr, 0 },
},
ACPI_DISPLAY_ADR (
1,
0,
0,
1,
0,
ACPI_ADR_DISPLAY_TYPE_EXTERNAL_DIGITAL,
0,
0
)
}
#define ACPI_DEVICE_PATH
Definition: DevicePath.h:190
#define ACPI_ADR_DP
Definition: DevicePath.h:264

Definition at line 32 of file DriverBinding.c.

◆ mComponentName2

Initial value:
= {
VirtioGpuGetDriverName,
VirtioGpuGetControllerName,
"en"
}

Definition at line 163 of file DriverBinding.c.

◆ mDriverBinding

Initial value:
= {
VirtioGpuDriverBindingSupported,
VirtioGpuDriverBindingStart,
VirtioGpuDriverBindingStop,
0x10,
NULL,
}
#define NULL
Definition: Base.h:319

Definition at line 1030 of file DriverBinding.c.

◆ mDriverNameTable

Initial value:
= {
{ "en", L"Virtio GPU Driver" },
{ NULL, NULL }
}

Definition at line 55 of file DriverBinding.c.