ia64/xen-unstable

view xen/include/public/io/domain_controller.h @ 5708:49a00af50777

Make structs non-empty.
author kaf24@firebug.cl.cam.ac.uk
date Sat Jul 09 10:01:49 2005 +0000 (2005-07-09)
parents 287583627544
children 215d8b2f3d94
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 int shmem_ref;
144 } blkif_fe_interface_connect_t;
146 /*
147 * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
148 * If successful, the domain controller will acknowledge with a
149 * STATUS_DISCONNECTED message.
150 */
151 typedef struct blkif_fe_interface_disconnect {
152 u32 handle;
153 } blkif_fe_interface_disconnect_t;
155 /*
156 * CMSG_BLKIF_FE_INTERFACE_QUERY:
157 */
158 typedef struct blkif_fe_interface_query {
159 /* IN */
160 u32 handle;
161 /* OUT */
162 u32 status;
163 u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
164 domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */
165 } blkif_fe_interface_query_t;
168 /******************************************************************************
169 * BLOCK-INTERFACE BACKEND DEFINITIONS
170 */
172 /* Messages from domain controller. */
173 #define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */
174 #define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */
175 #define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
176 #define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
177 #define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */
178 #define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */
180 /* Messages to domain controller. */
181 #define CMSG_BLKIF_BE_DRIVER_STATUS 32
183 /*
184 * Message request/response definitions for block-device messages.
185 */
187 /* Non-specific 'okay' return. */
188 #define BLKIF_BE_STATUS_OKAY 0
189 /* Non-specific 'error' return. */
190 #define BLKIF_BE_STATUS_ERROR 1
191 /* The following are specific error returns. */
192 #define BLKIF_BE_STATUS_INTERFACE_EXISTS 2
193 #define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
194 #define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
195 #define BLKIF_BE_STATUS_VBD_EXISTS 5
196 #define BLKIF_BE_STATUS_VBD_NOT_FOUND 6
197 #define BLKIF_BE_STATUS_OUT_OF_MEMORY 7
198 #define BLKIF_BE_STATUS_PHYSDEV_NOT_FOUND 8
199 #define BLKIF_BE_STATUS_MAPPING_ERROR 9
201 /* This macro can be used to create an array of descriptive error strings. */
202 #define BLKIF_BE_STATUS_ERRORS { \
203 "Okay", \
204 "Non-specific error", \
205 "Interface already exists", \
206 "Interface not found", \
207 "Interface is still connected", \
208 "VBD already exists", \
209 "VBD not found", \
210 "Out of memory", \
211 "Extent not found for VBD", \
212 "Could not map domain memory" }
214 /*
215 * CMSG_BLKIF_BE_CREATE:
216 * When the driver sends a successful response then the interface is fully
217 * created. The controller will send a DOWN notification to the front-end
218 * driver.
219 */
220 typedef struct blkif_be_create {
221 /* IN */
222 domid_t domid; /* Domain attached to new interface. */
223 u32 blkif_handle; /* Domain-specific interface handle. */
224 /* OUT */
225 u32 status;
226 } blkif_be_create_t;
228 /*
229 * CMSG_BLKIF_BE_DESTROY:
230 * When the driver sends a successful response then the interface is fully
231 * torn down. The controller will send a DESTROYED notification to the
232 * front-end driver.
233 */
234 typedef struct blkif_be_destroy {
235 /* IN */
236 domid_t domid; /* Identify interface to be destroyed. */
237 u32 blkif_handle; /* ...ditto... */
238 /* OUT */
239 u32 status;
240 } blkif_be_destroy_t;
242 /*
243 * CMSG_BLKIF_BE_CONNECT:
244 * When the driver sends a successful response then the interface is fully
245 * connected. The controller will send a CONNECTED notification to the
246 * front-end driver.
247 */
248 typedef struct blkif_be_connect {
249 /* IN */
250 domid_t domid; /* Domain attached to new interface. */
251 u32 blkif_handle; /* Domain-specific interface handle. */
252 memory_t shmem_frame; /* Page cont. shared comms window. */
253 int shmem_ref; /* Grant table reference. */
254 u32 evtchn; /* Event channel for notifications. */
255 /* OUT */
256 u32 status;
257 } blkif_be_connect_t;
259 /*
260 * CMSG_BLKIF_BE_DISCONNECT:
261 * When the driver sends a successful response then the interface is fully
262 * disconnected. The controller will send a DOWN notification to the front-end
263 * driver.
264 */
265 typedef struct blkif_be_disconnect {
266 /* IN */
267 domid_t domid; /* Domain attached to new interface. */
268 u32 blkif_handle; /* Domain-specific interface handle. */
269 /* OUT */
270 u32 status;
271 } blkif_be_disconnect_t;
273 /* CMSG_BLKIF_BE_VBD_CREATE */
274 typedef struct blkif_be_vbd_create {
275 /* IN */
276 domid_t domid; /* Identify blkdev interface. */
277 u32 blkif_handle; /* ...ditto... */
278 blkif_pdev_t pdevice;
279 u32 dev_handle; /* Extended device id field. */
280 blkif_vdev_t vdevice; /* Interface-specific id for this VBD. */
281 u16 readonly; /* Non-zero -> VBD isn't writable. */
282 /* OUT */
283 u32 status;
284 } blkif_be_vbd_create_t;
286 /* CMSG_BLKIF_BE_VBD_DESTROY */
287 typedef struct blkif_be_vbd_destroy {
288 /* IN */
289 domid_t domid; /* Identify blkdev interface. */
290 u32 blkif_handle; /* ...ditto... */
291 blkif_vdev_t vdevice; /* Interface-specific id of the VBD. */
292 /* OUT */
293 u32 status;
294 } blkif_be_vbd_destroy_t;
296 /*
297 * CMSG_BLKIF_BE_DRIVER_STATUS:
298 * Notify the domain controller that the back-end driver is DOWN or UP.
299 * If the driver goes DOWN while interfaces are still UP, the controller
300 * will automatically send DOWN notifications.
301 */
302 typedef struct blkif_be_driver_status {
303 u32 status; /* BLKIF_DRIVER_STATUS_??? */
304 } blkif_be_driver_status_t;
307 /******************************************************************************
308 * NETWORK-INTERFACE FRONTEND DEFINITIONS
309 */
311 /* Messages from domain controller to guest. */
312 #define CMSG_NETIF_FE_INTERFACE_STATUS 0
314 /* Messages from guest to domain controller. */
315 #define CMSG_NETIF_FE_DRIVER_STATUS 32
316 #define CMSG_NETIF_FE_INTERFACE_CONNECT 33
317 #define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34
318 #define CMSG_NETIF_FE_INTERFACE_QUERY 35
320 /*
321 * CMSG_NETIF_FE_INTERFACE_STATUS:
322 * Notify a guest about a status change on one of its network interfaces.
323 * If the interface is CLOSED or DOWN then the interface is disconnected:
324 * 1. The shared-memory frame is available for reuse.
325 * 2. Any unacknowledged messgaes pending on the interface were dropped.
326 */
327 #define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
328 #define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
329 #define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
330 #define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
331 typedef struct netif_fe_interface_status {
332 u32 handle;
333 u32 status;
334 u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
335 u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
336 domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */
337 } netif_fe_interface_status_t;
339 /*
340 * CMSG_NETIF_FE_DRIVER_STATUS:
341 * Notify the domain controller that the front-end driver is DOWN or UP.
342 * When the driver goes DOWN then the controller will send no more
343 * status-change notifications.
344 * If the driver goes DOWN while interfaces are still UP, the domain
345 * will automatically take the interfaces DOWN.
346 *
347 * NB. The controller should not send an INTERFACE_STATUS message
348 * for interfaces that are active when it receives an UP notification. We
349 * expect that the frontend driver will query those interfaces itself.
350 */
351 #define NETIF_DRIVER_STATUS_DOWN 0
352 #define NETIF_DRIVER_STATUS_UP 1
353 typedef struct netif_fe_driver_status {
354 /* IN */
355 u32 status; /* NETIF_DRIVER_STATUS_??? */
356 /* OUT */
357 /* Driver should query interfaces [0..max_handle]. */
358 u32 max_handle;
359 } netif_fe_driver_status_t;
361 /*
362 * CMSG_NETIF_FE_INTERFACE_CONNECT:
363 * If successful, the domain controller will acknowledge with a
364 * STATUS_CONNECTED message.
365 */
366 typedef struct netif_fe_interface_connect {
367 u32 handle;
368 memory_t tx_shmem_frame;
369 memory_t rx_shmem_frame;
370 } netif_fe_interface_connect_t;
372 /*
373 * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
374 * If successful, the domain controller will acknowledge with a
375 * STATUS_DISCONNECTED message.
376 */
377 typedef struct netif_fe_interface_disconnect {
378 u32 handle;
379 } netif_fe_interface_disconnect_t;
381 /*
382 * CMSG_NETIF_FE_INTERFACE_QUERY:
383 */
384 typedef struct netif_fe_interface_query {
385 /* IN */
386 u32 handle;
387 /* OUT */
388 u32 status;
389 u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
390 u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
391 domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */
392 } netif_fe_interface_query_t;
395 /******************************************************************************
396 * NETWORK-INTERFACE BACKEND DEFINITIONS
397 */
399 /* Messages from domain controller. */
400 #define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
401 #define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
402 #define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
403 #define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
404 #define CMSG_NETIF_BE_CREDITLIMIT 4 /* Limit i/f to a given credit limit. */
406 /* Messages to domain controller. */
407 #define CMSG_NETIF_BE_DRIVER_STATUS 32
409 /*
410 * Message request/response definitions for net-device messages.
411 */
413 /* Non-specific 'okay' return. */
414 #define NETIF_BE_STATUS_OKAY 0
415 /* Non-specific 'error' return. */
416 #define NETIF_BE_STATUS_ERROR 1
417 /* The following are specific error returns. */
418 #define NETIF_BE_STATUS_INTERFACE_EXISTS 2
419 #define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
420 #define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
421 #define NETIF_BE_STATUS_OUT_OF_MEMORY 5
422 #define NETIF_BE_STATUS_MAPPING_ERROR 6
424 /* This macro can be used to create an array of descriptive error strings. */
425 #define NETIF_BE_STATUS_ERRORS { \
426 "Okay", \
427 "Non-specific error", \
428 "Interface already exists", \
429 "Interface not found", \
430 "Interface is still connected", \
431 "Out of memory", \
432 "Could not map domain memory" }
434 /*
435 * CMSG_NETIF_BE_CREATE:
436 * When the driver sends a successful response then the interface is fully
437 * created. The controller will send a DOWN notification to the front-end
438 * driver.
439 */
440 typedef struct netif_be_create {
441 /* IN */
442 domid_t domid; /* Domain attached to new interface. */
443 u32 netif_handle; /* Domain-specific interface handle. */
444 u8 mac[6];
445 u8 be_mac[6];
446 /* OUT */
447 u32 status;
448 } netif_be_create_t;
450 /*
451 * CMSG_NETIF_BE_DESTROY:
452 * When the driver sends a successful response then the interface is fully
453 * torn down. The controller will send a DESTROYED notification to the
454 * front-end driver.
455 */
456 typedef struct netif_be_destroy {
457 /* IN */
458 domid_t domid; /* Identify interface to be destroyed. */
459 u32 netif_handle; /* ...ditto... */
460 /* OUT */
461 u32 status;
462 } netif_be_destroy_t;
464 /*
465 * CMSG_NETIF_BE_CREDITLIMIT:
466 * Limit a virtual interface to "credit_bytes" bytes per "period_usec"
467 * microseconds.
468 */
469 typedef struct netif_be_creditlimit {
470 /* IN */
471 domid_t domid; /* Domain attached to new interface. */
472 u32 netif_handle; /* Domain-specific interface handle. */
473 u32 credit_bytes; /* Vifs credit of bytes per period. */
474 u32 period_usec; /* Credit replenishment period. */
475 /* OUT */
476 u32 status;
477 } netif_be_creditlimit_t;
479 /*
480 * CMSG_NETIF_BE_CONNECT:
481 * When the driver sends a successful response then the interface is fully
482 * connected. The controller will send a CONNECTED notification to the
483 * front-end driver.
484 */
485 typedef struct netif_be_connect {
486 /* IN */
487 domid_t domid; /* Domain attached to new interface. */
488 u32 netif_handle; /* Domain-specific interface handle. */
489 memory_t tx_shmem_frame; /* Page cont. tx shared comms window. */
490 memory_t rx_shmem_frame; /* Page cont. rx shared comms window. */
491 u16 evtchn; /* Event channel for notifications. */
492 /* OUT */
493 u32 status;
494 } netif_be_connect_t;
496 /*
497 * CMSG_NETIF_BE_DISCONNECT:
498 * When the driver sends a successful response then the interface is fully
499 * disconnected. The controller will send a DOWN notification to the front-end
500 * driver.
501 */
502 typedef struct netif_be_disconnect {
503 /* IN */
504 domid_t domid; /* Domain attached to new interface. */
505 u32 netif_handle; /* Domain-specific interface handle. */
506 /* OUT */
507 u32 status;
508 } netif_be_disconnect_t;
510 /*
511 * CMSG_NETIF_BE_DRIVER_STATUS:
512 * Notify the domain controller that the back-end driver is DOWN or UP.
513 * If the driver goes DOWN while interfaces are still UP, the domain
514 * will automatically send DOWN notifications.
515 */
516 typedef struct netif_be_driver_status {
517 u32 status; /* NETIF_DRIVER_STATUS_??? */
518 } netif_be_driver_status_t;
522 /******************************************************************************
523 * USB-INTERFACE FRONTEND DEFINITIONS
524 */
526 /* Messages from domain controller to guest. */
527 #define CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED 0
529 /* Messages from guest to domain controller. */
530 #define CMSG_USBIF_FE_DRIVER_STATUS_CHANGED 32
531 #define CMSG_USBIF_FE_INTERFACE_CONNECT 33
532 #define CMSG_USBIF_FE_INTERFACE_DISCONNECT 34
533 /*
534 * CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED:
535 * Notify a guest about a status change on one of its block interfaces.
536 * If the interface is DESTROYED or DOWN then the interface is disconnected:
537 * 1. The shared-memory frame is available for reuse.
538 * 2. Any unacknowledged messages pending on the interface were dropped.
539 */
540 #define USBIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */
541 #define USBIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
542 #define USBIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
543 typedef struct usbif_fe_interface_status_changed {
544 u32 status;
545 u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
546 domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */
547 u32 bandwidth;
548 u32 num_ports;
549 } usbif_fe_interface_status_changed_t;
551 /*
552 * CMSG_USBIF_FE_DRIVER_STATUS_CHANGED:
553 * Notify the domain controller that the front-end driver is DOWN or UP.
554 * When the driver goes DOWN then the controller will send no more
555 * status-change notifications.
556 * If the driver goes DOWN while interfaces are still UP, the domain
557 * will automatically take the interfaces DOWN.
558 *
559 * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
560 * for interfaces that are active when it receives an UP notification. We
561 * expect that the frontend driver will query those interfaces itself.
562 */
563 #define USBIF_DRIVER_STATUS_DOWN 0
564 #define USBIF_DRIVER_STATUS_UP 1
565 typedef struct usbif_fe_driver_status_changed {
566 /* IN */
567 u32 status; /* USBIF_DRIVER_STATUS_??? */
568 } usbif_fe_driver_status_changed_t;
570 /*
571 * CMSG_USBIF_FE_INTERFACE_CONNECT:
572 * If successful, the domain controller will acknowledge with a
573 * STATUS_CONNECTED message.
574 */
575 typedef struct usbif_fe_interface_connect {
576 memory_t shmem_frame;
577 } usbif_fe_interface_connect_t;
579 /*
580 * CMSG_USBIF_FE_INTERFACE_DISCONNECT:
581 * If successful, the domain controller will acknowledge with a
582 * STATUS_DISCONNECTED message.
583 */
584 typedef struct usbif_fe_interface_disconnect {
585 int dummy; /* make struct non-empty */
586 } usbif_fe_interface_disconnect_t;
589 /******************************************************************************
590 * USB-INTERFACE BACKEND DEFINITIONS
591 */
593 /* Messages from domain controller. */
594 #define CMSG_USBIF_BE_CREATE 0 /* Create a new block-device interface. */
595 #define CMSG_USBIF_BE_DESTROY 1 /* Destroy a block-device interface. */
596 #define CMSG_USBIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
597 #define CMSG_USBIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
598 #define CMSG_USBIF_BE_CLAIM_PORT 4 /* Claim host port for a domain. */
599 #define CMSG_USBIF_BE_RELEASE_PORT 5 /* Release host port. */
600 /* Messages to domain controller. */
601 #define CMSG_USBIF_BE_DRIVER_STATUS_CHANGED 32
603 /* Non-specific 'okay' return. */
604 #define USBIF_BE_STATUS_OKAY 0
605 /* Non-specific 'error' return. */
606 #define USBIF_BE_STATUS_ERROR 1
607 /* The following are specific error returns. */
608 #define USBIF_BE_STATUS_INTERFACE_EXISTS 2
609 #define USBIF_BE_STATUS_INTERFACE_NOT_FOUND 3
610 #define USBIF_BE_STATUS_INTERFACE_CONNECTED 4
611 #define USBIF_BE_STATUS_OUT_OF_MEMORY 7
612 #define USBIF_BE_STATUS_MAPPING_ERROR 9
614 /* This macro can be used to create an array of descriptive error strings. */
615 #define USBIF_BE_STATUS_ERRORS { \
616 "Okay", \
617 "Non-specific error", \
618 "Interface already exists", \
619 "Interface not found", \
620 "Interface is still connected", \
621 "Out of memory", \
622 "Could not map domain memory" }
624 /*
625 * CMSG_USBIF_BE_CREATE:
626 * When the driver sends a successful response then the interface is fully
627 * created. The controller will send a DOWN notification to the front-end
628 * driver.
629 */
630 typedef struct usbif_be_create {
631 /* IN */
632 domid_t domid; /* Domain attached to new interface. */
633 /* OUT */
634 u32 status;
635 } usbif_be_create_t;
637 /*
638 * CMSG_USBIF_BE_DESTROY:
639 * When the driver sends a successful response then the interface is fully
640 * torn down. The controller will send a DESTROYED notification to the
641 * front-end driver.
642 */
643 typedef struct usbif_be_destroy {
644 /* IN */
645 domid_t domid; /* Identify interface to be destroyed. */
646 /* OUT */
647 u32 status;
648 } usbif_be_destroy_t;
650 /*
651 * CMSG_USBIF_BE_CONNECT:
652 * When the driver sends a successful response then the interface is fully
653 * connected. The controller will send a CONNECTED notification to the
654 * front-end driver.
655 */
656 typedef struct usbif_be_connect {
657 /* IN */
658 domid_t domid; /* Domain attached to new interface. */
659 memory_t shmem_frame; /* Page cont. shared comms window. */
660 u32 evtchn; /* Event channel for notifications. */
661 u32 bandwidth; /* Bandwidth allocated for isoch / int - us
662 * per 1ms frame (ie between 0 and 900 or 800
663 * depending on USB version). */
664 /* OUT */
665 u32 status;
666 } usbif_be_connect_t;
668 /*
669 * CMSG_USBIF_BE_DISCONNECT:
670 * When the driver sends a successful response then the interface is fully
671 * disconnected. The controller will send a DOWN notification to the front-end
672 * driver.
673 */
674 typedef struct usbif_be_disconnect {
675 /* IN */
676 domid_t domid; /* Domain attached to new interface. */
677 /* OUT */
678 u32 status;
679 } usbif_be_disconnect_t;
681 /*
682 * CMSG_USBIF_BE_DRIVER_STATUS_CHANGED:
683 * Notify the domain controller that the back-end driver is DOWN or UP.
684 * If the driver goes DOWN while interfaces are still UP, the controller
685 * will automatically send DOWN notifications.
686 */
687 typedef struct usbif_be_driver_status_changed {
688 u32 status; /* USBIF_DRIVER_STATUS_??? */
689 } usbif_be_driver_status_changed_t;
691 #define USB_PATH_LEN 16
693 /*
694 * CMSG_USBIF_BE_CLAIM_PORT:
695 * Instruct the backend driver to claim any device plugged into the specified
696 * host port and to allow the specified domain to control that port.
697 */
698 typedef struct usbif_be_claim_port {
699 /* IN */
700 domid_t domid; /* which domain */
701 u32 usbif_port; /* port on the virtual root hub */
702 u32 status; /* status of operation */
703 char path[USB_PATH_LEN]; /* Currently specified in the Linux style - may need to be
704 * converted to some OS-independent format at some stage. */
705 } usbif_be_claim_port_t;
707 /*
708 * CMSG_USBIF_BE_RELEASE_PORT:
709 * Instruct the backend driver to release any device plugged into the specified
710 * host port.
711 */
712 typedef struct usbif_be_release_port {
713 char path[USB_PATH_LEN];
714 } usbif_be_release_port_t;
716 /******************************************************************************
717 * SHUTDOWN DEFINITIONS
718 */
720 /*
721 * Subtypes for shutdown messages.
722 */
723 #define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
724 #define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
725 #define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
726 /* SHUTDOWN_suspend. */
727 #define CMSG_SHUTDOWN_SYSRQ 3
729 typedef struct shutdown_sysrq {
730 char key; /* sysrq key */
731 } shutdown_sysrq_t;
733 /******************************************************************************
734 * VCPU HOTPLUG CONTROLS
735 */
737 /*
738 * Subtypes for shutdown messages.
739 */
740 #define CMSG_VCPU_HOTPLUG_OFF 0 /* turn vcpu off */
741 #define CMSG_VCPU_HOTPLUG_ON 1 /* turn vcpu on */
743 /*
744 * CMSG_VCPU_HOTPLUG:
745 * Indicate which vcpu's state should change
746 */
747 typedef struct vcpu_hotplug {
748 u32 vcpu; /* VCPU's whose state will change */
749 u32 status; /* Return code indicates success or failure. */
750 } vcpu_hotplug_t;
752 /******************************************************************************
753 * MEMORY CONTROLS
754 */
756 #define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
758 /*
759 * CMSG_MEM_REQUEST:
760 * Request that the domain change its memory reservation.
761 */
762 typedef struct mem_request {
763 /* OUT */
764 u32 target; /* Target memory reservation in pages. */
765 /* IN */
766 u32 status; /* Return code indicates success or failure. */
767 } mem_request_t;
770 /******************************************************************************
771 * PDB INTERFACE DEFINITIONS
772 */
774 #define CMSG_DEBUG_CONNECTION_STATUS 0
775 typedef struct pdb_Connection {
776 #define PDB_CONNECTION_STATUS_UP 1
777 #define PDB_CONNECTION_STATUS_DOWN 2
778 u32 status;
779 memory_t ring; /* status: UP */
780 u32 evtchn; /* status: UP */
781 } pdb_connection_t, *pdb_connection_p;
783 #endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */