blob: 2258607a98f19be4c552ffb37c9ba392e7072db1 [file] [log] [blame]
Nick Kralevicha67e4de2013-01-14 11:28:26 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
Ben Cheng655a7c02013-10-16 16:09:24 -070019#ifndef _LINUX_VIRTIO_PCI_H
20#define _LINUX_VIRTIO_PCI_H
Christopher Ferris05d08e92016-02-04 13:16:38 -080021#include <linux/types.h>
22#ifndef VIRTIO_PCI_NO_LEGACY
Christopher Ferris05d08e92016-02-04 13:16:38 -080023#define VIRTIO_PCI_HOST_FEATURES 0
Ben Cheng655a7c02013-10-16 16:09:24 -070024#define VIRTIO_PCI_GUEST_FEATURES 4
25#define VIRTIO_PCI_QUEUE_PFN 8
26#define VIRTIO_PCI_QUEUE_NUM 12
Christopher Ferris05d08e92016-02-04 13:16:38 -080027#define VIRTIO_PCI_QUEUE_SEL 14
Ben Cheng655a7c02013-10-16 16:09:24 -070028#define VIRTIO_PCI_QUEUE_NOTIFY 16
29#define VIRTIO_PCI_STATUS 18
30#define VIRTIO_PCI_ISR 19
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define VIRTIO_MSI_CONFIG_VECTOR 20
32#define VIRTIO_MSI_QUEUE_VECTOR 22
Christopher Ferris38062f92014-07-09 15:33:25 -070033#define VIRTIO_PCI_CONFIG_OFF(msix_enabled) ((msix_enabled) ? 24 : 20)
Christopher Ferris38062f92014-07-09 15:33:25 -070034#define VIRTIO_PCI_CONFIG(dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define VIRTIO_PCI_ABI_VERSION 0
36#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
37#define VIRTIO_PCI_VRING_ALIGN 4096
Christopher Ferris38062f92014-07-09 15:33:25 -070038#endif
Christopher Ferris05d08e92016-02-04 13:16:38 -080039#define VIRTIO_PCI_ISR_CONFIG 0x2
40#define VIRTIO_MSI_NO_VECTOR 0xffff
41#ifndef VIRTIO_PCI_NO_MODERN
42#define VIRTIO_PCI_CAP_COMMON_CFG 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080043#define VIRTIO_PCI_CAP_NOTIFY_CFG 2
44#define VIRTIO_PCI_CAP_ISR_CFG 3
45#define VIRTIO_PCI_CAP_DEVICE_CFG 4
46#define VIRTIO_PCI_CAP_PCI_CFG 5
Christopher Ferris05d08e92016-02-04 13:16:38 -080047struct virtio_pci_cap {
48 __u8 cap_vndr;
49 __u8 cap_next;
50 __u8 cap_len;
Christopher Ferris05d08e92016-02-04 13:16:38 -080051 __u8 cfg_type;
52 __u8 bar;
53 __u8 padding[3];
54 __le32 offset;
Christopher Ferris05d08e92016-02-04 13:16:38 -080055 __le32 length;
56};
57struct virtio_pci_notify_cap {
58 struct virtio_pci_cap cap;
Christopher Ferris05d08e92016-02-04 13:16:38 -080059 __le32 notify_off_multiplier;
60};
61struct virtio_pci_common_cfg {
62 __le32 device_feature_select;
Christopher Ferris05d08e92016-02-04 13:16:38 -080063 __le32 device_feature;
64 __le32 guest_feature_select;
65 __le32 guest_feature;
66 __le16 msix_config;
Christopher Ferris05d08e92016-02-04 13:16:38 -080067 __le16 num_queues;
68 __u8 device_status;
69 __u8 config_generation;
70 __le16 queue_select;
Christopher Ferris05d08e92016-02-04 13:16:38 -080071 __le16 queue_size;
72 __le16 queue_msix_vector;
73 __le16 queue_enable;
74 __le16 queue_notify_off;
Christopher Ferris05d08e92016-02-04 13:16:38 -080075 __le32 queue_desc_lo;
76 __le32 queue_desc_hi;
77 __le32 queue_avail_lo;
78 __le32 queue_avail_hi;
Christopher Ferris05d08e92016-02-04 13:16:38 -080079 __le32 queue_used_lo;
80 __le32 queue_used_hi;
81};
82struct virtio_pci_cfg_cap {
Christopher Ferris05d08e92016-02-04 13:16:38 -080083 struct virtio_pci_cap cap;
84 __u8 pci_cfg_data[4];
85};
86#define VIRTIO_PCI_CAP_VNDR 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080087#define VIRTIO_PCI_CAP_NEXT 1
88#define VIRTIO_PCI_CAP_LEN 2
89#define VIRTIO_PCI_CAP_CFG_TYPE 3
90#define VIRTIO_PCI_CAP_BAR 4
Christopher Ferris05d08e92016-02-04 13:16:38 -080091#define VIRTIO_PCI_CAP_OFFSET 8
92#define VIRTIO_PCI_CAP_LENGTH 12
93#define VIRTIO_PCI_NOTIFY_CAP_MULT 16
94#define VIRTIO_PCI_COMMON_DFSELECT 0
Christopher Ferris05d08e92016-02-04 13:16:38 -080095#define VIRTIO_PCI_COMMON_DF 4
96#define VIRTIO_PCI_COMMON_GFSELECT 8
97#define VIRTIO_PCI_COMMON_GF 12
98#define VIRTIO_PCI_COMMON_MSIX 16
Christopher Ferris05d08e92016-02-04 13:16:38 -080099#define VIRTIO_PCI_COMMON_NUMQ 18
100#define VIRTIO_PCI_COMMON_STATUS 20
101#define VIRTIO_PCI_COMMON_CFGGENERATION 21
102#define VIRTIO_PCI_COMMON_Q_SELECT 22
Christopher Ferris05d08e92016-02-04 13:16:38 -0800103#define VIRTIO_PCI_COMMON_Q_SIZE 24
104#define VIRTIO_PCI_COMMON_Q_MSIX 26
105#define VIRTIO_PCI_COMMON_Q_ENABLE 28
106#define VIRTIO_PCI_COMMON_Q_NOFF 30
Christopher Ferris05d08e92016-02-04 13:16:38 -0800107#define VIRTIO_PCI_COMMON_Q_DESCLO 32
108#define VIRTIO_PCI_COMMON_Q_DESCHI 36
109#define VIRTIO_PCI_COMMON_Q_AVAILLO 40
110#define VIRTIO_PCI_COMMON_Q_AVAILHI 44
Christopher Ferris05d08e92016-02-04 13:16:38 -0800111#define VIRTIO_PCI_COMMON_Q_USEDLO 48
112#define VIRTIO_PCI_COMMON_Q_USEDHI 52
113#endif
114#endif