fedora core 2.6.9-1.11-FC2
[linux-2.6.git] / include / asm-xen / gnttab.h
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, K A Fraser
10  * Copyright (c) 2005, Christopher Clark
11  */
12
13 #ifndef __ASM_GNTTAB_H__
14 #define __ASM_GNTTAB_H__
15
16 #include <linux/config.h>
17 #include <asm-xen/hypervisor.h>
18 #include <asm-xen/xen-public/grant_table.h>
19
20 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
21 #define NR_GRANT_FRAMES 4
22 #define NR_GRANT_ENTRIES (NR_GRANT_FRAMES * PAGE_SIZE / sizeof(grant_entry_t))
23
24 int
25 gnttab_grant_foreign_access(
26     domid_t domid, unsigned long frame, int readonly);
27
28 void
29 gnttab_end_foreign_access(
30     grant_ref_t ref, int readonly);
31
32 int
33 gnttab_grant_foreign_transfer(
34     domid_t domid, unsigned long pfn);
35
36 unsigned long
37 gnttab_end_foreign_transfer(
38     grant_ref_t ref);
39
40 int
41 gnttab_query_foreign_access( 
42     grant_ref_t ref );
43
44 /*
45  * operations on reserved batches of grant references
46  */
47 int
48 gnttab_alloc_grant_references(
49     u16 count, grant_ref_t *pprivate_head, grant_ref_t *private_terminal );
50
51 void
52 gnttab_free_grant_references(
53     u16 count, grant_ref_t private_head );
54
55 int
56 gnttab_claim_grant_reference( grant_ref_t *pprivate_head, grant_ref_t terminal
57 );
58
59 void
60 gnttab_release_grant_reference(
61     grant_ref_t *private_head, grant_ref_t release );
62
63 void
64 gnttab_grant_foreign_access_ref(
65     grant_ref_t ref, domid_t domid, unsigned long frame, int readonly);
66
67 void
68 gnttab_grant_foreign_transfer_ref(
69     grant_ref_t, domid_t domid, unsigned long pfn);
70
71
72 #endif /* __ASM_GNTTAB_H__ */