ia64/xen-unstable

view linux-2.6-xen-sparse/drivers/xen/tpmback/common.h @ 11764:9d0b22eb1758

[TPM] back: Allocate pages for foreign mappings individually rather than contiguously.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Oct 05 23:16:21 2006 +0100 (2006-10-05)
parents 23136423a765
children d275951acf10
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 <xen/evtchn.h>
14 #include <xen/driver_util.h>
15 #include <xen/interface/grant_table.h>
16 #include <xen/interface/io/tpmif.h>
17 #include <asm/io.h>
18 #include <asm/pgalloc.h>
20 #define DPRINTK(_f, _a...) \
21 pr_debug("(file=%s, line=%d) " _f, \
22 __FILE__ , __LINE__ , ## _a )
24 struct backend_info;
26 typedef struct tpmif_st {
27 struct list_head tpmif_list;
28 /* Unique identifier for this interface. */
29 domid_t domid;
30 unsigned int handle;
32 /* Physical parameters of the comms window. */
33 unsigned int evtchn;
34 unsigned int irq;
36 /* The shared rings and indexes. */
37 tpmif_tx_interface_t *tx;
38 struct vm_struct *tx_area;
40 /* Miscellaneous private stuff. */
41 enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
42 int active;
44 struct tpmif_st *hash_next;
45 struct list_head list; /* scheduling list */
46 atomic_t refcnt;
48 struct backend_info *bi;
50 grant_handle_t shmem_handle;
51 grant_ref_t shmem_ref;
52 struct page **mmap_pages;
54 char devname[20];
55 } tpmif_t;
57 void tpmif_disconnect_complete(tpmif_t * tpmif);
58 tpmif_t *tpmif_find(domid_t domid, struct backend_info *bi);
59 void tpmif_interface_init(void);
60 void tpmif_interface_exit(void);
61 void tpmif_schedule_work(tpmif_t * tpmif);
62 void tpmif_deschedule_work(tpmif_t * tpmif);
63 void tpmif_xenbus_init(void);
64 void tpmif_xenbus_exit(void);
65 int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
66 irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
68 long int tpmback_get_instance(struct backend_info *bi);
70 int vtpm_release_packets(tpmif_t * tpmif, int send_msgs);
73 #define tpmif_get(_b) (atomic_inc(&(_b)->refcnt))
74 #define tpmif_put(_b) \
75 do { \
76 if (atomic_dec_and_test(&(_b)->refcnt)) \
77 tpmif_disconnect_complete(_b); \
78 } while (0)
80 extern int num_frontends;
82 static inline unsigned long idx_to_kaddr(tpmif_t *t, unsigned int idx)
83 {
84 return (unsigned long)pfn_to_kaddr(page_to_pfn(t->mmap_pages[idx]));
85 }
87 #endif /* __TPMIF__BACKEND__COMMON_H__ */