diff options
Diffstat (limited to 'extras/mini-os/include')
-rw-r--r-- | extras/mini-os/include/ia64/atomic.h | 22 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/endian.h | 75 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/hypercall-ia64.h | 129 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/ia64_cpu.h | 50 | ||||
-rw-r--r-- | extras/mini-os/include/ia64/os.h | 30 |
5 files changed, 36 insertions, 270 deletions
diff --git a/extras/mini-os/include/ia64/atomic.h b/extras/mini-os/include/ia64/atomic.h index 618ff82abc..ba5aa16517 100644 --- a/extras/mini-os/include/ia64/atomic.h +++ b/extras/mini-os/include/ia64/atomic.h @@ -427,11 +427,10 @@ atomic_readandclear_64(volatile uint64_t* p) static inline void set_bit(int num, volatile void *addr) { - uint32_t bit, b, old, new; + uint32_t bit, old, new; volatile uint32_t *p; p = (volatile uint32_t *) addr + (num >> 5); - b = 1 << (num & 31); - bit = SWAP(b); + bit = 1 << (num & 31); do { old = *p; @@ -442,11 +441,10 @@ set_bit(int num, volatile void *addr) static __inline__ void clear_bit(int num, volatile void *addr) { - uint32_t mask, m, old, new; + uint32_t mask, old, new; volatile uint32_t *p; p = (volatile uint32_t *) addr + (num >> 5); - m = ~(1 << (num & 31)); - mask = SWAP(m); + mask = ~(1 << (num & 31)); do { old = *p; new = old & mask; @@ -456,7 +454,7 @@ clear_bit(int num, volatile void *addr) static __inline__ int test_bit(int num, const volatile void *addr) { - uint32_t val = SWAP(1); + uint32_t val = 1; return val & (((const volatile uint32_t *) addr)[num >> 5] >> (num & 31)); } @@ -468,12 +466,11 @@ test_bit(int num, const volatile void *addr) static inline int test_and_set_bit (int num, volatile void *addr) { - uint32_t bit, b, old, new; + uint32_t bit, old, new; volatile uint32_t *m; m = (volatile uint32_t *) addr + (num >> 5); - b = 1 << (num & 31); - bit = SWAP(b); + bit = 1 << (num & 31); do { old = *m; new = old | bit; @@ -489,12 +486,11 @@ test_and_set_bit (int num, volatile void *addr) static inline int test_and_clear_bit(int num, volatile unsigned long * addr) { - uint32_t bit, b, old, new; + uint32_t bit, old, new; volatile uint32_t* a; a = (volatile uint32_t *) addr + (num >> 5); - b = ~(1 << (num & 31)); - bit = SWAP(b); + bit = ~(1 << (num & 31)); do { old = *a; new = old & bit; diff --git a/extras/mini-os/include/ia64/endian.h b/extras/mini-os/include/ia64/endian.h deleted file mode 100644 index 1d036ffa29..0000000000 --- a/extras/mini-os/include/ia64/endian.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Done by Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com> - * Parts are taken from FreeBSD. - * - **************************************************************************** - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -#if !defined(_ENDIAN_H_) -#define _ENDIAN_H_ - -#include <mini-os/types.h> - - -#if !defined(__ASSEMBLY__) - -#if defined(BIG_ENDIAN) - -static __inline uint64_t -__bswap64(uint64_t __x) -{ - uint64_t __r; - asm __volatile("mux1 %0=%1,@rev" : "=r" (__r) : "r"(__x)); - return __r; -} - -static __inline uint32_t -__bswap32(uint32_t __x) -{ - return (__bswap64(__x) >> 32); -} - -static __inline uint16_t -__bswap16(uint16_t __x) -{ - return (__bswap64(__x) >> 48); -} - -#define doswap(x,sz) ( \ - ((sz)==1)? (uint8_t)(x): \ - ((sz)==2)? __bswap16(x): \ - ((sz)==4)? __bswap32(x): \ - ((sz)==8)? __bswap64(x): \ - ~0l ) - -#define SWAP(x) doswap((x), sizeof((x))) - - -#else /* defined(BIG_ENDIAN) */ - -#define SWAP(x) (x) - -#endif /* defined(BIG_ENDIAN) */ - -#endif /* !defined(__ASSEMBLY__) */ - - -#endif /* !defined(_ENDIAN_H_) */ diff --git a/extras/mini-os/include/ia64/hypercall-ia64.h b/extras/mini-os/include/ia64/hypercall-ia64.h index dbab3d55bf..06ddc8c774 100644 --- a/extras/mini-os/include/ia64/hypercall-ia64.h +++ b/extras/mini-os/include/ia64/hypercall-ia64.h @@ -34,8 +34,6 @@ #ifndef __HYPERCALL_H__ #define __HYPERCALL_H__ -#include <mini-os/lib.h> /* memcpy() */ -#include <mini-os/errno.h> /* ENOSYS() */ #include <xen/event_channel.h> #include <xen/sched.h> #include <xen/version.h> @@ -114,123 +112,24 @@ extern unsigned long __hypercall(unsigned long a1, unsigned long a2, }) -extern unsigned long xencomm_vaddr_to_paddr(unsigned long vaddr); -struct xencomm_handle; - -/* Inline version. To be used only on linear space (kernel space). */ -static inline struct xencomm_handle * -xencomm_create_inline(void *buffer) -{ - unsigned long paddr; - - paddr = xencomm_vaddr_to_paddr((unsigned long)buffer); - return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG); -} - -static inline int -xencomm_arch_event_channel_op(int cmd, void *arg) -{ - int rc; - struct xencomm_handle *newArg; - - newArg = xencomm_create_inline(arg); - rc = _hypercall2(int, event_channel_op, cmd, newArg); - if (unlikely(rc == -ENOSYS)) { - struct evtchn_op op; - - op.cmd = SWAP(cmd); - memcpy(&op.u, arg, sizeof(op.u)); - rc = _hypercall1(int, event_channel_op_compat, &op); - } - return rc; -} -#define HYPERVISOR_event_channel_op xencomm_arch_event_channel_op - -static inline int -xencomm_arch_xen_version(int cmd, struct xencomm_handle *arg) -{ - return _hypercall2(int, xen_version, cmd, arg); -} - -static inline int -xencomm_arch_xen_feature(int cmd, struct xencomm_handle *arg) -{ - struct xencomm_handle *newArg; - - newArg = xencomm_create_inline(arg); - return _hypercall2(int, xen_version, cmd, newArg); -} - -static inline int -HYPERVISOR_xen_version(int cmd, void *arg) -{ - switch(cmd) { - case XENVER_version: - return xencomm_arch_xen_version(cmd, 0); - case XENVER_get_features: - return xencomm_arch_xen_feature(cmd, arg); - default: - return -1; - } -} - -static inline int -xencomm_arch_console_io(int cmd, int count, char *str) -{ - struct xencomm_handle *newStr; - - newStr = xencomm_create_inline(str); - return _hypercall3(int, console_io, cmd, count, newStr); -} - - -#define HYPERVISOR_console_io xencomm_arch_console_io - -static inline int -HYPERVISOR_sched_op_compat(int cmd, unsigned long arg) -{ - return _hypercall2(int, sched_op_compat, cmd, arg); -} - -static inline int -xencomm_arch_sched_op(int cmd, void *arg) -{ - struct xencomm_handle *newArg; - - newArg = xencomm_create_inline(arg); - return _hypercall2(int, sched_op, cmd, newArg); -} - -#define HYPERVISOR_sched_op xencomm_arch_sched_op - -static inline int -xencomm_arch_callback_op(int cmd, void *arg) -{ - struct xencomm_handle *newArg; - - newArg = xencomm_create_inline(arg); - return _hypercall2(int, callback_op, cmd, newArg); -} -#define HYPERVISOR_callback_op xencomm_arch_callback_op - -static inline int -xencomm_arch_hypercall_grant_table_op(unsigned int cmd, - struct xencomm_handle *uop, - unsigned int count) -{ - return _hypercall3(int, grant_table_op, cmd, uop, count); -} +int HYPERVISOR_event_channel_op(int cmd, void *arg); + +int HYPERVISOR_xen_version(int cmd, void *arg); + +int HYPERVISOR_console_io(int cmd, int count, char *str); + +int HYPERVISOR_sched_op_compat(int cmd, unsigned long arg); + +int HYPERVISOR_sched_op(int cmd, void *arg); + +int HYPERVISOR_callback_op(int cmd, void *arg); int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count); -static inline int -HYPERVISOR_opt_feature(void *arg) -{ - struct xencomm_handle *new_arg; +int HYPERVISOR_opt_feature(void *arg); - new_arg = xencomm_create_inline(arg); +int HYPERVISOR_suspend(unsigned long srec); - return _hypercall1(int, opt_feature, new_arg); -} +int HYPERVISOR_shutdown(unsigned int reason); #endif /* __HYPERCALL_H__ */ diff --git a/extras/mini-os/include/ia64/ia64_cpu.h b/extras/mini-os/include/ia64/ia64_cpu.h index f9ebf7329f..3e2e9147ed 100644 --- a/extras/mini-os/include/ia64/ia64_cpu.h +++ b/extras/mini-os/include/ia64/ia64_cpu.h @@ -134,23 +134,16 @@ #define IA64_PSR_IA 0x0000200000000000 -/* Endianess of mini-os. */ -#if defined(BIG_ENDIAN) -#define MOS_IA64_PSR_BE IA64_PSR_BE -#else -#define MOS_IA64_PSR_BE 0 -#endif - #define STARTUP_PSR (IA64_PSR_IT | IA64_PSR_PK | \ - IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \ + IA64_PSR_DT | IA64_PSR_RT | \ IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC) #define MOS_SYS_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \ - IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \ + IA64_PSR_DT | IA64_PSR_RT | \ IA64_PSR_BN | IA64_PSR_CPL_KERN | IA64_PSR_AC) #define MOS_USR_PSR (IA64_PSR_IC | IA64_PSR_I | IA64_PSR_IT | \ - IA64_PSR_DT | IA64_PSR_RT | MOS_IA64_PSR_BE | \ + IA64_PSR_DT | IA64_PSR_RT | \ IA64_PSR_BN | IA64_PSR_CPL_USER | IA64_PSR_AC) /* @@ -193,14 +186,7 @@ #define IA64_DCR_MBZ1_V 0xffffffffffffULL - /* Endianess of DCR register. */ -#if defined(BIG_ENDIAN) -#define MOS_IA64_DCR_BE (1 << IA64_DCR_BE) -#else -#define MOS_IA64_DCR_BE (0 << IA64_DCR_BE) -#endif - -#define IA64_DCR_DEFAULT (MOS_IA64_DCR_BE) +#define IA64_DCR_DEFAULT (IA64_DCR_BE) /* * Vector numbers for various ia64 interrupts. @@ -262,18 +248,8 @@ #define IA64_RSC_MODE_LI (0x2) /* Load intensive */ #define IA64_RSC_MODE_EA (0x3) /* Eager */ -/* RSE endian mode. */ -#if defined(BIG_ENDIAN) -#define MOS_IA64_RSC_BE 1 /* Big endian rse. */ -#else -#define MOS_IA64_RSC_BE 0 /* Little endian rse. */ -#endif - -#define IA64_RSE_EAGER ((IA64_RSC_MODE_EA<<IA64_RSC_MODE) | \ - (MOS_IA64_RSC_BE << IA64_RSC_BE) ) - -#define IA64_RSE_LAZY ((IA64_RSC_MODE_LY<<IA64_RSC_MODE) | \ - (MOS_IA64_RSC_BE << IA64_RSC_BE) ) +#define IA64_RSE_EAGER (IA64_RSC_MODE_EA<<IA64_RSC_MODE) +#define IA64_RSE_LAZY (IA64_RSC_MODE_LY<<IA64_RSC_MODE) @@ -719,19 +695,6 @@ typedef struct trap_frame trap_frame_t; */ typedef struct { -#if defined(BIG_ENDIAN) - uint64_t pte_ig :11; /* bits 53..63 */ - uint64_t pte_ed :1; /* bits 52..52 */ - uint64_t pte_rv2:2; /* bits 50..51 */ - uint64_t pte_ppn:38; /* bits 12..49 */ - uint64_t pte_ar :3; /* bits 9..11 */ - uint64_t pte_pl :2; /* bits 7..8 */ - uint64_t pte_d :1; /* bits 6..6 */ - uint64_t pte_a :1; /* bits 5..5 */ - uint64_t pte_ma :3; /* bits 2..4 */ - uint64_t pte_rv1:1; /* bits 1..1 */ - uint64_t pte_p :1; /* bits 0..0 */ -#else uint64_t pte_p :1; /* bits 0..0 */ uint64_t pte_rv1:1; /* bits 1..1 */ uint64_t pte_ma :3; /* bits 2..4 */ @@ -743,7 +706,6 @@ typedef struct uint64_t pte_rv2:2; /* bits 50..51 */ uint64_t pte_ed :1; /* bits 52..52 */ uint64_t pte_ig :11; /* bits 53..63 */ -#endif } ia64_pte_t; diff --git a/extras/mini-os/include/ia64/os.h b/extras/mini-os/include/ia64/os.h index 2cbfa424b7..9a79e9bdc5 100644 --- a/extras/mini-os/include/ia64/os.h +++ b/extras/mini-os/include/ia64/os.h @@ -28,7 +28,6 @@ #if !defined(__ASSEMBLY__) #include <mini-os/types.h> -#include "endian.h" #include "ia64_cpu.h" #include "atomic.h" #include "efi.h" @@ -192,21 +191,6 @@ __synch_cmpxchg(volatile void *ptr, uint64_t old, uint64_t new, int size) extern shared_info_t *HYPERVISOR_shared_info; -static inline int -HYPERVISOR_shutdown(unsigned int reason) -{ - struct sched_shutdown sched_shutdown = { - .reason = reason - }; - - int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); - - if (rc == -ENOSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason); - - return rc; -} - /* * This code is from the originally os.h and should be put in a @@ -225,7 +209,7 @@ HYPERVISOR_shutdown(unsigned int reason) do { \ vcpu_info_t *_vcpu; \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - _vcpu->evtchn_upcall_mask = SWAP(1); \ + _vcpu->evtchn_upcall_mask = 1; \ barrier(); \ } while (0) @@ -236,7 +220,7 @@ do { \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ _vcpu->evtchn_upcall_mask = 0; \ barrier(); /* unmask then check (avoid races) */ \ - if (unlikely(SWAP(_vcpu->evtchn_upcall_pending))) \ + if (unlikely(_vcpu->evtchn_upcall_pending)) \ force_evtchn_callback(); \ } while (0) @@ -244,7 +228,7 @@ do { \ do { \ vcpu_info_t *_vcpu; \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - (x) = SWAP(_vcpu->evtchn_upcall_mask); \ + (x) = _vcpu->evtchn_upcall_mask; \ } while (0) #define __restore_flags(x) \ @@ -254,7 +238,7 @@ do { \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ if ((_vcpu->evtchn_upcall_mask = (x)) == 0) { \ barrier(); /* unmask then check (avoid races) */ \ - if ( unlikely(SWAP(_vcpu->evtchn_upcall_pending)) ) \ + if ( unlikely(_vcpu->evtchn_upcall_pending) ) \ force_evtchn_callback(); \ }\ } while (0) @@ -265,8 +249,8 @@ do { \ do { \ vcpu_info_t *_vcpu; \ _vcpu = &HYPERVISOR_shared_info->vcpu_info[smp_processor_id()]; \ - (x) = SWAP(_vcpu->evtchn_upcall_mask); \ - _vcpu->evtchn_upcall_mask = SWAP(1); \ + (x) = _vcpu->evtchn_upcall_mask; \ + _vcpu->evtchn_upcall_mask = 1; \ barrier(); \ } while (0) @@ -277,7 +261,7 @@ do { \ #define local_irq_enable() __sti() #define irqs_disabled() \ - SWAP(HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask) + (HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].evtchn_upcall_mask) /* This is a barrier for the compiler only, NOT the processor! */ #define barrier() __asm__ __volatile__("": : :"memory") |