]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Virtio10Dxe/Virtio10.h
OvmfPkg/Virtio10Dxe: implement IOMMU-like member functions
[mirror_edk2.git] / OvmfPkg / Virtio10Dxe / Virtio10.h
1 /** @file
2 Private definitions of the VirtIo 1.0 driver.
3
4 Copyright (C) 2016, Red Hat, Inc.
5
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 **/
14
15 #ifndef _VIRTIO_1_0_DXE_H_
16 #define _VIRTIO_1_0_DXE_H_
17
18 #include <Protocol/PciIo.h>
19 #include <Protocol/VirtioDevice.h>
20
21 #define VIRTIO_1_0_SIGNATURE SIGNATURE_32 ('V', 'I', 'O', '1')
22
23 //
24 // Type of the PCI BAR that contains a VirtIo 1.0 config structure.
25 //
26 typedef enum {
27 Virtio10BarTypeMem,
28 Virtio10BarTypeIo
29 } VIRTIO_1_0_BAR_TYPE;
30
31 //
32 // The type below defines the access to a VirtIo 1.0 config structure.
33 //
34 typedef struct {
35 BOOLEAN Exists; // The device exposes this structure
36 VIRTIO_1_0_BAR_TYPE BarType;
37 UINT8 Bar;
38 UINT32 Offset; // Offset into BAR where structure starts
39 UINT32 Length; // Length of structure in BAR.
40 } VIRTIO_1_0_CONFIG;
41
42 typedef struct {
43 UINT32 Signature;
44 VIRTIO_DEVICE_PROTOCOL VirtIo;
45 EFI_PCI_IO_PROTOCOL *PciIo;
46 UINT64 OriginalPciAttributes;
47 VIRTIO_1_0_CONFIG CommonConfig; // Common settings
48 VIRTIO_1_0_CONFIG NotifyConfig; // Notifications
49 UINT32 NotifyOffsetMultiplier;
50 VIRTIO_1_0_CONFIG SpecificConfig; // Device specific settings
51 } VIRTIO_1_0_DEV;
52
53 #define VIRTIO_1_0_FROM_VIRTIO_DEVICE(Device) \
54 CR (Device, VIRTIO_1_0_DEV, VirtIo, VIRTIO_1_0_SIGNATURE)
55
56 #endif // _VIRTIO_1_0_DXE_H_