1 /*
2 * Copyright (C) 2011 Citrix Ltd.
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2. See
5 * the COPYING file in the top-level directory.
6 *
7 */
8
9 #ifndef XEN_MAPCACHE_H
10 #define XEN_MAPCACHE_H
11
12 #include "exec/cpu-common.h"
13 #include "sysemu/xen.h"
14
15 typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr phys_offset,
16 ram_addr_t size);
17 #ifdef CONFIG_XEN_IS_POSSIBLE
18
19 void xen_map_cache_init(phys_offset_to_gaddr_t f,
20 void *opaque);
21 uint8_t *xen_map_cache(MemoryRegion *mr, hwaddr phys_addr, hwaddr size,
22 ram_addr_t ram_addr_offset,
23 uint8_t lock, bool dma,
24 bool is_write);
25 ram_addr_t xen_ram_addr_from_mapcache(void *ptr);
26 void xen_invalidate_map_cache_entry(uint8_t *buffer);
27 void xen_invalidate_map_cache(void);
28 uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr,
29 hwaddr new_phys_addr,
30 hwaddr size);
31 #else
32
xen_map_cache_init(phys_offset_to_gaddr_t f,void * opaque)33 static inline void xen_map_cache_init(phys_offset_to_gaddr_t f,
34 void *opaque)
35 {
36 }
37
xen_map_cache(MemoryRegion * mr,hwaddr phys_addr,hwaddr size,ram_addr_t ram_addr_offset,uint8_t lock,bool dma,bool is_write)38 static inline uint8_t *xen_map_cache(MemoryRegion *mr,
39 hwaddr phys_addr,
40 hwaddr size,
41 ram_addr_t ram_addr_offset,
42 uint8_t lock,
43 bool dma,
44 bool is_write)
45 {
46 abort();
47 }
48
xen_ram_addr_from_mapcache(void * ptr)49 static inline ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
50 {
51 abort();
52 }
53
xen_invalidate_map_cache_entry(uint8_t * buffer)54 static inline void xen_invalidate_map_cache_entry(uint8_t *buffer)
55 {
56 }
57
xen_invalidate_map_cache(void)58 static inline void xen_invalidate_map_cache(void)
59 {
60 }
61
xen_replace_cache_entry(hwaddr old_phys_addr,hwaddr new_phys_addr,hwaddr size)62 static inline uint8_t *xen_replace_cache_entry(hwaddr old_phys_addr,
63 hwaddr new_phys_addr,
64 hwaddr size)
65 {
66 abort();
67 }
68
69 #endif
70
71 #endif /* XEN_MAPCACHE_H */
72