1 | /** @file
|
---|
2 | Private definitions of the VirtIo 1.0 driver.
|
---|
3 |
|
---|
4 | Copyright (C) 2016, Red Hat, Inc.
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _VIRTIO_1_0_DXE_H_
|
---|
10 | #define _VIRTIO_1_0_DXE_H_
|
---|
11 |
|
---|
12 | #include <Protocol/PciIo.h>
|
---|
13 | #include <Protocol/VirtioDevice.h>
|
---|
14 |
|
---|
15 | #define VIRTIO_1_0_SIGNATURE SIGNATURE_32 ('V', 'I', 'O', '1')
|
---|
16 |
|
---|
17 | //
|
---|
18 | // Type of the PCI BAR that contains a VirtIo 1.0 config structure.
|
---|
19 | //
|
---|
20 | typedef enum {
|
---|
21 | Virtio10BarTypeMem,
|
---|
22 | Virtio10BarTypeIo
|
---|
23 | } VIRTIO_1_0_BAR_TYPE;
|
---|
24 |
|
---|
25 | //
|
---|
26 | // The type below defines the access to a VirtIo 1.0 config structure.
|
---|
27 | //
|
---|
28 | typedef struct {
|
---|
29 | BOOLEAN Exists; // The device exposes this structure
|
---|
30 | VIRTIO_1_0_BAR_TYPE BarType;
|
---|
31 | UINT8 Bar;
|
---|
32 | UINT32 Offset; // Offset into BAR where structure starts
|
---|
33 | UINT32 Length; // Length of structure in BAR.
|
---|
34 | } VIRTIO_1_0_CONFIG;
|
---|
35 |
|
---|
36 | typedef struct {
|
---|
37 | UINT32 Signature;
|
---|
38 | VIRTIO_DEVICE_PROTOCOL VirtIo;
|
---|
39 | EFI_PCI_IO_PROTOCOL *PciIo;
|
---|
40 | UINT64 OriginalPciAttributes;
|
---|
41 | VIRTIO_1_0_CONFIG CommonConfig; // Common settings
|
---|
42 | VIRTIO_1_0_CONFIG NotifyConfig; // Notifications
|
---|
43 | UINT32 NotifyOffsetMultiplier;
|
---|
44 | VIRTIO_1_0_CONFIG SpecificConfig; // Device specific settings
|
---|
45 | } VIRTIO_1_0_DEV;
|
---|
46 |
|
---|
47 | #define VIRTIO_1_0_FROM_VIRTIO_DEVICE(Device) \
|
---|
48 | CR (Device, VIRTIO_1_0_DEV, VirtIo, VIRTIO_1_0_SIGNATURE)
|
---|
49 |
|
---|
50 | #endif // _VIRTIO_1_0_DXE_H_
|
---|