• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/include/xen/
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 *
16 * Copyright (C) IBM Corp. 2006
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 *          Jerone Young <jyoung5@us.ibm.com>
20 */
21
22#ifndef _LINUX_XENCOMM_H_
23#define _LINUX_XENCOMM_H_
24
25#include <xen/interface/xencomm.h>
26
27#define XENCOMM_MINI_ADDRS 3
28struct xencomm_mini {
29	struct xencomm_desc _desc;
30	uint64_t address[XENCOMM_MINI_ADDRS];
31};
32
33/* To avoid additionnal virt to phys conversion, an opaque structure is
34   presented.  */
35struct xencomm_handle;
36
37extern void xencomm_free(struct xencomm_handle *desc);
38extern struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes);
39extern struct xencomm_handle *__xencomm_map_no_alloc(void *ptr,
40			unsigned long bytes,  struct xencomm_mini *xc_area);
41
42#define XENCOMM_MINI_ALIGNED(xc_desc, n)				\
43	unsigned char xc_desc ## _base[((n) + 1 ) *			\
44				       sizeof(struct xencomm_mini)];	\
45	struct xencomm_mini *xc_desc = (struct xencomm_mini *)		\
46		((unsigned long)xc_desc ## _base +			\
47		 (sizeof(struct xencomm_mini) -				\
48		  ((unsigned long)xc_desc ## _base) %			\
49		  sizeof(struct xencomm_mini)));
50#define xencomm_map_no_alloc(ptr, bytes)			\
51	({ XENCOMM_MINI_ALIGNED(xc_desc, 1);			\
52		__xencomm_map_no_alloc(ptr, bytes, xc_desc); })
53
54/* provided by architecture code: */
55extern unsigned long xencomm_vtop(unsigned long vaddr);
56
57static inline void *xencomm_pa(void *ptr)
58{
59	return (void *)xencomm_vtop((unsigned long)ptr);
60}
61
62#define xen_guest_handle(hnd)  ((hnd).p)
63
64#endif /* _LINUX_XENCOMM_H_ */
65