00001
00022 #ifndef _XENO_MISC_H
00023 #define _XENO_MISC_H
00024
00025 #include <native/types.h>
00026
00027 #define IORN_IOPORT 0x1
00028 #define IORN_IOMEM 0x2
00029
00030 typedef struct rt_ioregion_placeholder {
00031 xnhandle_t opaque;
00032 } RT_IOREGION_PLACEHOLDER;
00033
00034 #if defined(__KERNEL__) || defined(__XENO_SIM__)
00035
00036 #include <native/ppd.h>
00037
00038 #define XENO_IOREGION_MAGIC 0x55550b0b
00039
00040 typedef struct rt_ioregion {
00041
00042 unsigned magic;
00043
00044 xnhandle_t handle;
00045
00046 uint64_t start;
00047
00048 uint64_t len;
00049
00050 char name[XNOBJECT_NAME_LEN];
00051
00052 int flags;
00053
00054 pid_t cpid;
00055
00056 xnholder_t rlink;
00057
00058 #define rlink2ioregion(ln) container_of(ln, RT_IOREGION, rlink)
00059
00060 xnqueue_t *rqueue;
00061
00062 } RT_IOREGION;
00063
00064 int rt_ioregion_delete(RT_IOREGION *iorn);
00065
00066 static inline void __native_ioregion_flush_rq(xnqueue_t *rq)
00067 {
00068 #ifdef CONFIG_XENO_OPT_PERVASIVE
00069 xeno_flush_rq(RT_IOREGION, rq, ioregion);
00070 #endif
00071 }
00072
00073 static inline int __native_misc_pkg_init(void)
00074 {
00075 return 0;
00076 }
00077
00078 static inline void __native_misc_pkg_cleanup(void)
00079 {
00080 #ifdef CONFIG_XENO_OPT_PERVASIVE
00081 __native_ioregion_flush_rq(&__native_global_rholder.ioregionq);
00082 #endif
00083 }
00084
00085 #else
00086
00087 typedef RT_IOREGION_PLACEHOLDER RT_IOREGION;
00088
00089 #ifdef __cplusplus
00090 extern "C" {
00091 #endif
00092
00093
00094
00095 int rt_io_get_region(RT_IOREGION *iorn,
00096 const char *name,
00097 uint64_t start,
00098 uint64_t len,
00099 int flags);
00100
00101 int rt_io_put_region(RT_IOREGION *iorn);
00102
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106
00107 #endif
00108
00109 #endif