X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=arch_ppc.h;fp=arch_ppc.h;h=0000000000000000000000000000000000000000;hp=9c4ec912537b6550e5e0676ef350635fb14cc507;hb=ec4e58a3aba2084440012f8ccac3a31eb6101183;hpb=2f873279bc92fac32e6549d6eb72f3197c7048ac diff --git a/arch_ppc.h b/arch_ppc.h deleted file mode 100644 index 9c4ec91..0000000 --- a/arch_ppc.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef _ARCH_PPC_H -#define _ARCH_PPC_H - -/* - * arch_ppc.h: trivial definitions for the powerpc architecture. - * - * Copyright (c) 2009 Paul E. McKenney, IBM Corporation. - * Copyright (c) 2009 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. -* - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#define CONFIG_HAVE_FENCE 1 -#define CONFIG_HAVE_MEM_COHERENCY - -#ifndef BITS_PER_LONG -#define BITS_PER_LONG (__SIZEOF_LONG__ * 8) -#endif - -#define mb() asm volatile("sync":::"memory") -#define rmb() asm volatile("sync":::"memory") -#define wmb() asm volatile("sync"::: "memory") - -/* - * Architectures without cache coherency need something like the following: - * - * #define mb() mc() - * #define rmb() rmc() - * #define wmb() wmc() - * #define mc() arch_cache_flush() - * #define rmc() arch_cache_flush_read() - * #define wmc() arch_cache_flush_write() - */ - -#define mc() barrier() -#define rmc() barrier() -#define wmc() barrier() - -/* Assume SMP machine, given we don't have this information */ -#define CONFIG_SMP 1 - -#ifdef CONFIG_SMP -#define smp_mb() mb() -#define smp_rmb() rmb() -#define smp_wmb() wmb() -#define smp_mc() mc() -#define smp_rmc() rmc() -#define smp_wmc() wmc() -#else -#define smp_mb() barrier() -#define smp_rmb() barrier() -#define smp_wmb() barrier() -#define smp_mc() barrier() -#define smp_rmc() barrier() -#define smp_wmc() barrier() -#endif - -/* Nop everywhere except on alpha. */ -#define smp_read_barrier_depends() - -static inline void cpu_relax(void) -{ - barrier(); -} - -/* - * Serialize core instruction execution. Also acts as a compiler barrier. - */ -static inline void sync_core() -{ - asm volatile("isync" : : : "memory"); -} - -#define mftbl() \ - ({ \ - unsigned long rval; \ - asm volatile("mftbl %0" : "=r" (rval)); \ - rval; \ - }) - -#define mftbu() \ - ({ \ - unsigned long rval; \ - asm volatile("mftbu %0" : "=r" (rval)); \ - rval; \ - }) - -typedef unsigned long long cycles_t; - -static inline cycles_t get_cycles (void) -{ - long h, l; - - for (;;) { - h = mftbu(); - barrier(); - l = mftbl(); - barrier(); - if (mftbu() == h) - return (((cycles_t) h) << 32) + l; - } -} - -#endif /* _ARCH_PPC_H */