ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-xen/gnttab.h @ 6800:6dadf4d93ee3

Converge ia64 grant_table API
author djm@kirby.fc.hp.com
date Tue Sep 13 14:20:02 2005 -0600 (2005-09-13)
parents b35215021b32
children 9af349b055e5
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, 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-xen/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 void gnttab_end_foreign_access_ref(grant_ref_t ref, int readonly);
38 void gnttab_end_foreign_access(grant_ref_t ref, int readonly);
40 int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn);
42 unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref);
43 unsigned long gnttab_end_foreign_transfer(grant_ref_t ref);
45 int gnttab_query_foreign_access(grant_ref_t ref);
47 /*
48 * operations on reserved batches of grant references
49 */
50 int gnttab_alloc_grant_references(u16 count, grant_ref_t *pprivate_head);
52 void gnttab_free_grant_reference(grant_ref_t ref);
54 void gnttab_free_grant_references(grant_ref_t head);
56 int gnttab_claim_grant_reference(grant_ref_t *pprivate_head);
58 void gnttab_release_grant_reference(grant_ref_t *private_head,
59 grant_ref_t release);
61 void gnttab_request_free_callback(struct gnttab_free_callback *callback,
62 void (*fn)(void *), void *arg, u16 count);
64 void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
65 unsigned long frame, int readonly);
67 void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
68 unsigned long pfn);
70 #ifdef __ia64__
71 #define gnttab_map_vaddr(map) __va(map.dev_bus_addr)
72 #else
73 #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
74 #endif
76 #endif /* __ASM_GNTTAB_H__ */