2 * Copyright (c) 1998-2012 Apple Computer, 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_IOTYPES_H
29 #define __IOKIT_IOTYPES_H
31 #ifndef PLATFORM_DriverKit
38 #include <IOKit/system.h>
40 #include <mach/message.h>
41 #include <mach/vm_types.h>
44 #include <IOKit/IOReturn.h>
51 #if defined (__cplusplus)
52 #ifdef XNU_KERNEL_PRIVATE
55 #if __cplusplus >= 201103L && (defined(__arm__) || defined(__arm64__))
62 #define NULL ((void *)0)
70 #include <libkern/OSTypes.h>
73 #include <libkern/OSBase.h>
76 typedef UInt32 IOOptionBits
;
77 typedef SInt32 IOFixed
;
78 typedef UInt32 IOVersion
;
79 typedef UInt32 IOItemCount
;
80 typedef UInt32 IOCacheMode
;
82 typedef UInt32 IOByteCount32
;
83 typedef UInt64 IOByteCount64
;
85 typedef UInt32 IOPhysicalAddress32
;
86 typedef UInt64 IOPhysicalAddress64
;
87 typedef UInt32 IOPhysicalLength32
;
88 typedef UInt64 IOPhysicalLength64
;
90 #if !defined(__arm__) && !defined(__i386__)
91 typedef mach_vm_address_t IOVirtualAddress
;
93 typedef vm_address_t IOVirtualAddress
;
96 #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__))
97 typedef IOByteCount64 IOByteCount
;
98 #define PRIIOByteCount PRIu64
100 typedef IOByteCount32 IOByteCount
;
101 #define PRIIOByteCount PRIu32
104 typedef IOVirtualAddress IOLogicalAddress
;
106 #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL))
108 typedef IOPhysicalAddress64 IOPhysicalAddress
;
109 typedef IOPhysicalLength64 IOPhysicalLength
;
110 #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
111 #define IOPhysSize 64
115 typedef IOPhysicalAddress32 IOPhysicalAddress
;
116 typedef IOPhysicalLength32 IOPhysicalLength
;
117 #define IOPhysical32( hi, lo ) (lo)
118 #define IOPhysSize 32
124 IOPhysicalAddress address
;
129 IOVirtualAddress address
;
133 #if !defined(__arm__) && !defined(__i386__)
134 typedef IOVirtualRange IOAddressRange
;
137 mach_vm_address_t address
;
138 mach_vm_size_t length
;
143 * Map between #defined or enum'd constants and text description.
152 * Memory alignment -- specified as a power of two.
154 typedef unsigned int IOAlignment
;
156 #define IO_NULL_VM_TASK ((vm_task_t)0)
160 * Pull in machine specific stuff.
163 //#include <IOKit/machine/IOTypes.h>
167 #ifndef __IOKIT_PORTS_DEFINED__
168 #define __IOKIT_PORTS_DEFINED__
172 typedef OSObject
* io_object_t
;
174 typedef struct OSObject
* io_object_t
;
177 typedef mach_port_t io_object_t
;
179 #endif /* __IOKIT_PORTS_DEFINED__ */
181 #include <device/device_types.h>
183 typedef io_object_t io_connect_t
;
184 typedef io_object_t io_enumerator_t
;
185 typedef io_object_t io_iterator_t
;
186 typedef io_object_t io_registry_entry_t
;
187 typedef io_object_t io_service_t
;
188 typedef io_object_t uext_object_t
;
190 #define IO_OBJECT_NULL ((io_object_t) 0)
192 #endif /* MACH_KERNEL */
194 // IOConnectMapMemory memoryTypes
196 kIODefaultMemoryType
= 0
202 kIOWriteThruCache
= 2,
203 kIOCopybackCache
= 3,
204 kIOWriteCombineCache
= 4,
205 kIOCopybackInnerCache
= 5,
207 kIORealTimeCache
= 7,
208 kIOPostedReordered
= 8,
209 kIOPostedCombinedReordered
= 9,
212 // IOMemory mapping options
214 kIOMapAnywhere
= 0x00000001,
216 kIOMapCacheMask
= 0x00000f00,
217 kIOMapCacheShift
= 8,
218 kIOMapDefaultCache
= kIODefaultCache
<< kIOMapCacheShift
,
219 kIOMapInhibitCache
= kIOInhibitCache
<< kIOMapCacheShift
,
220 kIOMapWriteThruCache
= kIOWriteThruCache
<< kIOMapCacheShift
,
221 kIOMapCopybackCache
= kIOCopybackCache
<< kIOMapCacheShift
,
222 kIOMapWriteCombineCache
= kIOWriteCombineCache
<< kIOMapCacheShift
,
223 kIOMapCopybackInnerCache
= kIOCopybackInnerCache
<< kIOMapCacheShift
,
224 kIOMapPostedWrite
= kIOPostedWrite
<< kIOMapCacheShift
,
225 kIOMapRealTimeCache
= kIORealTimeCache
<< kIOMapCacheShift
,
226 kIOMapPostedReordered
= kIOPostedReordered
<< kIOMapCacheShift
,
227 kIOMapPostedCombinedReordered
= kIOPostedCombinedReordered
<< kIOMapCacheShift
,
229 kIOMapUserOptionsMask
= 0x00000fff,
231 kIOMapReadOnly
= 0x00001000,
233 kIOMapStatic
= 0x01000000,
234 kIOMapReference
= 0x02000000,
235 kIOMapUnique
= 0x04000000,
236 #ifdef XNU_KERNEL_PRIVATE
237 kIOMap64Bit
= 0x08000000,
239 kIOMapPrefault
= 0x10000000,
240 kIOMapOverwrite
= 0x20000000
243 /*! @enum Scale Factors
244 * @discussion Used when a scale_factor parameter is required to define a unit of time.
245 * @constant kNanosecondScale Scale factor for nanosecond based times.
246 * @constant kMicrosecondScale Scale factor for microsecond based times.
247 * @constant kMillisecondScale Scale factor for millisecond based times.
248 * @constant kTickScale Scale factor for the standard (100Hz) tick.
249 * @constant kSecondScale Scale factor for second based times. */
252 kNanosecondScale
= 1,
253 kMicrosecondScale
= 1000,
254 kMillisecondScale
= 1000 * 1000,
255 kSecondScale
= 1000 * 1000 * 1000,
256 kTickScale
= (kSecondScale
/ 100)
260 kIOConnectMethodVarOutputSize
= -3
263 /* compatibility types */
267 typedef unsigned int IODeviceNumber
;
275 #else /* !PLATFORM_DriverKit */
279 typedef uint32_t IOOptionBits
;
280 typedef int32_t IOFixed
;
281 typedef uint32_t IOVersion
;
282 typedef uint32_t IOItemCount
;
283 typedef uint32_t IOCacheMode
;
285 typedef uint32_t IOByteCount32
;
286 typedef uint64_t IOByteCount64
;
287 typedef IOByteCount64 IOByteCount
;
289 typedef uint32_t IOPhysicalAddress32
;
290 typedef uint64_t IOPhysicalAddress64
;
291 typedef uint32_t IOPhysicalLength32
;
292 typedef uint64_t IOPhysicalLength64
;
294 typedef IOPhysicalAddress64 IOPhysicalAddress
;
295 typedef IOPhysicalLength64 IOPhysicalLength
;
297 typedef uint64_t IOVirtualAddress
;
299 #endif /* PLATFORM_DriverKit */
302 kIOMaxBusStall40usec
= 40000,
303 kIOMaxBusStall30usec
= 30000,
304 kIOMaxBusStall25usec
= 25000,
305 kIOMaxBusStall20usec
= 20000,
306 kIOMaxBusStall10usec
= 10000,
307 kIOMaxBusStall5usec
= 5000,
308 kIOMaxBusStallNone
= 0,
311 #endif /* ! __IOKIT_IOTYPES_H */