1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ASM_SPINLOCK_TYPES_H 3 #define __ASM_SPINLOCK_TYPES_H 4 5 typedef struct { 6 #ifdef CONFIG_PA20 7 volatile unsigned int slock; 8 # define __ARCH_SPIN_LOCK_UNLOCKED { 1 } 9 #else 10 volatile unsigned int lock[4]; 11 # define __ARCH_SPIN_LOCK_UNLOCKED { { 1, 1, 1, 1 } } 12 #endif 13 } arch_spinlock_t; 14 15 16 /* counter: 17 * Unlocked : 0x0100_0000 18 * Read lock(s) : 0x00FF_FFFF to 0x01 (Multiple Readers decrement it) 19 * Write lock : 0x0, but only if prior value is "unlocked" 0x0100_0000 20 */ 21 typedef struct { 22 arch_spinlock_t lock_mutex; 23 volatile unsigned int counter; 24 } arch_rwlock_t; 25 26 #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000 27 #define __ARCH_RW_LOCK_UNLOCKED { .lock_mutex = __ARCH_SPIN_LOCK_UNLOCKED, \ 28 .counter = __ARCH_RW_LOCK_UNLOCKED__ } 29 30 #endif 31