TianoCore EDK2 master
|
#include <IndustryStandard/Pci.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include "VirtioPciDevice.h"
Go to the source code of this file.
This driver produces Virtio Device Protocol instances for Virtio PCI devices.
Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
Copyright (C) 2013, ARM Ltd. Copyright (C) 2017, AMD Inc, All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file VirtioPciDevice.c.
STATIC EFI_STATUS EFIAPI VirtioPciDeviceBindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
After we've pronounced support for a specific device in DriverBindingSupported(), we start managing said device (passed in by the Driver Execution Environment) with the following service.
See DriverBindingSupported() for specification references.
[in] | This | The EFI_DRIVER_BINDING_PROTOCOL object incorporating this driver (independently of any device). |
[in] | DeviceHandle | The supported device to drive. |
[in] | RemainingDevicePath | Relevant only for bus drivers, ignored. |
EFI_SUCCESS | Driver instance has been created and initialized for the virtio-pci device, it is now accessible via VIRTIO_DEVICE_PROTOCOL. |
EFI_OUT_OF_RESOURCES | Memory allocation failed. |
Definition at line 429 of file VirtioPciDevice.c.
STATIC EFI_STATUS EFIAPI VirtioPciDeviceBindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Stop driving the Virtio PCI device
[in] | This | The EFI_DRIVER_BINDING_PROTOCOL object incorporating this driver (independently of any device). |
[in] | DeviceHandle | Stop driving this device. |
[in] | NumberOfChildren | Since this function belongs to a device driver only (as opposed to a bus driver), the caller environment sets NumberOfChildren to zero, and we ignore it. |
[in] | ChildHandleBuffer | Ignored (corresponding to NumberOfChildren). |
EFI_SUCCESS | Driver instance has been stopped and the PCI configuration attributes have been restored. |
Definition at line 566 of file VirtioPciDevice.c.
STATIC EFI_STATUS EFIAPI VirtioPciDeviceBindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Device probe function for this driver.
The DXE core calls this function for any given device in order to see if the driver can drive the device.
[in] | This | The EFI_DRIVER_BINDING_PROTOCOL object incorporating this driver (independently of any device). |
[in] | DeviceHandle | The device to probe. |
[in] | RemainingDevicePath | Relevant only for bus drivers, ignored. |
EFI_SUCCESS | The driver supports the device being probed. |
EFI_UNSUPPORTED | Based on virtio-pci discovery, we do not support the device. |
Definition at line 238 of file VirtioPciDevice.c.
EFI_STATUS EFIAPI VirtioPciDeviceEntryPoint | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Definition at line 704 of file VirtioPciDevice.c.
EFI_STATUS EFIAPI VirtioPciGetDeviceName | ( | IN EFI_COMPONENT_NAME_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_HANDLE | ChildHandle, | ||
IN CHAR8 * | Language, | ||
OUT CHAR16 ** | ControllerName | ||
) |
Definition at line 674 of file VirtioPciDevice.c.
EFI_STATUS EFIAPI VirtioPciGetDriverName | ( | IN EFI_COMPONENT_NAME_PROTOCOL * | This, |
IN CHAR8 * | Language, | ||
OUT CHAR16 ** | DriverName | ||
) |
Definition at line 657 of file VirtioPciDevice.c.
STATIC EFI_STATUS EFIAPI VirtioPciInit | ( | IN OUT VIRTIO_PCI_DEVICE * | Device | ) |
Initialize the VirtIo PCI Device
[in,out] | Dev | The driver instance to configure. The caller is responsible for Device->PciIo's validity (ie. working IO access to the underlying virtio-pci device). |
EFI_SUCCESS | Setup complete. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and read size. |
Definition at line 328 of file VirtioPciDevice.c.
EFI_STATUS EFIAPI VirtioPciIoRead | ( | IN VIRTIO_PCI_DEVICE * | Dev, |
IN UINTN | FieldOffset, | ||
IN UINTN | FieldSize, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Read a word from Region 0 of the device specified by PciIo.
Region 0 must be an iomem region. This is an internal function for the PCI implementation of the protocol.
[in] | Dev | Virtio PCI device. |
[in] | FieldOffset | Source offset. |
[in] | FieldSize | Source field size, must be in { 1, 2, 4, 8 }. |
[in] | BufferSize | Number of bytes available in the target buffer. Must equal FieldSize. |
[out] | Buffer | Target buffer. |
Definition at line 69 of file VirtioPciDevice.c.
EFI_STATUS EFIAPI VirtioPciIoWrite | ( | IN VIRTIO_PCI_DEVICE * | Dev, |
IN UINTN | FieldOffset, | ||
IN UINTN | FieldSize, | ||
IN UINT64 | Value | ||
) |
Write a word into Region 0 of the device specified by PciIo.
Region 0 must be an iomem region. This is an internal function for the PCI implementation of the protocol.
[in] | Dev | Virtio PCI device. |
[in] | FieldOffset | Destination offset. |
[in] | FieldSize | Destination field size, must be in { 1, 2, 4, 8 }. |
[in] | Value | Little endian value to write, converted to UINT64. The least significant FieldSize bytes will be used. |
Definition at line 152 of file VirtioPciDevice.c.
STATIC VOID EFIAPI VirtioPciUninit | ( | IN OUT VIRTIO_PCI_DEVICE * | Device | ) |
Uninitialize the internals of a virtio-pci device that has been successfully set up with VirtioPciInit().
[in,out] | Dev | The device to clean up. |
Definition at line 390 of file VirtioPciDevice.c.
STATIC EFI_COMPONENT_NAME_PROTOCOL gComponentName |
Definition at line 653 of file VirtioPciDevice.c.
STATIC EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 |
Definition at line 693 of file VirtioPciDevice.c.
STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding |
Definition at line 629 of file VirtioPciDevice.c.
STATIC VIRTIO_DEVICE_PROTOCOL mDeviceProtocolTemplate |
Definition at line 23 of file VirtioPciDevice.c.
STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] |
Definition at line 647 of file VirtioPciDevice.c.