TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtioMmioDevice.h
Go to the documentation of this file.
1
12#ifndef _VIRTIO_MMIO_DEVICE_INTERNAL_H_
13#define _VIRTIO_MMIO_DEVICE_INTERNAL_H_
14
16
18
19#include <Library/DebugLib.h>
20#include <Library/IoLib.h>
21#include <Library/UefiLib.h>
24
25#define VIRTIO_MMIO_DEVICE_SIGNATURE SIGNATURE_32 ('V', 'M', 'I', 'O')
26#define VIRTIO_MMIO_DEVICE_VERSION_0_95 1
27#define VIRTIO_MMIO_DEVICE_VERSION_1_00 2
28
29typedef struct {
30 UINT32 Signature;
31 UINT32 Version;
32 UINT16 QueueNum;
33 VIRTIO_DEVICE_PROTOCOL VirtioDevice;
34 PHYSICAL_ADDRESS BaseAddress;
36
37#define VIRTIO_MMIO_DEVICE_FROM_VIRTIO_DEVICE(Device) \
38 CR (Device, VIRTIO_MMIO_DEVICE, VirtioDevice, VIRTIO_MMIO_DEVICE_SIGNATURE)
39
40#define VIRTIO_CFG_WRITE(Device, Offset, Val) \
41 (MmioWrite32 (Device->BaseAddress + (Offset), Val))
42#define VIRTIO_CFG_READ(Device, Offset) \
43 (MmioRead32 (Device->BaseAddress + (Offset)))
44
46EFIAPI
47VirtioMmioDeviceRead (
49 IN UINTN FieldOFfset,
50 IN UINTN FieldSize,
51 IN UINTN BufferSize,
52 OUT VOID *Buffer
53 );
54
56EFIAPI
57VirtioMmioDeviceWrite (
59 IN UINTN FieldOffset,
60 IN UINTN FieldSize,
61 IN UINT64 Value
62 );
63
65EFIAPI
66VirtioMmioGetDeviceFeatures (
68 OUT UINT64 *DeviceFeatures
69 );
70
72EFIAPI
73VirtioMmioGetQueueSize (
75 OUT UINT16 *QueueNumMax
76 );
77
79EFIAPI
80VirtioMmioGetDeviceStatus (
82 OUT UINT8 *DeviceStatus
83 );
84
86EFIAPI
87VirtioMmioSetQueueSize (
89 IN UINT16 QueueSize
90 );
91
93EFIAPI
94VirtioMmioSetDeviceStatus (
96 IN UINT8 DeviceStatus
97 );
98
100EFIAPI
101VirtioMmioSetQueueNotify (
103 IN UINT16 QueueNotify
104 );
105
107EFIAPI
108VirtioMmioSetQueueSel (
110 IN UINT16 Sel
111 );
112
114EFIAPI
115VirtioMmioSetQueueAddress (
117 IN VRING *Ring,
118 IN UINT64 RingBaseShift
119 );
120
122EFIAPI
123VirtioMmioSetQueueAlignment (
125 IN UINT32 Alignment
126 );
127
129EFIAPI
130VirtioMmioSetPageSize (
132 IN UINT32 PageSize
133 );
134
136EFIAPI
137VirtioMmioSetGuestFeatures (
139 IN UINT64 Features
140 );
141
143EFIAPI
144VirtioMmioAllocateSharedPages (
146 IN UINTN NumPages,
147 OUT VOID **HostAddress
148 );
149
150VOID
151EFIAPI
152VirtioMmioFreeSharedPages (
154 IN UINTN NumPages,
155 IN VOID *HostAddress
156 );
157
159EFIAPI
160VirtioMmioMapSharedBuffer (
162 IN VIRTIO_MAP_OPERATION Operation,
163 IN VOID *HostAddress,
164 IN OUT UINTN *NumberOfBytes,
165 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
166 OUT VOID **Mapping
167 );
168
170EFIAPI
171VirtioMmioUnmapSharedBuffer (
173 IN VOID *Mapping
174 );
175
176#endif // _VIRTIO_MMIO_DEVICE_INTERNAL_H_
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29