VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h@ 94368

Last change on this file since 94368 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1/** @file
2
3 Internal definitions for the VirtIo PCI Device driver
4
5 Copyright (C) 2013, ARM Ltd
6 Copyright (c) 2017, AMD Inc, All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10**/
11
12#ifndef _VIRTIO_PCI_DEVICE_DXE_H_
13#define _VIRTIO_PCI_DEVICE_DXE_H_
14
15#include <Protocol/ComponentName.h>
16#include <Protocol/DriverBinding.h>
17#include <Protocol/PciIo.h>
18#include <Protocol/VirtioDevice.h>
19
20#include <IndustryStandard/Virtio.h>
21
22#define VIRTIO_PCI_DEVICE_SIGNATURE SIGNATURE_32 ('V', 'P', 'C', 'I')
23
24typedef struct {
25 UINT32 Signature;
26 VIRTIO_DEVICE_PROTOCOL VirtioDevice;
27 EFI_PCI_IO_PROTOCOL *PciIo;
28 UINT64 OriginalPciAttributes;
29 UINT32 DeviceSpecificConfigurationOffset;
30} VIRTIO_PCI_DEVICE;
31
32#define VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE(Device) \
33 CR (Device, VIRTIO_PCI_DEVICE, VirtioDevice, VIRTIO_PCI_DEVICE_SIGNATURE)
34
35
36EFI_STATUS
37EFIAPI
38VirtioPciIoRead (
39 IN VIRTIO_PCI_DEVICE *Dev,
40 IN UINTN FieldOffset,
41 IN UINTN FieldSize,
42 IN UINTN BufferSize,
43 OUT VOID *Buffer
44 );
45
46EFI_STATUS
47EFIAPI
48VirtioPciIoWrite (
49 IN VIRTIO_PCI_DEVICE *Dev,
50 IN UINTN FieldOffset,
51 IN UINTN FieldSize,
52 IN UINT64 Value
53 );
54
55/********************************************
56 * PCI Functions for VIRTIO_DEVICE_PROTOCOL
57 *******************************************/
58EFI_STATUS
59EFIAPI
60VirtioPciDeviceRead (
61 IN VIRTIO_DEVICE_PROTOCOL *This,
62 IN UINTN FieldOffset,
63 IN UINTN FieldSize,
64 IN UINTN BufferSize,
65 OUT VOID *Buffer
66 );
67
68EFI_STATUS
69EFIAPI
70VirtioPciDeviceWrite (
71 IN VIRTIO_DEVICE_PROTOCOL *This,
72 IN UINTN FieldOffset,
73 IN UINTN FieldSize,
74 IN UINT64 Value
75 );
76
77EFI_STATUS
78EFIAPI
79VirtioPciGetDeviceFeatures (
80 IN VIRTIO_DEVICE_PROTOCOL *This,
81 OUT UINT64 *DeviceFeatures
82 );
83
84EFI_STATUS
85EFIAPI
86VirtioPciGetQueueSize (
87 IN VIRTIO_DEVICE_PROTOCOL *This,
88 OUT UINT16 *QueueNumMax
89 );
90
91EFI_STATUS
92EFIAPI
93VirtioPciSetQueueAlignment (
94 IN VIRTIO_DEVICE_PROTOCOL *This,
95 IN UINT32 Alignment
96 );
97
98EFI_STATUS
99EFIAPI
100VirtioPciSetPageSize (
101 IN VIRTIO_DEVICE_PROTOCOL *This,
102 IN UINT32 PageSize
103 );
104
105EFI_STATUS
106EFIAPI
107VirtioPciGetDeviceStatus (
108 IN VIRTIO_DEVICE_PROTOCOL *This,
109 OUT UINT8 *DeviceStatus
110 );
111
112EFI_STATUS
113EFIAPI
114VirtioPciSetGuestFeatures (
115 IN VIRTIO_DEVICE_PROTOCOL *This,
116 IN UINT64 Features
117 );
118
119EFI_STATUS
120EFIAPI
121VirtioPciSetQueueAddress (
122 IN VIRTIO_DEVICE_PROTOCOL *This,
123 IN VRING *Ring,
124 IN UINT64 RingBaseShift
125 );
126
127EFI_STATUS
128EFIAPI
129VirtioPciSetQueueSel (
130 IN VIRTIO_DEVICE_PROTOCOL *This,
131 IN UINT16 Sel
132 );
133
134EFI_STATUS
135EFIAPI
136VirtioPciSetQueueNotify (
137 IN VIRTIO_DEVICE_PROTOCOL *This,
138 IN UINT16 Index
139 );
140
141EFI_STATUS
142EFIAPI
143VirtioPciSetQueueSize (
144 IN VIRTIO_DEVICE_PROTOCOL *This,
145 IN UINT16 Size
146 );
147
148EFI_STATUS
149EFIAPI
150VirtioPciSetDeviceStatus (
151 IN VIRTIO_DEVICE_PROTOCOL *This,
152 IN UINT8 DeviceStatus
153 );
154
155EFI_STATUS
156EFIAPI
157VirtioPciAllocateSharedPages (
158 IN VIRTIO_DEVICE_PROTOCOL *This,
159 IN UINTN NumPages,
160 OUT VOID **HostAddress
161 );
162
163VOID
164EFIAPI
165VirtioPciFreeSharedPages (
166 IN VIRTIO_DEVICE_PROTOCOL *This,
167 IN UINTN NumPages,
168 IN VOID *HostAddress
169 );
170
171EFI_STATUS
172EFIAPI
173VirtioPciMapSharedBuffer (
174 IN VIRTIO_DEVICE_PROTOCOL *This,
175 IN VIRTIO_MAP_OPERATION Operation,
176 IN VOID *HostAddress,
177 IN OUT UINTN *NumberOfBytes,
178 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
179 OUT VOID **Mapping
180 );
181
182EFI_STATUS
183EFIAPI
184VirtioPciUnmapSharedBuffer (
185 IN VIRTIO_DEVICE_PROTOCOL *This,
186 IN VOID *Mapping
187 );
188#endif // _VIRTIO_PCI_DEVICE_DXE_H_
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette