]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ppc/lock.h
xnu-517.3.15.tar.gz
[apple/xnu.git] / osfmk / ppc / lock.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
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
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
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.
1c79356b
A
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
0b4e3aa0
A
59#ifndef _PPC_LOCK_H_
60#define _PPC_LOCK_H_
1c79356b 61
9bccf70c
A
62#include <sys/appleapiopts.h>
63
64#ifdef __APPLE_API_PRIVATE
65
1c79356b
A
66#include <kern/macro_help.h>
67#include <kern/assert.h>
55e303ae
A
68#include <mach/etap_events.h>
69#include <mach/etap.h>
1c79356b 70
0b4e3aa0 71extern unsigned int LockTimeOut; /* Number of hardware ticks of a lock timeout */
1c79356b 72
9bccf70c
A
73#if defined(MACH_KERNEL_PRIVATE)
74
75#include <cpus.h>
76
77#if !(NCPUS == 1 || ETAP_LOCK_TRACE || USLOCK_DEBUG)
78
79#include <ppc/hw_lock_types.h>
80
9bccf70c
A
81#define __slock_held_func__(l) hw_lock_held(l)
82
55e303ae
A
83extern void ppc_usimple_lock_init(simple_lock_t,etap_event_t);
84extern void ppc_usimple_lock(simple_lock_t);
85extern void ppc_usimple_unlock_rwmb(simple_lock_t);
86extern void ppc_usimple_unlock_rwcmb(simple_lock_t);
87extern unsigned int ppc_usimple_lock_try(simple_lock_t);
1c79356b 88
55e303ae
A
89#define MACHINE_SIMPLE_LOCK
90
91#define simple_lock_init(l,t) ppc_usimple_lock_init(l,t)
92#define simple_lock(l) ppc_usimple_lock(l)
93#define simple_unlock(l) ppc_usimple_unlock_rwcmb(l)
94#define simple_unlock_rwmb(l) ppc_usimple_unlock_rwmb(l)
95#define simple_lock_try(l) ppc_usimple_lock_try(l)
96#define simple_lock_addr(l) (&(l))
9bccf70c
A
97#define thread_sleep_simple_lock(l, e, i) \
98 thread_sleep_fast_usimple_lock((l), (e), (i))
99
55e303ae
A
100#define mutex_unlock(l) mutex_unlock_rwcmb(l)
101
9bccf70c
A
102#endif /* !(NCPUS == 1 || ETAP_LOCK_TRACE || USLOCK_DEBUG) */
103
104#endif /* MACH_KERNEL_PRIVATE */
0b4e3aa0 105
9bccf70c 106#endif /* __APPLE_API_PRIVATE */
1c79356b 107
0b4e3aa0 108#endif /* _PPC_LOCK_H_ */