1 /* Copyright (c) 2009, 2011, 2013-2015 The Linux Foundation.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
16 * Part of this this code is based on the standard ARM spinlock
17 * implementation (asm/spinlock.h) found in the 2.6.29 kernel.
20 #ifndef __ASM__ARCH_QC_REMOTE_SPINLOCK_H
21 #define __ASM__ARCH_QC_REMOTE_SPINLOCK_H
24 #include <linux/types.h>
26 #define REMOTE_SPINLOCK_NUM_PID 128
27 #define REMOTE_SPINLOCK_TID_START REMOTE_SPINLOCK_NUM_PID
29 /* Remote spinlock definitions. */
32 volatile uint32_t lock;
33 } raw_remote_spinlock_t;
35 typedef raw_remote_spinlock_t *_remote_spinlock_t;
37 #define remote_spinlock_id_t const char *
39 #if defined(CONFIG_REMOTE_SPINLOCK_MSM)
40 int _remote_spin_lock_init(remote_spinlock_id_t, _remote_spinlock_t *lock);
41 void _remote_spin_release_all(uint32_t pid);
42 void _remote_spin_lock(_remote_spinlock_t *lock);
43 void _remote_spin_unlock(_remote_spinlock_t *lock);
44 int _remote_spin_trylock(_remote_spinlock_t *lock);
45 int _remote_spin_release(_remote_spinlock_t *lock, uint32_t pid);
46 int _remote_spin_owner(_remote_spinlock_t *lock);
47 void _remote_spin_lock_rlock_id(_remote_spinlock_t *lock, uint32_t tid);
48 void _remote_spin_unlock_rlock(_remote_spinlock_t *lock);
49 int _remote_spin_get_hw_spinlocks_element(_remote_spinlock_t *lock);
52 int _remote_spin_lock_init(remote_spinlock_id_t id, _remote_spinlock_t *lock)
56 static inline void _remote_spin_release_all(uint32_t pid) {}
57 static inline void _remote_spin_lock(_remote_spinlock_t *lock) {}
58 static inline void _remote_spin_unlock(_remote_spinlock_t *lock) {}
59 static inline int _remote_spin_trylock(_remote_spinlock_t *lock)
63 static inline int _remote_spin_release(_remote_spinlock_t *lock, uint32_t pid)
67 static inline int _remote_spin_owner(_remote_spinlock_t *lock)
71 static inline void _remote_spin_lock_rlock_id(_remote_spinlock_t *lock,
73 static inline void _remote_spin_unlock_rlock(_remote_spinlock_t *lock) {}
74 static inline int _remote_spin_get_hw_spinlocks_element(
75 _remote_spinlock_t *lock)
80 #endif /* __ASM__ARCH_QC_REMOTE_SPINLOCK_H */