VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.h@ 77662

Last change on this file since 77662 was 77662, checked in by vboxsync, 6 years ago

EFI: First step in UDK2018 merge. Does not build yet.

  • Property svn:eol-style set to native
File size: 4.7 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 This program and the accompanying materials are licensed and made available
9 under the terms and conditions of the BSD License which accompanies this
10 distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
14 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16**/
17
18#ifndef _VIRTIO_PCI_DEVICE_DXE_H_
19#define _VIRTIO_PCI_DEVICE_DXE_H_
20
21#include <Protocol/ComponentName.h>
22#include <Protocol/DriverBinding.h>
23#include <Protocol/PciIo.h>
24#include <Protocol/VirtioDevice.h>
25
26#include <IndustryStandard/Virtio.h>
27
28#define VIRTIO_PCI_DEVICE_SIGNATURE SIGNATURE_32 ('V', 'P', 'C', 'I')
29
30typedef struct {
31 UINT32 Signature;
32 VIRTIO_DEVICE_PROTOCOL VirtioDevice;
33 EFI_PCI_IO_PROTOCOL *PciIo;
34 UINT64 OriginalPciAttributes;
35 UINT32 DeviceSpecificConfigurationOffset;
36} VIRTIO_PCI_DEVICE;
37
38#define VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE(Device) \
39 CR (Device, VIRTIO_PCI_DEVICE, VirtioDevice, VIRTIO_PCI_DEVICE_SIGNATURE)
40
41
42EFI_STATUS
43EFIAPI
44VirtioPciIoRead (
45 IN VIRTIO_PCI_DEVICE *Dev,
46 IN UINTN FieldOffset,
47 IN UINTN FieldSize,
48 IN UINTN BufferSize,
49 OUT VOID *Buffer
50 );
51
52EFI_STATUS
53EFIAPI
54VirtioPciIoWrite (
55 IN VIRTIO_PCI_DEVICE *Dev,
56 IN UINTN FieldOffset,
57 IN UINTN FieldSize,
58 IN UINT64 Value
59 );
60
61/********************************************
62 * PCI Functions for VIRTIO_DEVICE_PROTOCOL
63 *******************************************/
64EFI_STATUS
65EFIAPI
66VirtioPciDeviceRead (
67 IN VIRTIO_DEVICE_PROTOCOL *This,
68 IN UINTN FieldOffset,
69 IN UINTN FieldSize,
70 IN UINTN BufferSize,
71 OUT VOID *Buffer
72 );
73
74EFI_STATUS
75EFIAPI
76VirtioPciDeviceWrite (
77 IN VIRTIO_DEVICE_PROTOCOL *This,
78 IN UINTN FieldOffset,
79 IN UINTN FieldSize,
80 IN UINT64 Value
81 );
82
83EFI_STATUS
84EFIAPI
85VirtioPciGetDeviceFeatures (
86 IN VIRTIO_DEVICE_PROTOCOL *This,
87 OUT UINT64 *DeviceFeatures
88 );
89
90EFI_STATUS
91EFIAPI
92VirtioPciGetQueueSize (
93 IN VIRTIO_DEVICE_PROTOCOL *This,
94 OUT UINT16 *QueueNumMax
95 );
96
97EFI_STATUS
98EFIAPI
99VirtioPciSetQueueAlignment (
100 IN VIRTIO_DEVICE_PROTOCOL *This,
101 IN UINT32 Alignment
102 );
103
104EFI_STATUS
105EFIAPI
106VirtioPciSetPageSize (
107 IN VIRTIO_DEVICE_PROTOCOL *This,
108 IN UINT32 PageSize
109 );
110
111EFI_STATUS
112EFIAPI
113VirtioPciGetDeviceStatus (
114 IN VIRTIO_DEVICE_PROTOCOL *This,
115 OUT UINT8 *DeviceStatus
116 );
117
118EFI_STATUS
119EFIAPI
120VirtioPciSetGuestFeatures (
121 IN VIRTIO_DEVICE_PROTOCOL *This,
122 IN UINT64 Features
123 );
124
125EFI_STATUS
126EFIAPI
127VirtioPciSetQueueAddress (
128 IN VIRTIO_DEVICE_PROTOCOL *This,
129 IN VRING *Ring,
130 IN UINT64 RingBaseShift
131 );
132
133EFI_STATUS
134EFIAPI
135VirtioPciSetQueueSel (
136 IN VIRTIO_DEVICE_PROTOCOL *This,
137 IN UINT16 Sel
138 );
139
140EFI_STATUS
141EFIAPI
142VirtioPciSetQueueNotify (
143 IN VIRTIO_DEVICE_PROTOCOL *This,
144 IN UINT16 Index
145 );
146
147EFI_STATUS
148EFIAPI
149VirtioPciSetQueueSize (
150 IN VIRTIO_DEVICE_PROTOCOL *This,
151 IN UINT16 Size
152 );
153
154EFI_STATUS
155EFIAPI
156VirtioPciSetDeviceStatus (
157 IN VIRTIO_DEVICE_PROTOCOL *This,
158 IN UINT8 DeviceStatus
159 );
160
161EFI_STATUS
162EFIAPI
163VirtioPciAllocateSharedPages (
164 IN VIRTIO_DEVICE_PROTOCOL *This,
165 IN UINTN NumPages,
166 OUT VOID **HostAddress
167 );
168
169VOID
170EFIAPI
171VirtioPciFreeSharedPages (
172 IN VIRTIO_DEVICE_PROTOCOL *This,
173 IN UINTN NumPages,
174 IN VOID *HostAddress
175 );
176
177EFI_STATUS
178EFIAPI
179VirtioPciMapSharedBuffer (
180 IN VIRTIO_DEVICE_PROTOCOL *This,
181 IN VIRTIO_MAP_OPERATION Operation,
182 IN VOID *HostAddress,
183 IN OUT UINTN *NumberOfBytes,
184 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
185 OUT VOID **Mapping
186 );
187
188EFI_STATUS
189EFIAPI
190VirtioPciUnmapSharedBuffer (
191 IN VIRTIO_DEVICE_PROTOCOL *This,
192 IN VOID *Mapping
193 );
194#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