aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/include
diff options
context:
space:
mode:
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r--sys/powerpc/include/atomic.h82
-rw-r--r--sys/powerpc/include/ieeefp.h8
-rw-r--r--sys/powerpc/include/param.h4
-rw-r--r--sys/powerpc/include/pte.h5
4 files changed, 59 insertions, 40 deletions
diff --git a/sys/powerpc/include/atomic.h b/sys/powerpc/include/atomic.h
index b2d7549e5bd0..60fb678e6b41 100644
--- a/sys/powerpc/include/atomic.h
+++ b/sys/powerpc/include/atomic.h
@@ -165,6 +165,28 @@ _ATOMIC_ADD(long)
* { *p &= ~v; }
*/
+#ifdef ISA_206_ATOMICS
+#define __atomic_clear_char(p, v, t) \
+ __asm __volatile( \
+ "1: lbarx %0, 0, %2\n" \
+ " andc %0, %0, %3\n" \
+ " stbcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cr0", "memory") \
+ /* __atomic_clear_short */
+#define __atomic_clear_short(p, v, t) \
+ __asm __volatile( \
+ "1: lharx %0, 0, %2\n" \
+ " andc %0, %0, %3\n" \
+ " sthcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cr0", "memory") \
+ /* __atomic_clear_short */
+#endif
#define __atomic_clear_int(p, v, t) \
__asm __volatile( \
"1: lwarx %0, 0, %2\n" \
@@ -222,6 +244,11 @@ _ATOMIC_ADD(long)
} \
/* _ATOMIC_CLEAR */
+#ifdef ISA_206_ATOMICS
+_ATOMIC_CLEAR(char)
+_ATOMIC_CLEAR(short)
+#endif
+
_ATOMIC_CLEAR(int)
_ATOMIC_CLEAR(long)
@@ -265,6 +292,28 @@ _ATOMIC_CLEAR(long)
* atomic_set(p, v)
* { *p |= v; }
*/
+#ifdef ISA_206_ATOMICS
+#define __atomic_set_char(p, v, t) \
+ __asm __volatile( \
+ "1: lbarx %0, 0, %2\n" \
+ " or %0, %3, %0\n" \
+ " stbcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cr0", "memory") \
+ /* __atomic_set_char */
+#define __atomic_set_short(p, v, t) \
+ __asm __volatile( \
+ "1: lharx %0, 0, %2\n" \
+ " or %0, %3, %0\n" \
+ " sthcx. %0, 0, %2\n" \
+ " bne- 1b\n" \
+ : "=&r" (t), "=m" (*p) \
+ : "r" (p), "r" (v), "m" (*p) \
+ : "cr0", "memory") \
+ /* __atomic_set_short */
+#endif
#define __atomic_set_int(p, v, t) \
__asm __volatile( \
@@ -323,6 +372,11 @@ _ATOMIC_CLEAR(long)
} \
/* _ATOMIC_SET */
+#ifdef ISA_206_ATOMICS
+_ATOMIC_SET(char)
+_ATOMIC_SET(short)
+#endif
+
_ATOMIC_SET(int)
_ATOMIC_SET(long)
@@ -1140,34 +1194,10 @@ atomic_thread_fence_seq_cst(void)
#define atomic_set_short atomic_set_16
#define atomic_clear_short atomic_clear_16
#else
-
-static __inline void
-atomic_set_short(volatile u_short *p, u_short bit)
-{
- u_short v;
-
- v = atomic_load_short(p);
- for (;;) {
- if (atomic_fcmpset_16(p, &v, v | bit))
- break;
- }
-}
-
-static __inline void
-atomic_clear_short(volatile u_short *p, u_short bit)
-{
- u_short v;
-
- v = atomic_load_short(p);
- for (;;) {
- if (atomic_fcmpset_16(p, &v, v & ~bit))
- break;
- }
-}
-
+#define atomic_set_8 atomic_set_char
+#define atomic_clear_8 atomic_clear_char
#define atomic_set_16 atomic_set_short
#define atomic_clear_16 atomic_clear_short
-
#endif /* ISA_206_ATOMICS */
/* These need sys/_atomic_subword.h on non-ISA-2.06-atomic platforms. */
diff --git a/sys/powerpc/include/ieeefp.h b/sys/powerpc/include/ieeefp.h
index 3aa92ff4522b..829e167aefae 100644
--- a/sys/powerpc/include/ieeefp.h
+++ b/sys/powerpc/include/ieeefp.h
@@ -10,19 +10,11 @@
/* Deprecated historical FPU control interface */
typedef int fp_except_t;
-#ifdef __SPE__
-#define FP_X_OFL 0x01 /* overflow exception */
-#define FP_X_UFL 0x02 /* underflow exception */
-#define FP_X_DZ 0x04 /* divide-by-zero exception */
-#define FP_X_INV 0x08 /* invalid operation exception */
-#define FP_X_IMP 0x10 /* imprecise (loss of precision) */
-#else
#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
#define FP_X_DZ 0x02 /* divide-by-zero exception */
#define FP_X_UFL 0x04 /* underflow exception */
#define FP_X_OFL 0x08 /* overflow exception */
#define FP_X_INV 0x10 /* invalid operation exception */
-#endif
typedef enum {
FP_RN=0, /* round to nearest representable number */
diff --git a/sys/powerpc/include/param.h b/sys/powerpc/include/param.h
index a190f60c02cc..a154859c0459 100644
--- a/sys/powerpc/include/param.h
+++ b/sys/powerpc/include/param.h
@@ -57,13 +57,9 @@
#define MACHINE_ARCH "powerpc64"
#endif
#else
-#ifdef __SPE__
-#define MACHINE_ARCH "powerpcspe"
-#else
#define MACHINE_ARCH "powerpc"
#endif
#endif
-#endif
#define MID_MACHINE MID_POWERPC
#ifdef __powerpc64__
#ifndef MACHINE_ARCH32
diff --git a/sys/powerpc/include/pte.h b/sys/powerpc/include/pte.h
index ed926f80c879..2e8cdacbe165 100644
--- a/sys/powerpc/include/pte.h
+++ b/sys/powerpc/include/pte.h
@@ -145,10 +145,11 @@ typedef struct lpte lpte_t;
#define LPTE_RO LPTE_BR
/* HPT superpage definitions */
-#define HPT_SP_SHIFT (VM_LEVEL_0_ORDER + PAGE_SHIFT)
+#define VM_LEVEL_0_ORDER_HPT 12
+#define HPT_SP_SHIFT (VM_LEVEL_0_ORDER_HPT + PAGE_SHIFT)
#define HPT_SP_SIZE (1 << HPT_SP_SHIFT)
#define HPT_SP_MASK (HPT_SP_SIZE - 1)
-#define HPT_SP_PAGES (1 << VM_LEVEL_0_ORDER)
+#define HPT_SP_PAGES (1 << VM_LEVEL_0_ORDER_HPT)
/* POWER ISA 3.0 Radix Table Definitions */
#define RPTE_VALID 0x8000000000000000ULL