1 | /* |
---|
2 | * Copyright (C) 2006 Hollis Blanchard <hollisb@us.ibm.com>, IBM Corporation |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU General Public License as published by |
---|
6 | * the Free Software Foundation; either version 2 of the License, or |
---|
7 | * (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef _LINUX_XENCOMM_H_ |
---|
20 | #define _LINUX_XENCOMM_H_ |
---|
21 | |
---|
22 | #include <xen/interface/xencomm.h> |
---|
23 | |
---|
24 | #define XENCOMM_MINI_ADDRS 3 |
---|
25 | struct xencomm_mini { |
---|
26 | struct xencomm_desc _desc; |
---|
27 | uint64_t address[XENCOMM_MINI_ADDRS]; |
---|
28 | }; |
---|
29 | |
---|
30 | /* Must be called before any hypercall. */ |
---|
31 | extern void xencomm_init (void); |
---|
32 | |
---|
33 | /* To avoid additionnal virt to phys conversion, an opaque structure is |
---|
34 | presented. */ |
---|
35 | struct xencomm_handle; |
---|
36 | |
---|
37 | extern int xencomm_create(void *buffer, unsigned long bytes, |
---|
38 | struct xencomm_handle **desc, gfp_t type); |
---|
39 | extern void xencomm_free(struct xencomm_handle *desc); |
---|
40 | |
---|
41 | extern int xencomm_create_mini(struct xencomm_mini *area, int *nbr_area, |
---|
42 | void *buffer, unsigned long bytes, |
---|
43 | struct xencomm_handle **ret); |
---|
44 | |
---|
45 | /* Translate virtual address to physical address. */ |
---|
46 | extern unsigned long xencomm_vaddr_to_paddr(unsigned long vaddr); |
---|
47 | |
---|
48 | /* Inline version. To be used only on linear space (kernel space). */ |
---|
49 | static inline struct xencomm_handle * |
---|
50 | xencomm_create_inline(void *buffer) |
---|
51 | { |
---|
52 | unsigned long paddr; |
---|
53 | |
---|
54 | paddr = xencomm_vaddr_to_paddr((unsigned long)buffer); |
---|
55 | return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG); |
---|
56 | } |
---|
57 | |
---|
58 | #define xen_guest_handle(hnd) ((hnd).p) |
---|
59 | |
---|
60 | #endif /* _LINUX_XENCOMM_H_ */ |
---|