aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include
diff options
context:
space:
mode:
Diffstat (limited to 'extras/mini-os/include')
-rw-r--r--extras/mini-os/include/ia64/atomic.h22
-rw-r--r--extras/mini-os/include/ia64/endian.h75
-rw-r--r--extras/mini-os/include/ia64/ia64_cpu.h50
-rw-r--r--extras/mini-os/include/ia64/os.h15
4 files changed, 22 insertions, 140 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/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 133893acbd..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"
@@ -210,7 +209,7 @@ extern shared_info_t *HYPERVISOR_shared_info;
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)
@@ -221,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)
@@ -229,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) \
@@ -239,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)
@@ -250,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)
@@ -262,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")