2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
15 #ifndef _ASM_TILE_SPINLOCK_TYPES_H
16 #define _ASM_TILE_SPINLOCK_TYPES_H
18 #ifndef __LINUX_SPINLOCK_TYPES_H
19 # error "please don't include this file directly"
24 /* Low 15 bits are "next"; high 15 bits are "current". */
25 typedef struct arch_spinlock {
29 #define __ARCH_SPIN_LOCK_UNLOCKED { 0 }
31 /* High bit is "writer owns"; low 31 bits are a count of readers. */
32 typedef struct arch_rwlock {
36 #define __ARCH_RW_LOCK_UNLOCKED { 0 }
40 typedef struct arch_spinlock {
41 /* Next ticket number to hand out. */
43 /* The ticket number that currently owns this lock. */
47 #define __ARCH_SPIN_LOCK_UNLOCKED { 0, 0 }
50 * Byte 0 for tns (only the low bit is used), byte 1 for ticket-lock "next",
51 * byte 2 for ticket-lock "current", byte 3 for reader count.
53 typedef struct arch_rwlock {
57 #define __ARCH_RW_LOCK_UNLOCKED { 0 }
60 #endif /* _ASM_TILE_SPINLOCK_TYPES_H */