Read a word from the device-specific I/O region of the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | FieldOffset | Source offset. |
[in] | FieldSize | Source field size in bytes, must be in {1, 2, 4, 8}. |
[in] | BufferSize | Number of bytes available in the target buffer. Must equal FieldSize. |
[out] | Buffer | Target buffer. |
- Return values
-
EFI_SUCCESS | The data was read successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and read size. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
Write a word to the device-specific I/O region of the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | FieldOffset | Destination offset. |
[in] | FieldSize | Destination field size in bytes, must be in {1, 2, 4, 8}. |
[out] | Value | Value to write. |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
Read the device features field from the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[out] | DeviceFeatures | The device features field. |
- Return values
-
EFI_SUCCESS | The data was read successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and read size. |
EFI_INVALID_PARAMETER | DeviceFeatures is NULL |
Write the guest features field in the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | Features | The guest features field |
Write the queue address field(s) in the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | Ring | The initialized VRING object to take the addresses from. The caller is responsible for ensuring that on input, all Ring->NumPages pages, starting at Ring->Base, have been successfully mapped with a single call to This->MapSharedBuffer() for CommonBuffer bus master operation. |
[in] | RingBaseShift | Adding this value using UINT64 arithmetic to the addresses found in Ring translates them from system memory to bus addresses. The caller shall calculate RingBaseShift as (DeviceAddress - (UINT64)(UINTN)HostAddress), where DeviceAddress and HostAddress (i.e., Ring->Base) were output and input parameters of This->MapSharedBuffer(), respectively. |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Write the queue select field in the Virtio Header.
Writing to the queue select field sets the index of the queue to which operations such as SetQueueAlign and GetQueueNumMax apply.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | Index | The index of the queue to select |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Write the queue notify field in the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | Address | The 32-bit Queue Notify field |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Write the queue alignment field in the Virtio Header.
The queue to which the alignment applies is selected by the Queue Select field.
Note: This operation is not implemented by the VirtIo over PCI. The PCI implementation of this protocol returns EFI_SUCCESS.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | Alignment | The alignment boundary of the Used Ring in bytes. Must be a power of 2. |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Write the guest page size.
Note: This operation is not implemented by the VirtIo over PCI. The PCI implementation of this protocol returns EFI_SUCCESS.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | PageSize | Size of the Guest page in bytes. Must be a power of 2. |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Get the size of the virtqueue selected by the queue select field.
See Virtio spec Section 2.3
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[out] | QueueNumMax | The size of the virtqueue in bytes. Always a power of 2. |
- Return values
-
EFI_SUCCESS | The data was read successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and read size. |
EFI_INVALID_PARAMETER | QueueNumMax is NULL |
Write to the QueueNum field in the Virtio Header.
This function only applies to Virtio-MMIO and may be a stub for other implementations. See Virtio Spec appendix X.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | QueueSize | The number of elements in the queue. |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Get the DeviceStatus field from the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[out] | DeviceStatus | The 8-bit value for the Device status field |
- Return values
-
EFI_SUCCESS | The data was read successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and read size. |
EFI_INVALID_PARAMETER | DeviceStatus is NULL |
Write the DeviceStatus field in the Virtio Header.
- Parameters
-
[in] | This | This instance of VIRTIO_DEVICE_PROTOCOL |
[in] | DeviceStatus | The 8-bit value for the Device status field |
- Return values
-
EFI_SUCCESS | The data was written successfully. |
EFI_UNSUPPORTED | The underlying IO device doesn't support the provided address offset and write size. |
Provides the virtio device address required to access system memory from a DMA bus master.
The interface follows the same usage pattern as defined in UEFI spec 2.6 (Section 13.2 PCI Root Bridge I/O Protocol)
- Parameters
-
[in] | This | The protocol instance pointer. |
[in] | Operation | Indicates if the bus master is going to read or write to system memory. |
[in] | HostAddress | The system memory address to map to shared buffer address. |
[in,out] | NumberOfBytes | On input the number of bytes to map. On output the number of bytes that were mapped. |
[out] | DeviceAddress | The resulting shared map address for the bus master to access the hosts HostAddress. |
[out] | Mapping | A resulting token to pass to VIRTIO_UNMAP_SHARED. |
- Return values
-
EFI_SUCCESS | The range was mapped for the returned NumberOfBytes. |
EFI_UNSUPPORTED | The HostAddress cannot be mapped as a common buffer. |
EFI_INVALID_PARAMETER | One or more parameters are invalid. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
EFI_DEVICE_ERROR | The system hardware could not map the requested address. |