]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/lock.h
007e2e6c36ba9abee59bb509a0fb6681896a6bd9
[apple/xnu.git] / osfmk / ppc / lock.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright (C) 1998 Apple Computer
27 * All Rights Reserved
28 */
29 /*
30 * @OSF_COPYRIGHT@
31 */
32
33 /*
34 * Mach Operating System
35 * Copyright (c) 1991,1990 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58
59 #ifndef _PPC_LOCK_H_
60 #define _PPC_LOCK_H_
61
62 #include <sys/appleapiopts.h>
63
64 #ifdef __APPLE_API_PRIVATE
65
66 #include <kern/macro_help.h>
67 #include <kern/assert.h>
68
69 extern unsigned int LockTimeOut; /* Number of hardware ticks of a lock timeout */
70
71 #if defined(MACH_KERNEL_PRIVATE)
72
73 #include <cpus.h>
74
75 #if !(NCPUS == 1 || ETAP_LOCK_TRACE || USLOCK_DEBUG)
76
77 #include <ppc/hw_lock_types.h>
78
79 #define simple_lock_init(l,t) hw_lock_init(l)
80 #define __slock_held_func__(l) hw_lock_held(l)
81
82 extern void fast_usimple_lock(simple_lock_t);
83 extern void fast_usimple_unlock(simple_lock_t);
84 extern unsigned int fast_usimple_lock_try(simple_lock_t);
85
86 #define simple_lock(l) fast_usimple_lock(l)
87 #define simple_unlock(l) fast_usimple_unlock(l)
88 #define simple_lock_try(l) fast_usimple_lock_try(l)
89 #define simple_lock_addr(l) (&(l))
90 #define thread_sleep_simple_lock(l, e, i) \
91 thread_sleep_fast_usimple_lock((l), (e), (i))
92
93 #endif /* !(NCPUS == 1 || ETAP_LOCK_TRACE || USLOCK_DEBUG) */
94
95 #endif /* MACH_KERNEL_PRIVATE */
96
97 #endif /* __APPLE_API_PRIVATE */
98
99 #endif /* _PPC_LOCK_H_ */