This commit was manufactured by cvs2svn to create branch 'fedora'.
[linux-2.6.git] / include / asm-xen / xen-public / io / usbif.h
1 /******************************************************************************
2  * usbif.h
3  * 
4  * Unified block-device I/O interface for Xen guest OSes.
5  * 
6  * Copyright (c) 2003-2004, Keir Fraser
7  */
8
9 #ifndef __SHARED_USBIF_H__
10 #define __SHARED_USBIF_H__
11
12 #define usbif_vdev_t   u16
13 #define usbif_sector_t u64
14
15 #define USBIF_OP_IO      0 /* Request IO to a device */
16 #define USBIF_OP_PROBE   1 /* Is there a device on this port? */
17 #define USBIF_OP_RESET   2 /* Reset a virtual USB port.       */
18
19 typedef struct {
20     unsigned long  id;           /* private guest value, echoed in resp  */
21     u8             operation;    /* USBIF_OP_???                         */
22     u8  __pad1;
23     usbif_vdev_t   port;         /* guest virtual USB port               */
24     unsigned long  devnum :7;    /* Device address, as seen by the guest.*/
25     unsigned long  endpoint :4;  /* Device endpoint.                         */
26     unsigned long  direction :1; /* Pipe direction.                          */
27     unsigned long  speed :1;     /* Pipe speed.                              */
28     unsigned long  pipe_type :2; /* Pipe type (iso, bulk, int, ctrl)         */
29     unsigned long  __pad2 :18;
30     unsigned long  transfer_buffer; /* Machine address */
31     unsigned long  length;          /* Buffer length */
32     unsigned long  transfer_flags;  /* For now just pass Linux transfer
33                                      * flags - this may change. */
34     unsigned char setup[8];         /* Embed setup packets directly. */
35     unsigned long  iso_schedule;    /* Machine address of transfer sched (iso
36                                      * only) */
37     unsigned long num_iso;        /* length of iso schedule */
38     unsigned long timeout;        /* timeout in ms */
39 } usbif_request_t;
40
41 /* Data we need to pass:
42  * - Transparently handle short packets or complain at us?
43  */
44
45 typedef struct {
46     unsigned long   id;              /* copied from request         */
47     u8              operation;       /* copied from request         */
48     u8              data;            /* Small chunk of in-band data */
49     s16             status;          /* USBIF_RSP_???               */
50     unsigned long   transfer_mutex;  /* Used for cancelling requests atomically. */
51     unsigned long    length;         /* How much data we really got */
52 } usbif_response_t;
53
54 #define USBIF_RSP_ERROR  -1 /* non-specific 'error' */
55 #define USBIF_RSP_OKAY    0 /* non-specific 'okay'  */
56
57 DEFINE_RING_TYPES(usbif, usbif_request_t, usbif_response_t);
58
59 typedef struct {
60     unsigned long length; /* IN = expected, OUT = actual */
61     unsigned long buffer_offset;  /* IN offset in buffer specified in main
62                                      packet */
63     unsigned long status; /* OUT Status for this packet. */
64 } usbif_iso_t;
65
66 #endif /* __SHARED_USBIF_H__ */