diff options
Diffstat (limited to 'gcell/ibm')
77 files changed, 0 insertions, 5804 deletions
diff --git a/gcell/ibm/.gitignore b/gcell/ibm/.gitignore deleted file mode 100644 index a02b6ff73..000000000 --- a/gcell/ibm/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo diff --git a/gcell/ibm/Makefile.am b/gcell/ibm/Makefile.am deleted file mode 100644 index 6438c7331..000000000 --- a/gcell/ibm/Makefile.am +++ /dev/null @@ -1,98 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -include $(top_srcdir)/Makefile.common - -EXTRA_DIST += \ - ./README \ - ./sync/ppu_source/atomic_add.h \ - ./sync/ppu_source/atomic_add_return.h \ - ./sync/ppu_source/atomic_dec_and_test.h \ - ./sync/ppu_source/atomic_dec.h \ - ./sync/ppu_source/atomic_dec_if_positive.h \ - ./sync/ppu_source/atomic_dec_return.h \ - ./sync/ppu_source/atomic.h \ - ./sync/ppu_source/atomic_inc.h \ - ./sync/ppu_source/atomic_inc_return.h \ - ./sync/ppu_source/atomic_read.h \ - ./sync/ppu_source/atomic_set.h \ - ./sync/ppu_source/atomic_sub_and_test.h \ - ./sync/ppu_source/atomic_sub.h \ - ./sync/ppu_source/atomic_sub_return.h \ - ./sync/ppu_source/complete_all.h \ - ./sync/ppu_source/complete.h \ - ./sync/ppu_source/completion.h \ - ./sync/ppu_source/cond_broadcast.h \ - ./sync/ppu_source/cond.h \ - ./sync/ppu_source/cond_init.h \ - ./sync/ppu_source/cond_signal.h \ - ./sync/ppu_source/cond_wait.h \ - ./sync/ppu_source/init_completion.h \ - ./sync/ppu_source/libsync.h \ - ./sync/ppu_source/mutex.h \ - ./sync/ppu_source/mutex_init.h \ - ./sync/ppu_source/mutex_lock.h \ - ./sync/ppu_source/mutex_trylock.h \ - ./sync/ppu_source/mutex_unlock.h \ - ./sync/ppu_source/pdt_libsync_config.xml \ - ./sync/ppu_source/pdt_libsync.xml \ - ./sync/ppu_source/sync_utils.h \ - ./sync/ppu_source/trace_libsync.h \ - ./sync/ppu_source/wait_for_completion.h \ - ./sync/spu_source/atomic_add.h \ - ./sync/spu_source/atomic_add_return.h \ - ./sync/spu_source/atomic_dec_and_test.h \ - ./sync/spu_source/atomic_dec.h \ - ./sync/spu_source/atomic_dec_if_positive.h \ - ./sync/spu_source/atomic_dec_return.h \ - ./sync/spu_source/atomic.h \ - ./sync/spu_source/atomic_inc.h \ - ./sync/spu_source/atomic_inc_return.h \ - ./sync/spu_source/atomic_read.h \ - ./sync/spu_source/atomic_set.h \ - ./sync/spu_source/atomic_sub_and_test.h \ - ./sync/spu_source/atomic_sub.h \ - ./sync/spu_source/atomic_sub_return.h \ - ./sync/spu_source/complete_all.h \ - ./sync/spu_source/complete.h \ - ./sync/spu_source/completion.h \ - ./sync/spu_source/cond_broadcast.h \ - ./sync/spu_source/cond.h \ - ./sync/spu_source/cond_init.h \ - ./sync/spu_source/cond_signal.h \ - ./sync/spu_source/cond_wait.h \ - ./sync/spu_source/init_completion.h \ - ./sync/spu_source/libsync.h \ - ./sync/spu_source/mutex.h \ - ./sync/spu_source/mutex_init.h \ - ./sync/spu_source/mutex_lock.h \ - ./sync/spu_source/mutex_trylock.h \ - ./sync/spu_source/mutex_unlock.h \ - ./sync/spu_source/read_lock.h \ - ./sync/spu_source/read_trylock.h \ - ./sync/spu_source/read_unlock.h \ - ./sync/spu_source/rwlock_init.h \ - ./sync/spu_source/sync_irq.h \ - ./sync/spu_source/sync_utils.h \ - ./sync/spu_source/trace_libsync.h \ - ./sync/spu_source/wait_for_completion.h \ - ./sync/spu_source/write_lock.h \ - ./sync/spu_source/write_trylock.h \ - ./sync/spu_source/write_unlock.h diff --git a/gcell/ibm/README b/gcell/ibm/README deleted file mode 100644 index 9420fcc46..000000000 --- a/gcell/ibm/README +++ /dev/null @@ -1,10 +0,0 @@ -This directory and below contains code from IBM licensed under the -"Modified BSD license." It was extracted unmodified from the IBM Cell -SDK 3.0 library source tarball, lib_source.tar, typically found in -/opt/cell/sdk/src/lib_source.tar. - -We've done this because this code doesn't come unpacked in the native -(cell) installation of the SDK 3.0, and thus we can't just add a --I/path/to/this/stuff in our Makefiles. If this changes, we'll delete -this code from here, and fix our Makefiles. In the meanwhile, this -reduces the probability of build problems. diff --git a/gcell/ibm/sync/ppu_source/atomic.h b/gcell/ibm/sync/ppu_source/atomic.h deleted file mode 100644 index 105f7bf37..000000000 --- a/gcell/ibm/sync/ppu_source/atomic.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -/* - * atomic.h - PPE atomic SHM counter operations. - * - * Interfaces patterned after, and hopefully compatible - * with PowerPC64-Linux atomic counter operations. Uses - * 32b values for various counters. - */ -#ifndef _PPU_ATOMIC_H_ -#define _PPU_ATOMIC_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" - -typedef unsigned int atomic_t __attribute__ ((aligned (128))); - - -/* atomic_ea_t is a 64bit effective address that points to - * an atomic_t variable - */ -typedef unsigned long long atomic_ea_t; - -/** - * ASSUMPTIONS: - * On the PPE, the size of a reservation granule is 128 bytes - * (a cache-line), so when a programmer puts a reservation on an - * address, that whole cacheline is reserved. Therefore both - * the PPE and SPE can participate in an atomic operation as long as - * lwarx and getllar operate on the same cacheline. - */ - - -/* - * atomically loads and replaces the value v with val. - * Returns the old value at v - */ -static __inline int _atomic_replace(atomic_ea_t v, int val) -{ - int old; - void *p; - - SYNC_ULL_TO_PTR(v, p); - - do { - old = (int)__lwarx(p); - } while (__stwcx(p, (unsigned int)val) == 0); - - return old; -} - - -/* - * atomically loads the value at v, adds val, replaces the - * value at v with the sum. Returns the old value at v - */ -static __inline int _atomic_modify(atomic_ea_t v, int val) -{ - int oldval, newval; - void *p; - - SYNC_ULL_TO_PTR(v, p); - - do { - oldval = (int)__lwarx(p); - newval = oldval + val; - } while (__stwcx(p, (unsigned int)newval) == 0); - - return oldval; -} - - -#endif /* _PPU_ATOMIC_H_ */ - diff --git a/gcell/ibm/sync/ppu_source/atomic_add.h b/gcell/ibm/sync/ppu_source/atomic_add.h deleted file mode 100644 index dd7a5b25a..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_add.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_ADD_H_ -#define _PPU_ATOMIC_ADD_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_add - atomically add to a counter. - * @v: handle to effective address of counter. - * @a: value to be added. - * - * Atomically add a value to a counter in system memory. - * The only restriction is that @v must be word aligned. - */ -static __inline void _atomic_add(int a, atomic_ea_t v) -{ - _atomic_modify (v, a); -} - - - -#endif /* _PPU_ATOMIC_ADD_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_add_return.h b/gcell/ibm/sync/ppu_source/atomic_add_return.h deleted file mode 100644 index 0fe127565..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_add_return.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_ADD_RETURN_H_ -#define _PPU_ATOMIC_ADD_RETURN_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_add_return - atomically add to a counter and return previous value. - * @v: handle to effective address of counter. - * @a: value to be added. - * - * Atomically add a value to a counter in system memory. - * The only restriction is that @v must be word aligned. - * - * This routine implements the "fetch and add" primitive - * that is described in "Book I PowerPC User Instruction - * Set Architecture" - * Returns the previous value from system memory. - */ -static __inline int _atomic_add_return(int a, atomic_ea_t v) -{ - return _atomic_modify (v, a); -} - - -#endif /* _PPU_ATOMIC_ADD_RETURN_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_dec.h b/gcell/ibm/sync/ppu_source/atomic_dec.h deleted file mode 100644 index 4f82f04e0..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_dec.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_DEC_H_ -#define _PPU_ATOMIC_DEC_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_dec - atomically decrement a counter. - * @v: handle to effective address of location to be modified. - * - * Atomically decrement a counter in system memory. The only - * restriction is that @v must be word aligned. - */ -static __inline void _atomic_dec(atomic_ea_t v) -{ - _atomic_modify (v, -1); -} - - -#endif /* _PPU_ATOMIC_DEC_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_dec_and_test.h b/gcell/ibm/sync/ppu_source/atomic_dec_and_test.h deleted file mode 100644 index 5093d4059..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_dec_and_test.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_DEC_AND_TEST_H_ -#define _PPU_ATOMIC_DEC_AND_TEST_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_dec_and_test - atomically decrement and test if previous==0. - * @v: handle to effective address of counter. - * - * Atomically decrement a counter in system memory and test - * if previous==0. The only restriction is that @v must be - * word aligned. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_dec_and_test(atomic_ea_t v) -{ - return (_atomic_modify(v, -1) == 0) ? 1 : 0; -} - - -#endif /* _PPU_ATOMIC_DEC_AND_TEST_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_dec_if_positive.h b/gcell/ibm/sync/ppu_source/atomic_dec_if_positive.h deleted file mode 100644 index c4d113bfd..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_dec_if_positive.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_DEC_IF_POSITIVE_H_ -#define _PPU_ATOMIC_DEC_IF_POSITIVE_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "atomic.h" - -/* - * atomic_dec_if_positive - atomically decrement if counter is positive. - * - * v: handle to effective address of counter. - * - * Atomically decrement a counter if its value is positive. - * The only restriction is that v must be word aligned. - * - * - * Returns the old value of the counter, minus 1. - */ -static __inline int _atomic_dec_if_positive(atomic_ea_t v) -{ - int ret; - int tmp; - void *p; - - SYNC_ULL_TO_PTR(v, p); - - do { - tmp = (int)__lwarx(p); - ret = tmp - 1; - tmp = (tmp > 0) ? ret : tmp; - } while (__stwcx(p, (unsigned)tmp) == 0); - - return ret; -} - -#endif /* _PPU_ATOMIC_DEC_IF_POSITIVE_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_dec_return.h b/gcell/ibm/sync/ppu_source/atomic_dec_return.h deleted file mode 100644 index cd87893fa..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_dec_return.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_DEC_RETURN_H_ -#define _PPU_ATOMIC_DEC_RETURN_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_dec_return - atomically decrement a counter and return previous value. - * @v: handle to effective address of counter. - * - * Atomically decrement a counter in system memory and return its - * previous value. The only restriction is that @v must be word - * aligned. - * - * This routine implements the "fetch and decrement" - * primitive that is described in "Book I PowerPC User - * Instruction Set Architecture". - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_dec_return(atomic_ea_t v) -{ - return _atomic_modify (v, -1); -} - - - -#endif /* _PPU_ATOMIC_DEC_RETURN_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_inc.h b/gcell/ibm/sync/ppu_source/atomic_inc.h deleted file mode 100644 index 714aecbc0..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_inc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_INC_H_ -#define _PPU_ATOMIC_INC_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_inc - atomically increment a counter in system memory. - * @v: handle to effective address of counter. - * - * Atomically increment a counter in system memory. - * The only restriction is that @v must be word aligned. - */ -static __inline void _atomic_inc(atomic_ea_t v) -{ - _atomic_modify (v, 1); -} - -#endif /* _PPU_ATOMIC_INC_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_inc_return.h b/gcell/ibm/sync/ppu_source/atomic_inc_return.h deleted file mode 100644 index 95178f50d..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_inc_return.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_INC_RETURN_H_ -#define _PPU_ATOMIC_INC_RETURN_H_ - -#include <sync_utils.h> -#include <atomic.h> - - -/** - * atomic_inc_return - atomically increment a counter and return previous. - * @v: handle to effective address of counter. - * - * Atomically increment a counter in system memory. - * The only restriction is that @v must be word aligned. - * - * This routine implements the "fetch and increment" - * primitive that is described in "Book I PowerPC User - * Instruction Set Architecture" - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_inc_return(atomic_ea_t v) -{ - return _atomic_modify (v, 1); -} - -#endif /* _PPU_ATOMIC_INC_RETURN_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_read.h b/gcell/ibm/sync/ppu_source/atomic_read.h deleted file mode 100644 index 258fd516c..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_read.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_READ_H_ -#define _PPU_ATOMIC_READ_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/* - * On PowerPC architecture, if v is a word_aligned address, then - * a load of that address is guaranteed to be atomic. An atomic - * read operation is simply a load. - */ -static __inline int _atomic_read(atomic_ea_t v) -{ - volatile int *p; - - SYNC_ULL_TO_PTR(v, p); - - return (*p); -} - - -#endif /* _PPU_ATOMIC_READ_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_set.h b/gcell/ibm/sync/ppu_source/atomic_set.h deleted file mode 100644 index e624af40d..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_set.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_SET_H_ -#define _PPU_ATOMIC_SET_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_set - atomically set a counter in system memory. - * @v: this is a 64bit address that points to an atomic_t - * - * Atomically set a counter to a given value. The only - * restriction is that @v must be word aligned. - * - * This routine implements the "fetch and store" - * primitive that is described in "Book I PowerPC User - * Instruction Set Architecture" - * - * Returns the previous value from system memory. - */ -static __inline void _atomic_set(atomic_ea_t v, int val) -{ - _atomic_replace (v, val); -} - - -#endif /* _PPU_ATOMIC_SET_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_sub.h b/gcell/ibm/sync/ppu_source/atomic_sub.h deleted file mode 100644 index b8d35975a..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_sub.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_SUB_H_ -#define _PPU_ATOMIC_SUB_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_sub - atomically subtract from a counter. - * @v: handle to effective address of counter. - * @a: value to be subtracted. - * - * Atomically subtract a value from a counter in system memory. - * The only restriction is that @v must be word aligned. - */ -static __inline void _atomic_sub(int a, atomic_ea_t v) -{ - _atomic_modify (v, -a); -} - - -#endif /* _PPU_ATOMIC_SUB_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_sub_and_test.h b/gcell/ibm/sync/ppu_source/atomic_sub_and_test.h deleted file mode 100644 index 37ba58896..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_sub_and_test.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_SUB_AND_TEST_H_ -#define _PPU_ATOMIC_SUB_AND_TEST_H_ - -#include "sync_utils.h" -#include "atomic.h" - -/** - * atomic_sub_and_test - atomically subtract and test if previous==0. - * @v: handle to effective address of counter. - * @a: value to be subtracted. - * - * Atomically subtract a value from a counter in system memory - * and test if previous==0. The only restriction is that @v - * must be word aligned. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_sub_and_test(int a, atomic_ea_t v) -{ - return (_atomic_modify(v, -a) == 0) ? 1 : 0; -} - -#endif /* _PPU_ATOMIC_SUB_AND_TEST_H_ */ diff --git a/gcell/ibm/sync/ppu_source/atomic_sub_return.h b/gcell/ibm/sync/ppu_source/atomic_sub_return.h deleted file mode 100644 index 084bfa6b1..000000000 --- a/gcell/ibm/sync/ppu_source/atomic_sub_return.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_ATOMIC_SUB_RETURN_H_ -#define _PPU_ATOMIC_SUB_RETURN_H_ - -#include <sync_utils.h> -#include <atomic.h> - - -/** - * atomic_sub_return - atomically subtract from a counter & return previous. - * @v: handle to effective address of counter. - * @a: value to be subtracted. - * - * Atomically subtract a value from a counter in system memory. - * The only restriction is that @v must be word aligned. - * - * Returns the previous value from system memory. - */ - - -static __inline int _atomic_sub_return(int a, atomic_ea_t v) -{ - return _atomic_modify (v, -a); -} - -#endif /* _PPU_ATOMIC_SUB_RETURN_H_ */ diff --git a/gcell/ibm/sync/ppu_source/complete.h b/gcell/ibm/sync/ppu_source/complete.h deleted file mode 100644 index 8633463f7..000000000 --- a/gcell/ibm/sync/ppu_source/complete.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COMPLETE_H_ -#define _PPU_COMPLETE_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "completion.h" - - -static __inline void _complete (completion_ea_t comp) -{ - unsigned int old; - void *p; - - SYNC_ULL_TO_PTR(comp, p); - - do { - old = __lwarx(p); - } while (__stwcx(p, (unsigned int)1) == 0); -} - -#endif /* _PPU_COMPLETE_H_ */ diff --git a/gcell/ibm/sync/ppu_source/complete_all.h b/gcell/ibm/sync/ppu_source/complete_all.h deleted file mode 100644 index c12eb7f03..000000000 --- a/gcell/ibm/sync/ppu_source/complete_all.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COMPLETE_ALL_H_ -#define _PPU_COMPLETE_ALL_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "completion.h" - -/** - * complete_all - indicate that a completion is true. - * @completion: handle to effective address of completion variable. - * - * Indicate that all are completed is true by storing - * MAX_THREADS_WAITING to the completionition variable. - */ - -static __inline void _complete_all(completion_ea_t comp) -{ - unsigned int old; - unsigned int val = MAX_THREADS_WAITING; - - void *p; - - SYNC_ULL_TO_PTR(comp, p); - - do { - old = __lwarx(p); - } while (__stwcx(p, val) == 0); -} - -#endif /* _PPU_COMPLETE_ALL_H_ */ diff --git a/gcell/ibm/sync/ppu_source/completion.h b/gcell/ibm/sync/ppu_source/completion.h deleted file mode 100644 index b74bdaae7..000000000 --- a/gcell/ibm/sync/ppu_source/completion.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ - -#ifndef _PPU_COMPLETION_H_ -#define _PPU_COMPLETION_H_ - - -#define MAX_THREADS_WAITING 32000 - -typedef unsigned long long completion_ea_t; - -#endif /* _PPU_COMPLETION_H_ */ diff --git a/gcell/ibm/sync/ppu_source/cond.h b/gcell/ibm/sync/ppu_source/cond.h deleted file mode 100644 index 9a38f71a4..000000000 --- a/gcell/ibm/sync/ppu_source/cond.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COND_VAR_H_ -#define _PPU_COND_VAR_H_ - -#include <mutex.h> -#include <sync_utils.h> - - -typedef struct -{ - short num_threads_signal; /* the number of threads that are going to be waken up. - There are 3 values possible for this parameter, 0, 1, - or num_threads_waiting*/ - short num_threads_waiting; /* the number of threads that are waiting to be awaken */ -} condition_variable_t __attribute__ ((aligned (16))); - -typedef unsigned long long cond_ea_t; /* a system memory 64 bit address that points to - * a valid condition_variable_t */ - -typedef union { - unsigned long long ull; - unsigned int ui[2]; -} val64; - - -#endif /* _PPU_COND_VAR_H_ */ diff --git a/gcell/ibm/sync/ppu_source/cond_broadcast.h b/gcell/ibm/sync/ppu_source/cond_broadcast.h deleted file mode 100644 index b93bf7b37..000000000 --- a/gcell/ibm/sync/ppu_source/cond_broadcast.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COND_BROADCAST_H_ -#define _PPU_COND_BROADCAST_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "cond.h" - -/** - * cond_broadcast - indicate that a condition is true. - * @cond: handle to effective address of condition variable. - */ -static __inline void _cond_broadcast (cond_ea_t cond) -{ - unsigned int val; - void *p; - - SYNC_ULL_TO_PTR(cond, p); - - do { - val = __lwarx(p); - - /* Copy the waiting count (low halfword) to - * the signaled count (high halfword) - */ - val = (val & 0xFFFF) | ((val+1) << 16); - - } while (__stwcx(p, val) == 0); -} - -#endif /* _PPU_COND_BROADCAST_H_ */ diff --git a/gcell/ibm/sync/ppu_source/cond_init.h b/gcell/ibm/sync/ppu_source/cond_init.h deleted file mode 100644 index 0dfbd6349..000000000 --- a/gcell/ibm/sync/ppu_source/cond_init.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COND_INIT_H_ -#define _PPU_COND_INIT_H_ - -#include "sync_utils.h" -#include "cond.h" - -/** - * cond_init - initialize condition variable. - * @cond: handle to effective address of condition variable. - * - * Only one thread initializes a condition variable. Usually, the - * PPE thread initializes a condidtion variable - * - * Description: Initialize a cond variable to false. - */ -static __inline void _cond_init (cond_ea_t cond) -{ - volatile unsigned int *p; - - SYNC_ULL_TO_PTR(cond, p); - - *p = 0; -} - - -#endif /* _PPU_COND_INIT_H_ */ diff --git a/gcell/ibm/sync/ppu_source/cond_signal.h b/gcell/ibm/sync/ppu_source/cond_signal.h deleted file mode 100644 index dd4874827..000000000 --- a/gcell/ibm/sync/ppu_source/cond_signal.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COND_SIGNAL_H_ -#define _PPU_COND_SIGNAL_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "cond.h" - -/* - * _cond_signal: signaling any of the waiting threads to wake up. - */ -static __inline void _cond_signal (cond_ea_t cond) -{ - unsigned int val, waiting, signaled; - void *p; - - SYNC_ULL_TO_PTR(cond, p); - - do { - val = __lwarx(p); - - waiting = val & 0xFFFF; - signaled = val >> 16; - - /* If no other party is waiting. Don't send a signal. - * Otherwise, increment the signaled halfword. - */ - if (waiting == signaled) break; - val = ((val+1) << 16) | waiting; - - } while (__stwcx(p, val) == 0); -} - - -#endif /* _PPU_COND_SIGNAL_H_ */ diff --git a/gcell/ibm/sync/ppu_source/cond_wait.h b/gcell/ibm/sync/ppu_source/cond_wait.h deleted file mode 100644 index ed5fbecb1..000000000 --- a/gcell/ibm/sync/ppu_source/cond_wait.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_COND_WAIT_H_ -#define _PPU_COND_WAIT_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "mutex_lock.h" -#include "mutex_unlock.h" -#include "cond.h" - -static __inline void _cond_wait (cond_ea_t cond, mutex_ea_t mutex) -{ - int delta, cur_delta; - unsigned int val, cond_val, signaled_cnt; - void *p; - - - SYNC_ULL_TO_PTR(cond, p); - - /* Atomically signal we have entered the condition wait by incrementing - * the waiting count. - */ - do { - val = __lwarx(p); - val = (val & ~0xFFFF) | ((val+1) & 0xFFFF); - } while (__stwcx(p, val) == 0); - - - /* Release the lock - */ - _mutex_unlock (mutex); - - /* Determine the signal count needed for this - * participant to be signaled. - */ - - signaled_cnt = val >> 16; - delta = (int)(val & 0xFFFF) - (int)signaled_cnt; - if (delta < 0) delta = -delta; - - /* Wait until the signaled count reaches the count - * previously determined. - */ - do { - cond_val = __lwarx(p); - - cur_delta = (int)(cond_val >> 16) - signaled_cnt; - if (cur_delta < 0) cur_delta = -cur_delta; - - } while (cur_delta < delta); - - /* Relock the mutex - */ - _mutex_lock (mutex); -} - -#endif /* _PPU_COND_WAIT_H_ */ diff --git a/gcell/ibm/sync/ppu_source/init_completion.h b/gcell/ibm/sync/ppu_source/init_completion.h deleted file mode 100644 index 8e7081111..000000000 --- a/gcell/ibm/sync/ppu_source/init_completion.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_INIT_COMPLETION_H_ -#define _PPU_INIT_COMPLETION_H_ - -#include "sync_utils.h" -#include "completion.h" - -/** - * completion_init - initialize completion variable. - * @completion: handle to effective address of completion variable. - * - * Description: Initialize a completion variable to 0. - */ -static __inline void _init_completion(completion_ea_t comp) -{ - volatile unsigned int *p; - - SYNC_ULL_TO_PTR(comp, p); - - *p = 0; -} - - -#endif /* _PPU_INIT_COMPLETION_H_ */ diff --git a/gcell/ibm/sync/ppu_source/libsync.h b/gcell/ibm/sync/ppu_source/libsync.h deleted file mode 100644 index bd2e04347..000000000 --- a/gcell/ibm/sync/ppu_source/libsync.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_LIBSYNC_H_ -#define _PPU_LIBSYNC_H_ - -#include "sync_utils.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long long atomic_ea_t; - -extern void atomic_set(atomic_ea_t v, int val); -extern void atomic_add(int a, atomic_ea_t v); -extern void atomic_sub(int a, atomic_ea_t v); -extern void atomic_inc(atomic_ea_t v); -extern void atomic_dec(atomic_ea_t v); - -extern int atomic_read(atomic_ea_t v); -extern int atomic_add_return(int a, atomic_ea_t v); -extern int atomic_sub_return(int a, atomic_ea_t v); -extern int atomic_inc_return(atomic_ea_t v); -extern int atomic_dec_return(atomic_ea_t v); -extern int atomic_sub_and_test(int a, atomic_ea_t v); -extern int atomic_dec_and_test(atomic_ea_t v); -extern int atomic_dec_if_positive(atomic_ea_t v); - -typedef unsigned long long mutex_ea_t; -void mutex_init(mutex_ea_t lock); - -void mutex_lock(mutex_ea_t lock); -int mutex_trylock(mutex_ea_t ea); -void mutex_unlock(mutex_ea_t lock); - -typedef struct -{ - int num_threads_signal; /* the number of threads that are going to be waken up. - There are 3 values possible for this parameter, 0, 1, - or num_threads_waiting*/ - int num_threads_waiting; /* the number of threads that are waiting to be awaken */ -} condition_variable_t __attribute__ ((aligned (16))); - -typedef unsigned long long cond_ea_t; /* a system memory 64 bit address that points to - * a valid condition_variable_t */ - -typedef union { - unsigned long long ull; - unsigned int ui[2]; -} val64; - - -void cond_init (cond_ea_t cond); -void cond_signal (cond_ea_t cond); -void cond_broadcast (cond_ea_t cond); -void cond_wait (cond_ea_t cond, mutex_ea_t mutex); - - -#define MAX_THREADS_WAITING 32000 - -typedef unsigned long long completion_ea_t; - -extern void init_completion(completion_ea_t comp); -extern void wait_for_completion(completion_ea_t comp); -/* -extern void wait_for_completion_irq(completion_ea_t comp); -extern void wait_for_completion_irqsave(completion_ea_t comp); -*/ -extern void complete_all(completion_ea_t comp); -extern void complete (completion_ea_t comp); - -#ifdef __cplusplus -} -#endif - -#endif /* _PPU_LIBSYNC_H_ */ diff --git a/gcell/ibm/sync/ppu_source/mutex.h b/gcell/ibm/sync/ppu_source/mutex.h deleted file mode 100644 index 364bb2249..000000000 --- a/gcell/ibm/sync/ppu_source/mutex.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_MUTEX_H_ -#define _PPU_MUTEX_H_ 1 - -typedef unsigned long long mutex_ea_t; - -#endif /* _PPU_MUTEX_H_ */ diff --git a/gcell/ibm/sync/ppu_source/mutex_init.h b/gcell/ibm/sync/ppu_source/mutex_init.h deleted file mode 100644 index 105dc2c57..000000000 --- a/gcell/ibm/sync/ppu_source/mutex_init.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_MUTEX_INIT_H_ -#define _PPU_MUTEX_INIT_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include "trace_libsync.h" - -/***************************************************************************/ -/** - * mutex_init - initialize the mutex by setting the value - * to 0. - * @lock: handle to effective address of lock variable. - * - * Description: Initialize a mutex. - */ -static __inline void _mutex_init(mutex_ea_t lock) -{ - volatile unsigned int *p; - - SYNC_ULL_TO_PTR(lock, p); - - *p = 0; - - TRACE_MUTEX_INIT(lock); -} - -#endif /* _PPU_MUTEX_INIT_H_ */ diff --git a/gcell/ibm/sync/ppu_source/mutex_lock.h b/gcell/ibm/sync/ppu_source/mutex_lock.h deleted file mode 100644 index 75240a141..000000000 --- a/gcell/ibm/sync/ppu_source/mutex_lock.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_MUTEX_LOCK_H_ -#define _PPU_MUTEX_LOCK_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "mutex.h" -#include "trace_libsync.h" - -/* function: _mutex_lock - * - * Aquire a lock at a location in system memory by waiting for the - * value to become zero, then atomically storing 1. - */ -static __inline void _mutex_lock (mutex_ea_t lock) -{ - unsigned int done = 0; - void *p; -#ifdef LIBSYNC_TRACE - unsigned int miss = 0; -#endif /* LIBSYNC_TRACE */ - - TRACE_MUTEX_LOCK_ENTRY(interval); - - SYNC_ULL_TO_PTR(lock, p); - - do { - if (__lwarx(p) == 0) done = __stwcx(p, (unsigned int) 1); -#ifdef LIBSYNC_TRACE - /* if we missed the lock, note it.. */ - if (done == 0) miss = 1; -#endif - } while (done == 0); - __isync(); - - TRACE_MUTEX_LOCK_EXIT(interval, lock, miss); -} - -#endif /* _PPU_MUTEX_LOCK_H_ */ diff --git a/gcell/ibm/sync/ppu_source/mutex_trylock.h b/gcell/ibm/sync/ppu_source/mutex_trylock.h deleted file mode 100644 index 445196c74..000000000 --- a/gcell/ibm/sync/ppu_source/mutex_trylock.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_MUTEX_TRYLOCK_H_ -#define _PPU_MUTEX_TRYLOCK_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "mutex.h" -#include "trace_libsync.h" - -/** - * mutex_trylock - acquire a lock, or return immediately. - * @lock: handle to effective address of lock variable. - * - * Description: Acquire a lock, or return immediately - * without polling for availability. - * - * Context: The application should not call this interface - * from a tight loop!! Use spin_lock() instead. - * - * Attempt to immediately aquire a lock at a location in system memory, - * and return 1 if the lock was aquired or 0 otherwise. - */ -static __inline int _mutex_trylock (mutex_ea_t lock) -{ - int val; - int ret = 0; - void *p; - - SYNC_ULL_TO_PTR(lock, p); - - do { - val = (int)__lwarx(p); - if (val) break; - } while ((ret = __stwcx(p, (unsigned int)1)) == 0); - __isync(); - - TRACE_MUTEX_TRYLOCK(lock,ret); - - return (ret); -} - -#endif /* _PPU_MUTEX_TRYLOCK_H_ */ diff --git a/gcell/ibm/sync/ppu_source/mutex_unlock.h b/gcell/ibm/sync/ppu_source/mutex_unlock.h deleted file mode 100644 index e5255be02..000000000 --- a/gcell/ibm/sync/ppu_source/mutex_unlock.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_MUTEX_UNLOCK_H_ -#define _PPU_MUTEX_UNLOCK_H_ - -#include "mutex.h" -#include "atomic.h" -#include "trace_libsync.h" - -/* function: _mutex_unlock - * - * Release a lock held at address 'lock' in system memory. - * For the PU, this routine is the same _unlock, and is - * provided here as a simple convenience for programmers - * (to match the interfaces that are supported on the SPU). - * All I need to do is a store since store is an atomic operation by itself - */ -static __inline void _mutex_unlock (mutex_ea_t lock) -{ - _atomic_replace ((atomic_ea_t)lock, 0); - - TRACE_MUTEX_UNLOCK(lock); -} - - -#endif /* _PPU_MUTEX_UNLOCK_H_ */ diff --git a/gcell/ibm/sync/ppu_source/pdt_libsync.xml b/gcell/ibm/sync/ppu_source/pdt_libsync.xml deleted file mode 100644 index d9ea2ce9f..000000000 --- a/gcell/ibm/sync/ppu_source/pdt_libsync.xml +++ /dev/null @@ -1,184 +0,0 @@ -<pdtGroup name="LIBSYNC" id="0x03" version="3.0"> - <!-- PPE events --> - <subGroup name="PPE_MUTEX" id="0xFE03"> - <recordType name="PPE_MUTEX_INIT" description="PPE: mutex lock init" id="0x0003" type="event"> - <include href="/usr/share/pdt/config/pdt_ppe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="empty3" description="empty slot 3" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - <recordType name="PPE_MUTEX_LOCK" description="PPE: acquire a mutex lock" id="0x0103" type="interval"> - <include href="/usr/share/pdt/config/pdt_ppe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="miss" description="Missed" type="int" toString="0x%x" visible="true"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - <recordType name="PPE_MUTEX_TRYLOCK" description="PPE: try to acquire a lock" id="0x0203" type="event"> - <include href="/usr/share/pdt/config/pdt_ppe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="ret" description="Try lock return code" type="int" toString="0x%x" visible="true"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - <recordType name="PPE_MUTEX_UNLOCK" description="PPE: unlock a mutex lock" id="0x0303" type="event"> - <include href="/usr/share/pdt/config/pdt_ppe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="empty3" description="empty slot 3" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - </subGroup> - <!-- SPE events --> - <subGroup name="SPE_MUTEX" id="0xFD03"> - <recordType name="SPE_MUTEX_INIT" description="SPE: mutex lock init" id="0x0403" type="event"> - <include href="/usr/share/pdt/config/pdt_spe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="empty3" description="empty slot 3" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - <recordType name="SPE_MUTEX_LOCK" description="SPE: acquire a mutex lock" id="0x0503" type="interval"> - <include href="/usr/share/pdt/config/pdt_spe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="miss" description="Missed" type="int" toString="0x%x" visible="true"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - <recordType name="SPE_MUTEX_TRYLOCK" description="SPE: try to acquire a mutex lock" id="0x0603" type="event"> - <include href="/usr/share/pdt/config/pdt_spe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="ret_val" description="Try lock return code" type="int" toString="0x%x" visible="true"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - <recordType name="SPE_MUTEX_UNLOCK" description="SPE: unlock a mutex lock" id="0x0703" type="event"> - <include href="/usr/share/pdt/config/pdt_spe_event_header.xml"/> - <physicalField name="lock" description="Lock address" type="long" toString="0x%x" visible="true"/> - <physicalField name="empty3" description="empty slot 3" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty4" description="empty slot 4" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty5" description="empty slot 5" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty6" description="empty slot 6" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty7" description="empty slot 7" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty8" description="empty slot 8" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty9" description="empty slot 9" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty10" description="empty slot 10" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty11" description="empty slot 11" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty12" description="empty slot 12" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty13" description="empty slot 13" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty14" description="empty slot 14" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty15" description="empty slot 15" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty16" description="empty slot 16" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty17" description="empty slot 17" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty18" description="empty slot 18" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty19" description="empty slot 19" type="int" toString="0x%x" visible="false"/> - <physicalField name="empty20" description="empty slot 20" type="int" toString="0x%x" visible="false"/> - </recordType> - </subGroup> -</pdtGroup> diff --git a/gcell/ibm/sync/ppu_source/pdt_libsync_config.xml b/gcell/ibm/sync/ppu_source/pdt_libsync_config.xml deleted file mode 100644 index a0b848d84..000000000 --- a/gcell/ibm/sync/ppu_source/pdt_libsync_config.xml +++ /dev/null @@ -1,61 +0,0 @@ -<pdt_configuration application_name="libsync" output_dir="." version="3.0"> - <groups> - <group name="GENERAL" description="General event types" id="0x00"> - <view yStart="0.0" yEnd="0.2" color="0x0000FF"/> - <include href="/usr/share/pdt/config/pdt_general.xml"/> - </group> - <group name="LIBSPE2" description="CBE libspe 2.0 event types" id="0x01"> - <view yStart="0.2" yEnd="0.4" color="0x00FFFF"/> - <include href="/usr/share/pdt/config/pdt_libspe2.xml"/> - </group> - <group name="MFCIO" description="SPE MFCIO event types" id="0x02"> - <view yStart="0.4" yEnd="0.6" color="0x00FF80"/> - <include href="/usr/share/pdt/config/pdt_mfcio.xml"/> - </group> - <group name="LIBSYNC" description="General event types" id="0x03"> - <view yStart="0.6" yEnd="0.8" color="0xFFFF00"/> - <include href="/usr/share/pdt/config/pdt_libsync.xml"/> - </group> - </groups> -<configuration name="CBE"> -<host name="none"/> -<groupsControl> - <group name="GENERAL" active="true"> - <profile active="false"/> - <!-- The GENERAL group of events are always active--> - </group> - <group name="LIBSPE2" active="true"> - </group> - <group name="LIBSYNC" active="true"> - <sub_group name="PPE_MUTEX" active="true"> - <event name="PPE_MUTEX_INIT" active="true"/> - <event name="PPE_MUTEX_LOCK" active="true"/> - <event name="PPE_MUTEX_TRYLOCK" active="true"/> - <event name="PPE_MUTEX_UNLOCK" active="true"/> - </sub_group> - </group> -</groupsControl> -</configuration> -<!-- --> -<!-- SPEs configuration - this section is read with the CBE configuration --> -<!-- --> -<configuration name="SPE"> -<host name="CBE"/> -<groupsControl> - <group name="GENERAL" active="true"> - <profile active="false"/> - <!-- The GENERAL group of events are always active--> - </group> - <group name="MFCIO" active="true"> - </group> - <group name="LIBSYNC" active="true"> - <sub_group name="SPE_MUTEX" active="true"> - <event name="SPE_MUTEX_INIT" active="true"/> - <event name="SPE_MUTEX_LOCK" active="true"/> - <event name="SPE_MUTEX_TRYLOCK" active="true"/> - <event name="SPE_MUTEX_UNLOCK" active="true"/> - </sub_group> - </group> -</groupsControl> -</configuration> -</pdt_configuration> diff --git a/gcell/ibm/sync/ppu_source/sync_utils.h b/gcell/ibm/sync/ppu_source/sync_utils.h deleted file mode 100644 index c7120a3cc..000000000 --- a/gcell/ibm/sync/ppu_source/sync_utils.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _PPU_SYNC_UTILS_H_ -#define _PPU_SYNC_UTILS_H_ 1 - -/* SYNC_ULL_TO_PTR - convert a 64-bit unsigned long long to a void - * pointer. - */ -#ifdef __powerpc64__ - -#define SYNC_ULL_TO_PTR(_ull, _ptr) { \ - union { \ - void *ptr; \ - unsigned long long ull; \ - } _x; \ - \ - _x.ull = _ull; \ - _ptr = _x.ptr; \ -} - -#else - -#define SYNC_ULL_TO_PTR(_ull, _ptr) { \ - union { \ - void *ptr[2]; \ - unsigned long long ull; \ - } _x; \ - \ - _x.ull = _ull; \ - _ptr = _x.ptr[1]; \ -} - -#endif - -#endif /* _PPU_SYNC_UTILS_H_ */ diff --git a/gcell/ibm/sync/ppu_source/trace_libsync.h b/gcell/ibm/sync/ppu_source/trace_libsync.h deleted file mode 100644 index 6d6f036e5..000000000 --- a/gcell/ibm/sync/ppu_source/trace_libsync.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2007 */ -/* International Business Machines Corporation */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef __LIBSYNC_PPU_TRACEHOOKS_H__ -#define __LIBSYNC_PPU_TRACEHOOKS_H__ - -#ifdef LIBSYNC_TRACE - -#include <trace_events.h> - -/* - * last parameter in the trace_even and trace_interval_entry call is - * the stack level to report the PC in the trace record. so 0 means - * the PC of the current frame, 1 means the PC of the caller, etc. - * there's a dilemma here - these macros are included in the inline - * _mutex calls which get called from the (created during build) - * mutex functions in the mutex .c files. in that case, the level - * should be 1 - we don't want the PC of where in the mutex function - * the trace call is happening, we want the PC of whomever is calling - * the mutex function. - * - * but.. an app can call the inline functions - it can #include the - * appropriate libsync mutex .h files, and call the inlined _mutex - * function in their code. in that case, the appropriate level for the - * trace calls would be 0 - the user would want to know where in their - * code the call to the _mutex function is. - * - * so, we'll assume _LEVEL of 0 which is what the inline funtions need. - * when we build the files for libsync, we'll do a -D_LEVEL=1 - */ -#ifndef _LEVEL -#define _LEVEL 0 -#endif - - -#define TRACE_EVENT_MUTEX_INIT 0x0003 - -#define TRACE_MUTEX_INIT(lock) { \ - trace_payload_t payload; \ - payload.dword[0]=(uint64_t)lock; \ - trace_event(TRACE_EVENT_MUTEX_INIT, 1, &payload, "Event=%d, lock=0x%x",_LEVEL); \ -} - -#define TRACE_EVENT_MUTEX_LOCK 0x0103 - -#define TRACE_MUTEX_LOCK_ENTRY(_INTERVAL) \ -trace_interval_p _INTERVAL = trace_interval_entry(TRACE_EVENT_MUTEX_LOCK, _LEVEL) - -#define TRACE_MUTEX_LOCK_EXIT(_INTERVAL,lock,miss) { \ - trace_payload_t payload; \ - payload.dword[0]=(uint64_t)lock; \ - payload.word[2]=(uint32_t)miss; \ - trace_interval_exit(_INTERVAL, 2, &payload, "Event=%d, lock=0x%x, miss=0x%x"); \ -} - -#define TRACE_EVENT_MUTEX_TRYLOCK 0x0203 - -#define TRACE_MUTEX_TRYLOCK(lock,ret) { \ - trace_payload_t payload; \ - payload.dword[0]=(uint64_t)lock; \ - payload.word[2]=(uint32_t)ret; \ - trace_event(TRACE_EVENT_MUTEX_TRYLOCK, 2, &payload, "Event=%d, lock=0x%x, ret=0x%x", _LEVEL); \ -} - -#define TRACE_EVENT_MUTEX_UNLOCK 0x0303 - -#define TRACE_MUTEX_UNLOCK(lock) { \ - trace_payload_t payload; \ - payload.dword[0]=(uint64_t)lock; \ - trace_event(TRACE_EVENT_MUTEX_UNLOCK, 1, &payload, "Event=%d, lock=0x%x", _LEVEL); \ -} - -#else /* LIBSYNC_TRACE */ - -#define TRACE_MUTEX_INIT(lock) -#define TRACE_MUTEX_LOCK_ENTRY(_INTERVAL) -#define TRACE_MUTEX_LOCK_EXIT(_INTERVAL,lock,miss) -#define TRACE_MUTEX_TRYLOCK(lock,ret_val) -#define TRACE_MUTEX_UNLOCK(lock) - -#endif /* LIBSYNC_TRACE */ - -#endif /* __LIBSYNC_PPU_TRACEHOOKS_H__ */ diff --git a/gcell/ibm/sync/ppu_source/wait_for_completion.h b/gcell/ibm/sync/ppu_source/wait_for_completion.h deleted file mode 100644 index f2b04275a..000000000 --- a/gcell/ibm/sync/ppu_source/wait_for_completion.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ - -#ifndef _PPU_WAIT_FOR_COMPLETION_H_ -#define _PPU_WAIT_FOR_COMPLETION_H_ - -#include <ppu_intrinsics.h> -#include "sync_utils.h" -#include "completion.h" - - -/** - * completion_wait - wait until a completion is broadcast. - * @comp: handle to effective address of completion variable. - * - * Description: Wait until another processor or device signals - * that a completionition is 'true'. The only restriction here is - * that @comp must be a word aligned address. - * - * Beware: This function hot polls waiting for completion. - */ -static __inline void _wait_for_completion(completion_ea_t comp) -{ - int val; - void *p; - - SYNC_ULL_TO_PTR(comp, p); - - do { - val = (int)__lwarx(p); - if (val != 1) val = (int)__stwcx(p, (unsigned int)0); - } while (val == 0); - __isync(); -} - - -#endif /* _PPU_WAIT_FOR_COMPLETION_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic.h b/gcell/ibm/sync/spu_source/atomic.h deleted file mode 100644 index 951c26e3f..000000000 --- a/gcell/ibm/sync/spu_source/atomic.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -/* - * atomic.h - SPU atomic SHM counter operations. - * - * Interfaces patterned after, and hopefully compatible - * with PowerPC64-Linux atomic counter operations. Uses - * 32b values for various counters. - */ -#ifndef _SPU_ATOMIC_H_ -#define _SPU_ATOMIC_H_ - -#include <sync_utils.h> -#include <spu_mfcio.h> - - -/* atomic_eaddr_t is a 64bit effective address - * that points to an atomic_t variable */ -typedef unsigned long long atomic_ea_t; - -#define DECL_ATOMIC_VARS() \ - char _tmp[256]; \ - char *tmp = (char *) ALIGN(_tmp, 128); \ - volatile s32 *buf = (volatile s32 *) &tmp[0]; \ - u32 size = 128, tagid = 0; \ - s32 ret_val; \ - u32 offset; \ - addr64 ea64 - -/* __atomic_op -* Internal routine to acquire lock line reservation -* then conditionally modify the counter variable -* pointed to by 'v'. The 'replace' flag indicates -* whether or not this is to be an arithmetic R-M-W -* or a simple replace operation. -*/ -#define ATOMIC_OP(__v, __val, __replace, __final_val) \ -{ \ - char __tmp[256]; \ - char *_tmp = (char *) ALIGN(__tmp, 128); \ - volatile s32 *_buf = (volatile s32 *) &_tmp[0]; \ - u32 _size = 128, _tagid = 0; \ - s32 _status, _ret_val; \ - u32 _offset; \ - addr64 _ea64; \ - \ - _ea64.ull = ALIGN128_EA(__v); \ - _offset = OFFSET128_EA_U32(__v); \ - do { \ - MFC_DMA(_buf, _ea64, _size, _tagid, MFC_GETLLAR_CMD); \ - spu_readch (MFC_RdAtomicStat); \ - \ - _ret_val = _buf[_offset]; \ - _buf[_offset] = (__replace) ? __val : _ret_val + __val; \ - MFC_DMA(_buf, _ea64, _size, _tagid, MFC_PUTLLC_CMD); \ - _status = spu_readch(MFC_RdAtomicStat); \ - } while (_status != 0); \ - \ - __final_val = _ret_val; \ -} - -#endif /* _SPU_ATOMIC_H_ */ - diff --git a/gcell/ibm/sync/spu_source/atomic_add.h b/gcell/ibm/sync/spu_source/atomic_add.h deleted file mode 100644 index 7606ae05b..000000000 --- a/gcell/ibm/sync/spu_source/atomic_add.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_ADD_H_ -#define _SPU_ATOMIC_ADD_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_add - atomically add to a counter. - * @v: handle to effective address of counter. - * @a: value to be added. - * - * Atomically add a value to a counter in system memory. - * The only restriction is that @v must be word aligned. - */ -static __inline void _atomic_add(int a, atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP (v, a, 0, ret_val); -} - - -#endif /* _SPU_ATOMIC_ADD_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_add_return.h b/gcell/ibm/sync/spu_source/atomic_add_return.h deleted file mode 100644 index 35f07adf6..000000000 --- a/gcell/ibm/sync/spu_source/atomic_add_return.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_ADD_RETURN_H_ -#define _SPU_ATOMIC_ADD_RETURN_H_ - -#include <sync_utils.h> -#include <atomic.h> -/** - * atomic_add_return - atomically add to a counter and return previous value. - * @v: handle to effective address of counter. - * @a: value to be added. - * - * Atomically add a value to a counter in system memory. - * The only restriction is that @v must be word aligned. - * - * This routine implements the "fetch and add" primitive - * that is described in "Book I PowerPC User Instruction - * Set Architecture", but uses MFC lock line reservation - * operations instead of lwarx/stwcx. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_add_return(int a, atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP(v, a, 0, ret_val); - return ret_val; -} - - -#endif /* _SPU_ATOMIC_ADD_RETURN_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_dec.h b/gcell/ibm/sync/spu_source/atomic_dec.h deleted file mode 100644 index 30ca7c514..000000000 --- a/gcell/ibm/sync/spu_source/atomic_dec.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_DEC_H_ -#define _SPU_ATOMIC_DEC_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_dec - atomically decrement a counter. - * @v: handle to effective address of location to be modified. - * - * Atomically decrement a counter in system memory. The only - * restriction is that @v must be word aligned. - */ -static __inline void _atomic_dec(atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP (v, -1, 0, ret_val); -} - - -#endif /* _SPU_ATOMIC_DEC_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_dec_and_test.h b/gcell/ibm/sync/spu_source/atomic_dec_and_test.h deleted file mode 100644 index b3c829820..000000000 --- a/gcell/ibm/sync/spu_source/atomic_dec_and_test.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_DEC_AND_TEST_H_ -#define _SPU_ATOMIC_DEC_AND_TEST_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_dec_and_test - atomically decrement and test if previous==0. - * @v: handle to effective address of counter. - * - * Atomically decrement a counter in system memory and test - * if previous==0. The only restriction is that @v must be - * word aligned. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_dec_and_test(atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP(v, -1, 0, ret_val); - return (ret_val == 0) ? 1 : 0; -} - -#endif /* _SPU_ATOMIC_DEC_AND_TEST_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_dec_if_positive.h b/gcell/ibm/sync/spu_source/atomic_dec_if_positive.h deleted file mode 100644 index 2a01ec307..000000000 --- a/gcell/ibm/sync/spu_source/atomic_dec_if_positive.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_DEC_IF_POSITIVE_H_ -#define _SPU_ATOMIC_DEC_IF_POSITIVE_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_dec_if_positive - atomically decrement if counter is positive. - * @v: handle to effective address of counter. - * - * Atomically decrement a counter if its value is positive. - * The only restriction is that @v must be word aligned. - * -* - * Returns the old value of the counter, minus 1. - */ -static __inline int _atomic_dec_if_positive(atomic_ea_t v) -{ - DECL_ATOMIC_VARS(); - s32 status; - - ea64.ull = ALIGN128_EA(v); - offset = OFFSET128_EA_U32(v); - do { - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - - ret_val = buf[offset] - 1; - if (likely(ret_val >= 0)) { - buf[offset] = ret_val; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); - status = spu_readch(MFC_RdAtomicStat); - } else { - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); - spu_readch(MFC_RdAtomicStat); - status = 0; - break; - } - } while (status != 0); - - return ret_val; -} - - - -#endif /* _SPU_ATOMIC_DEC_IF_POSITIVE_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_dec_return.h b/gcell/ibm/sync/spu_source/atomic_dec_return.h deleted file mode 100644 index 45effb689..000000000 --- a/gcell/ibm/sync/spu_source/atomic_dec_return.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_DEC_RETURN_H_ -#define _SPU_ATOMIC_DEC_RETURN_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_dec_return - atomically decrement a counter and return previous value. - * @v: handle to effective address of counter. - * - * Atomically decrement a counter in system memory and return its - * previous value. The only restriction is that @v must be word - * aligned. - * - * This routine implements the "fetch and decrement" - * primitive that is described in "Book I PowerPC User - * Instruction Set Architecture", but uses MFC lock line - * reservation operations instead of lwarx/stwcx. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_dec_return(atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP(v, -1, 0, ret_val); - return ret_val; -} - - -#endif /* _SPU_ATOMIC_DEC_RETURN_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_inc.h b/gcell/ibm/sync/spu_source/atomic_inc.h deleted file mode 100644 index 6800efea3..000000000 --- a/gcell/ibm/sync/spu_source/atomic_inc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_INC_H_ -#define _SPU_ATOMIC_INC_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_inc - atomically increment a counter in system memory. - * @v: handle to effective address of counter. - * - * Atomically increment a counter in system memory. - * The only restriction is that @v must be word aligned. - */ -static __inline void _atomic_inc(atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP (v, 1, 0, ret_val); -} - - -#endif /* _SPU_ATOMIC_INC_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_inc_return.h b/gcell/ibm/sync/spu_source/atomic_inc_return.h deleted file mode 100644 index 89361a0a1..000000000 --- a/gcell/ibm/sync/spu_source/atomic_inc_return.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_INC_RETURN_H_ -#define _SPU_ATOMIC_INC_RETURN_H_ - -#include <sync_utils.h> -#include <atomic.h> - - -/** - * atomic_inc_return - atomically increment a counter and return previous. - * @v: handle to effective address of counter. - * - * Atomically increment a counter in system memory. - * The only restriction is that @v must be word aligned. - * - * This routine implements the "fetch and increment" - * primitive that is described in "Book I PowerPC User - * Instruction Set Architecture", but uses MFC lock line - * reservation operations instead of lwarx/stwcx. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_inc_return(atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP(v, 1, 0, ret_val); - return ret_val; -} - - -#endif /* _SPU_ATOMIC_INC_RETURN_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_read.h b/gcell/ibm/sync/spu_source/atomic_read.h deleted file mode 100644 index 711a0ad26..000000000 --- a/gcell/ibm/sync/spu_source/atomic_read.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_READ_H_ -#define _SPU_ATOMIC_READ_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_read - read an atomic counter. - * @v: handle to effective address of counter. - * - * Read the current value of an atomic counter. - */ -static __inline int _atomic_read(atomic_ea_t v) -{ - DECL_ATOMIC_VARS(); - - /* reserve a tag for use */ - tagid = mfc_tag_reserve(); - - u32 oldtmask, tagmask = 1 << (tagid & 31); - - ea64.ull = ALIGN128_EA(v); - offset = OFFSET128_EA_U32(v); - - MFC_DMA(buf, ea64, size, tagid & 31, MFC_GET_CMD); - oldtmask = spu_readch(MFC_RdTagMask); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - spu_writech(MFC_WrTagMask, oldtmask); - - mfc_tag_release (tagid); - ret_val = buf[offset]; - return ret_val; -} - - -#endif /* _SPU_ATOMIC_READ_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_set.h b/gcell/ibm/sync/spu_source/atomic_set.h deleted file mode 100644 index 261d28a3d..000000000 --- a/gcell/ibm/sync/spu_source/atomic_set.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_SET_H_ -#define _SPU_ATOMIC_SET_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_set - atomically set a counter in system memory. - * @v: handle to effective address of counter. - * - * Atomically set a counter to a given value. The only - * restriction is that @v must be word aligned. - * - * This routine implements the "fetch and store" - * primitive that is described in "Book I PowerPC User - * Instruction Set Architecture", but uses MFC lock line - * reservation operations instead of lwarx/stwcx. - * - * Returns the previous value from system memory. - */ -static __inline void _atomic_set(atomic_ea_t v, int val) -{ - int ret_val; - ATOMIC_OP(v, val, 1, ret_val); -} - - -#endif /* _SPU_ATOMIC_SET_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_sub.h b/gcell/ibm/sync/spu_source/atomic_sub.h deleted file mode 100644 index f366e1dee..000000000 --- a/gcell/ibm/sync/spu_source/atomic_sub.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_SUB_H_ -#define _SPU_ATOMIC_SUB_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_sub - atomically subtract from a counter. - * @v: handle to effective address of counter. - * @a: value to be subtracted. - * - * Atomically subtract a value from a counter in system memory. - * The only restriction is that @v must be word aligned. - */ -static __inline void _atomic_sub(int a, atomic_ea_t v) -{ - int ret_val; - - ATOMIC_OP (v, -a, 0, ret_val); -} - - - -#endif /* _SPU_ATOMIC_SUB_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_sub_and_test.h b/gcell/ibm/sync/spu_source/atomic_sub_and_test.h deleted file mode 100644 index fe5824a43..000000000 --- a/gcell/ibm/sync/spu_source/atomic_sub_and_test.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_SUB_AND_TEST_H_ -#define _SPU_ATOMIC_SUB_AND_TEST_H_ - -#include <sync_utils.h> -#include <atomic.h> - -/** - * atomic_sub_and_test - atomically subtract and test if previous==0. - * @v: handle to effective address of counter. - * @a: value to be subtracted. - * - * Atomically subtract a value from a counter in system memory - * and test if previous==0. The only restriction is that @v - * must be word aligned. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_sub_and_test(int a, atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP(v, -a, 0, ret_val); - return (ret_val == 0) ? 1 : 0; -} - - -#endif /* _SPU_ATOMIC_SUB_AND_TEST_H_ */ diff --git a/gcell/ibm/sync/spu_source/atomic_sub_return.h b/gcell/ibm/sync/spu_source/atomic_sub_return.h deleted file mode 100644 index 5dbed5b85..000000000 --- a/gcell/ibm/sync/spu_source/atomic_sub_return.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_ATOMIC_SUB_RETURN_H_ -#define _SPU_ATOMIC_SUB_RETURN_H_ - -#include <sync_utils.h> -#include <atomic.h> - - -/** - * atomic_sub_return - atomically subtract from a counter & return previous. - * @v: handle to effective address of counter. - * @a: value to be subtracted. - * - * Atomically subtract a value from a counter in system memory. - * The only restriction is that @v must be word aligned. - * - * Returns the previous value from system memory. - */ -static __inline int _atomic_sub_return(int a, atomic_ea_t v) -{ - int ret_val; - ATOMIC_OP(v, -a, 0, ret_val); - return ret_val; - //return __atomic_op(v, -a, 0); -} - - - - -#endif /* _SPU_ATOMIC_SUB_RETURN_H_ */ diff --git a/gcell/ibm/sync/spu_source/complete.h b/gcell/ibm/sync/spu_source/complete.h deleted file mode 100644 index 6a7808650..000000000 --- a/gcell/ibm/sync/spu_source/complete.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COMPLETE_H_ -#define _SPU_COMPLETE_H_ - -#include "sync_utils.h" -#include <spu_mfcio.h> -#include "completion.h" - -static __inline void _complete(completion_ea_t completion) -{ - DECL_COMPLETION_VARS(); - - ea64.ull = ALIGN128_EA(completion); - offset = OFFSET128_EA_U32(completion); - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - - /* set the completionition variable to exactly one so - * only one thread can be awaken */ - buf[offset] = 1; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLUC_CMD); - spu_readch(MFC_RdAtomicStat); -} - - - - -#endif /* _SPU_COMPLETE_H_ */ diff --git a/gcell/ibm/sync/spu_source/complete_all.h b/gcell/ibm/sync/spu_source/complete_all.h deleted file mode 100644 index 5f9c3dcfa..000000000 --- a/gcell/ibm/sync/spu_source/complete_all.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COMPLETE_ALL_H_ -#define _SPU_COMPLETE_ALL_H_ - -#include "sync_utils.h" -#include <spu_mfcio.h> -#include "completion.h" - -/** - * completion_broadcast - indicate that a completion is true. - * @completion: handle to effective address of completion variable. - * - * Indicate that a completionition is true by storing '1' to the - * completionition variable. - */ -static __inline void _complete_all(completion_ea_t completion) -{ - DECL_COMPLETION_VARS(); - - ea64.ull = ALIGN128_EA(completion); - offset = OFFSET128_EA_U32(completion); - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - - /* set the completionition variable to the count. So that - * all the threads */ - buf[offset] = MAX_THREADS_WAITING; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLUC_CMD); - spu_readch(MFC_RdAtomicStat); -} - - - - -#endif /* _SPU_COMPLETE_ALL_H_ */ diff --git a/gcell/ibm/sync/spu_source/completion.h b/gcell/ibm/sync/spu_source/completion.h deleted file mode 100644 index 4a302d25c..000000000 --- a/gcell/ibm/sync/spu_source/completion.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -/* - * cond.h - simple condition wait & broadcast operations. - * - * Interrupt aware versions of the routines are supported. - * Applications should call either '_irq' or '_irqsave' - * forms of the functions when interrupts are enabled. - */ - -#ifndef __SPU_COMPLETION_H__ -#define __SPU_COMPLETION_H__ - -#include "sync_utils.h" - -#define MAX_THREADS_WAITING 32000 -typedef unsigned long long completion_ea_t; - - -#define DECL_COMPLETION_VARS() \ - char _tmp[256]; \ - char *tmp = (char *) ALIGN(_tmp, 128); \ - volatile s32 *buf = (volatile s32 *) &tmp[0]; \ - u32 size = 128, tagid = 0; \ - u32 offset; \ - addr64 ea64 - - - -#endif /* __SPU_COMPLETION_H__ */ diff --git a/gcell/ibm/sync/spu_source/cond.h b/gcell/ibm/sync/spu_source/cond.h deleted file mode 100644 index ceb3285d9..000000000 --- a/gcell/ibm/sync/spu_source/cond.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COND_VAR_H_ -#define _SPU_COND_VAR_H_ - -#include "sync_utils.h" -typedef struct -{ - int num_threads_signal; /* the number of threads that are going to be waken up. - There are 3 values possible for this parameter, 0, 1, - or num_threads_waiting*/ - int num_threads_waiting; /* the number of threads that are waiting to be awaken */ -} condition_variable_t __attribute__ ((aligned (128))); - -typedef eaddr_t cond_ea_t; /* a system memory 64 bit address that points to - * a valid condition_variable_t */ - - - - -#define DECL_COND_VARS() \ - char _tmp[256]; \ - char *tmp = (char *) ALIGN(_tmp, 128); \ - volatile s32 *buf = (volatile s32 *) &tmp[0]; \ - u32 size = 128, tagid = 0; \ - s32 status, ret_val; \ - u32 offset; \ - addr64 ea64; \ - condition_variable_t cond_var - -#endif /* _SPU_COND_VAR_H_ */ diff --git a/gcell/ibm/sync/spu_source/cond_broadcast.h b/gcell/ibm/sync/spu_source/cond_broadcast.h deleted file mode 100644 index 15a1da330..000000000 --- a/gcell/ibm/sync/spu_source/cond_broadcast.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COND_BROADCAST_H_ -#define _SPU_COND_BROADCAST_H_ - -#include "sync_utils.h" -#include "cond.h" -#include <spu_mfcio.h> - -/** - * cond_broadcast - indicate that a condition is true. - * @cond: handle to effective address of condition variable. - */ -static __inline void _cond_broadcast(cond_ea_t cond) -{ - char _tmp[256]; - char *tmp = (char *) ALIGN(_tmp, 128); - volatile unsigned short *buf = (volatile unsigned short *) &tmp[0]; - unsigned int size = 128, tagid = 0; - u32 offset; - addr64 ea64; - - ea64.ull = ALIGN128_EA(cond); - offset = OFFSET128_EA_U16(cond); - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - - /* set the condition variable to the count. So that - * all the threads */ - buf[offset] = buf[offset + 1]; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLUC_CMD); - spu_readch(MFC_RdAtomicStat); -} - -#endif /* _SPU_COND_BROADCAST_H_ */ diff --git a/gcell/ibm/sync/spu_source/cond_init.h b/gcell/ibm/sync/spu_source/cond_init.h deleted file mode 100644 index 7202e5352..000000000 --- a/gcell/ibm/sync/spu_source/cond_init.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COND_INIT_H_ -#define _SPU_COND_INIT_H_ - -#include "sync_utils.h" -#include "cond.h" -#include <spu_mfcio.h> - - -/** - * cond_init - initialize condition variable. - * @cond: handle to effective address of condition variable. - * - * - * Conditional Variable - is a synchronization device that allows - * SPE and PPE threads to suspend execution and relinquish the - * processors until some predicate on shared data is satisfied. - * The basic operations on conditions are: signal the condition - * (when the predicate becomes true), and wait for the condition, - * suspending the thread execution until anoter thread signals the - * condition - * - * A condition variable must always be associated with a mutex, to - * avoid the race condition where a thread prepares to wait on a - * condition variable and another thread signals the condition just - * before the first thread actually waits on it. - * - * cond_init initializes the condition variable cond. - * - * cond_signal restarts one of the threads that are waiting on the - * condition variable cond. If no threads are waiting on cond, nothing - * happens. If several threads are waiting on cond, exactly one - * is restarted, but it is not specified which - * - * cond_broadcast restarts all the threads that are waiting on the - * condition variable cond. Nothing happens if no threads are waiting - * on cond - * - * cond_wait atomically unlocks the mutex and waits for the condition - * variable cond to be signaled. The mutex must be lock locked by - * the calling thread on the entrance to cond_wait. Before returning - * to the calling thread, cond_wait re-acquires mutex. - * - * Only one thread initializes a condition variable. Usually, the - * PPE thread initializes a condidtion variable, however, a cond_init - * function is provided here for completeness - * - * Description: Initialize a cond variable to false. - */ -static __inline void _cond_init(cond_ea_t cond ) -{ - char _tmp[256]; - char *tmp = (char *) ALIGN(_tmp, 128); - volatile unsigned short *buf = (volatile unsigned short *) &tmp[0]; - unsigned int size = 128, tagid; - unsigned int offset; - addr64 ea64; - unsigned int oldtmask; - unsigned int tagmask; - - tagid = mfc_tag_reserve(); - - tagmask = 1 << (tagid & 31); - - ea64.ull = ALIGN128_EA(cond); - offset = OFFSET128_EA_U16(cond); - - MFC_DMA(buf, ea64, size, tagid & 31, MFC_GET_CMD); - oldtmask = spu_readch(MFC_RdTagMask); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - - /* this is still just one word. since buf is of type - * short, we fit both counts into one word. */ - buf[offset] = 0; - buf[offset+1] = 0; - MFC_DMA(buf, ea64, size, (tagid & 31), MFC_PUT_CMD); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - spu_writech(MFC_WrTagMask, oldtmask); - mfc_tag_release (tagid); -} - - - -#endif /* _SPU_COND_INIT_H_ */ diff --git a/gcell/ibm/sync/spu_source/cond_signal.h b/gcell/ibm/sync/spu_source/cond_signal.h deleted file mode 100644 index a035d2875..000000000 --- a/gcell/ibm/sync/spu_source/cond_signal.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COND_SIGNAL_H_ -#define _SPU_COND_SIGNAL_H_ -#include <stdio.h> -#include "sync_utils.h" -#include "cond.h" -#include "atomic.h" -#include <spu_mfcio.h> - -/* - * _cond_signal: signalling any of the waiting threads to wake up. - */ -static __inline void _cond_signal(cond_ea_t cond) -{ - char _tmp[256]; - char *tmp = (char *) ALIGN(_tmp, 128); - volatile unsigned short *buf = (volatile unsigned short *) &tmp[0]; - unsigned int size = 128, tagid = 0; - u32 offset; - addr64 ea64; - int status; - - ea64.ull = ALIGN128_EA(cond); - offset = OFFSET128_EA_U16(cond); - - do { - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - (void)spu_readch(MFC_RdAtomicStat); - - /* Check for waiting threads. - */ - if (buf[offset] != buf[offset+1]) { - /* Increment the signaled count to release the next waiting - * thread. - */ - buf[offset]++; - - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); - status = spu_readch(MFC_RdAtomicStat); - } else { - /* Nobody is waiting, do nothing. - */ - status = 0; - } - } while (status); -} - - -#endif /* _SPU_COND_SIGNAL_H_ */ diff --git a/gcell/ibm/sync/spu_source/cond_wait.h b/gcell/ibm/sync/spu_source/cond_wait.h deleted file mode 100644 index cf4b880f5..000000000 --- a/gcell/ibm/sync/spu_source/cond_wait.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_COND_WAIT_H_ -#define _SPU_COND_WAIT_H_ -#include <stdio.h> -#include "sync_irq.h" -#include "sync_utils.h" -#include "mutex_lock.h" -#include "mutex_unlock.h" -#include "cond.h" -#include <spu_mfcio.h> - -static __inline void _cond_wait (cond_ea_t cond, mutex_ea_t mutex) -{ - char _tmp[256]; - char *tmp = (char *) ALIGN(_tmp, 128); - volatile signed short *buf = (volatile signed short *) &tmp[0]; - unsigned int size = 128, tagid = 0; - int status; - unsigned int offset; - addr64 ea64; - signed short delta, cur_delta, signaled_cnt; - - ea64.ull = ALIGN128_EA(cond); - offset = OFFSET128_EA_U16(cond); - - /* increment the waiting halfword of the condition variable. - */ - do { - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - (void)spu_readch(MFC_RdAtomicStat); - - buf[offset+1]++; - - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); - status = spu_readch(MFC_RdAtomicStat); - } while (status); - - _mutex_unlock(mutex); - - /* keep track of the change in count needed to be signaled. This - * is delta. - */ - signaled_cnt = buf[offset]; - delta = buf[offset+1] - signaled_cnt; - if (delta < 0) delta = -delta; - - while (1) { - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - (void)spu_readch(MFC_RdAtomicStat); - - cur_delta = buf[offset] - signaled_cnt; - if (cur_delta < 0) cur_delta = -cur_delta; - - - if (cur_delta >= delta) { - /* the counts indicate that this thread has been signaled. - */ - break; - } - } - _mutex_lock (mutex); -} - -#endif /* _SPU_COND_WAIT_H_ */ diff --git a/gcell/ibm/sync/spu_source/init_completion.h b/gcell/ibm/sync/spu_source/init_completion.h deleted file mode 100644 index bf93e72af..000000000 --- a/gcell/ibm/sync/spu_source/init_completion.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_INIT_COMPLETION_H_ -#define _SPU_INIT_COMPLETION_H_ - -#include "sync_utils.h" -#include <spu_mfcio.h> -#include "completion.h" - -/** - * completion_init - initialize completion variable. - * @completion: handle to effective address of completion variable. - * - * Description: Initialize a completion variable to false. - */ -static __inline void _init_completion(completion_ea_t completion) -{ - DECL_COMPLETION_VARS(); - u32 oldtmask, tagmask; - - tagid = mfc_tag_reserve(); - tagmask = 1 << (tagid & 31); - - ea64.ull = ALIGN128_EA(completion); - offset = OFFSET128_EA_U32(completion); - - MFC_DMA(buf, ea64, size, tagid & 31, MFC_GET_CMD); - oldtmask = spu_readch(MFC_RdTagMask); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - - buf[offset] = 0; - MFC_DMA(buf, ea64, size, tagid & 31, MFC_PUT_CMD); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - spu_writech(MFC_WrTagMask, oldtmask); - mfc_tag_release(tagid); -} - - - -#endif /* _SPU_INIT_COMPLETION_H_ */ diff --git a/gcell/ibm/sync/spu_source/libsync.h b/gcell/ibm/sync/spu_source/libsync.h deleted file mode 100644 index 48cc722bd..000000000 --- a/gcell/ibm/sync/spu_source/libsync.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_LIB_SYNC_H_ -#define _SPU_LIB_SYNC_H_ -#include "sync_utils.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned long long atomic_ea_t; - -extern void atomic_set(atomic_ea_t v, int val); -extern void atomic_add(int a, atomic_ea_t v); -extern void atomic_sub(int a, atomic_ea_t v); -extern void atomic_inc(atomic_ea_t v); -extern void atomic_dec(atomic_ea_t v); - -extern int atomic_read(atomic_ea_t v); -extern int atomic_add_return(int a, atomic_ea_t v); -extern int atomic_sub_return(int a, atomic_ea_t v); -extern int atomic_inc_return(atomic_ea_t v); -extern int atomic_dec_return(atomic_ea_t v); -extern int atomic_sub_and_test(int a, atomic_ea_t v); -extern int atomic_dec_and_test(atomic_ea_t v); -extern int atomic_dec_if_positive(atomic_ea_t v); - -typedef unsigned long long mutex_ea_t; - -extern void mutex_init(mutex_ea_t lock); -extern void mutex_lock(mutex_ea_t lock); -extern int mutex_trylock(mutex_ea_t ea); -extern void mutex_unlock(mutex_ea_t lock); - - -typedef struct -{ - int num_threads_signal; /* the number of threads that are going to be waken up. - * There are 3 values possible for this parameter, 0, 1, - * or num_threads_waiting - */ - int num_threads_waiting; /* the number of threads that are waiting to be awaken - */ -} condition_variable_t __attribute__ ((aligned (128))); - -typedef eaddr_t cond_ea_t; /* a system memory 64 bit address that points to - * a valid condition_variable_t - */ - - -extern void cond_init (cond_ea_t cond); -extern void cond_signal (cond_ea_t cond); -extern void cond_broadcast (cond_ea_t cond); -extern void cond_wait (cond_ea_t cond, mutex_ea_t mutex); - -typedef unsigned long long completion_ea_t; - -extern void init_completion(completion_ea_t completion); -extern void wait_for_completion(completion_ea_t completion); -extern void complete(completion_ea_t completion); -extern void complete_all(completion_ea_t completion); - -#ifdef __SPU__ - /* Function only implemented for the SPU - */ - extern void read_lock(eaddr_t ea); - extern void read_unlock(eaddr_t ea); - extern int read_trylock(eaddr_t ea); - extern void write_lock(eaddr_t ea); - extern void write_unlock(eaddr_t ea); - extern int write_trylock(eaddr_t ea); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _SPU_LIB_SYNC_H_ */ diff --git a/gcell/ibm/sync/spu_source/mutex.h b/gcell/ibm/sync/spu_source/mutex.h deleted file mode 100644 index 37f2b4d62..000000000 --- a/gcell/ibm/sync/spu_source/mutex.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_MUTEX_H_ -#define _SPU_MUTEX_H_ 1 - -#include "sync_utils.h" -#include "sync_irq.h" -#include <spu_mfcio.h> - -typedef eaddr_t mutex_ea_t; - -#define DECL_MUTEX_VARS() \ - char _tmp[256]; \ - char *tmp = (char *) ALIGN(_tmp, 128); \ - volatile s32 *buf = (volatile s32 *) &tmp[0]; \ - u32 size = 128, tagid = 0; \ - u32 offset; \ - addr64 ea64 - -/* RAW_TEST_AND_SET - * Macro implementing the test and set primitive. - * - * RAW_TEST_AND_SET(==, 1) used by spin_try_lock() - * RAW_TEST_AND_SET(>=, 1) used by read_try_lock() - * RAW_TEST_AND_SET(==, -1) used by write_try_lock() - */ -#define RAW_TEST_AND_SET(_RELOP_, _val) \ - ea64.ull = ALIGN128_EA(ea); \ - offset = OFFSET128_EA_U32(ea); \ - do { \ - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); \ - spu_readch(MFC_RdAtomicStat); \ - SET_HIT; \ - if (likely(buf[offset] _RELOP_ 0)) { \ - buf[offset] += _val; \ - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); \ - status = spu_readch(MFC_RdAtomicStat); \ - ret_val = 1; \ - } else { \ - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); \ - spu_readch(MFC_RdAtomicStat); \ - status = ret_val = 0; \ - break; \ - } \ - } while (status != 0) - -/* RAW_SPINLOCK - * Macro implementing the spinlock primitive. - * - * RAW_SPINLOCK(==, 1) used by spin_lock() - * RAW_SPINLOCK(>=, 1) used by read_lock() - * RAW_SPINLOCK(==, -1) used by write_lock() - */ - - -#define RAW_SPINLOCK(_RELOP_, _val) \ - ea64.ull = ALIGN128_EA(ea); \ - offset = OFFSET128_EA_U32(ea); \ - do { \ - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); \ - spu_readch(MFC_RdAtomicStat); \ - SET_HIT; \ - status = 1; \ - if (likely(buf[offset] _RELOP_ 0)) { \ - buf[offset] += _val; \ - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); \ - status = spu_readch(MFC_RdAtomicStat); \ - } \ - } while (status != 0); - - -static inline void _lock_init(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - u32 oldtmask, tagmask; - - tagid = mfc_tag_reserve(); - - tagmask = 1 << (tagid & 31); - - /* __lock_init - * Internal routine to initialize a spinlock or - * reader/writer lock. - */ - ea64.ull = ALIGN128_EA(ea); - offset = OFFSET128_EA_U32(ea); - MFC_DMA(buf, ea64, size, tagid & 31, MFC_GET_CMD); - oldtmask = spu_readch(MFC_RdTagMask); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - - buf[offset] = 0; - MFC_DMA(buf, ea64, size, tagid & 31, MFC_PUT_CMD); - spu_writech(MFC_WrTagMask, tagmask); - spu_writech(MFC_WrTagUpdate, MFC_TAG_UPDATE_ANY); - spu_readch(MFC_RdTagStat); - spu_writech(MFC_WrTagMask, oldtmask); - mfc_tag_release(tagid); -} - -static inline void _spin_lock(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status; - - /* _spin_lock - * Internal routine to acquire spinlock. - */ -/* non trace - no hit/miss indicator */ -#define SET_HIT - RAW_SPINLOCK(==, 1); -} - -#ifdef LIBSYNC_TRACE -static inline s32 _spin_lock_trace(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status = 0; -/* trace - need hit/miss indicator */ -#undef SET_HIT -#define SET_HIT if (status == 0) hit = buf[offset] - s32 hit; - - hit = 0; - /* _spin_lock_trace for trace - * Internal routine to acquire spinlock. - */ - RAW_SPINLOCK(==, 1); - - return hit; - -#undef SET_HIT -#define SET_HIT -} - -#endif /* LIBSYNC_TRACE */ - - -#endif /* SPU_MUTEX_H */ diff --git a/gcell/ibm/sync/spu_source/mutex_init.h b/gcell/ibm/sync/spu_source/mutex_init.h deleted file mode 100644 index 9bddb1456..000000000 --- a/gcell/ibm/sync/spu_source/mutex_init.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_MUTEX_INIT_H_ -#define _SPU_MUTEX_INIT_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include "trace_libsync.h" - -/***************************************************************************/ -/** - * mutex_init - initialize the mutex by setting the value - * to 0. - * @lock: handle to effective address of lock variable. - * - * Description: Initialize a mutex. - */ -static __inline void _mutex_init(mutex_ea_t lock) -{ - _lock_init(lock); - - TRACE_MUTEX_INIT(lock); -} - - -#endif /* _SPU_MUTEX_INIT_H_ */ diff --git a/gcell/ibm/sync/spu_source/mutex_lock.h b/gcell/ibm/sync/spu_source/mutex_lock.h deleted file mode 100644 index 63bdbc36a..000000000 --- a/gcell/ibm/sync/spu_source/mutex_lock.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_MUTEX_LOCK_H_ -#define _SPU_MUTEX_LOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include "trace_libsync.h" - -static __inline void _mutex_lock(mutex_ea_t ea) -{ - -#ifdef LIBSYNC_TRACE - s32 miss = 0; - - TRACE_MUTEX_LOCK_ENTRY(interval); - miss = _spin_lock_trace(ea); - TRACE_MUTEX_LOCK_EXIT(interval, ea, miss); - -#else /* LIBSYNC_TRACE */ - - _spin_lock(ea); - -#endif /* LIBSYNC_TRACE */ - -} - -#endif /* _SPU_MUTEX_LOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/mutex_trylock.h b/gcell/ibm/sync/spu_source/mutex_trylock.h deleted file mode 100644 index 3c8df4662..000000000 --- a/gcell/ibm/sync/spu_source/mutex_trylock.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_MUTEX_TRYLOCK_H_ -#define _SPU_MUTEX_TRYLOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include "trace_libsync.h" - -/** - * mutex_trylock - acquire a lock, or return immediately. - * @ea: handle to effective address of lock variable. - * - * Description: Acquire a lock, or return immediately - * without polling for availability. - * - * Context: The application should not call this interface - * from a tight loop!! Use spin_lock() instead. - */ -static __inline int _mutex_trylock(mutex_ea_t ea) -{ - DECL_MUTEX_VARS(); - s32 status, ret_val; - - RAW_TEST_AND_SET(==, 1); - - TRACE_MUTEX_TRYLOCK(ea, ret_val); - - return ret_val; -} - -#endif /* _SPU_MUTEX_TRYLOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/mutex_unlock.h b/gcell/ibm/sync/spu_source/mutex_unlock.h deleted file mode 100644 index 87d6bbaef..000000000 --- a/gcell/ibm/sync/spu_source/mutex_unlock.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_MUTEX_UNLOCK_H_ -#define _SPU_MUTEX_UNLOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include "atomic.h" -#include "trace_libsync.h" - -static __inline void _mutex_unlock(mutex_ea_t ea) -{ - int ret_val; - - ATOMIC_OP((atomic_ea_t)ea, 0, 1, ret_val); - - TRACE_MUTEX_UNLOCK(ea); -} - - -#endif /* _SPU_MUTEX_UNLOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/read_lock.h b/gcell/ibm/sync/spu_source/read_lock.h deleted file mode 100644 index 0e1d97182..000000000 --- a/gcell/ibm/sync/spu_source/read_lock.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_READ_LOCK_H_ -#define _SPU_READ_LOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" - -/** - * read_lock - acquire reader lock, or spin until available. - * @ea: handle to effective address of lock variable. - * - * Description: Acquire a non-exclusive reader lock, or spin - * until available. The only restriction here is that @ea - * must be word aligned. - * - * Context: This routine should not be called if SPU - * asynchronous interrupts are enabled. - */ -static __inline void _read_lock(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status; - - RAW_SPINLOCK(>=, 1); -} - -#endif /* _SPU_READ_LOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/read_trylock.h b/gcell/ibm/sync/spu_source/read_trylock.h deleted file mode 100644 index d03278351..000000000 --- a/gcell/ibm/sync/spu_source/read_trylock.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_READ_TRYLOCK_H_ -#define _SPU_READ_TRYLOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" - -/** - * read_trylock - acquire a reader lock, or return immediately. - * @ea: handle to effective address of lock variable. - * - * Acquire a non-exclusive reader lock, or return - * immediately. The only restriction here is that - * @ea must be word aligned. - * - * Returns 1 on success, or 0 on failure. - * - * Context: The application should not call this interface - * from a tight loop!! Use read_lock() instead. - */ -static __inline int _read_trylock(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status, ret_val; - - RAW_TEST_AND_SET(>=, 1); - - return ret_val; -} - - -#endif /* _SPU_READ_TRYLOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/read_unlock.h b/gcell/ibm/sync/spu_source/read_unlock.h deleted file mode 100644 index f011550e5..000000000 --- a/gcell/ibm/sync/spu_source/read_unlock.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_READ_UNLOCK_H_ -#define _SPU_READ_UNLOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include <spu_mfcio.h> - - -/** - * read_unlock - release reader lock. - * @ea: handle to effective address of lock variable. - * - * Description: Release a reader lock. The only restriction - * here is that @ea must be word aligned. - * - * Context: This routine should be used when interrupts - * do not need to be re-enabled --either because interrupts - * are not being used, or because the application will take - * steps to re-enable them later. - */ -static __inline void _read_unlock(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status; - - /* _read_unlock - * - * Reader locks must use PUTLLC when releasing, instead of - * the more traditional PUTLLUC because of the non-exclusive - * nature of the lock. The reason for this is that other - * readers may have incremented the counter, and we don't - * want to corrupt it by blindly issuing PUTLLUC!! - */ - ea64.ull = ALIGN128_EA(ea); - offset = OFFSET128_EA_U32(ea); - do { - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - - buf[offset] -= 1; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); - status = spu_readch(MFC_RdAtomicStat); - } while (status != 0); - -} - - -#endif /* _SPU_READ_UNLOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/rwlock_init.h b/gcell/ibm/sync/spu_source/rwlock_init.h deleted file mode 100644 index 6b05533bb..000000000 --- a/gcell/ibm/sync/spu_source/rwlock_init.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_RWLOCK_INIT_H_ -#define _SPU_RWLOCK_INIT_H_ - -#include "sync_utils.h" -#include "mutex.h" - -/** - * rwlock_init - initialize a reader/writer lock. - * @ea: handle to effective address of lock variable. - * - * Description: Initialize a reader/writer lock. - */ -static __inline void _rwlock_init(eaddr_t rwlock) -{ - _lock_init(rwlock); -} - - - -#endif /* _SPU_RWLOCK_INIT_H_ */ diff --git a/gcell/ibm/sync/spu_source/sync_irq.h b/gcell/ibm/sync/spu_source/sync_irq.h deleted file mode 100644 index feae65e50..000000000 --- a/gcell/ibm/sync/spu_source/sync_irq.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -/* - * irq.h - SPU interrupt management facilities. - * - * These utilities help an "interrupt aware" library to manage - * state of SPU interrupts. - */ - -#ifndef __SPU_IRQ_H__ -#define __SPU_IRQ_H__ - -#include <spu_intrinsics.h> -#include "sync_utils.h" - -static inline u32 irq_mask(u32 newmask) -{ - u32 old, tmp = 0; - - /* irq_mask - * Set the interrupt mask to the newmask value, - * and return its previous setting. Will - * detect and discard potential phantom - * events. - */ - - old = spu_readch(SPU_RdEventMask); - spu_writech(SPU_WrEventMask, tmp); - if (spu_readchcnt(SPU_RdEventStat)) { - tmp = spu_readch(SPU_RdEventStat); - spu_writech(SPU_WrEventAck, tmp); - } - spu_writech(SPU_WrEventMask, newmask); - - return old; -} - -#endif /* __SPU_IRQ_H__ */ diff --git a/gcell/ibm/sync/spu_source/sync_utils.h b/gcell/ibm/sync/spu_source/sync_utils.h deleted file mode 100644 index 516b41f74..000000000 --- a/gcell/ibm/sync/spu_source/sync_utils.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -/* - * sync_utils.h - SPU sync-library internal utilities. - * - * These utilities are used internally by the SPU sync library. - */ -#ifndef __SPU_SYNC_UTILS_H__ -#define __SPU_SYNC_UTILS_H__ - -#include <spu_intrinsics.h> - -typedef unsigned int u32; -typedef signed int s32; -typedef unsigned long long u64; -typedef unsigned long long eaddr_t; - - -typedef union { - u64 ull; - u32 ui[2]; -} addr64; - -#ifndef likely -#define likely(_c) \ - __builtin_expect((_c), 1) -#define unlikely(_c) \ - __builtin_expect((_c), 0) -#endif - -#define ALLOCA(_nbytes, _size) \ - alloca((_nbytes) + (_size)-1) - -#define ALIGN(_ptr, _size) \ - ((((u32) _ptr) + (_size)-1) & ~((_size)-1)) - -#define ALIGN128_EA(_ull) \ - ((_ull) & ~(127ULL)) -/* -#define OFFSET128_EA(_ull, _type) \ - (((_ull) & 127ULL) / sizeof(_type)) - */ - -#define OFFSET128_EA_U32(_ull) \ - (((_ull) & 127ULL) >> 2) - -#define OFFSET128_EA_U16(_ull) \ - (((_ull) & 127ULL) >> 1) - -#define MFC_DMA(_ls, _ea, _sz, _tg, _cmd) \ - spu_mfcdma64(_ls, _ea.ui[0], _ea.ui[1], _sz, _tg, _cmd) - -#define MFC_SYNC() { \ - u32 _tagid = 0; \ - spu_writech(mfc_tag_id, _tagid); \ - spu_writech(mfc_cmd_queue, MFC_SYNC_CMD); \ -} - -#define MFC_EIEIO() { \ - u32 _tagid = 0; \ - spu_writech(mfc_tag_id, _tagid); \ - spu_writech(mfc_cmd_queue, MFC_EIEIO_CMD); \ -} - -#endif /* __SPU_SYNC_UTILS_H__ */ diff --git a/gcell/ibm/sync/spu_source/trace_libsync.h b/gcell/ibm/sync/spu_source/trace_libsync.h deleted file mode 100644 index 47887c9dc..000000000 --- a/gcell/ibm/sync/spu_source/trace_libsync.h +++ /dev/null @@ -1,117 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2007 */ -/* International Business Machines Corporation */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef __LIBSYNC_SPU_TRACEHOOKS_H__ -#define __LIBSYNC_SPU_TRACEHOOKS_H__ - -#ifdef LIBSYNC_TRACE - -#include <trace_events.h> - -/* - * last parameter in the trace_even and trace_interval_entry call is - * the stack level to report the PC in the trace record. so 0 means - * the PC of the current frame, 1 means the PC of the caller, etc. - * there's a dilemma here - these macros are included in the inline - * _mutex calls which get called from the (created during build) - * mutex functions in the mutex .c files. in that case, the level - * should be 1 - we don't want the PC of where in the mutex function - * the trace call is happening, we want the PC of whomever is calling - * the mutex function. - * - * but.. an app can call the inline functions - it can #include the - * appropriate libsync mutex .h files, and call the inlined _mutex - * function in their code. in that case, the appropriate level for the - * trace calls would be 0 - the user would want to know where in their - * code the call to the _mutex function is. - * - * so, we'll assume _LEVEL of 0 which is what the inline funtions need. - * when we build the files for libsync, we'll do a -D_LEVEL=1 - */ -#ifndef _LEVEL -#define _LEVEL 0 -#endif - - -#define TRACE_EVENT_MUTEX_INIT 0x0403 - -#define TRACE_MUTEX_INIT(lock) { \ - trace_payload_t payload; \ - payload.dword[0]=(unsigned long)lock; \ - trace_event(TRACE_EVENT_MUTEX_INIT, 1, &payload, "Event=%d, lock=0x%x", _LEVEL); \ -} - -#define TRACE_EVENT_MUTEX_LOCK 0x0503 - -#define TRACE_MUTEX_LOCK_ENTRY(_INTERVAL) \ -trace_interval_p _INTERVAL = trace_interval_entry(TRACE_EVENT_MUTEX_LOCK, _LEVEL) - -#define TRACE_MUTEX_LOCK_EXIT(_INTERVAL,lock,miss) { \ - trace_payload_t payload; \ - payload.dword[0]=(unsigned long)lock; \ - payload.word[2]=(unsigned int)miss; \ - trace_interval_exit(_INTERVAL, 2, &payload, "Event=%d, lock=0x%x, miss=0x%x"); \ -} - -#define TRACE_EVENT_MUTEX_TRYLOCK 0x0603 - -#define TRACE_MUTEX_TRYLOCK(lock,ret_val) { \ - trace_payload_t payload; \ - payload.dword[0]=(unsigned long)lock; \ - payload.word[2]=(unsigned int)ret_val; \ - trace_event(TRACE_EVENT_MUTEX_TRYLOCK, 2, &payload, "Event=%d, lock=0x%x, ret_val=0x%x", _LEVEL); \ -} - -#define TRACE_EVENT_MUTEX_UNLOCK 0x0703 - -#define TRACE_MUTEX_UNLOCK(lock) { \ - trace_payload_t payload; \ - payload.dword[0]=(unsigned long)lock; \ - trace_event(TRACE_EVENT_MUTEX_UNLOCK, 1, &payload, "Event=%d, lock=0x%x", _LEVEL); \ -} - -#else /* LIBSYNC_TRACE */ - -#define TRACE_MUTEX_INIT(lock) -#define TRACE_MUTEX_LOCK_ENTRY(_INTERVAL) -#define TRACE_MUTEX_LOCK_EXIT(_INTERVAL,lock,miss) -#define TRACE_MUTEX_TRYLOCK(lock,ret_val) -#define TRACE_MUTEX_UNLOCK(lock) - -#endif /* LIBSYNC_TRACE */ - -#endif /* __LIBSYNC_SPU_TRACEHOOKS_H__ */ diff --git a/gcell/ibm/sync/spu_source/wait_for_completion.h b/gcell/ibm/sync/spu_source/wait_for_completion.h deleted file mode 100644 index ea7bdbe6d..000000000 --- a/gcell/ibm/sync/spu_source/wait_for_completion.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_WAIT_FOR_COMPLETION_H_ -#define _SPU_WAIT_FOR_COMPLETION_H_ - -#include "sync_utils.h" -#include <spu_mfcio.h> -#include "sync_irq.h" -#include "completion.h" - -/* _wait_for_completion - * Internal routine to wait for completion to - * become true (!0). When completion is false, - * uses lock line reservation lost event to - * sleep until the variable has been changed. - */ -static __inline void _wait_for_completion(completion_ea_t completion) -{ - DECL_COMPLETION_VARS(); - s32 status; - - status = 1; - - ea64.ull = ALIGN128_EA(completion); - offset = OFFSET128_EA_U32(completion); - do { - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - /* if the completion variable has been set elsewhere - * (a signal or broadcast function has been called - * then we get out of the loop, and reset the variable */ - if (likely(buf[offset] != 0)) { - /* decrement the variable */ - buf[offset]--; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); - spu_readch(MFC_RdAtomicStat); - status = 0; - } - } while (status != 0); -} - - - -#endif /* _SPU_WAIT_FOR_COMPLETION_H_ */ diff --git a/gcell/ibm/sync/spu_source/write_lock.h b/gcell/ibm/sync/spu_source/write_lock.h deleted file mode 100644 index 7af5175f0..000000000 --- a/gcell/ibm/sync/spu_source/write_lock.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_WRITE_LOCK_H_ -#define _SPU_WRITE_LOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" - -/** - * write_lock - acquire writer lock, or spin until available. - * @ea: handle to effective address of lock variable. - * - * Description: Acquire an exclusive writer lock, - * or spin until available. The only restriction - * here is that @ea must be word aligned. - * - * Context: This routine should not be called if SPU - * asynchronous interrupts are enabled. - */ -static __inline void _write_lock(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status; - - RAW_SPINLOCK(==, -1); -} - - -#endif /* _SPU_WRITE_LOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/write_trylock.h b/gcell/ibm/sync/spu_source/write_trylock.h deleted file mode 100644 index b3799b37e..000000000 --- a/gcell/ibm/sync/spu_source/write_trylock.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_WRITE_TRYLOCK_H_ -#define _SPU_WRITE_TRYLOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" - -/** - * write_trylock - acquire a writer lock, or return immediately. - * @ea: handle to effective address of lock variable. - * - * Try to acquire an exclusive writer lock, or return - * immediately. The only restriction here is that @ea - * must be word aligned. - * - * Returns 1 on success, or 0 on failure. - * - * Caution: - * The application should not call this interface from a tight - * loop!! Use write_lock() instead. - */ -static __inline int _write_trylock(eaddr_t ea) -{ - DECL_MUTEX_VARS(); - s32 status, ret_val; - - RAW_TEST_AND_SET(==, -1); - - return ret_val; -} - - -#endif /* _SPU_WRITE_TRYLOCK_H_ */ diff --git a/gcell/ibm/sync/spu_source/write_unlock.h b/gcell/ibm/sync/spu_source/write_unlock.h deleted file mode 100644 index 25b24e181..000000000 --- a/gcell/ibm/sync/spu_source/write_unlock.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -------------------------------------------------------------- */ -/* (C)Copyright 2001,2007, */ -/* International Business Machines Corporation, */ -/* Sony Computer Entertainment, Incorporated, */ -/* Toshiba Corporation, */ -/* */ -/* All Rights Reserved. */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the */ -/* following conditions are met: */ -/* */ -/* - Redistributions of source code must retain the above copyright*/ -/* notice, this list of conditions and the following disclaimer. */ -/* */ -/* - Redistributions in binary form must reproduce the above */ -/* copyright notice, this list of conditions and the following */ -/* disclaimer in the documentation and/or other materials */ -/* provided with the distribution. */ -/* */ -/* - Neither the name of IBM Corporation nor the names of its */ -/* contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written */ -/* permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ -/* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ -/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ -/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ -/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ -/* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ -/* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ -/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ -/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ -/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ -/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ -/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* -------------------------------------------------------------- */ -/* PROLOG END TAG zYx */ -#ifndef _SPU_WRITE_UNLOCK_H_ -#define _SPU_WRITE_UNLOCK_H_ - -#include "sync_utils.h" -#include "mutex.h" -#include <spu_mfcio.h> - -/** - * write_unlock - release writer lock. - * @rwlock: handle to effective address of lock variable. - * - * Release a single writer lock. - */ -static __inline void _write_unlock(eaddr_t rwlock) -{ - DECL_MUTEX_VARS(); - - ea64.ull = ALIGN128_EA(rwlock); - offset = OFFSET128_EA_U32(rwlock); - MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); - spu_readch(MFC_RdAtomicStat); - - buf[offset] = 0; - MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLUC_CMD); - spu_readch(MFC_RdAtomicStat); -} - - -#endif /* _SPU_WRITE_UNLOCK_H_ */ |