debuggers.hg

view xen/include/public/io/domain_controller.h @ 3501:3ced9b0f4dab

bitkeeper revision 1.1159.212.23 (41ee5e8fnbA6nB8wOl_As73BmvhklQ)

Support for USB virtualisation. Adds the USB frontend / backend, update build options,
make the control tools understand USB interfaces.

One extra file from vanilla Linux is imported (linux-2.4.28-xen-sparse/drivers/usb/hcd.c)
because small changes were required to make XenU domains build with a USB frontend. This
will not be required for the revised host controller infrastructure in Linux 2.6.

To use this, set "usb = " a list of USB ports in the domain config file. Ports are
specified as a path, e.g. '1' = the first USB port on the host, '1/2' is the second port
on the hub on the first host port, etc.

Should work for most mass storage and isochronous devices. May work for some HID devices
but these are not as intelligent and may have trouble supporting virtualisation.
author mwilli2@equilibrium.research
date Wed Jan 19 13:20:15 2005 +0000 (2005-01-19)
parents a9ac02b7727d
children bb56e77896e7 ef59b38283a5
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 * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
17 * interpreted by control software to determine the appropriate action. These
18 * are only really advisories: the controller can actually do as it likes.
19 */
20 #define SHUTDOWN_poweroff 0 /* Domain exited normally. Clean up and kill. */
21 #define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
22 #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
25 /*
26 * CONTROLLER MESSAGING INTERFACE.
27 */
29 typedef struct {
30 u8 type; /* 0: echoed in response */
31 u8 subtype; /* 1: echoed in response */
32 u8 id; /* 2: echoed in response */
33 u8 length; /* 3: number of bytes in 'msg' */
34 u8 msg[60]; /* 4: type-specific message data */
35 } PACKED control_msg_t; /* 64 bytes */
37 /* These are used by the control message deferred ring. */
38 #define CONTROL_RING_SIZE 8
39 typedef u32 CONTROL_RING_IDX;
40 #define MASK_CONTROL_IDX(_i) ((_i)&(CONTROL_RING_SIZE-1))
42 /*
43 * Generate control ring structures and types.
44 *
45 * CONTROL_RING_MEM is currently an 8-slot ring of ctrl_msg_t structs and
46 * two 32-bit counters: (64 * 8) + (2 * 4) = 520
47 */
48 #define CONTROL_RING_MEM 520
49 #define CTRL_RING RING_PARAMS(control_msg_t, control_msg_t, CONTROL_RING_MEM)
50 DEFINE_RING_TYPES(ctrl, CTRL_RING);
52 typedef struct {
53 ctrl_sring_t tx_ring; /* 0: guest -> controller */
54 ctrl_sring_t rx_ring; /* 520: controller -> guest */
55 } PACKED control_if_t; /* 1040 bytes */
57 /*
58 * Top-level command types.
59 */
60 #define CMSG_CONSOLE 0 /* Console */
61 #define CMSG_BLKIF_BE 1 /* Block-device backend */
62 #define CMSG_BLKIF_FE 2 /* Block-device frontend */
63 #define CMSG_NETIF_BE 3 /* Network-device backend */
64 #define CMSG_NETIF_FE 4 /* Network-device frontend */
65 #define CMSG_SHUTDOWN 6 /* Shutdown messages */
66 #define CMSG_MEM_REQUEST 7 /* Memory reservation reqs */
67 #define CMSG_USBIF_BE 8 /* USB controller backend */
68 #define CMSG_USBIF_FE 9 /* USB controller frontend */
70 /******************************************************************************
71 * CONSOLE DEFINITIONS
72 */
74 /*
75 * Subtypes for console messages.
76 */
77 #define CMSG_CONSOLE_DATA 0
80 /******************************************************************************
81 * BLOCK-INTERFACE FRONTEND DEFINITIONS
82 */
84 /* Messages from domain controller to guest. */
85 #define CMSG_BLKIF_FE_INTERFACE_STATUS 0
87 /* Messages from guest to domain controller. */
88 #define CMSG_BLKIF_FE_DRIVER_STATUS 32
89 #define CMSG_BLKIF_FE_INTERFACE_CONNECT 33
90 #define CMSG_BLKIF_FE_INTERFACE_DISCONNECT 34
91 #define CMSG_BLKIF_FE_INTERFACE_QUERY 35
93 /* These are used by both front-end and back-end drivers. */
94 #define blkif_vdev_t u16
95 #define blkif_pdev_t u16
96 #define blkif_sector_t u64
98 /*
99 * CMSG_BLKIF_FE_INTERFACE_STATUS:
100 * Notify a guest about a status change on one of its block interfaces.
101 * If the interface is DESTROYED or DOWN then the interface is disconnected:
102 * 1. The shared-memory frame is available for reuse.
103 * 2. Any unacknowledged messages pending on the interface were dropped.
104 */
105 #define BLKIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
106 #define BLKIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
107 #define BLKIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
108 #define BLKIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
109 typedef struct {
110 u32 handle; /* 0 */
111 u32 status; /* 4 */
112 u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
113 domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
114 } PACKED blkif_fe_interface_status_t; /* 12 bytes */
116 /*
117 * CMSG_BLKIF_FE_DRIVER_STATUS:
118 * Notify the domain controller that the front-end driver is DOWN or UP.
119 * When the driver goes DOWN then the controller will send no more
120 * status-change notifications.
121 * If the driver goes DOWN while interfaces are still UP, the domain
122 * will automatically take the interfaces DOWN.
123 *
124 * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
125 * for interfaces that are active when it receives an UP notification. We
126 * expect that the frontend driver will query those interfaces itself.
127 */
128 #define BLKIF_DRIVER_STATUS_DOWN 0
129 #define BLKIF_DRIVER_STATUS_UP 1
130 typedef struct {
131 /* IN */
132 u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
133 /* OUT */
134 /* Driver should query interfaces [0..max_handle]. */
135 u32 max_handle; /* 4 */
136 } PACKED blkif_fe_driver_status_t; /* 8 bytes */
138 /*
139 * CMSG_BLKIF_FE_INTERFACE_CONNECT:
140 * If successful, the domain controller will acknowledge with a
141 * STATUS_CONNECTED message.
142 */
143 typedef struct {
144 u32 handle; /* 0 */
145 u32 __pad;
146 memory_t shmem_frame; /* 8 */
147 MEMORY_PADDING;
148 } PACKED blkif_fe_interface_connect_t; /* 16 bytes */
150 /*
151 * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
152 * If successful, the domain controller will acknowledge with a
153 * STATUS_DISCONNECTED message.
154 */
155 typedef struct {
156 u32 handle; /* 0 */
157 } PACKED blkif_fe_interface_disconnect_t; /* 4 bytes */
159 /*
160 * CMSG_BLKIF_FE_INTERFACE_QUERY:
161 */
162 typedef struct {
163 /* IN */
164 u32 handle; /* 0 */
165 /* OUT */
166 u32 status; /* 4 */
167 u16 evtchn; /* 8: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
168 domid_t domid; /* 10: status != BLKIF_INTERFACE_STATUS_DESTROYED */
169 } PACKED blkif_fe_interface_query_t; /* 12 bytes */
172 /******************************************************************************
173 * BLOCK-INTERFACE BACKEND DEFINITIONS
174 */
176 /* Messages from domain controller. */
177 #define CMSG_BLKIF_BE_CREATE 0 /* Create a new block-device interface. */
178 #define CMSG_BLKIF_BE_DESTROY 1 /* Destroy a block-device interface. */
179 #define CMSG_BLKIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
180 #define CMSG_BLKIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
181 #define CMSG_BLKIF_BE_VBD_CREATE 4 /* Create a new VBD for an interface. */
182 #define CMSG_BLKIF_BE_VBD_DESTROY 5 /* Delete a VBD from an interface. */
183 #define CMSG_BLKIF_BE_VBD_GROW 6 /* Append an extent to a given VBD. */
184 #define CMSG_BLKIF_BE_VBD_SHRINK 7 /* Remove last extent from a given VBD. */
186 /* Messages to domain controller. */
187 #define CMSG_BLKIF_BE_DRIVER_STATUS 32
189 /*
190 * Message request/response definitions for block-device messages.
191 */
193 typedef struct {
194 blkif_sector_t sector_start; /* 0 */
195 blkif_sector_t sector_length; /* 8 */
196 blkif_pdev_t device; /* 16 */
197 u16 __pad; /* 18 */
198 } PACKED blkif_extent_t; /* 20 bytes */
200 /* Non-specific 'okay' return. */
201 #define BLKIF_BE_STATUS_OKAY 0
202 /* Non-specific 'error' return. */
203 #define BLKIF_BE_STATUS_ERROR 1
204 /* The following are specific error returns. */
205 #define BLKIF_BE_STATUS_INTERFACE_EXISTS 2
206 #define BLKIF_BE_STATUS_INTERFACE_NOT_FOUND 3
207 #define BLKIF_BE_STATUS_INTERFACE_CONNECTED 4
208 #define BLKIF_BE_STATUS_VBD_EXISTS 5
209 #define BLKIF_BE_STATUS_VBD_NOT_FOUND 6
210 #define BLKIF_BE_STATUS_OUT_OF_MEMORY 7
211 #define BLKIF_BE_STATUS_EXTENT_NOT_FOUND 8
212 #define BLKIF_BE_STATUS_MAPPING_ERROR 9
214 /* This macro can be used to create an array of descriptive error strings. */
215 #define BLKIF_BE_STATUS_ERRORS { \
216 "Okay", \
217 "Non-specific error", \
218 "Interface already exists", \
219 "Interface not found", \
220 "Interface is still connected", \
221 "VBD already exists", \
222 "VBD not found", \
223 "Out of memory", \
224 "Extent not found for VBD", \
225 "Could not map domain memory" }
227 /*
228 * CMSG_BLKIF_BE_CREATE:
229 * When the driver sends a successful response then the interface is fully
230 * created. The controller will send a DOWN notification to the front-end
231 * driver.
232 */
233 typedef struct {
234 /* IN */
235 domid_t domid; /* 0: Domain attached to new interface. */
236 u16 __pad;
237 u32 blkif_handle; /* 4: Domain-specific interface handle. */
238 /* OUT */
239 u32 status; /* 8 */
240 } PACKED blkif_be_create_t; /* 12 bytes */
242 /*
243 * CMSG_BLKIF_BE_DESTROY:
244 * When the driver sends a successful response then the interface is fully
245 * torn down. The controller will send a DESTROYED notification to the
246 * front-end driver.
247 */
248 typedef struct {
249 /* IN */
250 domid_t domid; /* 0: Identify interface to be destroyed. */
251 u16 __pad;
252 u32 blkif_handle; /* 4: ...ditto... */
253 /* OUT */
254 u32 status; /* 8 */
255 } PACKED blkif_be_destroy_t; /* 12 bytes */
257 /*
258 * CMSG_BLKIF_BE_CONNECT:
259 * When the driver sends a successful response then the interface is fully
260 * connected. The controller will send a CONNECTED notification to the
261 * front-end driver.
262 */
263 typedef struct {
264 /* IN */
265 domid_t domid; /* 0: Domain attached to new interface. */
266 u16 __pad;
267 u32 blkif_handle; /* 4: Domain-specific interface handle. */
268 memory_t shmem_frame; /* 8: Page cont. shared comms window. */
269 MEMORY_PADDING;
270 u32 evtchn; /* 16: Event channel for notifications. */
271 /* OUT */
272 u32 status; /* 20 */
273 } PACKED blkif_be_connect_t; /* 24 bytes */
275 /*
276 * CMSG_BLKIF_BE_DISCONNECT:
277 * When the driver sends a successful response then the interface is fully
278 * disconnected. The controller will send a DOWN notification to the front-end
279 * driver.
280 */
281 typedef struct {
282 /* IN */
283 domid_t domid; /* 0: Domain attached to new interface. */
284 u16 __pad;
285 u32 blkif_handle; /* 4: Domain-specific interface handle. */
286 /* OUT */
287 u32 status; /* 8 */
288 } PACKED blkif_be_disconnect_t; /* 12 bytes */
290 /* CMSG_BLKIF_BE_VBD_CREATE */
291 typedef struct {
292 /* IN */
293 domid_t domid; /* 0: Identify blkdev interface. */
294 u16 __pad;
295 u32 blkif_handle; /* 4: ...ditto... */
296 blkif_vdev_t vdevice; /* 8: Interface-specific id for this VBD. */
297 u16 readonly; /* 10: Non-zero -> VBD isn't writable. */
298 /* OUT */
299 u32 status; /* 12 */
300 } PACKED blkif_be_vbd_create_t; /* 16 bytes */
302 /* CMSG_BLKIF_BE_VBD_DESTROY */
303 typedef struct {
304 /* IN */
305 domid_t domid; /* 0: Identify blkdev interface. */
306 u16 __pad0; /* 2 */
307 u32 blkif_handle; /* 4: ...ditto... */
308 blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
309 u16 __pad1; /* 10 */
310 /* OUT */
311 u32 status; /* 12 */
312 } PACKED blkif_be_vbd_destroy_t; /* 16 bytes */
314 /* CMSG_BLKIF_BE_VBD_GROW */
315 typedef struct {
316 /* IN */
317 domid_t domid; /* 0: Identify blkdev interface. */
318 u16 __pad0; /* 2 */
319 u32 blkif_handle; /* 4: ...ditto... */
320 blkif_extent_t extent; /* 8: Physical extent to append to VBD. */
321 blkif_vdev_t vdevice; /* 28: Interface-specific id of the VBD. */
322 u16 __pad1; /* 30 */
323 /* OUT */
324 u32 status; /* 32 */
325 } PACKED blkif_be_vbd_grow_t; /* 36 bytes */
327 /* CMSG_BLKIF_BE_VBD_SHRINK */
328 typedef struct {
329 /* IN */
330 domid_t domid; /* 0: Identify blkdev interface. */
331 u16 __pad0; /* 2 */
332 u32 blkif_handle; /* 4: ...ditto... */
333 blkif_vdev_t vdevice; /* 8: Interface-specific id of the VBD. */
334 u16 __pad1; /* 10 */
335 /* OUT */
336 u32 status; /* 12 */
337 } PACKED blkif_be_vbd_shrink_t; /* 16 bytes */
339 /*
340 * CMSG_BLKIF_BE_DRIVER_STATUS:
341 * Notify the domain controller that the back-end driver is DOWN or UP.
342 * If the driver goes DOWN while interfaces are still UP, the controller
343 * will automatically send DOWN notifications.
344 */
345 typedef struct {
346 u32 status; /* 0: BLKIF_DRIVER_STATUS_??? */
347 } PACKED blkif_be_driver_status_t; /* 4 bytes */
350 /******************************************************************************
351 * NETWORK-INTERFACE FRONTEND DEFINITIONS
352 */
354 /* Messages from domain controller to guest. */
355 #define CMSG_NETIF_FE_INTERFACE_STATUS 0
357 /* Messages from guest to domain controller. */
358 #define CMSG_NETIF_FE_DRIVER_STATUS 32
359 #define CMSG_NETIF_FE_INTERFACE_CONNECT 33
360 #define CMSG_NETIF_FE_INTERFACE_DISCONNECT 34
361 #define CMSG_NETIF_FE_INTERFACE_QUERY 35
363 /*
364 * CMSG_NETIF_FE_INTERFACE_STATUS:
365 * Notify a guest about a status change on one of its network interfaces.
366 * If the interface is CLOSED or DOWN then the interface is disconnected:
367 * 1. The shared-memory frame is available for reuse.
368 * 2. Any unacknowledged messgaes pending on the interface were dropped.
369 */
370 #define NETIF_INTERFACE_STATUS_CLOSED 0 /* Interface doesn't exist. */
371 #define NETIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
372 #define NETIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
373 #define NETIF_INTERFACE_STATUS_CHANGED 3 /* A device has been added or removed. */
374 typedef struct {
375 u32 handle; /* 0 */
376 u32 status; /* 4 */
377 u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
378 u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
379 domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
380 } PACKED netif_fe_interface_status_t; /* 18 bytes */
382 /*
383 * CMSG_NETIF_FE_DRIVER_STATUS:
384 * Notify the domain controller that the front-end driver is DOWN or UP.
385 * When the driver goes DOWN then the controller will send no more
386 * status-change notifications.
387 * If the driver goes DOWN while interfaces are still UP, the domain
388 * will automatically take the interfaces DOWN.
389 *
390 * NB. The controller should not send an INTERFACE_STATUS message
391 * for interfaces that are active when it receives an UP notification. We
392 * expect that the frontend driver will query those interfaces itself.
393 */
394 #define NETIF_DRIVER_STATUS_DOWN 0
395 #define NETIF_DRIVER_STATUS_UP 1
396 typedef struct {
397 /* IN */
398 u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
399 /* OUT */
400 /* Driver should query interfaces [0..max_handle]. */
401 u32 max_handle; /* 4 */
402 } PACKED netif_fe_driver_status_t; /* 8 bytes */
404 /*
405 * CMSG_NETIF_FE_INTERFACE_CONNECT:
406 * If successful, the domain controller will acknowledge with a
407 * STATUS_CONNECTED message.
408 */
409 typedef struct {
410 u32 handle; /* 0 */
411 u32 __pad; /* 4 */
412 memory_t tx_shmem_frame; /* 8 */
413 MEMORY_PADDING;
414 memory_t rx_shmem_frame; /* 16 */
415 MEMORY_PADDING;
416 } PACKED netif_fe_interface_connect_t; /* 24 bytes */
418 /*
419 * CMSG_NETIF_FE_INTERFACE_DISCONNECT:
420 * If successful, the domain controller will acknowledge with a
421 * STATUS_DISCONNECTED message.
422 */
423 typedef struct {
424 u32 handle; /* 0 */
425 } PACKED netif_fe_interface_disconnect_t; /* 4 bytes */
427 /*
428 * CMSG_NETIF_FE_INTERFACE_QUERY:
429 */
430 typedef struct {
431 /* IN */
432 u32 handle; /* 0 */
433 /* OUT */
434 u32 status; /* 4 */
435 u16 evtchn; /* 8: status == NETIF_INTERFACE_STATUS_CONNECTED */
436 u8 mac[6]; /* 10: status == NETIF_INTERFACE_STATUS_CONNECTED */
437 domid_t domid; /* 16: status != NETIF_INTERFACE_STATUS_DESTROYED */
438 } PACKED netif_fe_interface_query_t; /* 18 bytes */
441 /******************************************************************************
442 * NETWORK-INTERFACE BACKEND DEFINITIONS
443 */
445 /* Messages from domain controller. */
446 #define CMSG_NETIF_BE_CREATE 0 /* Create a new net-device interface. */
447 #define CMSG_NETIF_BE_DESTROY 1 /* Destroy a net-device interface. */
448 #define CMSG_NETIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
449 #define CMSG_NETIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
451 /* Messages to domain controller. */
452 #define CMSG_NETIF_BE_DRIVER_STATUS 32
454 /*
455 * Message request/response definitions for net-device messages.
456 */
458 /* Non-specific 'okay' return. */
459 #define NETIF_BE_STATUS_OKAY 0
460 /* Non-specific 'error' return. */
461 #define NETIF_BE_STATUS_ERROR 1
462 /* The following are specific error returns. */
463 #define NETIF_BE_STATUS_INTERFACE_EXISTS 2
464 #define NETIF_BE_STATUS_INTERFACE_NOT_FOUND 3
465 #define NETIF_BE_STATUS_INTERFACE_CONNECTED 4
466 #define NETIF_BE_STATUS_OUT_OF_MEMORY 5
467 #define NETIF_BE_STATUS_MAPPING_ERROR 6
469 /* This macro can be used to create an array of descriptive error strings. */
470 #define NETIF_BE_STATUS_ERRORS { \
471 "Okay", \
472 "Non-specific error", \
473 "Interface already exists", \
474 "Interface not found", \
475 "Interface is still connected", \
476 "Out of memory", \
477 "Could not map domain memory" }
479 /*
480 * CMSG_NETIF_BE_CREATE:
481 * When the driver sends a successful response then the interface is fully
482 * created. The controller will send a DOWN notification to the front-end
483 * driver.
484 */
485 typedef struct {
486 /* IN */
487 domid_t domid; /* 0: Domain attached to new interface. */
488 u16 __pad0; /* 2 */
489 u32 netif_handle; /* 4: Domain-specific interface handle. */
490 u8 mac[6]; /* 8 */
491 u16 __pad1; /* 14 */
492 /* OUT */
493 u32 status; /* 16 */
494 } PACKED netif_be_create_t; /* 20 bytes */
496 /*
497 * CMSG_NETIF_BE_DESTROY:
498 * When the driver sends a successful response then the interface is fully
499 * torn down. The controller will send a DESTROYED notification to the
500 * front-end driver.
501 */
502 typedef struct {
503 /* IN */
504 domid_t domid; /* 0: Identify interface to be destroyed. */
505 u16 __pad;
506 u32 netif_handle; /* 4: ...ditto... */
507 /* OUT */
508 u32 status; /* 8 */
509 } PACKED netif_be_destroy_t; /* 12 bytes */
511 /*
512 * CMSG_NETIF_BE_CONNECT:
513 * When the driver sends a successful response then the interface is fully
514 * connected. The controller will send a CONNECTED notification to the
515 * front-end driver.
516 */
517 typedef struct {
518 /* IN */
519 domid_t domid; /* 0: Domain attached to new interface. */
520 u16 __pad0; /* 2 */
521 u32 netif_handle; /* 4: Domain-specific interface handle. */
522 memory_t tx_shmem_frame; /* 8: Page cont. tx shared comms window. */
523 MEMORY_PADDING;
524 memory_t rx_shmem_frame; /* 16: Page cont. rx shared comms window. */
525 MEMORY_PADDING;
526 u16 evtchn; /* 24: Event channel for notifications. */
527 u16 __pad1; /* 26 */
528 /* OUT */
529 u32 status; /* 28 */
530 } PACKED netif_be_connect_t; /* 32 bytes */
532 /*
533 * CMSG_NETIF_BE_DISCONNECT:
534 * When the driver sends a successful response then the interface is fully
535 * disconnected. The controller will send a DOWN notification to the front-end
536 * driver.
537 */
538 typedef struct {
539 /* IN */
540 domid_t domid; /* 0: Domain attached to new interface. */
541 u16 __pad;
542 u32 netif_handle; /* 4: Domain-specific interface handle. */
543 /* OUT */
544 u32 status; /* 8 */
545 } PACKED netif_be_disconnect_t; /* 12 bytes */
547 /*
548 * CMSG_NETIF_BE_DRIVER_STATUS:
549 * Notify the domain controller that the back-end driver is DOWN or UP.
550 * If the driver goes DOWN while interfaces are still UP, the domain
551 * will automatically send DOWN notifications.
552 */
553 typedef struct {
554 u32 status; /* 0: NETIF_DRIVER_STATUS_??? */
555 } PACKED netif_be_driver_status_t; /* 4 bytes */
559 /******************************************************************************
560 * USB-INTERFACE FRONTEND DEFINITIONS
561 */
563 /* Messages from domain controller to guest. */
564 #define CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED 0
566 /* Messages from guest to domain controller. */
567 #define CMSG_USBIF_FE_DRIVER_STATUS_CHANGED 32
568 #define CMSG_USBIF_FE_INTERFACE_CONNECT 33
569 #define CMSG_USBIF_FE_INTERFACE_DISCONNECT 34
570 /*
571 * CMSG_USBIF_FE_INTERFACE_STATUS_CHANGED:
572 * Notify a guest about a status change on one of its block interfaces.
573 * If the interface is DESTROYED or DOWN then the interface is disconnected:
574 * 1. The shared-memory frame is available for reuse.
575 * 2. Any unacknowledged messages pending on the interface were dropped.
576 */
577 #define USBIF_INTERFACE_STATUS_DESTROYED 0 /* Interface doesn't exist. */
578 #define USBIF_INTERFACE_STATUS_DISCONNECTED 1 /* Exists but is disconnected. */
579 #define USBIF_INTERFACE_STATUS_CONNECTED 2 /* Exists and is connected. */
580 typedef struct {
581 u32 status; /* 0 */
582 u16 evtchn; /* 4: (only if status == BLKIF_INTERFACE_STATUS_CONNECTED). */
583 domid_t domid; /* 6: status != BLKIF_INTERFACE_STATUS_DESTROYED */
584 u32 bandwidth; /* 8 */
585 u32 num_ports; /* 12 */
586 } PACKED usbif_fe_interface_status_changed_t; /* 12 bytes */
588 /*
589 * CMSG_USBIF_FE_DRIVER_STATUS_CHANGED:
590 * Notify the domain controller that the front-end driver is DOWN or UP.
591 * When the driver goes DOWN then the controller will send no more
592 * status-change notifications.
593 * If the driver goes DOWN while interfaces are still UP, the domain
594 * will automatically take the interfaces DOWN.
595 *
596 * NB. The controller should not send an INTERFACE_STATUS_CHANGED message
597 * for interfaces that are active when it receives an UP notification. We
598 * expect that the frontend driver will query those interfaces itself.
599 */
600 #define USBIF_DRIVER_STATUS_DOWN 0
601 #define USBIF_DRIVER_STATUS_UP 1
602 typedef struct {
603 /* IN */
604 u32 status; /* 0: USBIF_DRIVER_STATUS_??? */
605 } PACKED usbif_fe_driver_status_changed_t; /* 4 bytes */
607 /*
608 * CMSG_USBIF_FE_INTERFACE_CONNECT:
609 * If successful, the domain controller will acknowledge with a
610 * STATUS_CONNECTED message.
611 */
612 typedef struct {
613 u32 __pad;
614 memory_t shmem_frame; /* 8 */
615 MEMORY_PADDING;
616 } PACKED usbif_fe_interface_connect_t; /* 16 bytes */
618 /*
619 * CMSG_BLKIF_FE_INTERFACE_DISCONNECT:
620 * If successful, the domain controller will acknowledge with a
621 * STATUS_DISCONNECTED message.
622 */
623 typedef struct {} PACKED usbif_fe_interface_disconnect_t; /* 4 bytes */
626 /******************************************************************************
627 * USB-INTERFACE BACKEND DEFINITIONS
628 */
630 /* Messages from domain controller. */
631 #define CMSG_USBIF_BE_CREATE 0 /* Create a new block-device interface. */
632 #define CMSG_USBIF_BE_DESTROY 1 /* Destroy a block-device interface. */
633 #define CMSG_USBIF_BE_CONNECT 2 /* Connect i/f to remote driver. */
634 #define CMSG_USBIF_BE_DISCONNECT 3 /* Disconnect i/f from remote driver. */
635 #define CMSG_USBIF_BE_CLAIM_PORT 4 /* Claim host port for a domain. */
636 #define CMSG_USBIF_BE_RELEASE_PORT 5 /* Release host port. */
637 /* Messages to domain controller. */
638 #define CMSG_USBIF_BE_DRIVER_STATUS_CHANGED 32
640 /* Non-specific 'okay' return. */
641 #define USBIF_BE_STATUS_OKAY 0
642 /* Non-specific 'error' return. */
643 #define USBIF_BE_STATUS_ERROR 1
644 /* The following are specific error returns. */
645 #define USBIF_BE_STATUS_INTERFACE_EXISTS 2
646 #define USBIF_BE_STATUS_INTERFACE_NOT_FOUND 3
647 #define USBIF_BE_STATUS_INTERFACE_CONNECTED 4
648 #define USBIF_BE_STATUS_OUT_OF_MEMORY 7
649 #define USBIF_BE_STATUS_MAPPING_ERROR 9
651 /* This macro can be used to create an array of descriptive error strings. */
652 #define USBIF_BE_STATUS_ERRORS { \
653 "Okay", \
654 "Non-specific error", \
655 "Interface already exists", \
656 "Interface not found", \
657 "Interface is still connected", \
658 "Out of memory", \
659 "Could not map domain memory" }
661 /*
662 * CMSG_USBIF_BE_CREATE:
663 * When the driver sends a successful response then the interface is fully
664 * created. The controller will send a DOWN notification to the front-end
665 * driver.
666 */
667 typedef struct {
668 /* IN */
669 domid_t domid; /* 0: Domain attached to new interface. */
670 u16 __pad;
671 /* OUT */
672 u32 status; /* 8 */
673 } PACKED usbif_be_create_t; /* 12 bytes */
675 /*
676 * CMSG_USBIF_BE_DESTROY:
677 * When the driver sends a successful response then the interface is fully
678 * torn down. The controller will send a DESTROYED notification to the
679 * front-end driver.
680 */
681 typedef struct {
682 /* IN */
683 domid_t domid; /* 0: Identify interface to be destroyed. */
684 u16 __pad;
685 /* OUT */
686 u32 status; /* 8 */
687 } PACKED usbif_be_destroy_t; /* 12 bytes */
689 /*
690 * CMSG_USBIF_BE_CONNECT:
691 * When the driver sends a successful response then the interface is fully
692 * connected. The controller will send a CONNECTED notification to the
693 * front-end driver.
694 */
695 typedef struct {
696 /* IN */
697 domid_t domid; /* 0: Domain attached to new interface. */
698 u16 __pad;
699 memory_t shmem_frame; /* 8: Page cont. shared comms window. */
700 MEMORY_PADDING;
701 u32 evtchn; /* 16: Event channel for notifications. */
702 u32 bandwidth; /* 20: Bandwidth allocated for isoch / int - us
703 * per 1ms frame (ie between 0 and 900 or 800
704 * depending on USB version). */
705 /* OUT */
706 u32 status; /* 24 */
707 } PACKED usbif_be_connect_t; /* 28 bytes */
709 /*
710 * CMSG_USBIF_BE_DISCONNECT:
711 * When the driver sends a successful response then the interface is fully
712 * disconnected. The controller will send a DOWN notification to the front-end
713 * driver.
714 */
715 typedef struct {
716 /* IN */
717 domid_t domid; /* 0: Domain attached to new interface. */
718 u16 __pad;
719 /* OUT */
720 u32 status; /* 8 */
721 } PACKED usbif_be_disconnect_t; /* 12 bytes */
723 /*
724 * CMSG_USBIF_BE_DRIVER_STATUS_CHANGED:
725 * Notify the domain controller that the back-end driver is DOWN or UP.
726 * If the driver goes DOWN while interfaces are still UP, the controller
727 * will automatically send DOWN notifications.
728 */
729 typedef struct {
730 u32 status; /* 0: USBIF_DRIVER_STATUS_??? */
731 } PACKED usbif_be_driver_status_changed_t; /* 4 bytes */
733 #define USB_PATH_LEN 16
735 /*
736 * CMSG_USBIF_BE_CLAIM_PORT:
737 * Instruct the backend driver to claim any device plugged into the specified
738 * host port and to allow the specified domain to control that port.
739 */
740 typedef struct
741 {
742 /* IN */
743 domid_t domid; /* 0: which domain */
744 u32 usbif_port; /* 6: port on the virtual root hub */
745 u32 status; /* 10: status of operation */
746 char path[USB_PATH_LEN]; /* Currently specified in the Linux style - may need to be
747 * converted to some OS-independent format at some stage. */
748 } PACKED usbif_be_claim_port_t;
750 /*
751 * CMSG_USBIF_BE_RELEASE_PORT:
752 * Instruct the backend driver to release any device plugged into the specified
753 * host port.
754 */
755 typedef struct
756 {
757 char path[USB_PATH_LEN];
758 } PACKED usbif_be_release_port_t;
760 /******************************************************************************
761 * SHUTDOWN DEFINITIONS
762 */
764 /*
765 * Subtypes for shutdown messages.
766 */
767 #define CMSG_SHUTDOWN_POWEROFF 0 /* Clean shutdown (SHUTDOWN_poweroff). */
768 #define CMSG_SHUTDOWN_REBOOT 1 /* Clean shutdown (SHUTDOWN_reboot). */
769 #define CMSG_SHUTDOWN_SUSPEND 2 /* Create suspend info, then */
770 /* SHUTDOWN_suspend. */
771 #define CMSG_SHUTDOWN_SYSRQ 3
774 /******************************************************************************
775 * MEMORY CONTROLS
776 */
778 #define CMSG_MEM_REQUEST_SET 0 /* Request a domain to set its mem footprint. */
780 /*
781 * CMSG_MEM_REQUEST:
782 * Request that the domain change its memory reservation.
783 */
784 typedef struct {
785 /* OUT */
786 u32 target; /* 0: Target memory reservation in pages. */
787 /* IN */
788 u32 status; /* 4: Return code indicates success or failure. */
789 } PACKED mem_request_t; /* 8 bytes */
792 #endif /* __XEN_PUBLIC_IO_DOMAIN_CONTROLLER_H__ */