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 #if __cplusplus >= 201103L
58 #define NULL ((void *)0)
66 #include <libkern/OSTypes.h>
69 #include <libkern/OSBase.h>
72 typedef UInt32 IOOptionBits
;
73 typedef SInt32 IOFixed
;
74 typedef UInt32 IOVersion
;
75 typedef UInt32 IOItemCount
;
76 typedef UInt32 IOCacheMode
;
78 typedef UInt32 IOByteCount32
;
79 typedef UInt64 IOByteCount64
;
81 typedef UInt32 IOPhysicalAddress32
;
82 typedef UInt64 IOPhysicalAddress64
;
83 typedef UInt32 IOPhysicalLength32
;
84 typedef UInt64 IOPhysicalLength64
;
86 #if !defined(__arm__) && !defined(__i386__)
87 typedef mach_vm_address_t IOVirtualAddress
;
89 typedef vm_address_t IOVirtualAddress
;
92 #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__))
93 typedef IOByteCount64 IOByteCount
;
95 typedef IOByteCount32 IOByteCount
;
98 typedef IOVirtualAddress IOLogicalAddress
;
100 #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL))
102 typedef IOPhysicalAddress64 IOPhysicalAddress
;
103 typedef IOPhysicalLength64 IOPhysicalLength
;
104 #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
105 #define IOPhysSize 64
109 typedef IOPhysicalAddress32 IOPhysicalAddress
;
110 typedef IOPhysicalLength32 IOPhysicalLength
;
111 #define IOPhysical32( hi, lo ) (lo)
112 #define IOPhysSize 32
118 IOPhysicalAddress address
;
123 IOVirtualAddress address
;
127 #if !defined(__arm__) && !defined(__i386__)
128 typedef IOVirtualRange IOAddressRange
;
131 mach_vm_address_t address
;
132 mach_vm_size_t length
;
137 * Map between #defined or enum'd constants and text description.
146 * Memory alignment -- specified as a power of two.
148 typedef unsigned int IOAlignment
;
150 #define IO_NULL_VM_TASK ((vm_task_t)0)
154 * Pull in machine specific stuff.
157 //#include <IOKit/machine/IOTypes.h>
161 #ifndef __IOKIT_PORTS_DEFINED__
162 #define __IOKIT_PORTS_DEFINED__
166 typedef OSObject
* io_object_t
;
168 typedef struct OSObject
* io_object_t
;
171 typedef mach_port_t io_object_t
;
173 #endif /* __IOKIT_PORTS_DEFINED__ */
175 #include <device/device_types.h>
177 typedef io_object_t io_connect_t
;
178 typedef io_object_t io_enumerator_t
;
179 typedef io_object_t io_iterator_t
;
180 typedef io_object_t io_registry_entry_t
;
181 typedef io_object_t io_service_t
;
182 typedef io_object_t uext_object_t
;
184 #define IO_OBJECT_NULL ((io_object_t) 0)
186 #endif /* MACH_KERNEL */
188 // IOConnectMapMemory memoryTypes
190 kIODefaultMemoryType
= 0
196 kIOWriteThruCache
= 2,
197 kIOCopybackCache
= 3,
198 kIOWriteCombineCache
= 4,
199 kIOCopybackInnerCache
= 5,
201 kIORealTimeCache
= 7,
202 kIOPostedReordered
= 8,
203 kIOPostedCombinedReordered
= 9,
206 // IOMemory mapping options
208 kIOMapAnywhere
= 0x00000001,
210 kIOMapCacheMask
= 0x00000f00,
211 kIOMapCacheShift
= 8,
212 kIOMapDefaultCache
= kIODefaultCache
<< kIOMapCacheShift
,
213 kIOMapInhibitCache
= kIOInhibitCache
<< kIOMapCacheShift
,
214 kIOMapWriteThruCache
= kIOWriteThruCache
<< kIOMapCacheShift
,
215 kIOMapCopybackCache
= kIOCopybackCache
<< kIOMapCacheShift
,
216 kIOMapWriteCombineCache
= kIOWriteCombineCache
<< kIOMapCacheShift
,
217 kIOMapCopybackInnerCache
= kIOCopybackInnerCache
<< kIOMapCacheShift
,
218 kIOMapPostedWrite
= kIOPostedWrite
<< kIOMapCacheShift
,
219 kIOMapRealTimeCache
= kIORealTimeCache
<< kIOMapCacheShift
,
220 kIOMapPostedReordered
= kIOPostedReordered
<< kIOMapCacheShift
,
221 kIOMapPostedCombinedReordered
= kIOPostedCombinedReordered
<< kIOMapCacheShift
,
223 kIOMapUserOptionsMask
= 0x00000fff,
225 kIOMapReadOnly
= 0x00001000,
227 kIOMapStatic
= 0x01000000,
228 kIOMapReference
= 0x02000000,
229 kIOMapUnique
= 0x04000000,
230 #ifdef XNU_KERNEL_PRIVATE
231 kIOMap64Bit
= 0x08000000,
233 kIOMapPrefault
= 0x10000000,
234 kIOMapOverwrite
= 0x20000000
237 /*! @enum Scale Factors
238 * @discussion Used when a scale_factor parameter is required to define a unit of time.
239 * @constant kNanosecondScale Scale factor for nanosecond based times.
240 * @constant kMicrosecondScale Scale factor for microsecond based times.
241 * @constant kMillisecondScale Scale factor for millisecond based times.
242 * @constant kTickScale Scale factor for the standard (100Hz) tick.
243 * @constant kSecondScale Scale factor for second based times. */
246 kNanosecondScale
= 1,
247 kMicrosecondScale
= 1000,
248 kMillisecondScale
= 1000 * 1000,
249 kSecondScale
= 1000 * 1000 * 1000,
250 kTickScale
= (kSecondScale
/ 100)
254 kIOConnectMethodVarOutputSize
= -3
257 /* compatibility types */
261 typedef unsigned int IODeviceNumber
;
269 #else /* !PLATFORM_DriverKit */
273 typedef uint32_t IOOptionBits
;
274 typedef int32_t IOFixed
;
275 typedef uint32_t IOVersion
;
276 typedef uint32_t IOItemCount
;
277 typedef uint32_t IOCacheMode
;
279 typedef uint32_t IOByteCount32
;
280 typedef uint64_t IOByteCount64
;
281 typedef IOByteCount64 IOByteCount
;
283 typedef uint32_t IOPhysicalAddress32
;
284 typedef uint64_t IOPhysicalAddress64
;
285 typedef uint32_t IOPhysicalLength32
;
286 typedef uint64_t IOPhysicalLength64
;
288 typedef IOPhysicalAddress64 IOPhysicalAddress
;
289 typedef IOPhysicalLength64 IOPhysicalLength
;
291 typedef uint64_t IOVirtualAddress
;
293 #endif /* PLATFORM_DriverKit */
295 #endif /* ! __IOKIT_IOTYPES_H */