TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtioPciDevice.h File Reference

Go to the source code of this file.

Data Structures

struct  VIRTIO_PCI_DEVICE
 

Macros

#define VIRTIO_PCI_DEVICE_SIGNATURE   SIGNATURE_32 ('V', 'P', 'C', 'I')
 
#define VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE(Device)    CR (Device, VIRTIO_PCI_DEVICE, VirtioDevice, VIRTIO_PCI_DEVICE_SIGNATURE)
 

Functions

EFI_STATUS EFIAPI VirtioPciIoRead (IN VIRTIO_PCI_DEVICE *Dev, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI VirtioPciIoWrite (IN VIRTIO_PCI_DEVICE *Dev, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINT64 Value)
 
EFI_STATUS EFIAPI VirtioPciDeviceRead (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI VirtioPciDeviceWrite (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINT64 Value)
 
EFI_STATUS EFIAPI VirtioPciGetDeviceFeatures (IN VIRTIO_DEVICE_PROTOCOL *This, OUT UINT64 *DeviceFeatures)
 
EFI_STATUS EFIAPI VirtioPciGetQueueSize (IN VIRTIO_DEVICE_PROTOCOL *This, OUT UINT16 *QueueNumMax)
 
EFI_STATUS EFIAPI VirtioPciSetQueueAlignment (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT32 Alignment)
 
EFI_STATUS EFIAPI VirtioPciSetPageSize (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT32 PageSize)
 
EFI_STATUS EFIAPI VirtioPciGetDeviceStatus (IN VIRTIO_DEVICE_PROTOCOL *This, OUT UINT8 *DeviceStatus)
 
EFI_STATUS EFIAPI VirtioPciSetGuestFeatures (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT64 Features)
 
EFI_STATUS EFIAPI VirtioPciSetQueueAddress (IN VIRTIO_DEVICE_PROTOCOL *This, IN VRING *Ring, IN UINT64 RingBaseShift)
 
EFI_STATUS EFIAPI VirtioPciSetQueueSel (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT16 Sel)
 
EFI_STATUS EFIAPI VirtioPciSetQueueNotify (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT16 Index)
 
EFI_STATUS EFIAPI VirtioPciSetQueueSize (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT16 Size)
 
EFI_STATUS EFIAPI VirtioPciSetDeviceStatus (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINT8 DeviceStatus)
 
EFI_STATUS EFIAPI VirtioPciAllocateSharedPages (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN NumPages, OUT VOID **HostAddress)
 
VOID EFIAPI VirtioPciFreeSharedPages (IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN NumPages, IN VOID *HostAddress)
 
EFI_STATUS EFIAPI VirtioPciMapSharedBuffer (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)
 
EFI_STATUS EFIAPI VirtioPciUnmapSharedBuffer (IN VIRTIO_DEVICE_PROTOCOL *This, IN VOID *Mapping)
 

Detailed Description

Internal definitions for the VirtIo PCI Device driver

Copyright (C) 2013, ARM Ltd Copyright (c) 2017, AMD Inc, All rights reserved.

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

Definition in file VirtioPciDevice.h.

Macro Definition Documentation

◆ VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE

#define VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE (   Device)     CR (Device, VIRTIO_PCI_DEVICE, VirtioDevice, VIRTIO_PCI_DEVICE_SIGNATURE)

Definition at line 32 of file VirtioPciDevice.h.

◆ VIRTIO_PCI_DEVICE_SIGNATURE

#define VIRTIO_PCI_DEVICE_SIGNATURE   SIGNATURE_32 ('V', 'P', 'C', 'I')

Definition at line 22 of file VirtioPciDevice.h.

Function Documentation

◆ VirtioPciAllocateSharedPages()

EFI_STATUS EFIAPI VirtioPciAllocateSharedPages ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINTN  NumPages,
OUT VOID **  HostAddress 
)

Definition at line 320 of file VirtioPciFunctions.c.

◆ VirtioPciDeviceRead()

EFI_STATUS EFIAPI VirtioPciDeviceRead ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINTN  FieldOffset,
IN UINTN  FieldSize,
IN UINTN  BufferSize,
OUT VOID *  Buffer 
)

Read a word from Region 0 of the device specified by VirtIo Device protocol.

The function implements the ReadDevice protocol member of VIRTIO_DEVICE_PROTOCOL.

Parameters
[in]ThisVirtIo Device protocol.
[in]FieldOffsetSource offset.
[in]FieldSizeSource field size, must be in { 1, 2, 4, 8 }.
[in]BufferSizeNumber of bytes available in the target buffer. Must equal FieldSize.
[out]BufferTarget buffer.
Returns
Status code returned by PciIo->Io.Read().

Definition at line 44 of file VirtioPciFunctions.c.

◆ VirtioPciDeviceWrite()

EFI_STATUS EFIAPI VirtioPciDeviceWrite ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINTN  FieldOffset,
IN UINTN  FieldSize,
IN UINT64  Value 
)

