TianoCore EDK2 master
|
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/Virtio.h>
#include <Protocol/PciIo.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Protocol/VirtioDevice.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PciCapLib.h>
#include <Library/PciCapPciIoLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include "Virtio10.h"
Go to the source code of this file.
A non-transitional driver for VirtIo 1.0 PCI devices.
Copyright (C) 2016, Red Hat, Inc. Copyright (C) 2017, AMD Inc, All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Virtio10.c.
STATIC EFI_STATUS GetBarType | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | BarIndex, | ||
OUT VIRTIO_1_0_BAR_TYPE * | BarType | ||
) |
Determine if a PCI BAR is IO or MMIO.
[in] | PciIo | The EFI_PCI_IO_PROTOCOL instance that represents the device. |
[in] | BarIndex | The number of the BAR whose type the caller is interested in. |
[out] | BarType | On output, a VIRTIO_1_0_BAR_TYPE value that gives the type of the BAR. |
EFI_SUCCESS | The BAR type has been recognized and stored in BarType. |
EFI_UNSUPPORTED | The BAR type couldn't be identified. |
Definition at line 147 of file Virtio10.c.
STATIC EFI_STATUS ParseCapabilities | ( | IN OUT VIRTIO_1_0_DEV * | Device | ) |
Definition at line 207 of file Virtio10.c.
STATIC VOID UpdateAttributes | ( | IN VIRTIO_1_0_CONFIG * | Config, |
IN OUT UINT64 * | Attributes | ||
) |
Accumulate the BAR type of a virtio-1.0 register block into a UINT64 attribute map, such that the latter is suitable for enabling IO / MMIO decoding with EFI_PCI_IO_PROTOCOL.Attributes().
[in] | Config | The "fat pointer" structure that identifies the register block. It is allowed for the register block not to exist. |
[in,out] | Attributes | On output, if the register block exists, EFI_PCI_IO_ATTRIBUTE_MEMORY or EFI_PCI_IO_ATTRIBUTE_IO is OR-ed into Attributes, according to the register block's BAR type. |
Definition at line 358 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10AllocateSharedPages | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINTN | Pages, | ||
IN OUT VOID ** | HostAddress | ||
) |
Definition at line 845 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10BindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Definition at line 1058 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10BindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Definition at line 1169 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10BindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Definition at line 983 of file Virtio10.c.
EFI_STATUS EFIAPI Virtio10EntryPoint | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Definition at line 1295 of file Virtio10.c.
STATIC VOID EFIAPI Virtio10FreeSharedPages | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINTN | Pages, | ||
IN VOID * | HostAddress | ||
) |
Definition at line 870 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10GetDeviceFeatures | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
OUT UINT64 * | DeviceFeatures | ||
) |
Definition at line 377 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10GetDeviceName | ( | IN EFI_COMPONENT_NAME_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_HANDLE | ChildHandle, | ||
IN CHAR8 * | Language, | ||
OUT CHAR16 ** | ControllerName | ||
) |
Definition at line 1264 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10GetDeviceStatus | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
OUT UINT8 * | DeviceStatus | ||
) |
Definition at line 740 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10GetDriverName | ( | IN EFI_COMPONENT_NAME_PROTOCOL * | This, |
IN CHAR8 * | Language, | ||
OUT CHAR16 ** | DriverName | ||
) |
Definition at line 1246 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10GetQueueNumMax | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
OUT UINT16 * | QueueNumMax | ||
) |
Definition at line 691 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10MapSharedBuffer | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN VIRTIO_MAP_OPERATION | Operation, | ||
IN VOID * | HostAddress, | ||
IN OUT UINTN * | NumberOfBytes, | ||
OUT EFI_PHYSICAL_ADDRESS * | DeviceAddress, | ||
OUT VOID ** | Mapping | ||
) |
Definition at line 890 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10ReadDevice | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINTN | FieldOffset, | ||
IN UINTN | FieldSize, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer | ||
) |
Definition at line 814 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetDeviceStatus | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT8 | DeviceStatus | ||
) |
Definition at line 764 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetGuestFeatures | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT64 | Features | ||
) |
Definition at line 429 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetPageSize | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT32 | PageSize | ||
) |
Definition at line 680 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetQueueAddress | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN VRING * | Ring, | ||
IN UINT64 | RingBaseShift | ||
) |
Definition at line 483 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetQueueAlign | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT32 | Alignment | ||
) |
Definition at line 669 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetQueueNotify | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT16 | Index | ||
) |
Definition at line 577 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetQueueNum | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT16 | QueueSize | ||
) |
Definition at line 715 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10SetQueueSel | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINT16 | Index | ||
) |
Definition at line 553 of file Virtio10.c.
STATIC EFI_STATUS Virtio10Transfer | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN VIRTIO_1_0_CONFIG * | Config, | ||
IN BOOLEAN | Write, | ||
IN UINTN | FieldOffset, | ||
IN UINTN | FieldSize, | ||
IN OUT VOID * | Buffer | ||
) |
Transfer data between the caller and a register in a virtio-1.0 register block.
[in] | PciIo | The EFI_PCI_IO_PROTOCOL instance that represents the device. |
[in] | Config | The "fat pointer" structure that identifies the register block to access. |
[in] | Write | TRUE if the register should be written, FALSE if the register should be read. |
[in] | FieldOffset | The offset of the register within the register block. |
[in] | FieldSize | The size of the register within the register block. Can be one of 1, 2, 4 and 8. Accesses to 8-byte registers are broken up into two 4-byte accesses. |
[in,out] | Buffer | When Write is TRUE, the register is written with data from Buffer. When Write is FALSE, the caller receives the register value into Buffer. |
EFI_SUCCESS | Register access successful. |
EFI_INVALID_PARAMETER | The register block pointed-to by Config doesn't exist; or FieldOffset and FieldSize would overflow the register block; or FieldSize is invalid. |
Definition at line 67 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10UnmapSharedBuffer | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN VOID * | Mapping | ||
) |
Definition at line 936 of file Virtio10.c.
STATIC EFI_STATUS EFIAPI Virtio10WriteDevice | ( | IN VIRTIO_DEVICE_PROTOCOL * | This, |
IN UINTN | FieldOffset, | ||
IN UINTN | FieldSize, | ||
IN UINT64 | Value | ||
) |
Definition at line 788 of file Virtio10.c.
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName |
Definition at line 1241 of file Virtio10.c.
STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 |
Definition at line 1283 of file Virtio10.c.
STATIC EFI_DRIVER_BINDING_PROTOCOL mDriverBinding |
Definition at line 1220 of file Virtio10.c.
STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] |
Definition at line 1235 of file Virtio10.c.
STATIC CONST VIRTIO_DEVICE_PROTOCOL mVirtIoTemplate |
Definition at line 954 of file Virtio10.c.