]> git.saurik.com Git - apple/xnu.git/blame - iokit/Kernel/IOServicePrivate.h
xnu-3789.60.24.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 {
39037602
A
50 kIOServiceBusyStateMask = 0x000003ff,
51 kIOServiceBusyMax = 1023,
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,
39037602 66 kIOServiceWaitDetachState = 0x00040000,
1c79356b
A
67};
68
1c79356b
A
69// notify state
70enum {
0b4e3aa0
A
71 kIOServiceNotifyEnable = 0x00000001,
72 kIOServiceNotifyWaiter = 0x00000002
1c79356b
A
73};
74
75struct _IOServiceNotifierInvocation
76{
77 IOThread thread;
78 queue_chain_t link;
79};
80
81class _IOServiceNotifier : public IONotifier
82{
9bccf70c 83 friend class IOService;
1c79356b
A
84
85 OSDeclareDefaultStructors(_IOServiceNotifier)
86
87public:
88 OSOrderedSet * whence;
89
90 OSDictionary * matching;
b0d623f7
A
91 IOServiceMatchingNotificationHandler handler;
92 IOServiceNotificationHandler compatHandler;
1c79356b
A
93 void * target;
94 void * ref;
95 SInt32 priority;
96 queue_head_t handlerInvocations;
97 IOOptionBits state;
98
3e170ce0
A
99 virtual void free() APPLE_KEXT_OVERRIDE;
100 virtual void remove() APPLE_KEXT_OVERRIDE;
101 virtual bool disable() APPLE_KEXT_OVERRIDE;
102 virtual void enable( bool was ) APPLE_KEXT_OVERRIDE;
1c79356b
A
103 virtual void wait();
104};
105
106class _IOServiceInterestNotifier : public IONotifier
107{
9bccf70c 108 friend class IOService;
1c79356b
A
109
110 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
111
112public:
91447636 113 queue_chain_t chain;
1c79356b
A
114
115 IOServiceInterestHandler handler;
116 void * target;
117 void * ref;
118 queue_head_t handlerInvocations;
119 IOOptionBits state;
120
3e170ce0
A
121 virtual void free() APPLE_KEXT_OVERRIDE;
122 virtual void remove() APPLE_KEXT_OVERRIDE;
123 virtual bool disable() APPLE_KEXT_OVERRIDE;
124 virtual void enable( bool was ) APPLE_KEXT_OVERRIDE;
1c79356b 125 virtual void wait();
3e170ce0 126 virtual bool init() APPLE_KEXT_OVERRIDE;
1c79356b
A
127};
128
39037602
A
129class _IOServiceNullNotifier : public IONotifier
130{
131 OSDeclareDefaultStructors(_IOServiceNullNotifier)
132
133public:
134 virtual void taggedRetain(const void *tag) const APPLE_KEXT_OVERRIDE;
135 virtual void taggedRelease(const void *tag, const int when) const APPLE_KEXT_OVERRIDE;
136 virtual void free() APPLE_KEXT_OVERRIDE;
137 virtual void remove() APPLE_KEXT_OVERRIDE;
138 virtual bool disable() APPLE_KEXT_OVERRIDE;
139 virtual void enable( bool was ) APPLE_KEXT_OVERRIDE;
140 virtual void wait();
141};
142
1c79356b
A
143class _IOConfigThread : public OSObject
144{
9bccf70c 145 friend class IOService;
1c79356b
A
146
147 OSDeclareDefaultStructors(_IOConfigThread)
148
149public:
3e170ce0 150 virtual void free() APPLE_KEXT_OVERRIDE;
1c79356b 151
91447636 152 static void configThread( void );
b0d623f7 153 static void main( void * arg, wait_result_t result );
1c79356b
A
154};
155
156enum {
2d21ac55 157 kMaxConfigThreads = CONFIG_MAX_THREADS,
1c79356b
A
158};
159
160enum {
161 kMatchNubJob = 10,
1c79356b
A
162};
163
164class _IOServiceJob : public OSObject
165{
9bccf70c 166 friend class IOService;
1c79356b
A
167
168 OSDeclareDefaultStructors(_IOServiceJob)
169
170public:
171 int type;
172 IOService * nub;
173 IOOptionBits options;
174
175 static _IOServiceJob * startJob( IOService * nub, int type,
176 IOOptionBits options = 0 );
177 static void pingConfig( class _IOServiceJob * job );
178
179};
180
181class IOResources : public IOService
182{
9bccf70c 183 friend class IOService;
1c79356b
A
184
185 OSDeclareDefaultStructors(IOResources)
186
187public:
188 static IOService * resources( void );
3e170ce0
A
189 virtual bool init( OSDictionary * dictionary = 0 ) APPLE_KEXT_OVERRIDE;
190 virtual IOReturn newUserClient(task_t owningTask, void * securityID,
191 UInt32 type, OSDictionary * properties,
192 IOUserClient ** handler) APPLE_KEXT_OVERRIDE;
193 virtual IOWorkLoop * getWorkLoop( ) const APPLE_KEXT_OVERRIDE;
194 virtual bool matchPropertyTable( OSDictionary * table ) APPLE_KEXT_OVERRIDE;
195 virtual IOReturn setProperties( OSObject * properties ) APPLE_KEXT_OVERRIDE;
1c79356b
A
196};
197
198class _IOOpenServiceIterator : public OSIterator
199{
9bccf70c 200 friend class IOService;
1c79356b
A
201
202 OSDeclareDefaultStructors(_IOOpenServiceIterator)
203
204 OSIterator * iter;
205 const IOService * client;
206 const IOService * provider;
207 IOService * last;
208
209public:
210 static OSIterator * iterator( OSIterator * _iter,
211 const IOService * client,
212 const IOService * provider );
3e170ce0
A
213 virtual void free() APPLE_KEXT_OVERRIDE;
214 virtual void reset() APPLE_KEXT_OVERRIDE;
215 virtual bool isValid() APPLE_KEXT_OVERRIDE;
216 virtual OSObject * getNextObject() APPLE_KEXT_OVERRIDE;
1c79356b
A
217};
218
55e303ae
A
219extern const OSSymbol * gIOConsoleUsersKey;
220extern const OSSymbol * gIOConsoleSessionUIDKey;
6d2010ae 221extern const OSSymbol * gIOConsoleSessionAuditIDKey;
8f6c56a5
A
222extern const OSSymbol * gIOConsoleSessionOnConsoleKey;
223extern const OSSymbol * gIOConsoleSessionSecureInputPIDKey;
55e303ae 224
1c79356b
A
225#endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
226