From 6e3fe157f023a9163a3fb33930a5d9ccc8b7d6ac Mon Sep 17 00:00:00 2001 From: "dietmar.hahn@fujitsu-siemens.com" Date: Tue, 18 Nov 2008 10:55:51 +0100 Subject: [IA64] Remove the useless big endian stuff. This patch removes all the useless big endian stuff from the mini-os. Before there was an effort to support big endian for PV-guest. But the big endian support was never gotten into the common parts of the mini-os so it makes no sense to have this only in the ia64 specific sources. And as there is no open source big endian os and porting our BS2000 os to ia64 was stopped, nobody wants that stuff in the common minos. So this looks ugly then and remove the big endian stuff. Signed-off-by: Dietmar Hahn --- extras/mini-os/include/ia64/atomic.h | 22 ++++------ extras/mini-os/include/ia64/endian.h | 75 ---------------------------------- extras/mini-os/include/ia64/ia64_cpu.h | 50 +++-------------------- extras/mini-os/include/ia64/os.h | 15 ++++--- 4 files changed, 22 insertions(+), 140 deletions(-) delete mode 100644 extras/mini-os/include/ia64/endian.h (limited to 'extras/mini-os/include') 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 - * 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 - - -#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< -#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") -- cgit v1.2.3