Write a word into Region 0 of the device specified by VirtIo Device protocol.

Parameters
[in]ThisVirtIo Device protocol.
[in]FieldOffsetDestination offset.
[in]FieldSizeDestination field size, must be in { 1, 2, 4, 8 }.
[in]ValueLittle endian value to write, converted to UINT64. The least significant FieldSize bytes will be used.
Returns
Status code returned by PciIo->Io.Write().

Definition at line 84 of file VirtioPciFunctions.c.

◆ VirtioPciFreeSharedPages()

VOID EFIAPI VirtioPciFreeSharedPages ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINTN  NumPages,
IN VOID *  HostAddress 
)

Definition at line 339 of file VirtioPciFunctions.c.

◆ VirtioPciGetDeviceFeatures()

EFI_STATUS EFIAPI VirtioPciGetDeviceFeatures ( IN VIRTIO_DEVICE_PROTOCOL This,
OUT UINT64 *  DeviceFeatures 
)

Definition at line 105 of file VirtioPciFunctions.c.

◆ VirtioPciGetDeviceStatus()

EFI_STATUS EFIAPI VirtioPciGetDeviceStatus ( IN VIRTIO_DEVICE_PROTOCOL This,
OUT UINT8 *  DeviceStatus 
)

Definition at line 160 of file VirtioPciFunctions.c.

◆ VirtioPciGetQueueSize()

EFI_STATUS EFIAPI VirtioPciGetQueueSize ( IN VIRTIO_DEVICE_PROTOCOL This,
OUT UINT16 *  QueueNumMax 
)

Definition at line 136 of file VirtioPciFunctions.c.

◆ VirtioPciIoRead()

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.

Parameters
[in]DevVirtio PCI device.
[in]FieldOffsetSource offset.
[in]FieldSizeSource field size, must be in { 1, 2, 4, 8 }.
[in]BufferSizeNumber of bytes available in the target buffer. Must equal FieldSize.
[out]BufferTarget buffer.
Returns
Status code returned by PciIo->Io.Read().

Definition at line 69 of file VirtioPciDevice.c.

◆ VirtioPciIoWrite()

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.

Parameters
[in]DevVirtio PCI device.
[in]FieldOffsetDestination offset.
[in]FieldSizeDestination field size, must be in { 1, 2, 4, 8 }.
[in]ValueLittle endian value to write, converted to UINT64. The least significant FieldSize bytes will be used.
Returns
Status code returned by PciIo->Io.Write().

Definition at line 152 of file VirtioPciDevice.c.

◆ VirtioPciMapSharedBuffer()

EFI_STATUS EFIAPI VirtioPciMapSharedBuffer ( 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 350 of file VirtioPciFunctions.c.

◆ VirtioPciSetDeviceStatus()

EFI_STATUS EFIAPI VirtioPciSetDeviceStatus ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT8  DeviceStatus 
)

Definition at line 301 of file VirtioPciFunctions.c.

◆ VirtioPciSetGuestFeatures()

EFI_STATUS EFIAPI VirtioPciSetGuestFeatures ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT64  Features 
)

Definition at line 184 of file VirtioPciFunctions.c.

◆ VirtioPciSetPageSize()

EFI_STATUS EFIAPI VirtioPciSetPageSize ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT32  PageSize 
)

Definition at line 258 of file VirtioPciFunctions.c.

◆ VirtioPciSetQueueAddress()

EFI_STATUS EFIAPI VirtioPciSetQueueAddress ( IN VIRTIO_DEVICE_PROTOCOL This,
IN VRING Ring,
IN UINT64  RingBaseShift 
)

Definition at line 207 of file VirtioPciFunctions.c.

◆ VirtioPciSetQueueAlignment()

EFI_STATUS EFIAPI VirtioPciSetQueueAlignment ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT32  Alignment 
)

Definition at line 248 of file VirtioPciFunctions.c.

◆ VirtioPciSetQueueNotify()

EFI_STATUS EFIAPI VirtioPciSetQueueNotify ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT16  Index 
)

Definition at line 268 of file VirtioPciFunctions.c.

◆ VirtioPciSetQueueSel()

EFI_STATUS EFIAPI VirtioPciSetQueueSel ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT16  Sel 
)

Definition at line 229 of file VirtioPciFunctions.c.

◆ VirtioPciSetQueueSize()

EFI_STATUS EFIAPI VirtioPciSetQueueSize ( IN VIRTIO_DEVICE_PROTOCOL This,
IN UINT16  Size 
)

Definition at line 287 of file VirtioPciFunctions.c.

◆ VirtioPciUnmapSharedBuffer()

EFI_STATUS EFIAPI VirtioPciUnmapSharedBuffer ( IN VIRTIO_DEVICE_PROTOCOL This,
IN VOID *  Mapping 
)

Definition at line 367 of file VirtioPciFunctions.c.