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