]> git.saurik.com Git - apple/xnu.git/blame - iokit/Kernel/IOServicePrivate.h
xnu-3248.30.4.tar.gz
[apple/xnu.git] / iokit / Kernel / IOServicePrivate.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
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.
8f6c56a5 14 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
30 *
31 * HISTORY
32 *
33 */
34
35
36#ifndef _IOKIT_IOSERVICEPRIVATE_H
37#define _IOKIT_IOSERVICEPRIVATE_H
38
39// options for getExistingServices()
40enum {
316670eb
A
41 kIONotifyOnce = 0x00000001,
42 kIOServiceExistingSet = 0x00000002,
43 kIOServiceChangesOK = 0x00000004,
44 kIOServiceInternalDone = 0x00000008,
45 kIOServiceClassDone = 0x00000010,
1c79356b
A
46};
47
48// masks for __state[1]
49enum {
50 kIOServiceBusyStateMask = 0x000000ff,
51 kIOServiceBusyMax = 255,
0b4e3aa0
A
52 kIOServiceNeedConfigState = 0x80000000,
53 kIOServiceSynchronousState = 0x40000000,
54 kIOServiceModuleStallState = 0x20000000,
55 kIOServiceBusyWaiterState = 0x10000000,
56
57 kIOServiceSyncPubState = 0x08000000,
58 kIOServiceConfigState = 0x04000000,
39236c6e 59 kIOServiceStartState = 0x02000000,
0b4e3aa0
A
60 kIOServiceTermPhase2State = 0x01000000,
61 kIOServiceTermPhase3State = 0x00800000,
6d2010ae 62 kIOServiceTermPhase1State = 0x00400000,
39236c6e 63 kIOServiceTerm1WaiterState = 0x00200000,
1c79356b 64 kIOServiceRecursing = 0x00100000,
fe8ab488 65 kIOServiceNeedWillTerminate = 0x00080000,
1c79356b
A
66};
67
1c79356b
A
68// notify state
69enum {
0b4e3aa0
A
70 kIOServiceNotifyEnable = 0x00000001,
71 kIOServiceNotifyWaiter = 0x00000002
1c79356b
A
72};
73
74struct _IOServiceNotifierInvocation
75{
76 IOThread thread;
77 queue_chain_t link;
78};
79
80class _IOServiceNotifier : public IONotifier
81{
9bccf70c 82 friend class IOService;
1c79356b
A
83
84 OSDeclareDefaultStructors(_IOServiceNotifier)
85
86public:
87 OSOrderedSet * whence;
88
89 OSDictionary * matching;
b0d623f7
A
90 IOServiceMatchingNotificationHandler handler;
91 IOServiceNotificationHandler compatHandler;
1c79356b
A
92 void * target;
93 void * ref;
94 SInt32 priority;
95 queue_head_t handlerInvocations;
96 IOOptionBits state;
97
3e170ce0
A
98 virtual void free() APPLE_KEXT_OVERRIDE;
99 virtual void remove() APPLE_KEXT_OVERRIDE;
100 virtual bool disable() APPLE_KEXT_OVERRIDE;
101 virtual void enable( bool was ) APPLE_KEXT_OVERRIDE;
1c79356b
A
102 virtual void wait();
103};
104
105class _IOServiceInterestNotifier : public IONotifier
106{
9bccf70c 107 friend class IOService;
1c79356b
A
108
109 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
110
111public:
91447636 112 queue_chain_t chain;
1c79356b
A
113
114 IOServiceInterestHandler handler;
115 void * target;
116 void * ref;
117 queue_head_t handlerInvocations;
118 IOOptionBits state;
119
3e170ce0
A
120 virtual void free() APPLE_KEXT_OVERRIDE;
121 virtual void remove() APPLE_KEXT_OVERRIDE;
122 virtual bool disable() APPLE_KEXT_OVERRIDE;
123 virtual void enable( bool was ) APPLE_KEXT_OVERRIDE;
1c79356b 124 virtual void wait();
3e170ce0 125 virtual bool init() APPLE_KEXT_OVERRIDE;
1c79356b
A
126};
127
128class _IOConfigThread : public OSObject
129{
9bccf70c 130 friend class IOService;
1c79356b
A
131
132 OSDeclareDefaultStructors(_IOConfigThread)
133
134public:
3e170ce0 135 virtual void free() APPLE_KEXT_OVERRIDE;
1c79356b 136
91447636 137 static void configThread( void );
b0d623f7 138 static void main( void * arg, wait_result_t result );
1c79356b
A
139};
140
141enum {
2d21ac55 142 kMaxConfigThreads = CONFIG_MAX_THREADS,
1c79356b
A
143};
144
145enum {
146 kMatchNubJob = 10,
1c79356b
A
147};
148
149class _IOServiceJob : public OSObject
150{
9bccf70c 151 friend class IOService;
1c79356b
A
152
153 OSDeclareDefaultStructors(_IOServiceJob)
154
155public:
156 int type;
157 IOService * nub;
158 IOOptionBits options;
159
160 static _IOServiceJob * startJob( IOService * nub, int type,
161 IOOptionBits options = 0 );
162 static void pingConfig( class _IOServiceJob * job );
163
164};
165
166class IOResources : public IOService
167{
9bccf70c 168 friend class IOService;
1c79356b
A
169
170 OSDeclareDefaultStructors(IOResources)
171
172public:
173 static IOService * resources( void );
3e170ce0
A
174 virtual bool init( OSDictionary * dictionary = 0 ) APPLE_KEXT_OVERRIDE;
175 virtual IOReturn newUserClient(task_t owningTask, void * securityID,
176 UInt32 type, OSDictionary * properties,
177 IOUserClient ** handler) APPLE_KEXT_OVERRIDE;
178 virtual IOWorkLoop * getWorkLoop( ) const APPLE_KEXT_OVERRIDE;
179 virtual bool matchPropertyTable( OSDictionary * table ) APPLE_KEXT_OVERRIDE;
180 virtual IOReturn setProperties( OSObject * properties ) APPLE_KEXT_OVERRIDE;
1c79356b
A
181};
182
183class _IOOpenServiceIterator : public OSIterator
184{
9bccf70c 185 friend class IOService;
1c79356b
A
186
187 OSDeclareDefaultStructors(_IOOpenServiceIterator)
188
189 OSIterator * iter;
190 const IOService * client;
191 const IOService * provider;
192 IOService * last;
193
194public:
195 static OSIterator * iterator( OSIterator * _iter,
196 const IOService * client,
197 const IOService * provider );
3e170ce0
A
198 virtual void free() APPLE_KEXT_OVERRIDE;
199 virtual void reset() APPLE_KEXT_OVERRIDE;
200 virtual bool isValid() APPLE_KEXT_OVERRIDE;
201 virtual OSObject * getNextObject() APPLE_KEXT_OVERRIDE;
1c79356b
A
202};
203
55e303ae
A
204extern const OSSymbol * gIOConsoleUsersKey;
205extern const OSSymbol * gIOConsoleSessionUIDKey;
6d2010ae 206extern const OSSymbol * gIOConsoleSessionAuditIDKey;
8f6c56a5
A
207extern const OSSymbol * gIOConsoleSessionOnConsoleKey;
208extern const OSSymbol * gIOConsoleSessionSecureInputPIDKey;
55e303ae 209
1c79356b
A
210#endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
211