]> git.saurik.com Git - apple/xnu.git/blob - iokit/Kernel/IOServicePrivate.h
xnu-1504.7.4.tar.gz
[apple/xnu.git] / iokit / Kernel / IOServicePrivate.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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()
40 enum {
41 kIONotifyOnce = 0x00000001,
42 kIOServiceExistingSet = 0x00000002
43 };
44
45 // masks for __state[1]
46 enum {
47 kIOServiceBusyStateMask = 0x000000ff,
48 kIOServiceBusyMax = 255,
49 kIOServiceNeedConfigState = 0x80000000,
50 kIOServiceSynchronousState = 0x40000000,
51 kIOServiceModuleStallState = 0x20000000,
52 kIOServiceBusyWaiterState = 0x10000000,
53
54 kIOServiceSyncPubState = 0x08000000,
55 kIOServiceConfigState = 0x04000000,
56 kIOServiceTermPhase2State = 0x01000000,
57 kIOServiceTermPhase3State = 0x00800000,
58 };
59
60 // options for terminate()
61 enum {
62 kIOServiceRecursing = 0x00100000,
63 };
64
65 // notify state
66 enum {
67 kIOServiceNotifyEnable = 0x00000001,
68 kIOServiceNotifyWaiter = 0x00000002
69 };
70
71 struct _IOServiceNotifierInvocation
72 {
73 IOThread thread;
74 queue_chain_t link;
75 };
76
77 class _IOServiceNotifier : public IONotifier
78 {
79 friend class IOService;
80
81 OSDeclareDefaultStructors(_IOServiceNotifier)
82
83 public:
84 OSOrderedSet * whence;
85
86 OSDictionary * matching;
87 IOServiceMatchingNotificationHandler handler;
88 IOServiceNotificationHandler compatHandler;
89 void * target;
90 void * ref;
91 SInt32 priority;
92 queue_head_t handlerInvocations;
93 IOOptionBits state;
94
95 virtual void free();
96 virtual void remove();
97 virtual bool disable();
98 virtual void enable( bool was );
99 virtual void wait();
100 };
101
102 class _IOServiceInterestNotifier : public IONotifier
103 {
104 friend class IOService;
105
106 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
107
108 public:
109 queue_chain_t chain;
110
111 IOServiceInterestHandler handler;
112 void * target;
113 void * ref;
114 queue_head_t handlerInvocations;
115 IOOptionBits state;
116
117 virtual void free();
118 virtual void remove();
119 virtual bool disable();
120 virtual void enable( bool was );
121 virtual void wait();
122 };
123
124 class _IOConfigThread : public OSObject
125 {
126 friend class IOService;
127
128 OSDeclareDefaultStructors(_IOConfigThread)
129
130 public:
131 virtual void free();
132
133 static void configThread( void );
134 static void main( void * arg, wait_result_t result );
135 };
136
137 enum {
138 kMaxConfigThreads = CONFIG_MAX_THREADS,
139 };
140
141 enum {
142 kMatchNubJob = 10,
143 };
144
145 class _IOServiceJob : public OSObject
146 {
147 friend class IOService;
148
149 OSDeclareDefaultStructors(_IOServiceJob)
150
151 public:
152 int type;
153 IOService * nub;
154 IOOptionBits options;
155
156 static _IOServiceJob * startJob( IOService * nub, int type,
157 IOOptionBits options = 0 );
158 static void pingConfig( class _IOServiceJob * job );
159
160 };
161
162 class IOResources : public IOService
163 {
164 friend class IOService;
165
166 OSDeclareDefaultStructors(IOResources)
167
168 public:
169 static IOService * resources( void );
170 virtual IOWorkLoop * getWorkLoop( ) const;
171 virtual bool matchPropertyTable( OSDictionary * table );
172 virtual IOReturn setProperties( OSObject * properties );
173 };
174
175 class _IOOpenServiceIterator : public OSIterator
176 {
177 friend class IOService;
178
179 OSDeclareDefaultStructors(_IOOpenServiceIterator)
180
181 OSIterator * iter;
182 const IOService * client;
183 const IOService * provider;
184 IOService * last;
185
186 public:
187 static OSIterator * iterator( OSIterator * _iter,
188 const IOService * client,
189 const IOService * provider );
190 virtual void free();
191 virtual void reset();
192 virtual bool isValid();
193 virtual OSObject * getNextObject();
194 };
195
196 extern const OSSymbol * gIOConsoleUsersKey;
197 extern const OSSymbol * gIOConsoleSessionUIDKey;
198 extern const OSSymbol * gIOConsoleSessionOnConsoleKey;
199 extern const OSSymbol * gIOConsoleSessionSecureInputPIDKey;
200
201 #endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
202