ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-xen/gnttab.h @ 8534:da7873110bbb

Tiny bootstrap cleanup.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jan 09 19:46:46 2006 +0100 (2006-01-09)
parents b50eb7619dd4
children 990c009015e8
line source
1 /******************************************************************************
2 * gnttab.h
3 *
4 * Two sets of functionality:
5 * 1. Granting foreign access to our memory reservation.
6 * 2. Accessing others' memory reservations via grant references.
7 * (i.e., mechanisms for both sender and recipient of grant references)
8 *
9 * Copyright (c) 2004-2005, K A Fraser
10 * Copyright (c) 2005, Christopher Clark
11 */
13 #ifndef __ASM_GNTTAB_H__
14 #define __ASM_GNTTAB_H__
16 #include <linux/config.h>
17 #include <asm/hypervisor.h>
18 #include <asm-xen/xen-public/grant_table.h>
20 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
21 #ifdef __ia64__
22 #define NR_GRANT_FRAMES 1
23 #else
24 #define NR_GRANT_FRAMES 4
25 #endif
27 struct gnttab_free_callback {
28 struct gnttab_free_callback *next;
29 void (*fn)(void *);
30 void *arg;
31 u16 count;
32 };
34 int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
35 int readonly);
37 /*
38 * End access through the given grant reference, iff the grant entry is no
39 * longer in use. Return 1 if the grant entry was freed, 0 if it is still in
40 * use.
41 */
42 int gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
44 /*
45 * Eventually end access through the given grant reference, and once that
46 * access has been ended, free the given page too. Access will be ended
47 * immediately iff the grant entry is not in use, otherwise it will happen
48 * some time later. page may be 0, in which case no freeing will occur.
49 */
50 void gnttab_end_foreign_access(grant_ref_t ref, int readonly,
51 unsigned long page);
53 int gnttab_grant_foreign_transfer(domid_t domid);
55 unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
56 unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
58 int gnttab_query_foreign_access(grant_ref_t ref);
60 /*
61 * operations on reserved batches of grant references
62 */
63 int gnttab_alloc_grant_references(u16 count, grant_ref_t *pprivate_head);
65 void gnttab_free_grant_reference(grant_ref_t ref);
67 void gnttab_free_grant_references(grant_ref_t head);
69 int gnttab_claim_grant_reference(grant_ref_t *pprivate_head);
71 void gnttab_release_grant_reference(grant_ref_t *private_head,
72 grant_ref_t release);
74 void gnttab_request_free_callback(struct gnttab_free_callback *callback,
75 void (*fn)(void *), void *arg, u16 count);
77 void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
78 unsigned long frame, int readonly);
80 void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid);
82 #ifdef __ia64__
83 #define gnttab_map_vaddr(map) __va(map.dev_bus_addr)
84 #else
85 #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
86 #endif
88 #endif /* __ASM_GNTTAB_H__ */
90 /*
91 * Local variables:
92 * c-file-style: "linux"
93 * indent-tabs-mode: t
94 * c-indent-level: 8
95 * c-basic-offset: 8
96 * tab-width: 8
97 * End:
98 */