debuggers.hg

view linux-2.6.10-xen-sparse/drivers/xen/usbback/common.h @ 3692:03c49d1bcd6b

bitkeeper revision 1.1159.243.1 (42042ba8OAh4EZUckgdGWWSqRLutaQ)

Various cleanups, including a move to the new ring macros.
author mwilli2@equilibrium.research
date Sat Feb 05 02:12:56 2005 +0000 (2005-02-05)
parents d295396360fb
children 924777207448
line source
2 #ifndef __USBIF__BACKEND__COMMON_H__
3 #define __USBIF__BACKEND__COMMON_H__
5 #include <linux/config.h>
6 #include <linux/version.h>
7 #include <linux/module.h>
8 #include <linux/rbtree.h>
9 #include <linux/interrupt.h>
10 #include <linux/slab.h>
11 #include <linux/blkdev.h>
12 #include <asm/io.h>
13 #include <asm/setup.h>
14 #include <asm/pgalloc.h>
15 #include <asm-xen/ctrl_if.h>
16 #include <asm-xen/hypervisor.h>
18 #include <asm-xen/xen-public/io/usbif.h>
20 #if 0
21 #define ASSERT(_p) \
22 if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
23 __LINE__, __FILE__); *(int*)0=0; }
24 #define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
25 __FILE__ , __LINE__ , ## _a )
26 #else
27 #define ASSERT(_p) ((void)0)
28 #define DPRINTK(_f, _a...) ((void)0)
29 #endif
31 typedef struct usbif_priv_st usbif_priv_t;
33 struct usbif_priv_st {
34 /* Unique identifier for this interface. */
35 domid_t domid;
36 unsigned int handle;
37 /* Physical parameters of the comms window. */
38 unsigned long shmem_frame;
39 unsigned int evtchn;
40 int irq;
41 /* Comms Information */
42 usbif_back_ring_t usb_ring;
43 /* Private fields. */
44 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
45 /*
46 * DISCONNECT response is deferred until pending requests are ack'ed.
47 * We therefore need to store the id from the original request.
48 */
49 u8 disconnect_rspid;
50 usbif_priv_t *hash_next;
51 struct list_head usbif_list;
52 spinlock_t usb_ring_lock;
53 atomic_t refcnt;
55 struct work_struct work;
56 };
58 void usbif_create(usbif_be_create_t *create);
59 void usbif_destroy(usbif_be_destroy_t *destroy);
60 void usbif_connect(usbif_be_connect_t *connect);
61 int usbif_disconnect(usbif_be_disconnect_t *disconnect, u8 rsp_id);
62 void usbif_disconnect_complete(usbif_priv_t *up);
64 void usbif_release_port(usbif_be_release_port_t *msg);
65 int usbif_claim_port(usbif_be_claim_port_t *msg);
66 void usbif_release_ports(usbif_priv_t *up);
68 usbif_priv_t *usbif_find(domid_t domid);
69 #define usbif_get(_b) (atomic_inc(&(_b)->refcnt))
70 #define usbif_put(_b) \
71 do { \
72 if ( atomic_dec_and_test(&(_b)->refcnt) ) \
73 usbif_disconnect_complete(_b); \
74 } while (0)
77 void usbif_interface_init(void);
78 void usbif_ctrlif_init(void);
80 void usbif_deschedule(usbif_priv_t *up);
81 void remove_from_usbif_list(usbif_priv_t *up);
83 irqreturn_t usbif_be_int(int irq, void *dev_id, struct pt_regs *regs);
85 #endif /* __USBIF__BACKEND__COMMON_H__ */