direct-io.hg

view xen/include/public/io/domain_controller.h @ 5649:fc4e10d0455a

Avoid repeated #define's in public headers.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Jul 02 22:37:55 2005 +0000 (2005-07-02)
parents 2b6c1a809807
children 287583627544
line source
1 /******************************************************************************
2 * domain_controller.h
3 *
4 * Interface to server controller (e.g., 'xend'). This header file defines the
5 * interface that is shared with guest OSes.
6 *
7 * Copyright (c) 2004, K A Fraser
8 */
10 #ifndef __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__
11 #define __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__
13 #include "ring.h"
15 /*
16 * CONTROLLER MESSAGING INTERFACE.
17 */
19 typedef struct control_msg {
20 u8 type; /* 0: echoed in response */
21 u8 subtype; /* 1: echoed in response */
22 u8 id; /* 2: echoed in response */
23 u8 length; /* 3: number of bytes in 'msg' */
24 u8 msg[60]; /* 4: type-specific message data */
25 } control_msg_t; /* 64 bytes */
27 /* These are used by the control message deferred ring. */
28 #define CONTROL_RING_SIZE 8
29 typedef u32 CONTROL_RING_IDX;
30 #define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
32 /*
33 * Generate control ring structures and types.
34 *
35 * CONTROL_RING_MEM is currently an 8-slot ring of ctrl_msg_t structs and
36 * two 32-bit counters: (64 * 8) + (2 * 4) = 520
37 */
38 #define CONTROL_RING_MEM 520
39 DEFINE_RING_TYPES(ctrl, control_msg_t, control_msg_t);
41 typedef struct control_if {
42 union {
43 ctrl_sring_t tx_ring; /* guest -> controller */
44 char __x[CONTROL_RING_MEM];
45 };
46 union {
47 ctrl_sring_t rx_ring; /* controller -> guest */
48 char __y[CONTROL_RING_MEM];
49 };
50 } control_if_t;
52 /*
53 * Top-level command types.
54 */
55 #define CMSG_CONSOLE 0 /* Console */
56 #define CMSG_BLKIF_BE 1 /* Block-device backend */
57 #define CMSG_BLKIF_FE 2 /* Block-device frontend */
58 #define CMSG_NETIF_BE 3 /* Network-device backend */
59 #define CMSG_NETIF_FE 4 /* Network-device frontend */
60 #define CMSG_SHUTDOWN 6 /* Shutdown messages */
61 #define CMSG_MEM_REQUEST 7 /* Memory reservation reqs */
62 #define CMSG_USBIF_BE 8 /* USB controller backend */
63 #define CMSG_USBIF_FE 9 /* USB controller frontend */
64 #define CMSG_VCPU_HOTPLUG 10 /* Hotplug VCPU messages */
65 #define CMSG_DEBUG 11 /* PDB backend */
67 /******************************************************************************
68 * CONSOLE DEFINITIONS
69 */
71 /*
72 * Subtypes for console messages.
73 */
74 #define CMSG_CONSOLE_DATA 0
77 /******************************************************************************
78 * BLOCK-INTERFACE FRONTEND DEFINITIONS
79 */
81 /* Messages from domain controller to guest. */
82 #define CMSG_BLKIF_FE_INTERFACE_STATUS 0
84 /* Messages from guest to domain controller. */
85 #define CMSG_BLKIF_FE_DRIVER_STATUS 32
86 #define CMSG_BLKIF_FE_INTERFACE_CONNECT 33
87 #define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34
88 #define CMSG_BLKIF_FE_INTERFACE_QUERY 35
90 #ifndef blkif_vdev_t
91 #define blkif_vdev_t u16
92 #endif
93 #define blkif_pdev_t u32
95 /*
96 * CMSG_BLKIF_FE_INTERFACE_STATUS:
97 * Notify a guest about a status change on one of its block interfaces.
98 * If the interface is DESTROYED or DOWN then the interface is disconnected:
99 * 1. The shared-memory frame is available for reuse.
100 * 2. Any unacknowledged messages pending on the interface were dropped.
101 */
102 #define BLKIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
103 #define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
104 #define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
105 #define BLKIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
106 typedef struct blkif_fe_interface_status {
107 u32 handle;
108 u32 status;
109 u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
110 domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */
111 } blkif_fe_interface_status_t;
113 /*
114 * CMSG_BLKIF_FE_DRIVER_STATUS:
115 * Notify the domain controller that the front-end driver is DOWN or UP.
116 * When the driver goes DOWN then the controller will send no more
117 * status-change notifications.
118 * If the driver goes DOWN while interfaces are still UP, the domain
119 * will automatically take the interfaces DOWN.
120 *
121 * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
122 * for interfaces that are active when it receives an UP notification. We
123 * expect that the frontend driver will query those interfaces itself.
124 */
125 #define BLKIF_DRIVER_STATUS_DOWN 0
126 #define BLKIF_DRIVER_STATUS_UP 1
127 typedef struct blkif_fe_driver_status {
128 /* IN */
129 u32 status; /* BLKIF_DRIVER_STATUS_??? */
130 /* OUT */
131 /* Driver should query interfaces [0..max_handle]. */
132 u32 max_handle;
133 } blkif_fe_driver_status_t;
135 /*
136 * CMSG_BLKIF_FE_INTERFACE_CONNECT:
137 * If successful, the domain controller will acknowledge with a
138 * STATUS_CONNECTED message.
139 */
140 typedef struct blkif_fe_interface_connect {
141 u32 handle;
142 memory_t shmem_frame;
143 } blkif_fe_interface_connect_t;
145 /*
146 * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
147 * If successful, the domain controller will acknowledge with a
148 * STATUS_DISCONNECTED message.
149 */
150 typedef struct blkif_fe_interface_disconnect {
151 u32 handle;
152 } blkif_fe_interface_disconnect_t;
154 /*
155 * CMSG_BLKIF_FE_INTERFACE_QUERY:
156 */
157 typedef struct blkif_fe_interface_query {
158 /* IN */
159 u32 handle;
160 /* OUT */
161 u32 status;
162 u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
163 domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */
164 } blkif_fe_interface_query_t;
167 /******************************************************************************
168 * BLOCK-INTERFACE BACKEND DEFINITIONS
169 */
171 /* Messages from domain controller. */
172 #define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */
173 #define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */
174 #define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
175 #define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
176 #define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */
177 #define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */
179 /* Messages to domain controller. */
180 #define CMSG_BLKIF_BE_DRIVER_STATUS 32
182 /*
183 * Message request/response definitions for block-device messages.
184 */
186 /* Non-specific 'okay' return. */
187 #define BLKIF_BE_STATUS_OKAY 0
188 /* Non-specific 'error' return. */
189 #define BLKIF_BE_STATUS_ERROR 1
190 /* The following are specific error returns. */
191 #define BLKIF_BE_STATUS_INTERFACE_EXISTS 2
192 #define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
193 #define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
194 #define BLKIF_BE_STATUS_VBD_EXISTS 5
195 #define BLKIF_BE_STATUS_VBD_NOT_FOUND 6
196 #define BLKIF_BE_STATUS_OUT_OF_MEMORY 7
197 #define BLKIF_BE_STATUS_PHYSDEV_NOT_FOUND 8
198 #define BLKIF_BE_STATUS_MAPPING_ERROR 9
200 /* This macro can be used to create an array of descriptive error strings. */
201 #define BLKIF_BE_STATUS_ERRORS { \
202 "Okay", \
203 "Non-specific error", \
204 "Interface already exists", \
205 "Interface not found", \
206 "Interface is still connected", \
207 "VBD already exists", \
208 "VBD not found", \
209 "Out of memory", \
210 "Extent not found for VBD", \
211 "Could not map domain memory" }
213 /*
214 * CMSG_BLKIF_BE_CREATE:
215 * When the driver sends a successful response then the interface is fully
216 * created. The controller will send a DOWN notification to the front-end
217 * driver.
218 */
219 typedef struct blkif_be_create {
220 /* IN */
221 domid_t domid; /* Domain attached to new interface. */
222 u32 blkif_handle; /* Domain-specific interface handle. */
223 /* OUT */
224 u32 status;
225 } blkif_be_create_t;
227 /*
228 * CMSG_BLKIF_BE_DESTROY:
229 * When the driver sends a successful response then the interface is fully
230 * torn down. The controller will send a DESTROYED notification to the
231 * front-end driver.
232 */
233 typedef struct blkif_be_destroy {
234 /* IN */
235 domid_t domid; /* Identify interface to be destroyed. */
236 u32 blkif_handle; /* ...ditto... */
237 /* OUT */
238 u32 status;
239 } blkif_be_destroy_t;
241 /*
242 * CMSG_BLKIF_BE_CONNECT:
243 * When the driver sends a successful response then the interface is fully
244 * connected. The controller will send a CONNECTED notification to the
245 * front-end driver.
246 */
247 typedef struct blkif_be_connect {
248 /* IN */
249 domid_t domid; /* Domain attached to new interface. */
250 u32 blkif_handle; /* Domain-specific interface handle. */
251 memory_t shmem_frame; /* Page cont. shared comms window. */
252 u32 evtchn; /* Event channel for notifications. */
253 /* OUT */
254 u32 status;
255 } blkif_be_connect_t;
257 /*
258 * CMSG_BLKIF_BE_DISCONNECT:
259 * When the driver sends a successful response then the interface is fully
260 * disconnected. The controller will send a DOWN notification to the front-end
261 * driver.
262 */
263 typedef struct blkif_be_disconnect {
264 /* IN */
265 domid_t domid; /* Domain attached to new interface. */
266 u32 blkif_handle; /* Domain-specific interface handle. */
267 /* OUT */
268 u32 status;
269 } blkif_be_disconnect_t;
271 /* CMSG_BLKIF_BE_VBD_CREATE */
272 typedef struct blkif_be_vbd_create {
273 /* IN */
274 domid_t domid; /* Identify blkdev interface. */
275 u32 blkif_handle; /* ...ditto... */
276 blkif_pdev_t pdevice;
277 u32 dev_handle; /* Extended device id field. */
278 blkif_vdev_t vdevice; /* Interface-specific id for this VBD. */
279 u16 readonly; /* Non-zero -> VBD isn't writable. */
280 /* OUT */
281 u32 status;
282 } blkif_be_vbd_create_t;
284 /* CMSG_BLKIF_BE_VBD_DESTROY */
285 typedef struct blkif_be_vbd_destroy {
286 /* IN */
287 domid_t domid; /* Identify blkdev interface. */
288 u32 blkif_handle; /* ...ditto... */
289 blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */
290 /* OUT */
291 u32 status;
292 } blkif_be_vbd_destroy_t;
294 /*
295 * CMSG_BLKIF_BE_DRIVER_STATUS:
296 * Notify the domain controller that the back-end driver is DOWN or UP.
297 * If the driver goes DOWN while interfaces are still UP, the controller
298 * will automatically send DOWN notifications.
299 */
300 typedef struct blkif_be_driver_status {
301 u32 status; /* BLKIF_DRIVER_STATUS_??? */
302 } blkif_be_driver_status_t;
305 /******************************************************************************
306 * NETWORK-INTERFACE FRONTEND DEFINITIONS
307 */
309 /* Messages from domain controller to guest. */
310 #define CMSG_NETIF_FE_INTERFACE_STATUS 0
312 /* Messages from guest to domain controller. */
313 #define CMSG_NETIF_FE_DRIVER_STATUS 32
314 #define CMSG_NETIF_FE_INTERFACE_CONNECT 33
315 #define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34
316 #define CMSG_NETIF_FE_INTERFACE_QUERY 35
318 /*
319 * CMSG_NETIF_FE_INTERFACE_STATUS:
320 * Notify a guest about a status change on one of its network interfaces.
321 * If the interface is CLOSED or DOWN then the interface is disconnected:
322 * 1. The shared-memory frame is available for reuse.
323 * 2. Any unacknowledged messgaes pending on the interface were dropped.
324 */
325 #define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
326 #define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
327 #define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
328 #define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
329 typedef struct netif_fe_interface_status {
330 u32 handle;
331 u32 status;
332 u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
333 u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
334 domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */
335 } netif_fe_interface_status_t;
337 /*
338 * CMSG_NETIF_FE_DRIVER_STATUS:
339 * Notify the domain controller that the front-end driver is DOWN or UP.
340 * When the driver goes DOWN then the controller will send no more
341 * status-change notifications.
342 * If the driver goes DOWN while interfaces are still UP, the domain
343 * will automatically take the interfaces DOWN.
344 *
345 * NB. The controller should not send an INTERFACE_STATUS message
346 * for interfaces that are active when it receives an UP notification. We
347 * expect that the frontend driver will query those interfaces itself.
348 */
349 #define NETIF_DRIVER_STATUS_DOWN 0
350 #define NETIF_DRIVER_STATUS_UP 1
351 typedef struct netif_fe_driver_status {
352 /* IN */
353 u32 status; /* NETIF_DRIVER_STATUS_??? */
354 /* OUT */
355 /* Driver should query interfaces [0..max_handle]. */
356 u32 max_handle;
357 } netif_fe_driver_status_t;
359 /*
360 * CMSG_NETIF_FE_INTERFACE_CONNECT:
361 * If successful, the domain controller will acknowledge with a
362 * STATUS_CONNECTED message.
363 */
364 typedef struct netif_fe_interface_connect {
365 u32 handle;
366 memory_t tx_shmem_frame;
367 memory_t rx_shmem_frame;
368 } netif_fe_interface_connect_t;
370 /*
371 * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
372 * If successful, the domain controller will acknowledge with a
373 * STATUS_DISCONNECTED message.
374 */
375 typedef struct netif_fe_interface_disconnect {
376 u32 handle;
377 } netif_fe_interface_disconnect_t;
379 /*
380 * CMSG_NETIF_FE_INTERFACE_QUERY:
381 */
382 typedef struct netif_fe_interface_query {
383 /* IN */
384 u32 handle;
385 /* OUT */
386 u32 status;
387 u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
388 u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
389 domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */
390 } netif_fe_interface_query_t;
393 /******************************************************************************
394 * NETWORK-INTERFACE BACKEND DEFINITIONS
395 */
397 /* Messages from domain controller. */
398 #define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
399 #define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
400 #define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
401 #define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
402 #define CMSG_NETIF_BE_CREDITLIMIT 4 /* Limit i/f to a given credit limit. */
404 /* Messages to domain controller. */
405 #define CMSG_NETIF_BE_DRIVER_STATUS 32
407 /*
408 * Message request/response definitions for net-device messages.
409 */
411 /* Non-specific 'okay' return. */
412 #define NETIF_BE_STATUS_OKAY 0
413 /* Non-specific 'error' return. */
414 #define NETIF_BE_STATUS_ERROR 1
415 /* The following are specific error returns. */
416 #define NETIF_BE_STATUS_INTERFACE_EXISTS 2
417 #define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
418 #define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
419 #define NETIF_BE_STATUS_OUT_OF_MEMORY 5
420 #define NETIF_BE_STATUS_MAPPING_ERROR 6
422 /* This macro can be used to create an array of descriptive error strings. */
423 #define NETIF_BE_STATUS_ERRORS { \
424 "Okay", \
425 "Non-specific error", \
426 "Interface already exists", \
427 "Interface not found", \
428 "Interface is still connected", \
429 "Out of memory", \
430 "Could not map domain memory" }
432 /*
433 * CMSG_NETIF_BE_CREATE:
434 * When the driver sends a successful response then the interface is fully
435 * created. The controller will send a DOWN notification to the front-end
436 * driver.
437 */
438 typedef struct netif_be_create {
439 /* IN */
440 domid_t domid; /* Domain attached to new interface. */
441 u32 netif_handle; /* Domain-specific interface handle. */
442 u8 mac[6];
443 u8 be_mac[6];
444 /* OUT */
445 u32 status;
446 } netif_be_create_t;
448 /*
449 * CMSG_NETIF_BE_DESTROY:
450 * When the driver sends a successful response then the interface is fully
451 * torn down. The controller will send a DESTROYED notification to the
452 * front-end driver.
453 */
454 typedef struct netif_be_destroy {
455 /* IN */
456 domid_t domid; /* Identify interface to be destroyed. */
457 u32 netif_handle; /* ...ditto... */
458 /* OUT */
459 u32 status;
460 } netif_be_destroy_t;
462 /*
463 * CMSG_NETIF_BE_CREDITLIMIT:
464 * Limit a virtual interface to "credit_bytes" bytes per "period_usec"
465 * microseconds.
466 */
467 typedef struct netif_be_creditlimit {
468 /* IN */
469 domid_t domid; /* Domain attached to new interface. */
470 u32 netif_handle; /* Domain-specific interface handle. */
471 u32 credit_bytes; /* Vifs credit of bytes per period. */
472 u32 period_usec; /* Credit replenishment period. */
473 /* OUT */
474 u32 status;
475 } netif_be_creditlimit_t;
477 /*
478 * CMSG_NETIF_BE_CONNECT:
479 * When the driver sends a successful response then the interface is fully
480 * connected. The controller will send a CONNECTED notification to the
481 * front-end driver.
482 */
483 typedef struct netif_be_connect {
484 /* IN */
485 domid_t domid; /* Domain attached to new interface. */
486 u32 netif_handle; /* Domain-specific interface handle. */
487 memory_t tx_shmem_frame; /* Page cont. tx shared comms window. */
488 memory_t rx_shmem_frame; /* Page cont. rx shared comms window. */
489 u16 evtchn; /* Event channel for notifications. */
490 /* OUT */
491 u32 status;
492 } netif_be_connect_t;
494 /*
495 * CMSG_NETIF_BE_DISCONNECT:
496 * When the driver sends a successful response then the interface is fully
497 * disconnected. The controller will send a DOWN notification to the front-end
498 * driver.
499 */
500 typedef struct netif_be_disconnect {
501 /* IN */
502 domid_t domid; /* Domain attached to new interface. */
503 u32 netif_handle; /* Domain-specific interface handle. */
504 /* OUT */
505 u32 status;
506 } netif_be_disconnect_t;
508 /*
509 * CMSG_NETIF_BE_DRIVER_STATUS:
510 * Notify the domain controller that the back-end driver is DOWN or UP.
511 * If the driver goes DOWN while interfaces are still UP, the domain
512 * will automatically send DOWN notifications.
513 */
514 typedef struct netif_be_driver_status {
515 u32 status; /* NETIF_DRIVER_STATUS_??? */
516 } netif_be_driver_status_t;
520 /******************************************************************************
521 * USB-INTERFACE FRONTEND DEFINITIONS
522 */
524 /* Messages from domain controller to guest. */
525 #define CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED 0
527 /* Messages from guest to domain controller. */
528 #define CMSG_USBIF_FE_DRIVER_STATUS_CHANGED 32
529 #define CMSG_USBIF_FE_INTERFACE_CONNECT 33
530 #define CMSG_USBIF_FE_INTERFACE_DISCONNECT 34
531 /*
532 * CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED:
533 * Notify a guest about a status change on one of its block interfaces.
534 * If the interface is DESTROYED or DOWN then the interface is disconnected:
535 * 1. The shared-memory frame is available for reuse.
536 * 2. Any unacknowledged messages pending on the interface were dropped.
537 */
538 #define USBIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */
539 #define USBIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
540 #define USBIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
541 typedef struct usbif_fe_interface_status_changed {
542 u32 status;
543 u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
544 domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */
545 u32 bandwidth;
546 u32 num_ports;
547 } usbif_fe_interface_status_changed_t;
549 /*
550 * CMSG_USBIF_FE_DRIVER_STATUS_CHANGED:
551 * Notify the domain controller that the front-end driver is DOWN or UP.
552 * When the driver goes DOWN then the controller will send no more
553 * status-change notifications.
554 * If the driver goes DOWN while interfaces are still UP, the domain
555 * will automatically take the interfaces DOWN.
556 *
557 * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
558 * for interfaces that are active when it receives an UP notification. We
559 * expect that the frontend driver will query those interfaces itself.
560 */
561 #define USBIF_DRIVER_STATUS_DOWN 0
562 #define USBIF_DRIVER_STATUS_UP 1
563 typedef struct usbif_fe_driver_status_changed {
564 /* IN */
565 u32 status; /* USBIF_DRIVER_STATUS_??? */
566 } usbif_fe_driver_status_changed_t;
568 /*
569 * CMSG_USBIF_FE_INTERFACE_CONNECT:
570 * If successful, the domain controller will acknowledge with a
571 * STATUS_CONNECTED message.
572 */
573 typedef struct usbif_fe_interface_connect {
574 memory_t shmem_frame;
575 } usbif_fe_interface_connect_t;
577 /*
578 * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
579 * If successful, the domain controller will acknowledge with a
580 * STATUS_DISCONNECTED message.
581 */
582 typedef struct usbif_fe_interface_disconnect {
583 } usbif_fe_interface_disconnect_t;
586 /******************************************************************************
587 * USB-INTERFACE BACKEND DEFINITIONS
588 */
590 /* Messages from domain controller. */
591 #define CMSG_USBIF_BE_CREATE 0 /* Create a new block-device interface. */
592 #define CMSG_USBIF_BE_DESTROY 1 /* Destroy a block-device interface. */
593 #define CMSG_USBIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
594 #define CMSG_USBIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
595 #define CMSG_USBIF_BE_CLAIM_PORT 4 /* Claim host port for a domain. */
596 #define CMSG_USBIF_BE_RELEASE_PORT 5 /* Release host port. */
597 /* Messages to domain controller. */
598 #define CMSG_USBIF_BE_DRIVER_STATUS_CHANGED 32
600 /* Non-specific 'okay' return. */
601 #define USBIF_BE_STATUS_OKAY 0
602 /* Non-specific 'error' return. */
603 #define USBIF_BE_STATUS_ERROR 1
604 /* The following are specific error returns. */
605 #define USBIF_BE_STATUS_INTERFACE_EXISTS 2
606 #define USBIF_BE_STATUS_INTERFACE_NOT_FOUND 3
607 #define USBIF_BE_STATUS_INTERFACE_CONNECTED 4
608 #define USBIF_BE_STATUS_OUT_OF_MEMORY 7
609 #define USBIF_BE_STATUS_MAPPING_ERROR 9
611 /* This macro can be used to create an array of descriptive error strings. */
612 #define USBIF_BE_STATUS_ERRORS { \
613 "Okay", \
614 "Non-specific error", \
615 "Interface already exists", \
616 "Interface not found", \
617 "Interface is still connected", \
618 "Out of memory", \
619 "Could not map domain memory" }
621 /*
622 * CMSG_USBIF_BE_CREATE:
623 * When the driver sends a successful response then the interface is fully
624 * created. The controller will send a DOWN notification to the front-end
625 * driver.
626 */
627 typedef struct usbif_be_create {
628 /* IN */
629 domid_t domid; /* Domain attached to new interface. */
630 /* OUT */
631 u32 status;
632 } usbif_be_create_t;
634 /*
635 * CMSG_USBIF_BE_DESTROY:
636 * When the driver sends a successful response then the interface is fully
637 * torn down. The controller will send a DESTROYED notification to the
638 * front-end driver.
639 */
640 typedef struct usbif_be_destroy {
641 /* IN */
642 domid_t domid; /* Identify interface to be destroyed. */
643 /* OUT */
644 u32 status;
645 } usbif_be_destroy_t;
647 /*
648 * CMSG_USBIF_BE_CONNECT:
649 * When the driver sends a successful response then the interface is fully
650 * connected. The controller will send a CONNECTED notification to the
651 * front-end driver.
652 */
653 typedef struct usbif_be_connect {
654 /* IN */
655 domid_t domid; /* Domain attached to new interface. */
656 memory_t shmem_frame; /* Page cont. shared comms window. */
657 u32 evtchn; /* Event channel for notifications. */
658 u32 bandwidth; /* Bandwidth allocated for isoch / int - us
659 * per 1ms frame (ie between 0 and 900 or 800
660 * depending on USB version). */
661 /* OUT */
662 u32 status;
663 } usbif_be_connect_t;
665 /*
666 * CMSG_USBIF_BE_DISCONNECT:
667 * When the driver sends a successful response then the interface is fully
668 * disconnected. The controller will send a DOWN notification to the front-end
669 * driver.
670 */
671 typedef struct usbif_be_disconnect {
672 /* IN */
673 domid_t domid; /* Domain attached to new interface. */
674 /* OUT */
675 u32 status;
676 } usbif_be_disconnect_t;
678 /*
679 * CMSG_USBIF_BE_DRIVER_STATUS_CHANGED:
680 * Notify the domain controller that the back-end driver is DOWN or UP.
681 * If the driver goes DOWN while interfaces are still UP, the controller
682 * will automatically send DOWN notifications.
683 */
684 typedef struct usbif_be_driver_status_changed {
685 u32 status; /* USBIF_DRIVER_STATUS_??? */
686 } usbif_be_driver_status_changed_t;
688 #define USB_PATH_LEN 16
690 /*
691 * CMSG_USBIF_BE_CLAIM_PORT:
692 * Instruct the backend driver to claim any device plugged into the specified
693 * host port and to allow the specified domain to control that port.
694 */
695 typedef struct usbif_be_claim_port {
696 /* IN */
697 domid_t domid; /* which domain */
698 u32 usbif_port; /* port on the virtual root hub */
699 u32 status; /* status of operation */
700 char path[USB_PATH_LEN]; /* Currently specified in the Linux style - may need to be
701 * converted to some OS-independent format at some stage. */
702 } usbif_be_claim_port_t;
704 /*
705 * CMSG_USBIF_BE_RELEASE_PORT:
706 * Instruct the backend driver to release any device plugged into the specified
707 * host port.
708 */
709 typedef struct usbif_be_release_port {
710 char path[USB_PATH_LEN];
711 } usbif_be_release_port_t;
713 /******************************************************************************
714 * SHUTDOWN DEFINITIONS
715 */
717 /*
718 * Subtypes for shutdown messages.
719 */
720 #define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
721 #define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
722 #define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
723 /* SHUTDOWN_suspend. */
724 #define CMSG_SHUTDOWN_SYSRQ 3
726 typedef struct shutdown_sysrq {
727 char key; /* sysrq key */
728 } shutdown_sysrq_t;
730 /******************************************************************************
731 * VCPU HOTPLUG CONTROLS
732 */
734 /*
735 * Subtypes for shutdown messages.
736 */
737 #define CMSG_VCPU_HOTPLUG_OFF 0 /* turn vcpu off */
738 #define CMSG_VCPU_HOTPLUG_ON 1 /* turn vcpu on */
740 /*
741 * CMSG_VCPU_HOTPLUG:
742 * Indicate which vcpu's state should change
743 */
744 typedef struct vcpu_hotplug {
745 u32 vcpu; /* VCPU's whose state will change */
746 u32 status; /* Return code indicates success or failure. */
747 } vcpu_hotplug_t;
749 /******************************************************************************
750 * MEMORY CONTROLS
751 */
753 #define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
755 /*
756 * CMSG_MEM_REQUEST:
757 * Request that the domain change its memory reservation.
758 */
759 typedef struct mem_request {
760 /* OUT */
761 u32 target; /* Target memory reservation in pages. */
762 /* IN */
763 u32 status; /* Return code indicates success or failure. */
764 } mem_request_t;
767 /******************************************************************************
768 * PDB INTERFACE DEFINITIONS
769 */
771 #define CMSG_DEBUG_CONNECTION_STATUS 0
772 typedef struct pdb_Connection {
773 #define PDB_CONNECTION_STATUS_UP 1
774 #define PDB_CONNECTION_STATUS_DOWN 2
775 u32 status;
776 memory_t ring; /* status: UP */
777 u32 evtchn; /* status: UP */
778 } pdb_connection_t, *pdb_connection_p;
780 #endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */