]> git.saurik.com Git - apple/xnu.git/blob - iokit/Kernel/IOServicePrivate.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / Kernel / IOServicePrivate.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29
30 #ifndef _IOKIT_IOSERVICEPRIVATE_H
31 #define _IOKIT_IOSERVICEPRIVATE_H
32
33 // options for getExistingServices()
34 enum {
35 kIONotifyOnce = 0x00000001
36 };
37
38 // masks for __state[1]
39 enum {
40 kIOServiceBusyStateMask = 0x000000ff,
41 kIOServiceBusyMax = 255,
42 kIOServiceTerminatedState = 0x80000000,
43 kIOServiceConfigState = 0x40000000,
44 kIOServiceSynchronousState = 0x20000000,
45 };
46
47 // options for terminate()
48 enum {
49 kIOServiceRecursing = 0x00100000,
50 };
51
52
53 // notify state
54 enum {
55 kIOServiceNotifyEnable = 0x00000001,
56 kIOServiceNotifyWaiter = 0x00000002
57 };
58
59 struct _IOServiceNotifierInvocation
60 {
61 IOThread thread;
62 queue_chain_t link;
63 };
64
65 class _IOServiceNotifier : public IONotifier
66 {
67 friend IOService;
68
69 OSDeclareDefaultStructors(_IOServiceNotifier)
70
71 public:
72 OSOrderedSet * whence;
73
74 OSDictionary * matching;
75 IOServiceNotificationHandler handler;
76 void * target;
77 void * ref;
78 SInt32 priority;
79 queue_head_t handlerInvocations;
80 IOOptionBits state;
81
82 virtual void free();
83 virtual void remove();
84 virtual bool disable();
85 virtual void enable( bool was );
86 virtual void wait();
87 };
88
89 class _IOServiceInterestNotifier : public IONotifier
90 {
91 friend IOService;
92
93 OSDeclareDefaultStructors(_IOServiceInterestNotifier)
94
95 public:
96 OSArray * whence;
97
98 IOServiceInterestHandler handler;
99 void * target;
100 void * ref;
101 queue_head_t handlerInvocations;
102 IOOptionBits state;
103
104 virtual void free();
105 virtual void remove();
106 virtual bool disable();
107 virtual void enable( bool was );
108 virtual void wait();
109 };
110
111 class _IOConfigThread : public OSObject
112 {
113 friend IOService;
114
115 OSDeclareDefaultStructors(_IOConfigThread)
116
117 public:
118 IOThread thread;
119
120 virtual void free();
121
122 static _IOConfigThread * configThread( void );
123 static void main( _IOConfigThread * self );
124 };
125
126 enum {
127 #ifdef LESS_THREAD_CREATE
128 kMaxConfigThreads = 4,
129 #else
130 kMaxConfigThreads = 32,
131 #endif
132 };
133
134 enum {
135 kMatchNubJob = 10,
136 kTerminateNubJob,
137 };
138
139 class _IOServiceJob : public OSObject
140 {
141 friend IOService;
142
143 OSDeclareDefaultStructors(_IOServiceJob)
144
145 public:
146 int type;
147 IOService * nub;
148 IOOptionBits options;
149
150 static _IOServiceJob * startJob( IOService * nub, int type,
151 IOOptionBits options = 0 );
152 static void pingConfig( class _IOServiceJob * job );
153
154 };
155
156 class IOResources : public IOService
157 {
158 friend IOService;
159
160 OSDeclareDefaultStructors(IOResources)
161
162 public:
163 static IOService * resources( void );
164 virtual IOWorkLoop * getWorkLoop( ) const;
165 virtual bool matchPropertyTable( OSDictionary * table );
166 };
167
168 class _IOOpenServiceIterator : public OSIterator
169 {
170 friend IOService;
171
172 OSDeclareDefaultStructors(_IOOpenServiceIterator)
173
174 OSIterator * iter;
175 const IOService * client;
176 const IOService * provider;
177 IOService * last;
178
179 public:
180 static OSIterator * iterator( OSIterator * _iter,
181 const IOService * client,
182 const IOService * provider );
183 virtual void free();
184 virtual void reset();
185 virtual bool isValid();
186 virtual OSObject * getNextObject();
187 };
188
189 #endif /* ! _IOKIT_IOSERVICEPRIVATE_H */
190