ia64/xen-unstable

view linux-2.6-xen-sparse/drivers/xen/tpmback/common.h @ 6689:7d0fb56b4a91

merge?
author cl349@firebug.cl.cam.ac.uk
date Wed Sep 07 19:01:31 2005 +0000 (2005-09-07)
parents 549f4256ab3c dd668f7527cb
children b2f4823b6ff0 b35215021b32 9af349b055e5 3233e7ecfa9f
line source
1 /******************************************************************************
2 * drivers/xen/tpmback/common.h
3 */
5 #ifndef __NETIF__BACKEND__COMMON_H__
6 #define __NETIF__BACKEND__COMMON_H__
8 #include <linux/config.h>
9 #include <linux/version.h>
10 #include <linux/module.h>
11 #include <linux/interrupt.h>
12 #include <linux/slab.h>
13 #include <asm-xen/evtchn.h>
14 #include <asm-xen/xen-public/io/tpmif.h>
15 #include <asm/io.h>
16 #include <asm/pgalloc.h>
17 #include <asm-xen/xen-public/io/domain_controller.h>
19 #if 0
20 #define ASSERT(_p) \
21 if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
22 __LINE__, __FILE__); *(int*)0=0; }
23 #define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
24 __FILE__ , __LINE__ , ## _a )
25 #else
26 #define ASSERT(_p) ((void)0)
27 #define DPRINTK(_f, _a...) ((void)0)
28 #endif
30 typedef struct tpmif_st {
31 struct list_head tpmif_list;
32 /* Unique identifier for this interface. */
33 domid_t domid;
34 unsigned int handle;
36 /* Physical parameters of the comms window. */
37 unsigned long tx_shmem_frame;
38 unsigned int evtchn;
39 unsigned int remote_evtchn;
41 /* The shared rings and indexes. */
42 tpmif_tx_interface_t *tx;
44 /* Miscellaneous private stuff. */
45 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
46 int active;
48 struct tpmif_st *hash_next;
49 struct list_head list; /* scheduling list */
50 atomic_t refcnt;
52 long int tpm_instance;
53 unsigned long mmap_vstart;
55 struct work_struct work;
57 u16 shmem_handle;
58 unsigned long shmem_vaddr;
59 grant_ref_t shmem_ref;
61 } tpmif_t;
63 void tpmif_disconnect_complete(tpmif_t * tpmif);
64 tpmif_t *tpmif_find(domid_t domid, long int instance);
65 void tpmif_interface_init(void);
66 void tpmif_schedule_work(tpmif_t * tpmif);
67 void tpmif_deschedule_work(tpmif_t * tpmif);
68 void tpmif_xenbus_init(void);
69 int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
70 irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
71 int tpmif_vtpm_open(tpmif_t *tpmif, domid_t domain, u32 instance);
72 int tpmif_vtpm_close(u32 instance);
74 int vtpm_release_packets(tpmif_t * tpmif, int send_msgs);
76 #define tpmif_get(_b) (atomic_inc(&(_b)->refcnt))
77 #define tpmif_put(_b) \
78 do { \
79 if ( atomic_dec_and_test(&(_b)->refcnt) ) \
80 tpmif_disconnect_complete(_b); \
81 } while (0)
84 extern int num_frontends;
86 #define MMAP_VADDR(t,_req) ((t)->mmap_vstart + ((_req) * PAGE_SIZE))
88 #endif /* __TPMIF__BACKEND__COMMON_H__ */