summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arch-aarch64.h34
-rw-r--r--arch/arch-alpha.h10
-rw-r--r--arch/arch-arm.h19
-rw-r--r--arch/arch-generic.h10
-rw-r--r--arch/arch-hppa.h11
-rw-r--r--arch/arch-ia64.h41
-rw-r--r--arch/arch-mips.h10
-rw-r--r--arch/arch-ppc.h148
-rw-r--r--arch/arch-s390.h38
-rw-r--r--arch/arch-sh.h49
-rw-r--r--arch/arch-sparc.h11
-rw-r--r--arch/arch-sparc64.h18
-rw-r--r--arch/arch-x86-common.h77
-rw-r--r--arch/arch-x86.h40
-rw-r--r--arch/arch-x86_64.h71
-rw-r--r--arch/arch.h75
16 files changed, 0 insertions, 662 deletions
diff --git a/arch/arch-aarch64.h b/arch/arch-aarch64.h
deleted file mode 100644
index 0912a86f..00000000
--- a/arch/arch-aarch64.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef ARCH_AARCH64_H
-#define ARCH_AARCH64_H
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#define FIO_ARCH (arch_aarch64)
-
-#define nop do { __asm__ __volatile__ ("yield"); } while (0)
-#define read_barrier() do { __sync_synchronize(); } while (0)
-#define write_barrier() do { __sync_synchronize(); } while (0)
-
-static inline int arch_ffz(unsigned long bitmask)
-{
- unsigned long count, reversed_bits;
- if (~bitmask == 0) /* ffz() in lib/ffz.h does this. */
- return 63;
-
- __asm__ __volatile__ ("rbit %1, %2\n"
- "clz %0, %1\n" :
- "=r"(count), "=&r"(reversed_bits) :
- "r"(~bitmask));
- return count;
-}
-
-#define ARCH_HAVE_FFZ
-
-#ifdef ARCH_HAVE_CRC_CRYPTO
-#define ARCH_HAVE_ARM64_CRC_CRYPTO
-#endif
-
-#endif
diff --git a/arch/arch-alpha.h b/arch/arch-alpha.h
deleted file mode 100644
index 9318e15d..00000000
--- a/arch/arch-alpha.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef ARCH_ALPHA_H
-#define ARCH_ALPHA_H
-
-#define FIO_ARCH (arch_alpha)
-
-#define nop do { } while (0)
-#define read_barrier() __asm__ __volatile__("mb": : :"memory")
-#define write_barrier() __asm__ __volatile__("wmb": : :"memory")
-
-#endif
diff --git a/arch/arch-arm.h b/arch/arch-arm.h
deleted file mode 100644
index 31671fdb..00000000
--- a/arch/arch-arm.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef ARCH_ARM_H
-#define ARCH_ARM_H
-
-#define FIO_ARCH (arch_arm)
-
-#if defined (__ARM_ARCH_4__) || defined (__ARM_ARCH_4T__) \
- || defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5E__)\
- || defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__) \
- || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
-#define nop __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t")
-#define read_barrier() __asm__ __volatile__ ("" : : : "memory")
-#define write_barrier() __asm__ __volatile__ ("" : : : "memory")
-#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_8A__)
-#define nop __asm__ __volatile__ ("nop")
-#define read_barrier() __sync_synchronize()
-#define write_barrier() __sync_synchronize()
-#endif
-
-#endif
diff --git a/arch/arch-generic.h b/arch/arch-generic.h
deleted file mode 100644
index a0b71f8c..00000000
--- a/arch/arch-generic.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef ARCH_GENERIC_H
-#define ARCH_GENERIC_H
-
-#define FIO_ARCH (arch_generic)
-
-#define nop do { } while (0)
-#define read_barrier() __asm__ __volatile__("": : :"memory")
-#define write_barrier() __asm__ __volatile__("": : :"memory")
-
-#endif
diff --git a/arch/arch-hppa.h b/arch/arch-hppa.h
deleted file mode 100644
index eb4fc333..00000000
--- a/arch/arch-hppa.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef ARCH_HPPA_H
-#define ARCH_HPPA_H
-
-#define FIO_ARCH (arch_hppa)
-
-#define nop do { } while (0)
-
-#define read_barrier() __asm__ __volatile__ ("" : : : "memory")
-#define write_barrier() __asm__ __volatile__ ("" : : : "memory")
-
-#endif
diff --git a/arch/arch-ia64.h b/arch/arch-ia64.h
deleted file mode 100644
index 53c049fd..00000000
--- a/arch/arch-ia64.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef ARCH_IA64_H
-#define ARCH_IA64_H
-
-#define FIO_ARCH (arch_ia64)
-
-#define nop asm volatile ("hint @pause" ::: "memory");
-#define read_barrier() asm volatile ("mf" ::: "memory")
-#define write_barrier() asm volatile ("mf" ::: "memory")
-
-#define ia64_popcnt(x) \
-({ \
- unsigned long ia64_intri_res; \
- asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \
- ia64_intri_res; \
-})
-
-static inline unsigned long arch_ffz(unsigned long bitmask)
-{
- return ia64_popcnt(bitmask & (~bitmask - 1));
-}
-
-static inline unsigned long long get_cpu_clock(void)
-{
- unsigned long long ret;
-
- __asm__ __volatile__("mov %0=ar.itc" : "=r" (ret) : : "memory");
- return ret;
-}
-
-#define ARCH_HAVE_INIT
-extern int tsc_reliable;
-static inline int arch_init(char *envp[])
-{
- tsc_reliable = 1;
- return 0;
-}
-
-#define ARCH_HAVE_FFZ
-#define ARCH_HAVE_CPU_CLOCK
-
-#endif
diff --git a/arch/arch-mips.h b/arch/arch-mips.h
deleted file mode 100644
index 6f157fbb..00000000
--- a/arch/arch-mips.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef ARCH_MIPS64_H
-#define ARCH_MIPS64_H
-
-#define FIO_ARCH (arch_mips)
-
-#define read_barrier() __asm__ __volatile__("": : :"memory")
-#define write_barrier() __asm__ __volatile__("": : :"memory")
-#define nop __asm__ __volatile__("": : :"memory")
-
-#endif
diff --git a/arch/arch-ppc.h b/arch/arch-ppc.h
deleted file mode 100644
index 4a8aa97c..00000000
--- a/arch/arch-ppc.h
+++ /dev/null
@@ -1,148 +0,0 @@
-#ifndef ARCH_PPC_H
-#define ARCH_PPC_H
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#define FIO_ARCH (arch_ppc)
-
-#define nop do { } while (0)
-
-#ifdef __powerpc64__
-#define read_barrier() __asm__ __volatile__ ("lwsync" : : : "memory")
-#else
-#define read_barrier() __asm__ __volatile__ ("sync" : : : "memory")
-#endif
-
-#define write_barrier() __asm__ __volatile__ ("sync" : : : "memory")
-
-#ifdef __powerpc64__
-#define PPC_CNTLZL "cntlzd"
-#else
-#define PPC_CNTLZL "cntlzw"
-#endif
-
-static inline int __ilog2(unsigned long bitmask)
-{
- int lz;
-
- asm (PPC_CNTLZL " %0,%1" : "=r" (lz) : "r" (bitmask));
- return BITS_PER_LONG - 1 - lz;
-}
-
-static inline int arch_ffz(unsigned long bitmask)
-{
- if ((bitmask = ~bitmask) == 0)
- return BITS_PER_LONG;
- return __ilog2(bitmask & -bitmask);
-}
-
-static inline unsigned int mfspr(unsigned int reg)
-{
- unsigned int val;
-
- asm volatile("mfspr %0,%1": "=r" (val) : "K" (reg));
- return val;
-}
-
-#define SPRN_TBRL 0x10C /* Time Base Register Lower */
-#define SPRN_TBRU 0x10D /* Time Base Register Upper */
-#define SPRN_ATBL 0x20E /* Alternate Time Base Lower */
-#define SPRN_ATBU 0x20F /* Alternate Time Base Upper */
-
-#ifdef __powerpc64__
-static inline unsigned long long get_cpu_clock(void)
-{
- unsigned long long rval;
-
- asm volatile(
- "90: mfspr %0, %1;\n"
- " cmpwi %0,0;\n"
- " beq- 90b;\n"
- : "=r" (rval)
- : "i" (SPRN_TBRL));
-
- return rval;
-}
-#else
-static inline unsigned long long get_cpu_clock(void)
-{
- unsigned int tbl, tbu0, tbu1;
- unsigned long long ret;
-
- do {
- if (arch_flags & ARCH_FLAG_1) {
- tbu0 = mfspr(SPRN_ATBU);
- tbl = mfspr(SPRN_ATBL);
- tbu1 = mfspr(SPRN_ATBU);
- } else {
- tbu0 = mfspr(SPRN_TBRU);
- tbl = mfspr(SPRN_TBRL);
- tbu1 = mfspr(SPRN_TBRU);
- }
- } while (tbu0 != tbu1);
-
- ret = (((unsigned long long)tbu0) << 32) | tbl;
- return ret;
-}
-#endif
-
-#if 0
-static void atb_child(void)
-{
- arch_flags |= ARCH_FLAG_1;
- get_cpu_clock();
- _exit(0);
-}
-
-static void atb_clocktest(void)
-{
- pid_t pid;
-
- pid = fork();
- if (!pid)
- atb_child();
- else if (pid != -1) {
- int status;
-
- pid = wait(&status);
- if (pid == -1 || !WIFEXITED(status))
- arch_flags &= ~ARCH_FLAG_1;
- else
- arch_flags |= ARCH_FLAG_1;
- }
-}
-#endif
-
-#define ARCH_HAVE_INIT
-extern int tsc_reliable;
-
-static inline int arch_init(char *envp[])
-{
-#if 0
- tsc_reliable = 1;
- atb_clocktest();
-#endif
- return 0;
-}
-
-#define ARCH_HAVE_FFZ
-
-/*
- * We don't have it on all platforms, lets comment this out until we
- * can handle it more intelligently.
- *
- * #define ARCH_HAVE_CPU_CLOCK
- */
-
-/*
- * Let's have it defined for ppc64
- */
-
-#ifdef __powerpc64__
-#define ARCH_HAVE_CPU_CLOCK
-#endif
-
-#endif
diff --git a/arch/arch-s390.h b/arch/arch-s390.h
deleted file mode 100644
index 2e84bf8a..00000000
--- a/arch/arch-s390.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef ARCH_S390_H
-#define ARCH_S390_H
-
-#define FIO_ARCH (arch_s390)
-
-#define nop asm volatile("nop" : : : "memory")
-#define read_barrier() asm volatile("bcr 15,0" : : : "memory")
-#define write_barrier() asm volatile("bcr 15,0" : : : "memory")
-
-static inline unsigned long long get_cpu_clock(void)
-{
- unsigned long long clk;
-
-#ifdef CONFIG_S390_Z196_FACILITIES
- /*
- * Fio needs monotonic (never lower), but not strict monotonic (never
- * the same) so store clock fast is enough.
- */
- __asm__ __volatile__("stckf %0" : "=Q" (clk) : : "cc");
-#else
- __asm__ __volatile__("stck %0" : "=Q" (clk) : : "cc");
-#endif
- return clk>>12;
-}
-
-#define ARCH_CPU_CLOCK_CYCLES_PER_USEC 1
-#define ARCH_HAVE_CPU_CLOCK
-#undef ARCH_CPU_CLOCK_WRAPS
-
-#define ARCH_HAVE_INIT
-extern int tsc_reliable;
-static inline int arch_init(char *envp[])
-{
- tsc_reliable = 1;
- return 0;
-}
-
-#endif
diff --git a/arch/arch-sh.h b/arch/arch-sh.h
deleted file mode 100644
index 58ff2265..00000000
--- a/arch/arch-sh.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Renesas SH (32bit) only */
-
-#ifndef ARCH_SH_H
-#define ARCH_SH_H
-
-#define FIO_ARCH (arch_sh)
-
-#define nop __asm__ __volatile__ ("nop": : :"memory")
-
-#define mb() \
- do { \
- if (arch_flags & ARCH_FLAG_1) \
- __asm__ __volatile__ ("synco": : :"memory"); \
- else \
- __asm__ __volatile__ (" " : : : "memory"); \
- } while (0)
-
-#define read_barrier() mb()
-#define write_barrier() mb()
-
-#include <stdio.h>
-#include <elf.h>
-
-extern unsigned long arch_flags;
-
-#define CPU_HAS_LLSC 0x0040
-
-static inline int arch_init(char *envp[])
-{
- Elf32_auxv_t *auxv;
-
- while (*envp++ != NULL)
- ;
-
- for (auxv = (Elf32_auxv_t *) envp; auxv->a_type != AT_NULL; auxv++) {
- if (auxv->a_type == AT_HWCAP) {
- if (auxv->a_un.a_val & CPU_HAS_LLSC) {
- arch_flags |= ARCH_FLAG_1;
- break;
- }
- }
- }
-
- return 0;
-}
-
-#define ARCH_HAVE_INIT
-
-#endif
diff --git a/arch/arch-sparc.h b/arch/arch-sparc.h
deleted file mode 100644
index f82a1f23..00000000
--- a/arch/arch-sparc.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef ARCH_SPARC_H
-#define ARCH_SPARC_H
-
-#define FIO_ARCH (arch_sparc)
-
-#define nop do { } while (0)
-
-#define read_barrier() __asm__ __volatile__ ("" : : : "memory")
-#define write_barrier() __asm__ __volatile__ ("" : : : "memory")
-
-#endif
diff --git a/arch/arch-sparc64.h b/arch/arch-sparc64.h
deleted file mode 100644
index 80c697bc..00000000
--- a/arch/arch-sparc64.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef ARCH_SPARC64_H
-#define ARCH_SPARC64_H
-
-#define FIO_ARCH (arch_sparc64)
-
-#define nop do { } while (0)
-
-#define membar_safe(type) \
- do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
- " membar " type "\n" \
- "1:\n" \
- : : : "memory"); \
- } while (0)
-
-#define read_barrier() membar_safe("#LoadLoad")
-#define write_barrier() membar_safe("#StoreStore")
-
-#endif
diff --git a/arch/arch-x86-common.h b/arch/arch-x86-common.h
deleted file mode 100644
index cbf66b8d..00000000
--- a/arch/arch-x86-common.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef FIO_ARCH_X86_COMMON
-#define FIO_ARCH_X86_COMMON
-
-#include <string.h>
-
-static inline void cpuid(unsigned int op,
- unsigned int *eax, unsigned int *ebx,
- unsigned int *ecx, unsigned int *edx)
-{
- *eax = op;
- *ecx = 0;
- do_cpuid(eax, ebx, ecx, edx);
-}
-
-#define ARCH_HAVE_INIT
-
-extern int tsc_reliable;
-extern int arch_random;
-
-static inline void arch_init_intel(unsigned int level)
-{
- unsigned int eax, ebx, ecx = 0, edx;
-
- /*
- * Check for TSC
- */
- eax = 1;
- do_cpuid(&eax, &ebx, &ecx, &edx);
- if (!(edx & (1U << 4)))
- return;
-
- /*
- * Check for constant rate and synced (across cores) TSC
- */
- eax = 0x80000007;
- do_cpuid(&eax, &ebx, &ecx, &edx);
- tsc_reliable = (edx & (1U << 8)) != 0;
-
- /*
- * Check for FDRAND
- */
- eax = 0x1;
- do_cpuid(&eax, &ebx, &ecx, &edx);
- arch_random = (ecx & (1U << 30)) != 0;
-}
-
-static inline void arch_init_amd(unsigned int level)
-{
- unsigned int eax, ebx, ecx, edx;
-
- cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
- if (eax < 0x80000007)
- return;
-
- cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
- tsc_reliable = (edx & (1U << 8)) != 0;
-}
-
-static inline void arch_init(char *envp[])
-{
- unsigned int level;
- char str[13];
-
- arch_random = tsc_reliable = 0;
-
- cpuid(0, &level, (unsigned int *) &str[0],
- (unsigned int *) &str[8],
- (unsigned int *) &str[4]);
-
- str[12] = '\0';
- if (!strcmp(str, "GenuineIntel"))
- arch_init_intel(level);
- else if (!strcmp(str, "AuthenticAMD"))
- arch_init_amd(level);
-}
-
-#endif
diff --git a/arch/arch-x86.h b/arch/arch-x86.h
deleted file mode 100644
index 457b44c1..00000000
--- a/arch/arch-x86.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef ARCH_X86_H
-#define ARCH_X86_H
-
-static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
- unsigned int *ecx, unsigned int *edx)
-{
- asm volatile("xchgl %%ebx, %1\ncpuid\nxchgl %%ebx, %1"
- : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx)
- : "0" (*eax)
- : "memory");
-}
-
-#include "arch-x86-common.h"
-
-#define FIO_ARCH (arch_x86)
-
-#define FIO_HUGE_PAGE 4194304
-
-#define nop __asm__ __volatile__("rep;nop": : :"memory")
-#define read_barrier() __asm__ __volatile__("": : :"memory")
-#define write_barrier() __asm__ __volatile__("": : :"memory")
-
-static inline unsigned long arch_ffz(unsigned long bitmask)
-{
- __asm__("bsfl %1,%0" :"=r" (bitmask) :"r" (~bitmask));
- return bitmask;
-}
-
-static inline unsigned long long get_cpu_clock(void)
-{
- unsigned long long ret;
-
- __asm__ __volatile__("rdtsc" : "=A" (ret));
- return ret;
-}
-
-#define ARCH_HAVE_FFZ
-#define ARCH_HAVE_CPU_CLOCK
-
-#endif
diff --git a/arch/arch-x86_64.h b/arch/arch-x86_64.h
deleted file mode 100644
index e686d109..00000000
--- a/arch/arch-x86_64.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef ARCH_X86_64_H
-#define ARCH_X86_64_H
-
-static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
- unsigned int *ecx, unsigned int *edx)
-{
- asm volatile("cpuid"
- : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
- : "0" (*eax), "2" (*ecx)
- : "memory");
-}
-
-#include "arch-x86-common.h"
-
-#define FIO_ARCH (arch_x86_64)
-
-#define FIO_HUGE_PAGE 2097152
-
-#define nop __asm__ __volatile__("rep;nop": : :"memory")
-#define read_barrier() __asm__ __volatile__("lfence":::"memory")
-#define write_barrier() __asm__ __volatile__("sfence":::"memory")
-
-static inline unsigned long arch_ffz(unsigned long bitmask)
-{
- __asm__("bsf %1,%0" :"=r" (bitmask) :"r" (~bitmask));
- return bitmask;
-}
-
-static inline unsigned long long get_cpu_clock(void)
-{
- unsigned int lo, hi;
-
- __asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi));
- return ((unsigned long long) hi << 32ULL) | lo;
-}
-
-#define ARCH_HAVE_FFZ
-#define ARCH_HAVE_SSE4_2
-#define ARCH_HAVE_CPU_CLOCK
-
-#define RDRAND_LONG ".byte 0x48,0x0f,0xc7,0xf0"
-#define RDSEED_LONG ".byte 0x48,0x0f,0xc7,0xf8"
-#define RDRAND_RETRY 100
-
-static inline int arch_rand_long(unsigned long *val)
-{
- int ok;
-
- asm volatile("1: " RDRAND_LONG "\n\t"
- "jc 2f\n\t"
- "decl %0\n\t"
- "jnz 1b\n\t"
- "2:"
- : "=r" (ok), "=a" (*val)
- : "0" (RDRAND_RETRY));
-
- return ok;
-}
-
-static inline int arch_rand_seed(unsigned long *seed)
-{
- unsigned char ok;
-
- asm volatile(RDSEED_LONG "\n\t"
- "setc %0"
- : "=qm" (ok), "=a" (*seed));
-
- return 0;
-}
-
-#endif
diff --git a/arch/arch.h b/arch/arch.h
deleted file mode 100644
index 00d247c4..00000000
--- a/arch/arch.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef ARCH_H
-#define ARCH_H
-
-enum {
- arch_x86_64 = 1,
- arch_x86,
- arch_ppc,
- arch_ia64,
- arch_s390,
- arch_alpha,
- arch_sparc,
- arch_sparc64,
- arch_arm,
- arch_sh,
- arch_hppa,
- arch_mips,
- arch_aarch64,
-
- arch_generic,
-
- arch_nr,
-};
-
-enum {
- ARCH_FLAG_1 = 1 << 0,
- ARCH_FLAG_2 = 1 << 1,
- ARCH_FLAG_3 = 1 << 2,
- ARCH_FLAG_4 = 1 << 3,
-};
-
-extern unsigned long arch_flags;
-
-#define ARCH_CPU_CLOCK_WRAPS
-
-#if defined(__i386__)
-#include "arch-x86.h"
-#elif defined(__x86_64__)
-#include "arch-x86_64.h"
-#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__)
-#include "arch-ppc.h"
-#elif defined(__ia64__)
-#include "arch-ia64.h"
-#elif defined(__alpha__)
-#include "arch-alpha.h"
-#elif defined(__s390x__) || defined(__s390__)
-#include "arch-s390.h"
-#elif defined(__sparc__)
-#include "arch-sparc.h"
-#elif defined(__sparc64__)
-#include "arch-sparc64.h"
-#elif defined(__arm__)
-#include "arch-arm.h"
-#elif defined(__mips__) || defined(__mips64__)
-#include "arch-mips.h"
-#elif defined(__sh__)
-#include "arch-sh.h"
-#elif defined(__hppa__)
-#include "arch-hppa.h"
-#elif defined(__aarch64__)
-#include "arch-aarch64.h"
-#else
-#warning "Unknown architecture, attempting to use generic model."
-#include "arch-generic.h"
-#endif
-
-#include "../lib/ffz.h"
-
-#ifndef ARCH_HAVE_INIT
-static inline int arch_init(char *envp[])
-{
- return 0;
-}
-#endif
-
-#endif