aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen/interface/io
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/xen/interface/io
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/xen/interface/io')
-rw-r--r--include/xen/interface/io/blkif.h50
-rw-r--r--include/xen/interface/io/netif.h80
-rw-r--r--include/xen/interface/io/pciif.h112
-rw-r--r--include/xen/interface/io/ring.h11
-rw-r--r--include/xen/interface/io/xenbus.h8
5 files changed, 215 insertions, 46 deletions
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index c2d1fa4dc1ee..3d5d6db864fe 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -45,17 +45,26 @@ typedef uint64_t blkif_sector_t;
45#define BLKIF_OP_WRITE_BARRIER 2 45#define BLKIF_OP_WRITE_BARRIER 2
46 46
47/* 47/*
48 * Recognised if "feature-flush-cache" is present in backend xenbus
49 * info. A flush will ask the underlying storage hardware to flush its
50 * non-volatile caches as appropriate. The "feature-flush-cache" node
51 * contains a boolean indicating whether flush requests are likely to
52 * succeed or fail. Either way, a flush request may fail at any time
53 * with BLKIF_RSP_EOPNOTSUPP if it is unsupported by the underlying
54 * block-device hardware. The boolean simply indicates whether or not it
55 * is worthwhile for the frontend to attempt flushes. If a backend does
56 * not recognise BLKIF_OP_WRITE_FLUSH_CACHE, it should *not* create the
57 * "feature-flush-cache" node!
58 */
59#define BLKIF_OP_FLUSH_DISKCACHE 3
60/*
48 * Maximum scatter/gather segments per request. 61 * Maximum scatter/gather segments per request.
49 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE. 62 * This is carefully chosen so that sizeof(struct blkif_ring) <= PAGE_SIZE.
50 * NB. This could be 12 if the ring indexes weren't stored in the same page. 63 * NB. This could be 12 if the ring indexes weren't stored in the same page.
51 */ 64 */
52#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 65#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
53 66
54struct blkif_request { 67struct blkif_request_rw {
55 uint8_t operation; /* BLKIF_OP_??? */
56 uint8_t nr_segments; /* number of segments */
57 blkif_vdev_t handle; /* only for read/write requests */
58 uint64_t id; /* private guest value, echoed in resp */
59 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ 68 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
60 struct blkif_request_segment { 69 struct blkif_request_segment {
61 grant_ref_t gref; /* reference to I/O buffer frame */ 70 grant_ref_t gref; /* reference to I/O buffer frame */
@@ -65,6 +74,16 @@ struct blkif_request {
65 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; 74 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
66}; 75};
67 76
77struct blkif_request {
78 uint8_t operation; /* BLKIF_OP_??? */
79 uint8_t nr_segments; /* number of segments */
80 blkif_vdev_t handle; /* only for read/write requests */
81 uint64_t id; /* private guest value, echoed in resp */
82 union {
83 struct blkif_request_rw rw;
84 } u;
85};
86
68struct blkif_response { 87struct blkif_response {
69 uint64_t id; /* copied from request */ 88 uint64_t id; /* copied from request */
70 uint8_t operation; /* copied from request */ 89 uint8_t operation; /* copied from request */
@@ -91,4 +110,25 @@ DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
91#define VDISK_REMOVABLE 0x2 110#define VDISK_REMOVABLE 0x2
92#define VDISK_READONLY 0x4 111#define VDISK_READONLY 0x4
93 112
113/* Xen-defined major numbers for virtual disks, they look strangely
114 * familiar */
115#define XEN_IDE0_MAJOR 3
116#define XEN_IDE1_MAJOR 22
117#define XEN_SCSI_DISK0_MAJOR 8
118#define XEN_SCSI_DISK1_MAJOR 65
119#define XEN_SCSI_DISK2_MAJOR 66
120#define XEN_SCSI_DISK3_MAJOR 67
121#define XEN_SCSI_DISK4_MAJOR 68
122#define XEN_SCSI_DISK5_MAJOR 69
123#define XEN_SCSI_DISK6_MAJOR 70
124#define XEN_SCSI_DISK7_MAJOR 71
125#define XEN_SCSI_DISK8_MAJOR 128
126#define XEN_SCSI_DISK9_MAJOR 129
127#define XEN_SCSI_DISK10_MAJOR 130
128#define XEN_SCSI_DISK11_MAJOR 131
129#define XEN_SCSI_DISK12_MAJOR 132
130#define XEN_SCSI_DISK13_MAJOR 133
131#define XEN_SCSI_DISK14_MAJOR 134
132#define XEN_SCSI_DISK15_MAJOR 135
133
94#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ 134#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 518481c95f18..cb94668f6e9f 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -22,50 +22,50 @@
22 22
23/* 23/*
24 * This is the 'wire' format for packets: 24 * This is the 'wire' format for packets:
25 * Request 1: netif_tx_request -- NETTXF_* (any flags) 25 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
26 * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info) 26 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info)
27 * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE) 27 * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE)
28 * Request 4: netif_tx_request -- NETTXF_more_data 28 * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data
29 * Request 5: netif_tx_request -- NETTXF_more_data 29 * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data
30 * ... 30 * ...
31 * Request N: netif_tx_request -- 0 31 * Request N: xen_netif_tx_request -- 0
32 */ 32 */
33 33
34/* Protocol checksum field is blank in the packet (hardware offload)? */ 34/* Protocol checksum field is blank in the packet (hardware offload)? */
35#define _NETTXF_csum_blank (0) 35#define _XEN_NETTXF_csum_blank (0)
36#define NETTXF_csum_blank (1U<<_NETTXF_csum_blank) 36#define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank)
37 37
38/* Packet data has been validated against protocol checksum. */ 38/* Packet data has been validated against protocol checksum. */
39#define _NETTXF_data_validated (1) 39#define _XEN_NETTXF_data_validated (1)
40#define NETTXF_data_validated (1U<<_NETTXF_data_validated) 40#define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated)
41 41
42/* Packet continues in the next request descriptor. */ 42/* Packet continues in the next request descriptor. */
43#define _NETTXF_more_data (2) 43#define _XEN_NETTXF_more_data (2)
44#define NETTXF_more_data (1U<<_NETTXF_more_data) 44#define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data)
45 45
46/* Packet to be followed by extra descriptor(s). */ 46/* Packet to be followed by extra descriptor(s). */
47#define _NETTXF_extra_info (3) 47#define _XEN_NETTXF_extra_info (3)
48#define NETTXF_extra_info (1U<<_NETTXF_extra_info) 48#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info)
49 49
50struct xen_netif_tx_request { 50struct xen_netif_tx_request {
51 grant_ref_t gref; /* Reference to buffer page */ 51 grant_ref_t gref; /* Reference to buffer page */
52 uint16_t offset; /* Offset within buffer page */ 52 uint16_t offset; /* Offset within buffer page */
53 uint16_t flags; /* NETTXF_* */ 53 uint16_t flags; /* XEN_NETTXF_* */
54 uint16_t id; /* Echoed in response message. */ 54 uint16_t id; /* Echoed in response message. */
55 uint16_t size; /* Packet size in bytes. */ 55 uint16_t size; /* Packet size in bytes. */
56}; 56};
57 57
58/* Types of netif_extra_info descriptors. */ 58/* Types of xen_netif_extra_info descriptors. */
59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ 59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ 60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
61#define XEN_NETIF_EXTRA_TYPE_MAX (2) 61#define XEN_NETIF_EXTRA_TYPE_MAX (2)
62 62
63/* netif_extra_info flags. */ 63/* xen_netif_extra_info flags. */
64#define _XEN_NETIF_EXTRA_FLAG_MORE (0) 64#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) 65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
66 66
67/* GSO types - only TCPv4 currently supported. */ 67/* GSO types - only TCPv4 currently supported. */
68#define XEN_NETIF_GSO_TYPE_TCPV4 (1) 68#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
69 69
70/* 70/*
71 * This structure needs to fit within both netif_tx_request and 71 * This structure needs to fit within both netif_tx_request and
@@ -107,7 +107,7 @@ struct xen_netif_extra_info {
107 107
108struct xen_netif_tx_response { 108struct xen_netif_tx_response {
109 uint16_t id; 109 uint16_t id;
110 int16_t status; /* NETIF_RSP_* */ 110 int16_t status; /* XEN_NETIF_RSP_* */
111}; 111};
112 112
113struct xen_netif_rx_request { 113struct xen_netif_rx_request {
@@ -116,25 +116,29 @@ struct xen_netif_rx_request {
116}; 116};
117 117
118/* Packet data has been validated against protocol checksum. */ 118/* Packet data has been validated against protocol checksum. */
119#define _NETRXF_data_validated (0) 119#define _XEN_NETRXF_data_validated (0)
120#define NETRXF_data_validated (1U<<_NETRXF_data_validated) 120#define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated)
121 121
122/* Protocol checksum field is blank in the packet (hardware offload)? */ 122/* Protocol checksum field is blank in the packet (hardware offload)? */
123#define _NETRXF_csum_blank (1) 123#define _XEN_NETRXF_csum_blank (1)
124#define NETRXF_csum_blank (1U<<_NETRXF_csum_blank) 124#define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank)
125 125
126/* Packet continues in the next request descriptor. */ 126/* Packet continues in the next request descriptor. */
127#define _NETRXF_more_data (2) 127#define _XEN_NETRXF_more_data (2)
128#define NETRXF_more_data (1U<<_NETRXF_more_data) 128#define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data)
129 129
130/* Packet to be followed by extra descriptor(s). */ 130/* Packet to be followed by extra descriptor(s). */
131#define _NETRXF_extra_info (3) 131#define _XEN_NETRXF_extra_info (3)
132#define NETRXF_extra_info (1U<<_NETRXF_extra_info) 132#define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info)
133
134/* GSO Prefix descriptor. */
135#define _XEN_NETRXF_gso_prefix (4)
136#define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix)
133 137
134struct xen_netif_rx_response { 138struct xen_netif_rx_response {
135 uint16_t id; 139 uint16_t id;
136 uint16_t offset; /* Offset in page of start of received packet */ 140 uint16_t offset; /* Offset in page of start of received packet */
137 uint16_t flags; /* NETRXF_* */ 141 uint16_t flags; /* XEN_NETRXF_* */
138 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ 142 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
139}; 143};
140 144
@@ -149,10 +153,10 @@ DEFINE_RING_TYPES(xen_netif_rx,
149 struct xen_netif_rx_request, 153 struct xen_netif_rx_request,
150 struct xen_netif_rx_response); 154 struct xen_netif_rx_response);
151 155
152#define NETIF_RSP_DROPPED -2 156#define XEN_NETIF_RSP_DROPPED -2
153#define NETIF_RSP_ERROR -1 157#define XEN_NETIF_RSP_ERROR -1
154#define NETIF_RSP_OKAY 0 158#define XEN_NETIF_RSP_OKAY 0
155/* No response: used for auxiliary requests (e.g., netif_tx_extra). */ 159/* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */
156#define NETIF_RSP_NULL 1 160#define XEN_NETIF_RSP_NULL 1
157 161
158#endif 162#endif
diff --git a/include/xen/interface/io/pciif.h b/include/xen/interface/io/pciif.h
new file mode 100644
index 000000000000..d9922ae36eb5
--- /dev/null
+++ b/include/xen/interface/io/pciif.h
@@ -0,0 +1,112 @@
1/*
2 * PCI Backend/Frontend Common Data Structures & Macros
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
23 */
24#ifndef __XEN_PCI_COMMON_H__
25#define __XEN_PCI_COMMON_H__
26
27/* Be sure to bump this number if you change this file */
28#define XEN_PCI_MAGIC "7"
29
30/* xen_pci_sharedinfo flags */
31#define _XEN_PCIF_active (0)
32#define XEN_PCIF_active (1<<_XEN_PCIF_active)
33#define _XEN_PCIB_AERHANDLER (1)
34#define XEN_PCIB_AERHANDLER (1<<_XEN_PCIB_AERHANDLER)
35#define _XEN_PCIB_active (2)
36#define XEN_PCIB_active (1<<_XEN_PCIB_active)
37
38/* xen_pci_op commands */
39#define XEN_PCI_OP_conf_read (0)
40#define XEN_PCI_OP_conf_write (1)
41#define XEN_PCI_OP_enable_msi (2)
42#define XEN_PCI_OP_disable_msi (3)
43#define XEN_PCI_OP_enable_msix (4)
44#define XEN_PCI_OP_disable_msix (5)
45#define XEN_PCI_OP_aer_detected (6)
46#define XEN_PCI_OP_aer_resume (7)
47#define XEN_PCI_OP_aer_mmio (8)
48#define XEN_PCI_OP_aer_slotreset (9)
49
50/* xen_pci_op error numbers */
51#define XEN_PCI_ERR_success (0)
52#define XEN_PCI_ERR_dev_not_found (-1)
53#define XEN_PCI_ERR_invalid_offset (-2)
54#define XEN_PCI_ERR_access_denied (-3)
55#define XEN_PCI_ERR_not_implemented (-4)
56/* XEN_PCI_ERR_op_failed - backend failed to complete the operation */
57#define XEN_PCI_ERR_op_failed (-5)
58
59/*
60 * it should be PAGE_SIZE-sizeof(struct xen_pci_op))/sizeof(struct msix_entry))
61 * Should not exceed 128
62 */
63#define SH_INFO_MAX_VEC 128
64
65struct xen_msix_entry {
66 uint16_t vector;
67 uint16_t entry;
68};
69struct xen_pci_op {
70 /* IN: what action to perform: XEN_PCI_OP_* */
71 uint32_t cmd;
72
73 /* OUT: will contain an error number (if any) from errno.h */
74 int32_t err;
75
76 /* IN: which device to touch */
77 uint32_t domain; /* PCI Domain/Segment */
78 uint32_t bus;
79 uint32_t devfn;
80
81 /* IN: which configuration registers to touch */
82 int32_t offset;
83 int32_t size;
84
85 /* IN/OUT: Contains the result after a READ or the value to WRITE */
86 uint32_t value;
87 /* IN: Contains extra infor for this operation */
88 uint32_t info;
89 /*IN: param for msi-x */
90 struct xen_msix_entry msix_entries[SH_INFO_MAX_VEC];
91};
92
93/*used for pcie aer handling*/
94struct xen_pcie_aer_op {
95 /* IN: what action to perform: XEN_PCI_OP_* */
96 uint32_t cmd;
97 /*IN/OUT: return aer_op result or carry error_detected state as input*/
98 int32_t err;
99
100 /* IN: which device to touch */
101 uint32_t domain; /* PCI Domain/Segment*/
102 uint32_t bus;
103 uint32_t devfn;
104};
105struct xen_pci_sharedinfo {
106 /* flags - XEN_PCIF_* */
107 uint32_t flags;
108 struct xen_pci_op op;
109 struct xen_pcie_aer_op aer_op;
110};
111
112#endif /* __XEN_PCI_COMMON_H__ */
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h
index e8cbf431c8cc..75271b9a8f61 100644
--- a/include/xen/interface/io/ring.h
+++ b/include/xen/interface/io/ring.h
@@ -24,8 +24,15 @@ typedef unsigned int RING_IDX;
24 * A ring contains as many entries as will fit, rounded down to the nearest 24 * A ring contains as many entries as will fit, rounded down to the nearest
25 * power of two (so we can mask with (size-1) to loop around). 25 * power of two (so we can mask with (size-1) to loop around).
26 */ 26 */
27#define __RING_SIZE(_s, _sz) \ 27#define __CONST_RING_SIZE(_s, _sz) \
28 (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]))) 28 (__RD32(((_sz) - offsetof(struct _s##_sring, ring)) / \
29 sizeof(((struct _s##_sring *)0)->ring[0])))
30
31/*
32 * The same for passing in an actual pointer instead of a name tag.
33 */
34#define __RING_SIZE(_s, _sz) \
35 (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
29 36
30/* 37/*
31 * Macros to make the correct C datatypes for a new kind of ring. 38 * Macros to make the correct C datatypes for a new kind of ring.
diff --git a/include/xen/interface/io/xenbus.h b/include/xen/interface/io/xenbus.h
index 46508c7fa399..9fda532973a5 100644
--- a/include/xen/interface/io/xenbus.h
+++ b/include/xen/interface/io/xenbus.h
@@ -27,8 +27,14 @@ enum xenbus_state
27 XenbusStateClosing = 5, /* The device is being closed 27 XenbusStateClosing = 5, /* The device is being closed
28 due to an error or an unplug 28 due to an error or an unplug
29 event. */ 29 event. */
30 XenbusStateClosed = 6 30 XenbusStateClosed = 6,
31 31
32 /*
33 * Reconfiguring: The device is being reconfigured.
34 */
35 XenbusStateReconfiguring = 7,
36
37 XenbusStateReconfigured = 8
32}; 38};
33 39
34#endif /* _XEN_PUBLIC_IO_XENBUS_H */ 40#endif /* _XEN_PUBLIC_IO_XENBUS_H */