1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 4 */ 5 6 #ifndef __ASM_SPINLOCK_TYPES_H 7 #define __ASM_SPINLOCK_TYPES_H 8 9 typedef struct { 10 volatile unsigned int slock; 11 } arch_spinlock_t; 12 13 #define __ARCH_SPIN_LOCK_UNLOCKED__ 0 14 #define __ARCH_SPIN_LOCK_LOCKED__ 1 15 16 #define __ARCH_SPIN_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED__ } 17 #define __ARCH_SPIN_LOCK_LOCKED { __ARCH_SPIN_LOCK_LOCKED__ } 18 19 /* 20 * Unlocked : 0x0100_0000 21 * Read lock(s) : 0x00FF_FFFF to 0x01 (Multiple Readers decrement it) 22 * Write lock : 0x0, but only if prior value is "unlocked" 0x0100_0000 23 */ 24 typedef struct { 25 volatile unsigned int counter; 26 #ifndef CONFIG_ARC_HAS_LLSC 27 arch_spinlock_t lock_mutex; 28 #endif 29 } arch_rwlock_t; 30 31 #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000 32 #define __ARCH_RW_LOCK_UNLOCKED { .counter = __ARCH_RW_LOCK_UNLOCKED__ } 33 34 #endif 35