1*1031c584SApple OSS Distributions /* 2*1031c584SApple OSS Distributions * Copyright (c) 1998-2012 Apple Computer, Inc. All rights reserved. 3*1031c584SApple OSS Distributions * 4*1031c584SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*1031c584SApple OSS Distributions * 6*1031c584SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*1031c584SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*1031c584SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*1031c584SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*1031c584SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*1031c584SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*1031c584SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*1031c584SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*1031c584SApple OSS Distributions * 15*1031c584SApple OSS Distributions * Please obtain a copy of the License at 16*1031c584SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*1031c584SApple OSS Distributions * 18*1031c584SApple OSS Distributions * The Original Code and all software distributed under the License are 19*1031c584SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*1031c584SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*1031c584SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*1031c584SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*1031c584SApple OSS Distributions * Please see the License for the specific language governing rights and 24*1031c584SApple OSS Distributions * limitations under the License. 25*1031c584SApple OSS Distributions * 26*1031c584SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*1031c584SApple OSS Distributions */ 28*1031c584SApple OSS Distributions #ifndef __IOKIT_IOTYPES_H 29*1031c584SApple OSS Distributions #define __IOKIT_IOTYPES_H 30*1031c584SApple OSS Distributions 31*1031c584SApple OSS Distributions #ifndef XNU_PLATFORM_DriverKit 32*1031c584SApple OSS Distributions 33*1031c584SApple OSS Distributions #ifndef IOKIT 34*1031c584SApple OSS Distributions #define IOKIT 1 35*1031c584SApple OSS Distributions #endif /* !IOKIT */ 36*1031c584SApple OSS Distributions 37*1031c584SApple OSS Distributions #include <sys/cdefs.h> 38*1031c584SApple OSS Distributions 39*1031c584SApple OSS Distributions #if KERNEL 40*1031c584SApple OSS Distributions #include <IOKit/system.h> 41*1031c584SApple OSS Distributions #else 42*1031c584SApple OSS Distributions #include <mach/message.h> 43*1031c584SApple OSS Distributions #include <mach/vm_types.h> 44*1031c584SApple OSS Distributions #endif 45*1031c584SApple OSS Distributions 46*1031c584SApple OSS Distributions #include <IOKit/IOReturn.h> 47*1031c584SApple OSS Distributions 48*1031c584SApple OSS Distributions #ifdef __cplusplus 49*1031c584SApple OSS Distributions extern "C" { 50*1031c584SApple OSS Distributions #endif 51*1031c584SApple OSS Distributions 52*1031c584SApple OSS Distributions #ifndef NULL 53*1031c584SApple OSS Distributions #if defined (__cplusplus) 54*1031c584SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE 55*1031c584SApple OSS Distributions #define NULL nullptr 56*1031c584SApple OSS Distributions #else 57*1031c584SApple OSS Distributions #if __cplusplus >= 201103L && (defined(__arm__) || defined(__arm64__)) 58*1031c584SApple OSS Distributions #define NULL nullptr 59*1031c584SApple OSS Distributions #else 60*1031c584SApple OSS Distributions #define NULL 0 61*1031c584SApple OSS Distributions #endif 62*1031c584SApple OSS Distributions #endif 63*1031c584SApple OSS Distributions #else 64*1031c584SApple OSS Distributions #define NULL ((void *)0) 65*1031c584SApple OSS Distributions #endif 66*1031c584SApple OSS Distributions #endif 67*1031c584SApple OSS Distributions 68*1031c584SApple OSS Distributions /* 69*1031c584SApple OSS Distributions * Simple data types. 70*1031c584SApple OSS Distributions */ 71*1031c584SApple OSS Distributions #include <stdbool.h> 72*1031c584SApple OSS Distributions #include <libkern/OSTypes.h> 73*1031c584SApple OSS Distributions 74*1031c584SApple OSS Distributions #if KERNEL 75*1031c584SApple OSS Distributions #include <libkern/OSBase.h> 76*1031c584SApple OSS Distributions #endif 77*1031c584SApple OSS Distributions 78*1031c584SApple OSS Distributions typedef UInt32 IOOptionBits; 79*1031c584SApple OSS Distributions typedef SInt32 IOFixed; 80*1031c584SApple OSS Distributions typedef UInt32 IOVersion; 81*1031c584SApple OSS Distributions typedef UInt32 IOItemCount; 82*1031c584SApple OSS Distributions typedef UInt32 IOCacheMode; 83*1031c584SApple OSS Distributions 84*1031c584SApple OSS Distributions typedef UInt32 IOByteCount32; 85*1031c584SApple OSS Distributions typedef UInt64 IOByteCount64; 86*1031c584SApple OSS Distributions 87*1031c584SApple OSS Distributions typedef UInt32 IOPhysicalAddress32; 88*1031c584SApple OSS Distributions typedef UInt64 IOPhysicalAddress64; 89*1031c584SApple OSS Distributions typedef UInt32 IOPhysicalLength32; 90*1031c584SApple OSS Distributions typedef UInt64 IOPhysicalLength64; 91*1031c584SApple OSS Distributions 92*1031c584SApple OSS Distributions #if !defined(__arm__) && !defined(__i386__) 93*1031c584SApple OSS Distributions typedef mach_vm_address_t IOVirtualAddress __kernel_ptr_semantics; 94*1031c584SApple OSS Distributions #else 95*1031c584SApple OSS Distributions typedef vm_address_t IOVirtualAddress __kernel_ptr_semantics; 96*1031c584SApple OSS Distributions #endif 97*1031c584SApple OSS Distributions 98*1031c584SApple OSS Distributions #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__)) 99*1031c584SApple OSS Distributions typedef IOByteCount64 IOByteCount; 100*1031c584SApple OSS Distributions #define PRIIOByteCount PRIu64 101*1031c584SApple OSS Distributions #else 102*1031c584SApple OSS Distributions typedef IOByteCount32 IOByteCount; 103*1031c584SApple OSS Distributions #define PRIIOByteCount PRIu32 104*1031c584SApple OSS Distributions #endif 105*1031c584SApple OSS Distributions 106*1031c584SApple OSS Distributions typedef IOVirtualAddress IOLogicalAddress; 107*1031c584SApple OSS Distributions 108*1031c584SApple OSS Distributions #if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) 109*1031c584SApple OSS Distributions 110*1031c584SApple OSS Distributions typedef IOPhysicalAddress64 IOPhysicalAddress; 111*1031c584SApple OSS Distributions typedef IOPhysicalLength64 IOPhysicalLength; 112*1031c584SApple OSS Distributions #define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32)) 113*1031c584SApple OSS Distributions #define IOPhysSize 64 114*1031c584SApple OSS Distributions 115*1031c584SApple OSS Distributions #else 116*1031c584SApple OSS Distributions 117*1031c584SApple OSS Distributions typedef IOPhysicalAddress32 IOPhysicalAddress; 118*1031c584SApple OSS Distributions typedef IOPhysicalLength32 IOPhysicalLength; 119*1031c584SApple OSS Distributions #define IOPhysical32( hi, lo ) (lo) 120*1031c584SApple OSS Distributions #define IOPhysSize 32 121*1031c584SApple OSS Distributions 122*1031c584SApple OSS Distributions #endif 123*1031c584SApple OSS Distributions 124*1031c584SApple OSS Distributions 125*1031c584SApple OSS Distributions typedef struct{ 126*1031c584SApple OSS Distributions IOPhysicalAddress address; 127*1031c584SApple OSS Distributions IOByteCount length; 128*1031c584SApple OSS Distributions } IOPhysicalRange; 129*1031c584SApple OSS Distributions 130*1031c584SApple OSS Distributions typedef struct{ 131*1031c584SApple OSS Distributions IOVirtualAddress address; 132*1031c584SApple OSS Distributions IOByteCount length; 133*1031c584SApple OSS Distributions } IOVirtualRange; 134*1031c584SApple OSS Distributions 135*1031c584SApple OSS Distributions #if !defined(__arm__) && !defined(__i386__) 136*1031c584SApple OSS Distributions typedef IOVirtualRange IOAddressRange; 137*1031c584SApple OSS Distributions #else 138*1031c584SApple OSS Distributions typedef struct{ 139*1031c584SApple OSS Distributions mach_vm_address_t address; 140*1031c584SApple OSS Distributions mach_vm_size_t length; 141*1031c584SApple OSS Distributions } IOAddressRange; 142*1031c584SApple OSS Distributions #endif 143*1031c584SApple OSS Distributions 144*1031c584SApple OSS Distributions /* 145*1031c584SApple OSS Distributions * Map between #defined or enum'd constants and text description. 146*1031c584SApple OSS Distributions */ 147*1031c584SApple OSS Distributions typedef struct { 148*1031c584SApple OSS Distributions int value; 149*1031c584SApple OSS Distributions const char *name; 150*1031c584SApple OSS Distributions } IONamedValue; 151*1031c584SApple OSS Distributions 152*1031c584SApple OSS Distributions 153*1031c584SApple OSS Distributions /* 154*1031c584SApple OSS Distributions * Memory alignment -- specified as a power of two. 155*1031c584SApple OSS Distributions */ 156*1031c584SApple OSS Distributions typedef unsigned int IOAlignment; 157*1031c584SApple OSS Distributions 158*1031c584SApple OSS Distributions #define IO_NULL_VM_TASK ((vm_task_t)0) 159*1031c584SApple OSS Distributions 160*1031c584SApple OSS Distributions 161*1031c584SApple OSS Distributions /* 162*1031c584SApple OSS Distributions * Pull in machine specific stuff. 163*1031c584SApple OSS Distributions */ 164*1031c584SApple OSS Distributions 165*1031c584SApple OSS Distributions //#include <IOKit/machine/IOTypes.h> 166*1031c584SApple OSS Distributions 167*1031c584SApple OSS Distributions #ifndef MACH_KERNEL 168*1031c584SApple OSS Distributions 169*1031c584SApple OSS Distributions #ifndef __IOKIT_PORTS_DEFINED__ 170*1031c584SApple OSS Distributions #define __IOKIT_PORTS_DEFINED__ 171*1031c584SApple OSS Distributions #ifdef KERNEL 172*1031c584SApple OSS Distributions #ifdef __cplusplus 173*1031c584SApple OSS Distributions class OSObject; 174*1031c584SApple OSS Distributions typedef OSObject * io_object_t; 175*1031c584SApple OSS Distributions #else 176*1031c584SApple OSS Distributions typedef struct OSObject * io_object_t; 177*1031c584SApple OSS Distributions #endif 178*1031c584SApple OSS Distributions #else /* KERNEL */ 179*1031c584SApple OSS Distributions typedef mach_port_t io_object_t; 180*1031c584SApple OSS Distributions #endif /* KERNEL */ 181*1031c584SApple OSS Distributions #endif /* __IOKIT_PORTS_DEFINED__ */ 182*1031c584SApple OSS Distributions 183*1031c584SApple OSS Distributions #include <device/device_types.h> 184*1031c584SApple OSS Distributions 185*1031c584SApple OSS Distributions typedef io_object_t io_connect_t; 186*1031c584SApple OSS Distributions typedef io_object_t io_enumerator_t; 187*1031c584SApple OSS Distributions typedef io_object_t io_ident_t; 188*1031c584SApple OSS Distributions typedef io_object_t io_iterator_t; 189*1031c584SApple OSS Distributions typedef io_object_t io_registry_entry_t; 190*1031c584SApple OSS Distributions typedef io_object_t io_service_t; 191*1031c584SApple OSS Distributions typedef io_object_t uext_object_t; 192*1031c584SApple OSS Distributions 193*1031c584SApple OSS Distributions #define IO_OBJECT_NULL ((io_object_t) 0) 194*1031c584SApple OSS Distributions 195*1031c584SApple OSS Distributions #endif /* MACH_KERNEL */ 196*1031c584SApple OSS Distributions 197*1031c584SApple OSS Distributions #include <IOKit/IOMapTypes.h> 198*1031c584SApple OSS Distributions 199*1031c584SApple OSS Distributions /*! @enum Scale Factors 200*1031c584SApple OSS Distributions * @discussion Used when a scale_factor parameter is required to define a unit of time. 201*1031c584SApple OSS Distributions * @constant kNanosecondScale Scale factor for nanosecond based times. 202*1031c584SApple OSS Distributions * @constant kMicrosecondScale Scale factor for microsecond based times. 203*1031c584SApple OSS Distributions * @constant kMillisecondScale Scale factor for millisecond based times. 204*1031c584SApple OSS Distributions * @constant kTickScale Scale factor for the standard (100Hz) tick. 205*1031c584SApple OSS Distributions * @constant kSecondScale Scale factor for second based times. */ 206*1031c584SApple OSS Distributions 207*1031c584SApple OSS Distributions enum { 208*1031c584SApple OSS Distributions kNanosecondScale = 1, 209*1031c584SApple OSS Distributions kMicrosecondScale = 1000, 210*1031c584SApple OSS Distributions kMillisecondScale = 1000 * 1000, 211*1031c584SApple OSS Distributions kSecondScale = 1000 * 1000 * 1000, 212*1031c584SApple OSS Distributions kTickScale = (kSecondScale / 100) 213*1031c584SApple OSS Distributions }; 214*1031c584SApple OSS Distributions 215*1031c584SApple OSS Distributions enum { 216*1031c584SApple OSS Distributions kIOConnectMethodVarOutputSize = -3 217*1031c584SApple OSS Distributions }; 218*1031c584SApple OSS Distributions 219*1031c584SApple OSS Distributions /* compatibility types */ 220*1031c584SApple OSS Distributions 221*1031c584SApple OSS Distributions #ifndef KERNEL 222*1031c584SApple OSS Distributions 223*1031c584SApple OSS Distributions typedef unsigned int IODeviceNumber; 224*1031c584SApple OSS Distributions 225*1031c584SApple OSS Distributions #endif 226*1031c584SApple OSS Distributions 227*1031c584SApple OSS Distributions #ifdef __cplusplus 228*1031c584SApple OSS Distributions } 229*1031c584SApple OSS Distributions #endif 230*1031c584SApple OSS Distributions 231*1031c584SApple OSS Distributions #else /* !XNU_PLATFORM_DriverKit */ 232*1031c584SApple OSS Distributions 233*1031c584SApple OSS Distributions #include <stdint.h> 234*1031c584SApple OSS Distributions 235*1031c584SApple OSS Distributions typedef uint32_t IOOptionBits; 236*1031c584SApple OSS Distributions typedef int32_t IOFixed; 237*1031c584SApple OSS Distributions typedef uint32_t IOVersion; 238*1031c584SApple OSS Distributions typedef uint32_t IOItemCount; 239*1031c584SApple OSS Distributions typedef uint32_t IOCacheMode; 240*1031c584SApple OSS Distributions 241*1031c584SApple OSS Distributions typedef uint32_t IOByteCount32; 242*1031c584SApple OSS Distributions typedef uint64_t IOByteCount64; 243*1031c584SApple OSS Distributions typedef IOByteCount64 IOByteCount; 244*1031c584SApple OSS Distributions 245*1031c584SApple OSS Distributions typedef uint32_t IOPhysicalAddress32; 246*1031c584SApple OSS Distributions typedef uint64_t IOPhysicalAddress64; 247*1031c584SApple OSS Distributions typedef uint32_t IOPhysicalLength32; 248*1031c584SApple OSS Distributions typedef uint64_t IOPhysicalLength64; 249*1031c584SApple OSS Distributions 250*1031c584SApple OSS Distributions typedef IOPhysicalAddress64 IOPhysicalAddress; 251*1031c584SApple OSS Distributions typedef IOPhysicalLength64 IOPhysicalLength; 252*1031c584SApple OSS Distributions 253*1031c584SApple OSS Distributions typedef uint64_t IOVirtualAddress; 254*1031c584SApple OSS Distributions 255*1031c584SApple OSS Distributions #endif /* XNU_PLATFORM_DriverKit */ 256*1031c584SApple OSS Distributions 257*1031c584SApple OSS Distributions enum { 258*1031c584SApple OSS Distributions kIOMaxBusStall40usec = 40000, 259*1031c584SApple OSS Distributions kIOMaxBusStall30usec = 30000, 260*1031c584SApple OSS Distributions kIOMaxBusStall25usec = 25000, 261*1031c584SApple OSS Distributions kIOMaxBusStall20usec = 20000, 262*1031c584SApple OSS Distributions kIOMaxBusStall10usec = 10000, 263*1031c584SApple OSS Distributions kIOMaxBusStall5usec = 5000, 264*1031c584SApple OSS Distributions kIOMaxBusStallNone = 0, 265*1031c584SApple OSS Distributions }; 266*1031c584SApple OSS Distributions 267*1031c584SApple OSS Distributions #if PRIVATE 268*1031c584SApple OSS Distributions #define LIBKERN_OSNUMBER_FLOAT_SUPPORT 1 269*1031c584SApple OSS Distributions #endif /* PRIVATE */ 270*1031c584SApple OSS Distributions 271*1031c584SApple OSS Distributions #endif /* ! __IOKIT_IOTYPES_H */ 272