blob: ee6a078d39c9ef9412430c142172223016cd862d [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _LINUX_VIRTIO_PCI_H
8#define _LINUX_VIRTIO_PCI_H
Christopher Ferris05d08e92016-02-04 13:16:38 -08009#include <linux/types.h>
10#ifndef VIRTIO_PCI_NO_LEGACY
Christopher Ferris05d08e92016-02-04 13:16:38 -080011#define VIRTIO_PCI_HOST_FEATURES 0
Ben Cheng655a7c02013-10-16 16:09:24 -070012#define VIRTIO_PCI_GUEST_FEATURES 4
13#define VIRTIO_PCI_QUEUE_PFN 8
14#define VIRTIO_PCI_QUEUE_NUM 12
Christopher Ferris05d08e92016-02-04 13:16:38 -080015#define VIRTIO_PCI_QUEUE_SEL 14
Ben Cheng655a7c02013-10-16 16:09:24 -070016#define VIRTIO_PCI_QUEUE_NOTIFY 16
17#define VIRTIO_PCI_STATUS 18
18#define VIRTIO_PCI_ISR 19
Ben Cheng655a7c02013-10-16 16:09:24 -070019#define VIRTIO_MSI_CONFIG_VECTOR 20
20#define VIRTIO_MSI_QUEUE_VECTOR 22
Christopher Ferris38062f92014-07-09 15:33:25 -070021#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)
Christopher Ferris38062f92014-07-09 15:33:25 -070022#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
Ben Cheng655a7c02013-10-16 16:09:24 -070023#define VIRTIO_PCI_ABI_VERSION 0
24#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
25#define VIRTIO_PCI_VRING_ALIGN 4096
Christopher Ferris38062f92014-07-09 15:33:25 -070026#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -080027#define VIRTIO_PCI_ISR_CONFIG 0x2
28#define VIRTIO_MSI_NO_VECTOR 0xffff
29#ifndef VIRTIO_PCI_NO_MODERN
30#define VIRTIO_PCI_CAP_COMMON_CFG 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080031#define VIRTIO_PCI_CAP_NOTIFY_CFG 2
32#define VIRTIO_PCI_CAP_ISR_CFG 3
33#define VIRTIO_PCI_CAP_DEVICE_CFG 4
34#define VIRTIO_PCI_CAP_PCI_CFG 5
Christopher Ferris32ff3f82020-12-14 13:10:04 -080035#define VIRTIO_PCI_CAP_SHARED_MEMORY_CFG 8
Christopher Ferris05d08e92016-02-04 13:16:38 -080036struct virtio_pci_cap {
37 __u8 cap_vndr;
38 __u8 cap_next;
39 __u8 cap_len;
Christopher Ferris05d08e92016-02-04 13:16:38 -080040 __u8 cfg_type;
41 __u8 bar;
Christopher Ferris32ff3f82020-12-14 13:10:04 -080042 __u8 id;
43 __u8 padding[2];
Christopher Ferris05d08e92016-02-04 13:16:38 -080044 __le32 offset;
Christopher Ferris05d08e92016-02-04 13:16:38 -080045 __le32 length;
46};
Christopher Ferris32ff3f82020-12-14 13:10:04 -080047struct virtio_pci_cap64 {
48 struct virtio_pci_cap cap;
49 __le32 offset_hi;
50 __le32 length_hi;
51};
Christopher Ferris05d08e92016-02-04 13:16:38 -080052struct virtio_pci_notify_cap {
53 struct virtio_pci_cap cap;
Christopher Ferris05d08e92016-02-04 13:16:38 -080054 __le32 notify_off_multiplier;
55};
56struct virtio_pci_common_cfg {
57 __le32 device_feature_select;
Christopher Ferris05d08e92016-02-04 13:16:38 -080058 __le32 device_feature;
59 __le32 guest_feature_select;
60 __le32 guest_feature;
61 __le16 msix_config;
Christopher Ferris05d08e92016-02-04 13:16:38 -080062 __le16 num_queues;
63 __u8 device_status;
64 __u8 config_generation;
65 __le16 queue_select;
Christopher Ferris05d08e92016-02-04 13:16:38 -080066 __le16 queue_size;
67 __le16 queue_msix_vector;
68 __le16 queue_enable;
69 __le16 queue_notify_off;
Christopher Ferris05d08e92016-02-04 13:16:38 -080070 __le32 queue_desc_lo;
71 __le32 queue_desc_hi;
72 __le32 queue_avail_lo;
73 __le32 queue_avail_hi;
Christopher Ferris05d08e92016-02-04 13:16:38 -080074 __le32 queue_used_lo;
75 __le32 queue_used_hi;
76};
77struct virtio_pci_cfg_cap {
Christopher Ferris05d08e92016-02-04 13:16:38 -080078 struct virtio_pci_cap cap;
79 __u8 pci_cfg_data[4];
80};
81#define VIRTIO_PCI_CAP_VNDR 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080082#define VIRTIO_PCI_CAP_NEXT 1
83#define VIRTIO_PCI_CAP_LEN 2
84#define VIRTIO_PCI_CAP_CFG_TYPE 3
85#define VIRTIO_PCI_CAP_BAR 4
Christopher Ferris05d08e92016-02-04 13:16:38 -080086#define VIRTIO_PCI_CAP_OFFSET 8
87#define VIRTIO_PCI_CAP_LENGTH 12
88#define VIRTIO_PCI_NOTIFY_CAP_MULT 16
89#define VIRTIO_PCI_COMMON_DFSELECT 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080090#define VIRTIO_PCI_COMMON_DF 4
91#define VIRTIO_PCI_COMMON_GFSELECT 8
92#define VIRTIO_PCI_COMMON_GF 12
93#define VIRTIO_PCI_COMMON_MSIX 16
Christopher Ferris05d08e92016-02-04 13:16:38 -080094#define VIRTIO_PCI_COMMON_NUMQ 18
95#define VIRTIO_PCI_COMMON_STATUS 20
96#define VIRTIO_PCI_COMMON_CFGGENERATION 21
97#define VIRTIO_PCI_COMMON_Q_SELECT 22
Christopher Ferris05d08e92016-02-04 13:16:38 -080098#define VIRTIO_PCI_COMMON_Q_SIZE 24
99#define VIRTIO_PCI_COMMON_Q_MSIX 26
100#define VIRTIO_PCI_COMMON_Q_ENABLE 28
101#define VIRTIO_PCI_COMMON_Q_NOFF 30
Christopher Ferris05d08e92016-02-04 13:16:38 -0800102#define VIRTIO_PCI_COMMON_Q_DESCLO 32
103#define VIRTIO_PCI_COMMON_Q_DESCHI 36
104#define VIRTIO_PCI_COMMON_Q_AVAILLO 40
105#define VIRTIO_PCI_COMMON_Q_AVAILHI 44
Christopher Ferris05d08e92016-02-04 13:16:38 -0800106#define VIRTIO_PCI_COMMON_Q_USEDLO 48
107#define VIRTIO_PCI_COMMON_Q_USEDHI 52
Christopher Ferris7447a1c2022-10-04 18:24:44 -0700108#define VIRTIO_PCI_COMMON_Q_NDATA 56
109#define VIRTIO_PCI_COMMON_Q_RESET 58
Christopher Ferris05d08e92016-02-04 13:16:38 -0800110#endif
111#endif