Commit | Line | Data |
---|---|---|
6e35fa2d VG |
1 | /* |
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | |
3 | * | |
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 as | |
6 | * published by the Free Software Foundation. | |
7 | */ | |
8 | ||
9 | #ifndef __ASM_SPINLOCK_TYPES_H | |
10 | #define __ASM_SPINLOCK_TYPES_H | |
11 | ||
12 | typedef struct { | |
13 | volatile unsigned int slock; | |
14 | } arch_spinlock_t; | |
15 | ||
16 | #define __ARCH_SPIN_LOCK_UNLOCKED__ 0 | |
17 | #define __ARCH_SPIN_LOCK_LOCKED__ 1 | |
18 | ||
19 | #define __ARCH_SPIN_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED__ } | |
20 | #define __ARCH_SPIN_LOCK_LOCKED { __ARCH_SPIN_LOCK_LOCKED__ } | |
21 | ||
22 | /* | |
4b06ff35 VG |
23 | * Unlocked : 0x0100_0000 |
24 | * Read lock(s) : 0x00FF_FFFF to 0x01 (Multiple Readers decrement it) | |
25 | * Write lock : 0x0, but only if prior value is "unlocked" 0x0100_0000 | |
6e35fa2d VG |
26 | */ |
27 | typedef struct { | |
28 | volatile unsigned int counter; | |
29 | arch_spinlock_t lock_mutex; | |
30 | } arch_rwlock_t; | |
31 | ||
32 | #define __ARCH_RW_LOCK_UNLOCKED__ 0x01000000 | |
33 | #define __ARCH_RW_LOCK_UNLOCKED { .counter = __ARCH_RW_LOCK_UNLOCKED__ } | |
34 | ||
35 | #endif |