2 * Copyright (c) 1998-2010 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #ifndef IOKIT_IOTIMESTAMP_H
29 #define IOKIT_IOTIMESTAMP_H
31 #include <sys/kdebug.h>
34 IOTimeStampStartConstant(unsigned int csc
,
35 uintptr_t a
= 0, uintptr_t b
= 0,
36 uintptr_t c
= 0, uintptr_t d
= 0)
43 KERNEL_DEBUG_CONSTANT(((uint32_t)csc
) | DBG_FUNC_START
, a
, b
, c
, d
, 0);
47 IOTimeStampEndConstant(uintptr_t csc
,
48 uintptr_t a
= 0, uintptr_t b
= 0,
49 uintptr_t c
= 0, uintptr_t d
= 0)
56 KERNEL_DEBUG_CONSTANT(((uint32_t)csc
) | DBG_FUNC_END
, a
, b
, c
, d
, 0);
60 IOTimeStampConstant(uintptr_t csc
,
61 uintptr_t a
= 0, uintptr_t b
= 0,
62 uintptr_t c
= 0, uintptr_t d
= 0)
69 KERNEL_DEBUG_CONSTANT(((uint32_t)csc
) | DBG_FUNC_NONE
, a
, b
, c
, d
, 0);
73 IOTimeStampConstantFiltered(uintptr_t csc
,
74 uintptr_t a
= 0, uintptr_t b
= 0,
75 uintptr_t c
= 0, uintptr_t d
= 0)
82 KERNEL_DEBUG_CONSTANT_FILTERED(((uint32_t)csc
) | DBG_FUNC_NONE
, a
, b
, c
, d
, 0);
86 * Objects of this class will trace a filtered interval for their lifetime.
87 * The constructor takes in the start tracepoint's arguments.
88 * By default, the end tracepoint emits no additional arguments,
89 * but you can set them with setEndCodes.
90 * Alternatively, you can set them individually with setA...setD
92 class IOTimeStampIntervalConstantFiltered
95 IOTimeStampIntervalConstantFiltered(unsigned int csc
,
96 uintptr_t arg1
= 0, uintptr_t arg2
= 0,
97 uintptr_t arg3
= 0, uintptr_t arg4
= 0)
98 : _csc(csc
), _endArg1(0), _endArg2(0), _endArg3(0), _endArg4(0)
105 KDBG_FILTERED(((uint32_t)csc
) | DBG_FUNC_START
, arg1
, arg2
, arg3
, arg4
);
107 // Setters for the end debug codes
109 setEndCodes(uintptr_t arg1
= 0, uintptr_t arg2
= 0,
110 uintptr_t arg3
= 0, uintptr_t arg4
= 0)
118 setEndArg1(uintptr_t arg
)
123 setEndArg2(uintptr_t arg
)
128 setEndArg3(uintptr_t arg
)
133 setEndArg4(uintptr_t arg
)
137 ~IOTimeStampIntervalConstantFiltered()
139 KDBG_FILTERED(((uint32_t)_csc
) | DBG_FUNC_END
, _endArg1
, _endArg2
, _endArg3
, _endArg4
);
142 #if (KDEBUG_LEVEL < KDEBUG_LEVEL_STANDARD)
144 #endif /* KDEBUG_LEVEL < KDEBUG_LEVEL_STANDARD */
147 #if (KDEBUG_LEVEL < KDEBUG_LEVEL_STANDARD)
149 #endif /* KDEBUG_LEVEL < KDEBUG_LEVEL_STANDARD */
150 uintptr_t _endArg1
, _endArg2
, _endArg3
, _endArg4
;
156 IOTimeStampStart(uintptr_t csc
,
157 uintptr_t a
= 0, uintptr_t b
= 0,
158 uintptr_t c
= 0, uintptr_t d
= 0)
165 KERNEL_DEBUG(((uint32_t)csc
) | DBG_FUNC_START
, a
, b
, c
, d
, 0);
169 IOTimeStampEnd(uintptr_t csc
,
170 uintptr_t a
= 0, uintptr_t b
= 0,
171 uintptr_t c
= 0, uintptr_t d
= 0)
178 KERNEL_DEBUG(((uint32_t)csc
) | DBG_FUNC_END
, a
, b
, c
, d
, 0);
182 IOTimeStamp(uintptr_t csc
,
183 uintptr_t a
= 0, uintptr_t b
= 0,
184 uintptr_t c
= 0, uintptr_t d
= 0)
191 KERNEL_DEBUG(((uint32_t)csc
) | DBG_FUNC_NONE
, a
, b
, c
, d
, 0);
196 #define IODBG_STORAGE(code) (KDBG_CODE(DBG_IOKIT, DBG_IOSTORAGE, code))
197 #define IODBG_NETWORK(code) (KDBG_CODE(DBG_IOKIT, DBG_IONETWORK, code))
198 #define IODBG_KEYBOARD(code) (KDBG_CODE(DBG_IOKIT, DBG_IOKEYBOARD, code))
199 #define IODBG_HID(code) (KDBG_CODE(DBG_IOKIT, DBG_IOHID, code))
200 #define IODBG_AUDIO(code) (KDBG_CODE(DBG_IOKIT, DBG_IOAUDIO, code))
201 #define IODBG_SERIAL(code) (KDBG_CODE(DBG_IOKIT, DBG_IOSERIAL, code))
202 #define IODBG_TTY(code) (KDBG_CODE(DBG_IOKIT, DBG_IOTTY, code))
203 #define IODBG_SAM(code) (KDBG_CODE(DBG_IOKIT, DBG_IOSAM, code))
204 #define IODBG_PARALLELATA(code) (KDBG_CODE(DBG_IOKIT, DBG_IOPARALLELATA, code))
205 #define IODBG_PARALLELSCSI(code) (KDBG_CODE(DBG_IOKIT, DBG_IOPARALLELSCSI, code))
206 #define IODBG_SATA(code) (KDBG_CODE(DBG_IOKIT, DBG_IOSATA, code))
207 #define IODBG_SAS(code) (KDBG_CODE(DBG_IOKIT, DBG_IOSAS, code))
208 #define IODBG_FIBRECHANNEL(code) (KDBG_CODE(DBG_IOKIT, DBG_IOFIBRECHANNEL, code))
209 #define IODBG_USB(code) (KDBG_CODE(DBG_IOKIT, DBG_IOUSB, code))
210 #define IODBG_BLUETOOTH(code) (KDBG_CODE(DBG_IOKIT, DBG_IOBLUETOOTH, code))
211 #define IODBG_FIREWIRE(code) (KDBG_CODE(DBG_IOKIT, DBG_IOFIREWIRE, code))
212 #define IODBG_INFINIBAND(code) (KDBG_CODE(DBG_IOKIT, DBG_IOINFINIBAND, code))
215 /* Backwards compatibility */
216 #define IODBG_DISK(code) IODBG_STORAGE(code)
217 #define IODBG_POINTING(code) IODBG_HID(code)
220 /* IOKit infrastructure subclasses */
221 #define IODBG_INTC(code) (KDBG_CODE(DBG_IOKIT, DBG_IOINTC, code))
222 #define IODBG_WORKLOOP(code) (KDBG_CODE(DBG_IOKIT, DBG_IOWORKLOOP, code))
223 #define IODBG_INTES(code) (KDBG_CODE(DBG_IOKIT, DBG_IOINTES, code))
224 #define IODBG_TIMES(code) (KDBG_CODE(DBG_IOKIT, DBG_IOCLKES, code))
225 #define IODBG_CMDQ(code) (KDBG_CODE(DBG_IOKIT, DBG_IOCMDQ, code))
226 #define IODBG_MCURS(code) (KDBG_CODE(DBG_IOKIT, DBG_IOMCURS, code))
227 #define IODBG_MDESC(code) (KDBG_CODE(DBG_IOKIT, DBG_IOMDESC, code))
228 #define IODBG_POWER(code) (KDBG_CODE(DBG_IOKIT, DBG_IOPOWER, code))
229 #define IODBG_IOSERVICE(code) (KDBG_CODE(DBG_IOKIT, DBG_IOSERVICE, code))
230 #define IODBG_IOREGISTRY(code) (KDBG_CODE(DBG_IOKIT, DBG_IOREGISTRY, code))
231 #define IODBG_IOMDPA(code) (KDBG_CODE(DBG_IOKIT, DBG_IOMDPA, code))
233 /* IOKit specific codes - within each subclass */
235 /* DBG_IOKIT/DBG_IODISK codes */
237 /* DBG_IOKIT/DBG_IONETWORK codes */
239 /* DBG_IOKIT/DBG_IOKEYBOARD codes */
241 /* DBG_IOKIT/DBG_IOHID codes */
243 /* DBG_IOKIT/DBG_IOAUDIO codes */
245 /* DBG_IOKIT/DBG_IOSERIAL codes */
247 /* DBG_IOKIT/DBG_IOTTY codes */
249 /* DBG_IOKIT/DBG_IOINTC codes */
250 #define IOINTC_HANDLER 1 /* 0x05000004 */
251 #define IOINTC_SPURIOUS 2 /* 0x05000008 */
253 /* DBG_IOKIT/DBG_IOWORKLOOP codes */
254 #define IOWL_CLIENT 1 /* 0x05010004 */
255 #define IOWL_WORK 2 /* 0x05010008 */
257 /* DBG_IOKIT/DBG_IOINTES codes */
258 #define IOINTES_CLIENT 1 /* 0x05020004 */
259 #define IOINTES_LAT 2 /* 0x05020008 */
260 #define IOINTES_SEMA 3 /* 0x0502000c */
261 #define IOINTES_INTCTXT 4 /* 0x05020010 */
262 #define IOINTES_INTFLTR 5 /* 0x05020014 */
263 #define IOINTES_ACTION 6 /* 0x05020018 */
264 #define IOINTES_FILTER 7 /* 0x0502001c */
266 /* DBG_IOKIT/DBG_IOTIMES codes */
267 #define IOTIMES_CLIENT 1 /* 0x05030004 */
268 #define IOTIMES_LAT 2 /* 0x05030008 */
269 #define IOTIMES_SEMA 3 /* 0x0503000c */
270 #define IOTIMES_ACTION 4 /* 0x05030010 */
272 /* DBG_IOKIT/DBG_IOCMDQ codes */
273 #define IOCMDQ_CLIENT 1 /* 0x05040004 */
274 #define IOCMDQ_LAT 2 /* 0x05040008 */
275 #define IOCMDQ_SEMA 3 /* 0x0504000c */
276 #define IOCMDQ_PSEMA 4 /* 0x05040010 */
277 #define IOCMDQ_PLOCK 5 /* 0x05040014 */
278 #define IOCMDQ_ACTION 6 /* 0x05040018 */
280 /* DBG_IOKIT/DBG_IOMCURS codes */
282 /* DBG_IOKIT/DBG_IOMDESC codes */
283 #define IOMDESC_WIRE 1 /* 0x05060004 */
284 #define IOMDESC_PREPARE 2 /* 0x05060008 */
285 #define IOMDESC_MAP 3 /* 0x0506000C */
286 #define IOMDESC_UNMAP 4 /* 0x05060010 */
287 #define IOMDESC_DMA_MAP 5 /* 0x05060014 */
288 #define IOMDESC_DMA_UNMAP 6 /* 0x05060018 */
289 #define IOMDESC_COMPLETE 7 /* 0x0506001C */
291 /* DBG_IOKIT/DBG_IOMDPA */
292 #define IOMDPA_MAPPED 1 /* 0x05410004 */
293 #define IOMDPA_UNMAPPED 2 /* 0x05410008 */
294 #define IOMDPA_SEGMENTS_PAGE 3 /* 0x0541000C */
295 #define IOMDPA_SEGMENTS_LONG 4 /* 0x05410010 */
297 /* DBG_IOKIT/DBG_IOPOWER codes */
298 // See IOKit/pwr_mgt/IOPMlog.h for the power management codes
300 /* DBG_IOKIT/DBG_IOSERVICE codes */
301 #define IOSERVICE_BUSY 1 /* 0x05080004 */
302 #define IOSERVICE_NONBUSY 2 /* 0x05080008 */
303 #define IOSERVICE_MODULESTALL 3 /* 0x0508000C */
304 #define IOSERVICE_MODULEUNSTALL 4 /* 0x05080010 */
306 #define IOSERVICE_TERMINATE_PHASE1 5 /* 0x05080014 */
307 #define IOSERVICE_TERMINATE_REQUEST_OK 6 /* 0x05080018 */
308 #define IOSERVICE_TERMINATE_REQUEST_FAIL 7 /* 0x0508001C */
309 #define IOSERVICE_TERMINATE_SCHEDULE_STOP 8 /* 0x05080020 */
310 #define IOSERVICE_TERMINATE_SCHEDULE_FINALIZE 9 /* 0x05080024 */
311 #define IOSERVICE_TERMINATE_WILL 10 /* 0x05080028 */
312 #define IOSERVICE_TERMINATE_DID 11 /* 0x0508002C */
313 #define IOSERVICE_TERMINATE_DID_DEFER 12 /* 0x05080030 */
314 #define IOSERVICE_TERMINATE_FINALIZE 13 /* 0x05080034 */
315 #define IOSERVICE_TERMINATE_STOP 14 /* 0x05080038 */
316 #define IOSERVICE_TERMINATE_STOP_NOP 15 /* 0x0508003C */
317 #define IOSERVICE_TERMINATE_STOP_DEFER 16 /* 0x05080040 */
318 #define IOSERVICE_TERMINATE_DONE 17 /* 0x05080044 */
320 #define IOSERVICE_KEXTD_ALIVE 18 /* 0x05080048 */
321 #define IOSERVICE_KEXTD_READY 19 /* 0x0508004C */
322 #define IOSERVICE_REGISTRY_QUIET 20 /* 0x05080050 */
324 #define IOSERVICE_TERM_SET_INACTIVE 21 /* 0x05080054 */
325 #define IOSERVICE_TERM_SCHED_PHASE2 22 /* 0x05080058 */
326 #define IOSERVICE_TERM_START_PHASE2 23 /* 0x0508005C */
327 #define IOSERVICE_TERM_TRY_PHASE2 24 /* 0x05080060 */
328 #define IOSERVICE_TERM_UC_DEFER 25 /* 0x05080064 */
329 #define IOSERVICE_DETACH 26 /* 0x05080068 */
331 /* DBG_IOKIT/DBG_IOREGISTRY codes */
332 #define IOREGISTRYENTRY_NAME_STRING 1 /* 0x05090004 */
333 #define IOREGISTRYENTRY_NAME 2 /* 0x05090008 */
335 #endif /* ! IOKIT_IOTIMESTAMP_H */