ia64/xen-unstable

view xen/include/public/io/domain_controller.h @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 fa0754a9f64f
children dfaf788ab18c
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 unsigned long 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 unsigned long 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 unsigned long tx_shmem_frame;
369 int tx_shmem_ref;
370 unsigned long rx_shmem_frame;
371 int rx_shmem_ref;
372 } netif_fe_interface_connect_t;
374 /*
375 * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
376 * If successful, the domain controller will acknowledge with a
377 * STATUS_DISCONNECTED message.
378 */
379 typedef struct netif_fe_interface_disconnect {
380 u32 handle;
381 } netif_fe_interface_disconnect_t;
383 /*
384 * CMSG_NETIF_FE_INTERFACE_QUERY:
385 */
386 typedef struct netif_fe_interface_query {
387 /* IN */
388 u32 handle;
389 /* OUT */
390 u32 status;
391 u16 evtchn; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
392 u8 mac[6]; /* status == NETIF_INTERFACE_STATUS_CONNECTED */
393 domid_t domid; /* status != NETIF_INTERFACE_STATUS_DESTROYED */
394 } netif_fe_interface_query_t;
397 /******************************************************************************
398 * NETWORK-INTERFACE BACKEND DEFINITIONS
399 */
401 /* Messages from domain controller. */
402 #define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
403 #define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
404 #define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
405 #define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
406 #define CMSG_NETIF_BE_CREDITLIMIT 4 /* Limit i/f to a given credit limit. */
408 /* Messages to domain controller. */
409 #define CMSG_NETIF_BE_DRIVER_STATUS 32
411 /*
412 * Message request/response definitions for net-device messages.
413 */
415 /* Non-specific 'okay' return. */
416 #define NETIF_BE_STATUS_OKAY 0
417 /* Non-specific 'error' return. */
418 #define NETIF_BE_STATUS_ERROR 1
419 /* The following are specific error returns. */
420 #define NETIF_BE_STATUS_INTERFACE_EXISTS 2
421 #define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
422 #define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
423 #define NETIF_BE_STATUS_OUT_OF_MEMORY 5
424 #define NETIF_BE_STATUS_MAPPING_ERROR 6
426 /* This macro can be used to create an array of descriptive error strings. */
427 #define NETIF_BE_STATUS_ERRORS { \
428 "Okay", \
429 "Non-specific error", \
430 "Interface already exists", \
431 "Interface not found", \
432 "Interface is still connected", \
433 "Out of memory", \
434 "Could not map domain memory" }
436 /*
437 * CMSG_NETIF_BE_CREATE:
438 * When the driver sends a successful response then the interface is fully
439 * created. The controller will send a DOWN notification to the front-end
440 * driver.
441 */
442 typedef struct netif_be_create {
443 /* IN */
444 domid_t domid; /* Domain attached to new interface. */
445 u32 netif_handle; /* Domain-specific interface handle. */
446 u8 mac[6];
447 u8 be_mac[6];
448 /* OUT */
449 u32 status;
450 } netif_be_create_t;
452 /*
453 * CMSG_NETIF_BE_DESTROY:
454 * When the driver sends a successful response then the interface is fully
455 * torn down. The controller will send a DESTROYED notification to the
456 * front-end driver.
457 */
458 typedef struct netif_be_destroy {
459 /* IN */
460 domid_t domid; /* Identify interface to be destroyed. */
461 u32 netif_handle; /* ...ditto... */
462 /* OUT */
463 u32 status;
464 } netif_be_destroy_t;
466 /*
467 * CMSG_NETIF_BE_CREDITLIMIT:
468 * Limit a virtual interface to "credit_bytes" bytes per "period_usec"
469 * microseconds.
470 */
471 typedef struct netif_be_creditlimit {
472 /* IN */
473 domid_t domid; /* Domain attached to new interface. */
474 u32 netif_handle; /* Domain-specific interface handle. */
475 u32 credit_bytes; /* Vifs credit of bytes per period. */
476 u32 period_usec; /* Credit replenishment period. */
477 /* OUT */
478 u32 status;
479 } netif_be_creditlimit_t;
481 /*
482 * CMSG_NETIF_BE_CONNECT:
483 * When the driver sends a successful response then the interface is fully
484 * connected. The controller will send a CONNECTED notification to the
485 * front-end driver.
486 */
487 typedef struct netif_be_connect {
488 /* IN */
489 domid_t domid; /* Domain attached to new interface. */
490 u32 netif_handle; /* Domain-specific interface handle. */
491 unsigned long tx_shmem_frame;/* Page cont. tx shared comms window. */
492 int tx_shmem_ref; /* Grant reference for above */
493 unsigned long rx_shmem_frame;/* Page cont. rx shared comms window. */
494 int rx_shmem_ref; /* Grant reference for above */
495 u16 evtchn; /* Event channel for notifications. */
496 /* OUT */
497 u32 status;
498 } netif_be_connect_t;
500 /*
501 * CMSG_NETIF_BE_DISCONNECT:
502 * When the driver sends a successful response then the interface is fully
503 * disconnected. The controller will send a DOWN notification to the front-end
504 * driver.
505 */
506 typedef struct netif_be_disconnect {
507 /* IN */
508 domid_t domid; /* Domain attached to new interface. */
509 u32 netif_handle; /* Domain-specific interface handle. */
510 /* OUT */
511 u32 status;
512 } netif_be_disconnect_t;
514 /*
515 * CMSG_NETIF_BE_DRIVER_STATUS:
516 * Notify the domain controller that the back-end driver is DOWN or UP.
517 * If the driver goes DOWN while interfaces are still UP, the domain
518 * will automatically send DOWN notifications.
519 */
520 typedef struct netif_be_driver_status {
521 u32 status; /* NETIF_DRIVER_STATUS_??? */
522 } netif_be_driver_status_t;
526 /******************************************************************************
527 * USB-INTERFACE FRONTEND DEFINITIONS
528 */
530 /* Messages from domain controller to guest. */
531 #define CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED 0
533 /* Messages from guest to domain controller. */
534 #define CMSG_USBIF_FE_DRIVER_STATUS_CHANGED 32
535 #define CMSG_USBIF_FE_INTERFACE_CONNECT 33
536 #define CMSG_USBIF_FE_INTERFACE_DISCONNECT 34
537 /*
538 * CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED:
539 * Notify a guest about a status change on one of its block interfaces.
540 * If the interface is DESTROYED or DOWN then the interface is disconnected:
541 * 1. The shared-memory frame is available for reuse.
542 * 2. Any unacknowledged messages pending on the interface were dropped.
543 */
544 #define USBIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */
545 #define USBIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
546 #define USBIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
547 typedef struct usbif_fe_interface_status_changed {
548 u32 status;
549 u16 evtchn; /* (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
550 domid_t domid; /* status != BLKIF_INTERFACE_STATUS_DESTROYED */
551 u32 bandwidth;
552 u32 num_ports;
553 } usbif_fe_interface_status_changed_t;
555 /*
556 * CMSG_USBIF_FE_DRIVER_STATUS_CHANGED:
557 * Notify the domain controller that the front-end driver is DOWN or UP.
558 * When the driver goes DOWN then the controller will send no more
559 * status-change notifications.
560 * If the driver goes DOWN while interfaces are still UP, the domain
561 * will automatically take the interfaces DOWN.
562 *
563 * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
564 * for interfaces that are active when it receives an UP notification. We
565 * expect that the frontend driver will query those interfaces itself.
566 */
567 #define USBIF_DRIVER_STATUS_DOWN 0
568 #define USBIF_DRIVER_STATUS_UP 1
569 typedef struct usbif_fe_driver_status_changed {
570 /* IN */
571 u32 status; /* USBIF_DRIVER_STATUS_??? */
572 } usbif_fe_driver_status_changed_t;
574 /*
575 * CMSG_USBIF_FE_INTERFACE_CONNECT:
576 * If successful, the domain controller will acknowledge with a
577 * STATUS_CONNECTED message.
578 */
579 typedef struct usbif_fe_interface_connect {
580 unsigned long shmem_frame;
581 } usbif_fe_interface_connect_t;
583 /*
584 * CMSG_USBIF_FE_INTERFACE_DISCONNECT:
585 * If successful, the domain controller will acknowledge with a
586 * STATUS_DISCONNECTED message.
587 */
588 typedef struct usbif_fe_interface_disconnect {
589 int dummy; /* make struct non-empty */
590 } usbif_fe_interface_disconnect_t;
593 /******************************************************************************
594 * USB-INTERFACE BACKEND DEFINITIONS
595 */
597 /* Messages from domain controller. */
598 #define CMSG_USBIF_BE_CREATE 0 /* Create a new block-device interface. */
599 #define CMSG_USBIF_BE_DESTROY 1 /* Destroy a block-device interface. */
600 #define CMSG_USBIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
601 #define CMSG_USBIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
602 #define CMSG_USBIF_BE_CLAIM_PORT 4 /* Claim host port for a domain. */
603 #define CMSG_USBIF_BE_RELEASE_PORT 5 /* Release host port. */
604 /* Messages to domain controller. */
605 #define CMSG_USBIF_BE_DRIVER_STATUS_CHANGED 32
607 /* Non-specific 'okay' return. */
608 #define USBIF_BE_STATUS_OKAY 0
609 /* Non-specific 'error' return. */
610 #define USBIF_BE_STATUS_ERROR 1
611 /* The following are specific error returns. */
612 #define USBIF_BE_STATUS_INTERFACE_EXISTS 2
613 #define USBIF_BE_STATUS_INTERFACE_NOT_FOUND 3
614 #define USBIF_BE_STATUS_INTERFACE_CONNECTED 4
615 #define USBIF_BE_STATUS_OUT_OF_MEMORY 7
616 #define USBIF_BE_STATUS_MAPPING_ERROR 9
618 /* This macro can be used to create an array of descriptive error strings. */
619 #define USBIF_BE_STATUS_ERRORS { \
620 "Okay", \
621 "Non-specific error", \
622 "Interface already exists", \
623 "Interface not found", \
624 "Interface is still connected", \
625 "Out of memory", \
626 "Could not map domain memory" }
628 /*
629 * CMSG_USBIF_BE_CREATE:
630 * When the driver sends a successful response then the interface is fully
631 * created. The controller will send a DOWN notification to the front-end
632 * driver.
633 */
634 typedef struct usbif_be_create {
635 /* IN */
636 domid_t domid; /* Domain attached to new interface. */
637 /* OUT */
638 u32 status;
639 } usbif_be_create_t;
641 /*
642 * CMSG_USBIF_BE_DESTROY:
643 * When the driver sends a successful response then the interface is fully
644 * torn down. The controller will send a DESTROYED notification to the
645 * front-end driver.
646 */
647 typedef struct usbif_be_destroy {
648 /* IN */
649 domid_t domid; /* Identify interface to be destroyed. */
650 /* OUT */
651 u32 status;
652 } usbif_be_destroy_t;
654 /*
655 * CMSG_USBIF_BE_CONNECT:
656 * When the driver sends a successful response then the interface is fully
657 * connected. The controller will send a CONNECTED notification to the
658 * front-end driver.
659 */
660 typedef struct usbif_be_connect {
661 /* IN */
662 domid_t domid; /* Domain attached to new interface. */
663 unsigned long shmem_frame;/* Page cont. shared comms window. */
664 u32 evtchn; /* Event channel for notifications. */
665 u32 bandwidth; /* Bandwidth allocated for isoch / int - us
666 * per 1ms frame (ie between 0 and 900 or 800
667 * depending on USB version). */
668 /* OUT */
669 u32 status;
670 } usbif_be_connect_t;
672 /*
673 * CMSG_USBIF_BE_DISCONNECT:
674 * When the driver sends a successful response then the interface is fully
675 * disconnected. The controller will send a DOWN notification to the front-end
676 * driver.
677 */
678 typedef struct usbif_be_disconnect {
679 /* IN */
680 domid_t domid; /* Domain attached to new interface. */
681 /* OUT */
682 u32 status;
683 } usbif_be_disconnect_t;
685 /*
686 * CMSG_USBIF_BE_DRIVER_STATUS_CHANGED:
687 * Notify the domain controller that the back-end driver is DOWN or UP.
688 * If the driver goes DOWN while interfaces are still UP, the controller
689 * will automatically send DOWN notifications.
690 */
691 typedef struct usbif_be_driver_status_changed {
692 u32 status; /* USBIF_DRIVER_STATUS_??? */
693 } usbif_be_driver_status_changed_t;
695 #define USB_PATH_LEN 16
697 /*
698 * CMSG_USBIF_BE_CLAIM_PORT:
699 * Instruct the backend driver to claim any device plugged into the specified
700 * host port and to allow the specified domain to control that port.
701 */
702 typedef struct usbif_be_claim_port {
703 /* IN */
704 domid_t domid; /* which domain */
705 u32 usbif_port; /* port on the virtual root hub */
706 u32 status; /* status of operation */
707 char path[USB_PATH_LEN]; /* Currently specified in the Linux style - may need to be
708 * converted to some OS-independent format at some stage. */
709 } usbif_be_claim_port_t;
711 /*
712 * CMSG_USBIF_BE_RELEASE_PORT:
713 * Instruct the backend driver to release any device plugged into the specified
714 * host port.
715 */
716 typedef struct usbif_be_release_port {
717 char path[USB_PATH_LEN];
718 } usbif_be_release_port_t;
720 /******************************************************************************
721 * SHUTDOWN DEFINITIONS
722 */
724 /*
725 * Subtypes for shutdown messages.
726 */
727 #define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
728 #define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
729 #define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
730 /* SHUTDOWN_suspend. */
731 #define CMSG_SHUTDOWN_SYSRQ 3
733 typedef struct shutdown_sysrq {
734 char key; /* sysrq key */
735 } shutdown_sysrq_t;
737 /******************************************************************************
738 * VCPU HOTPLUG CONTROLS
739 */
741 /*
742 * Subtypes for shutdown messages.
743 */
744 #define CMSG_VCPU_HOTPLUG_OFF 0 /* turn vcpu off */
745 #define CMSG_VCPU_HOTPLUG_ON 1 /* turn vcpu on */
747 /*
748 * CMSG_VCPU_HOTPLUG:
749 * Indicate which vcpu's state should change
750 */
751 typedef struct vcpu_hotplug {
752 u32 vcpu; /* VCPU's whose state will change */
753 u32 status; /* Return code indicates success or failure. */
754 } vcpu_hotplug_t;
756 /******************************************************************************
757 * MEMORY CONTROLS
758 */
760 #define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
762 /*
763 * CMSG_MEM_REQUEST:
764 * Request that the domain change its memory reservation.
765 */
766 typedef struct mem_request {
767 /* OUT */
768 u32 target; /* Target memory reservation in pages. */
769 /* IN */
770 u32 status; /* Return code indicates success or failure. */
771 } mem_request_t;
774 /******************************************************************************
775 * PDB INTERFACE DEFINITIONS
776 */
778 #define CMSG_DEBUG_CONNECTION_STATUS 0
779 typedef struct pdb_Connection {
780 #define PDB_CONNECTION_STATUS_UP 1
781 #define PDB_CONNECTION_STATUS_DOWN 2
782 u32 status;
783 unsigned long ring; /* status: UP */
784 u32 evtchn; /* status: UP */
785 } pdb_connection_t, *pdb_connection_p;
787 #endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */