]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
8ad349bb | 4 | * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ |
1c79356b | 5 | * |
8ad349bb A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the | |
10 | * License may not be used to create, or enable the creation or | |
11 | * redistribution of, unlawful or unlicensed copies of an Apple operating | |
12 | * system, or to circumvent, violate, or enable the circumvention or | |
13 | * violation of, any terms of an Apple operating system software license | |
14 | * agreement. | |
15 | * | |
16 | * Please obtain a copy of the License at | |
17 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
18 | * file. | |
19 | * | |
20 | * The Original Code and all software distributed under the License are | |
21 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
22 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
23 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
24 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
25 | * Please see the License for the specific language governing rights and | |
26 | * limitations under the License. | |
27 | * | |
28 | * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ | |
1c79356b A |
29 | */ |
30 | /* | |
31 | * Copyright (C) 1998 Apple Computer | |
32 | * All Rights Reserved | |
33 | */ | |
34 | /* | |
35 | * @OSF_COPYRIGHT@ | |
36 | */ | |
37 | /* | |
38 | * Mach Operating System | |
39 | * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University | |
40 | * All Rights Reserved. | |
41 | * | |
42 | * Permission to use, copy, modify and distribute this software and its | |
43 | * documentation is hereby granted, provided that both the copyright | |
44 | * notice and this permission notice appear in all copies of the | |
45 | * software, derivative works or modified versions, and any portions | |
46 | * thereof, and that both notices appear in supporting documentation. | |
47 | * | |
48 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
49 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
50 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
51 | * | |
52 | * Carnegie Mellon requests users of this software to return to | |
53 | * | |
54 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
55 | * School of Computer Science | |
56 | * Carnegie Mellon University | |
57 | * Pittsburgh PA 15213-3890 | |
58 | * | |
59 | * any improvements or extensions that they make and grant Carnegie Mellon | |
60 | * the rights to redistribute these changes. | |
61 | */ | |
62 | /* | |
63 | * File: kern/simple_lock.h (derived from kern/lock.h) | |
64 | * Author: Avadis Tevanian, Jr., Michael Wayne Young | |
65 | * Date: 1985 | |
66 | * | |
91447636 | 67 | * Atomic primitives and Simple Locking primitives definitions |
1c79356b A |
68 | */ |
69 | ||
91447636 | 70 | #ifdef KERNEL_PRIVATE |
1c79356b | 71 | |
91447636 A |
72 | #ifndef _KERN_SIMPLE_LOCK_H_ |
73 | #define _KERN_SIMPLE_LOCK_H_ | |
1c79356b | 74 | |
91447636 | 75 | #include <sys/cdefs.h> |
1c79356b A |
76 | #include <mach/boolean.h> |
77 | #include <kern/kern_types.h> | |
91447636 | 78 | #include <machine/simple_lock.h> |
9bccf70c A |
79 | |
80 | #ifdef MACH_KERNEL_PRIVATE | |
91447636 | 81 | #include <mach_ldebug.h> |
9bccf70c | 82 | |
91447636 A |
83 | extern void hw_lock_init( |
84 | hw_lock_t); | |
9bccf70c | 85 | |
91447636 A |
86 | extern void hw_lock_lock( |
87 | hw_lock_t); | |
9bccf70c | 88 | |
91447636 A |
89 | extern void hw_lock_unlock( |
90 | hw_lock_t); | |
1c79356b | 91 | |
91447636 A |
92 | extern unsigned int hw_lock_to( |
93 | hw_lock_t, | |
94 | unsigned int); | |
9bccf70c | 95 | |
91447636 A |
96 | extern unsigned int hw_lock_try( |
97 | hw_lock_t); | |
9bccf70c | 98 | |
91447636 A |
99 | extern unsigned int hw_lock_held( |
100 | hw_lock_t); | |
9bccf70c | 101 | |
91447636 | 102 | #endif /* MACH_KERNEL_PRIVATE */ |
9bccf70c | 103 | |
91447636 | 104 | __BEGIN_DECLS |
9bccf70c | 105 | |
91447636 A |
106 | extern uint32_t hw_atomic_add( |
107 | uint32_t *dest, | |
108 | uint32_t delt); | |
1c79356b | 109 | |
91447636 A |
110 | extern uint32_t hw_atomic_sub( |
111 | uint32_t *dest, | |
112 | uint32_t delt); | |
1c79356b | 113 | |
91447636 A |
114 | extern uint32_t hw_atomic_or( |
115 | uint32_t *dest, | |
116 | uint32_t mask); | |
1c79356b | 117 | |
91447636 A |
118 | extern uint32_t hw_atomic_and( |
119 | uint32_t *dest, | |
120 | uint32_t mask); | |
1c79356b | 121 | |
91447636 A |
122 | extern uint32_t hw_compare_and_store( |
123 | uint32_t oldval, | |
124 | uint32_t newval, | |
125 | uint32_t *dest); | |
1c79356b | 126 | |
91447636 A |
127 | extern void hw_queue_atomic( |
128 | unsigned int *anchor, | |
129 | unsigned int *elem, | |
130 | unsigned int disp); | |
1c79356b | 131 | |
91447636 A |
132 | extern void hw_queue_atomic_list( |
133 | unsigned int *anchor, | |
134 | unsigned int *first, | |
135 | unsigned int *last, | |
136 | unsigned int disp); | |
1c79356b | 137 | |
91447636 A |
138 | extern unsigned int *hw_dequeue_atomic( |
139 | unsigned int *anchor, | |
140 | unsigned int disp); | |
9bccf70c | 141 | |
91447636 A |
142 | extern void usimple_lock_init( |
143 | usimple_lock_t, | |
144 | unsigned short); | |
9bccf70c | 145 | |
91447636 A |
146 | extern void usimple_lock( |
147 | usimple_lock_t); | |
1c79356b | 148 | |
91447636 A |
149 | extern void usimple_unlock( |
150 | usimple_lock_t); | |
1c79356b | 151 | |
91447636 A |
152 | extern unsigned int usimple_lock_try( |
153 | usimple_lock_t); | |
1c79356b | 154 | |
91447636 | 155 | __END_DECLS |
9bccf70c | 156 | |
91447636 A |
157 | #define ETAP_NO_TRACE 0 |
158 | #define ETAP_IO_AHA 0 | |
1c79356b A |
159 | |
160 | /* | |
161 | * If we got to here and we still don't have simple_lock_init | |
162 | * defined, then we must either be outside the osfmk component, | |
163 | * running on a true SMP, or need debug. | |
164 | */ | |
165 | #if !defined(simple_lock_init) | |
166 | #define simple_lock_init(l,t) usimple_lock_init(l,t) | |
167 | #define simple_lock(l) usimple_lock(l) | |
168 | #define simple_unlock(l) usimple_unlock(l) | |
169 | #define simple_lock_try(l) usimple_lock_try(l) | |
170 | #define simple_lock_addr(l) (&(l)) | |
9bccf70c A |
171 | #define thread_sleep_simple_lock(l, e, i) \ |
172 | thread_sleep_usimple_lock((l), (e), (i)) | |
55e303ae | 173 | #endif /* !defined(simple_lock_init) */ |
1c79356b | 174 | |
91447636 | 175 | #endif /*!_KERN_SIMPLE_LOCK_H_*/ |
1c79356b | 176 | |
91447636 | 177 | #endif /* KERNEL_PRIVATE */ |