blob: c59804060b9a2e1fdab9b68ce9174fb343410501 [file] [log] [blame]
Jun Nakajima432d2682010-08-31 16:41:25 +01001/*
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
Avi Kivityfd2a9d22011-07-20 12:14:06 +030012#include <stdlib.h>
13
Avi Kivitya8170e52012-10-23 12:30:10 +020014typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr start_addr,
Anthony PERARDcd1ba7d2012-01-18 12:21:38 +000015 ram_addr_t size,
16 void *opaque);
Avi Kivityfd2a9d22011-07-20 12:14:06 +030017#ifdef CONFIG_XEN
18
Anthony PERARDcd1ba7d2012-01-18 12:21:38 +000019void xen_map_cache_init(phys_offset_to_gaddr_t f,
20 void *opaque);
Avi Kivitya8170e52012-10-23 12:30:10 +020021uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size,
Jan Kiszkae41d7c62011-06-21 22:59:08 +020022 uint8_t lock);
23ram_addr_t xen_ram_addr_from_mapcache(void *ptr);
24void xen_invalidate_map_cache_entry(uint8_t *buffer);
25void xen_invalidate_map_cache(void);
Jun Nakajima432d2682010-08-31 16:41:25 +010026
Avi Kivityfd2a9d22011-07-20 12:14:06 +030027#else
28
Anthony PERARDcd1ba7d2012-01-18 12:21:38 +000029static inline void xen_map_cache_init(phys_offset_to_gaddr_t f,
30 void *opaque)
Avi Kivityfd2a9d22011-07-20 12:14:06 +030031{
32}
33
Avi Kivitya8170e52012-10-23 12:30:10 +020034static inline uint8_t *xen_map_cache(hwaddr phys_addr,
35 hwaddr size,
Avi Kivityfd2a9d22011-07-20 12:14:06 +030036 uint8_t lock)
37{
38 abort();
39}
40
41static inline ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
42{
43 abort();
44}
45
46static inline void xen_invalidate_map_cache_entry(uint8_t *buffer)
47{
48}
49
50static inline void xen_invalidate_map_cache(void)
51{
52}
53
54#endif
55
Jun Nakajima432d2682010-08-31 16:41:25 +010056#endif /* !XEN_MAPCACHE_H */