1 2#ifndef __IONDRVLIBRARIES__ 3#define __IONDRVLIBRARIES__ 4 5#include <libkern/OSByteOrder.h> 6#include <libkern/OSAtomic.h> 7#include <IOKit/ndrvsupport/IOMacOSTypes.h> 8#include <IOKit/graphics/IOGraphicsTypes.h> 9 10 11#ifdef __cplusplus 12extern "C" { 13#endif 14 15/* NameRegistry error codes */ 16enum { 17 nrLockedErr = -2536, 18 nrNotEnoughMemoryErr = -2537, 19 nrInvalidNodeErr = -2538, 20 nrNotFoundErr = -2539, 21 nrNotCreatedErr = -2540, 22 nrNameErr = -2541, 23 nrNotSlotDeviceErr = -2542, 24 nrDataTruncatedErr = -2543, 25 nrPowerErr = -2544, 26 nrPowerSwitchAbortErr = -2545, 27 nrTypeMismatchErr = -2546, 28 nrNotModifiedErr = -2547, 29 nrOverrunErr = -2548, 30 nrResultCodeBase = -2549, 31 nrPathNotFound = -2550, /* a path component lookup failed */ 32 nrPathBufferTooSmall = -2551, /* buffer for path is too small */ 33 nrInvalidEntryIterationOp = -2552, /* invalid entry iteration operation */ 34 nrPropertyAlreadyExists = -2553, /* property already exists */ 35 nrIterationDone = -2554, /* iteration operation is done */ 36 nrExitedIteratorScope = -2555, /* outer scope of iterator was exited */ 37 nrTransactionAborted = -2556, /* transaction was aborted */ 38 39 gestaltUndefSelectorErr = -5551 /*undefined selector was passed to Gestalt*/ 40}; 41 42enum { 43 kNVRAMProperty = 0x00000020, // matches NR 44}; 45 46 47/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 48 49#ifndef _IOKIT_IOSERVICE_H 50typedef struct IOService IOService; 51#endif 52 53IOReturn _IONDRVLibrariesInitialize( IOService * provider ); 54IOReturn _IONDRVLibrariesFinalize( IOService * provider ); 55 56#ifndef kAAPLRegEntryIDKey 57#define kAAPLRegEntryIDKey "AAPL,RegEntryID" 58#endif 59 60/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 61/******************************************************************************* 62 * 63 * Foundation Types 64 * 65 */ 66/* Value of a property */ 67typedef void * RegPropertyValue; 68/* Length of property value */ 69typedef UInt32 RegPropertyValueSize; 70 71/*******************************************************************************/ 72 73/******************************************************************************* 74 * 75 * Root Entry Name Definitions (Applies to all Names in the RootNameSpace) 76 * 77 * + Names are a colon-separated list of name components. Name components 78 * may not themselves contain colons. 79 * + Names are presented as null-terminated ASCII character strings. 80 * + Names follow similar parsing rules to Apple file system absolute 81 * and relative paths. However the '::' parent directory syntax is 82 * not currently supported. 83 */ 84/* Max length of Entry Name */ 85enum { 86 kRegCStrMaxEntryNameLength = 47 87}; 88 89/* Entry Names are single byte ASCII */ 90typedef char RegCStrEntryName; 91typedef char * RegCStrEntryNamePtr; 92/* length of RegCStrEntryNameBuf = kRegCStrMaxEntryNameLength+1*/ 93typedef char RegCStrEntryNameBuf[48]; 94typedef char RegCStrPathName; 95typedef UInt32 RegPathNameSize; 96enum { 97 kRegPathNameSeparator = ':', /* 0x3A */ 98 kRegEntryNameTerminator = 0x00, /* '\0' */ 99 kRegPathNameTerminator = 0x00 /* '\0' */ 100}; 101 102/******************************************************************************* 103 * 104 * Property Name and ID Definitions 105 * (Applies to all Properties Regardless of NameSpace) 106 */ 107enum { 108 kRegMaximumPropertyNameLength = 31, /* Max length of Property Name */ 109 kRegPropertyNameTerminator = 0x00 /* '\0' */ 110}; 111 112typedef char RegPropertyNameBuf[32]; 113typedef char RegPropertyName; 114typedef char * RegPropertyNamePtr; 115enum { 116 kRegMaxPropertyNameLength = kRegMaximumPropertyNameLength 117}; 118 119/******************************************************************************* 120 * 121 * Iteration Operations 122 * 123 * These specify direction when traversing the name relationships 124 */ 125typedef UInt32 RegIterationOp; 126typedef RegIterationOp RegEntryIterationOp; 127enum { 128 /* Absolute locations*/ 129 kRegIterRoot = 0x00000002, /* "Upward" Relationships */ 130 kRegIterParents = 0x00000003, /* include all parent(s) of entry */ 131 /* "Downward" Relationships*/ 132 kRegIterChildren = 0x00000004, /* include all children */ 133 kRegIterSubTrees = 0x00000005, /* include all sub trees of entry */ 134 kRegIterDescendants = 0x00000005, /* include all descendants of entry */ 135 /* "Horizontal" Relationships */ 136 kRegIterSibling = 0x00000006, /* include all siblings */ 137 /* Keep doing the same thing*/ 138 kRegIterContinue = 0x00000001 139}; 140 141/******************************************************************************* 142 * 143 * Name Entry and Property Modifiers 144 * 145 * 146 * 147 * Modifiers describe special characteristics of names 148 * and properties. Modifiers might be supported for 149 * some names and not others. 150 * 151 * Device Drivers should not rely on functionality 152 * specified as a modifier. 153 */ 154typedef UInt32 RegModifiers; 155typedef RegModifiers RegEntryModifiers; 156typedef RegModifiers RegPropertyModifiers; 157enum { 158 kRegNoModifiers = 0x00000000, /* no entry modifiers in place */ 159 kRegUniversalModifierMask = 0x0000FFFF, /* mods to all entries */ 160 kRegNameSpaceModifierMask = 0x00FF0000, /* mods to all entries within namespace */ 161 kRegModifierMask = (RegModifiers)0xFF000000 /* mods to just this entry */ 162}; 163 164/* Universal Property Modifiers */ 165enum { 166 kRegPropertyValueIsSavedToNVRAM = 0x00000020, /* property is non-volatile (saved in NVRAM) */ 167 kRegPropertyValueIsSavedToDisk = 0x00000040 /* property is non-volatile (saved on disk) */ 168}; 169 170typedef size_t Size; 171 172#ifndef _IOKIT_IOREGISTRYENTRY_H 173typedef struct IORegistryIterator IORegistryIterator; 174typedef struct OSIterator OSIterator; 175#endif /* _IOKIT_IOREGISTRYENTRY_H */ 176typedef IORegistryIterator * RegEntryIter; 177typedef OSIterator * RegPropertyIter; 178 179OSStatus RegistryEntryIDCopy( const RegEntryID * entryID, RegEntryID * to ); 180 181OSStatus RegistryEntryIDInit( RegEntryID * entryID ); 182 183Boolean RegistryEntryIDCompare( const RegEntryID * id1, const RegEntryID * id2); 184 185OSStatus RegistryPropertyGetSize( 186 const RegEntryID * entryID, 187 const RegPropertyName * propertyName, 188 RegPropertyValueSize * propertySize); 189 190OSStatus RegistryPropertyGet( 191 const RegEntryID * entryID, 192 const RegPropertyName * propertyName, 193 void * propertyValue, 194 RegPropertyValueSize * propertySize); 195 196OSStatus RegistryPropertyCreate( 197 const RegEntryID * entryID, 198 const RegPropertyName * propertyName, 199 const void * propertyValue, 200 RegPropertyValueSize propertySize); 201 202OSStatus RegistryPropertyDelete( 203 const RegEntryID * entryID, 204 const RegPropertyName * propertyName); 205 206OSStatus RegistryPropertySet( 207 const RegEntryID * entryID, 208 const RegPropertyName * propertyName, 209 const void * propertyValue, 210 RegPropertyValueSize propertySize); 211 212OSStatus RegistryPropertyGetMod( 213 const RegEntryID * entry, 214 const RegPropertyName * name, 215 RegPropertyModifiers * modifiers); 216 217OSStatus RegistryPropertySetMod( 218 const RegEntryID * entry, 219 const RegPropertyName * name, 220 RegPropertyModifiers modifiers); 221 222OSStatus RegistryPropertyIterateCreate( 223 const RegEntryID * entry, 224 RegPropertyIter * cookie); 225 226OSStatus RegistryPropertyIterateDispose( RegPropertyIter * cookie); 227 228OSStatus RegistryPropertyIterate( 229 RegPropertyIter * cookie, 230 RegPropertyName * foundProperty, 231 Boolean * done); 232 233OSStatus RegistryEntryIterateCreate( RegEntryIter * cookie); 234 235OSStatus RegistryEntryIterateDispose( RegEntryIter * cookie); 236 237OSStatus RegistryEntryIterate( RegEntryIter * cookie, 238 RegEntryIterationOp relationship, 239 RegEntryID * foundEntry, 240 Boolean * done); 241 242OSStatus RegistryCStrEntryToName( const RegEntryID * entryID, 243 RegEntryID * parentEntry, 244 RegCStrEntryName * nameComponent, 245 Boolean * done ); 246 247OSStatus RegistryCStrEntryLookup( const RegEntryID * parentEntry, 248 const RegCStrPathName * path, 249 RegEntryID * newEntry); 250 251OSStatus RegistryEntryIDDispose(RegEntryID * entryID); 252 253/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 254 255enum { 256 paramErr = -50, /*error in user parameter list*/ 257 noHardwareErr = -200, /*Sound Manager Error Returns*/ 258 notEnoughHardwareErr = -201, /*Sound Manager Error Returns*/ 259 userCanceledErr = -128, 260 qErr = -1, /*queue element not found during deletion*/ 261 vTypErr = -2, /*invalid queue element*/ 262 corErr = -3, /*core routine number out of range*/ 263 unimpErr = -4, /*unimplemented core routine*/ 264 SlpTypeErr = -5, /*invalid queue element*/ 265 seNoDB = -8, /*no debugger installed to handle debugger command*/ 266 controlErr = -17, /*I/O System Errors*/ 267 statusErr = -18, /*I/O System Errors*/ 268 readErr = -19, /*I/O System Errors*/ 269 writErr = -20, /*I/O System Errors*/ 270 badUnitErr = -21, /*I/O System Errors*/ 271 unitEmptyErr = -22, /*I/O System Errors*/ 272 openErr = -23, /*I/O System Errors*/ 273 closErr = -24, /*I/O System Errors*/ 274 dRemovErr = -25, /*tried to remove an open driver*/ 275 dInstErr = -26, /*DrvrInstall couldn't find driver in resources*/ 276 277 badCksmErr = -69, /*addr mark checksum didn't check*/ 278}; 279enum { 280 durationMicrosecond = -1, /* Microseconds are negative*/ 281 durationMillisecond = 1, /* Milliseconds are positive*/ 282 durationSecond = 1000, /* 1000 * durationMillisecond*/ 283 durationMinute = 60000, /* 60 * durationSecond,*/ 284 durationHour = 3600000, /* 60 * durationMinute,*/ 285 durationDay = 86400000, /* 24 * durationHour,*/ 286 durationNoWait = 0, /* don't block*/ 287 durationForever = 0x7FFFFFFF /* no time limit*/ 288}; 289#ifndef NULL 290 #if !defined(__cplusplus) && (defined(__SC__) || defined(THINK_C)) 291 /* Symantec C compilers (but not C++) want NULL and nil to be (void*)0 */ 292 #define NULL ((void *) 0) 293 #else 294 /* in case int is 16-bits, make sure NULL is 32-bits */ 295 #define NULL 0L 296 #endif 297#endif 298 299#ifndef nil 300 #define nil NULL 301#endif 302 303typedef ResType VSLGestaltType; 304 305enum { 306 clutType = 0, /*0 if lookup table*/ 307 fixedType = 1, /*1 if fixed table*/ 308 directType = 2, /*2 if direct values*/ 309 RGBDirect = 16 /* 16 & 32 bits/pixel pixelType value */ 310}; 311typedef UInt32 * UInt32Ptr; 312 313typedef struct IOHardwareCursorDescriptor HardwareCursorDescriptorRec; 314typedef HardwareCursorDescriptorRec * HardwareCursorDescriptorPtr; 315typedef struct IOHardwareCursorInfo HardwareCursorInfoRec; 316typedef HardwareCursorInfoRec * HardwareCursorInfoPtr; 317 318typedef ResType InterruptServiceType; 319typedef struct _VSLService * InterruptServiceIDType; 320typedef InterruptServiceIDType * InterruptServiceIDPtr; 321 322enum { 323 kVBLInterruptServiceType = 'vbl ', 324 kHBLInterruptServiceType = 'hbl ', 325 kFrameInterruptServiceType = 'fram', 326 kConnectInterruptServiceType = 'dci ', /* Renamed -- Use kFBCheckInterruptServiceType*/ 327 kFBConnectInterruptServiceType = kConnectInterruptServiceType, /* Demand to check configuration (Hardware unchanged)*/ 328 kFBChangedInterruptServiceType = 'chng', /* Demand to rebuild (Hardware has reinitialized on dependent change)*/ 329 kFBOfflineInterruptServiceType = 'remv', /* Demand to remove framebuffer (Hardware not available on dependent change -- but must not buserror)*/ 330 kFBOnlineInterruptServiceType = 'add ' /* Notice that hardware is available (after being removed)*/ 331}; 332 333enum { 334 kVSLClamshellStateGestaltType = 'clam', 335}; 336 337OSStatus 338VSLGestalt( VSLGestaltType selector, UInt32 * response ); 339 340OSErr 341VSLNewInterruptService( 342 RegEntryID * serviceDevice, 343 InterruptServiceType serviceType, 344 InterruptServiceIDPtr serviceID); 345 346OSErr 347VSLDisposeInterruptService(InterruptServiceIDType serviceID); 348 349OSErr 350VSLDoInterruptService(InterruptServiceIDType serviceID); 351 352Boolean 353VSLPrepareCursorForHardwareCursor( 354 void * cursorRef, 355 IOHardwareCursorDescriptor * hardwareDescriptor, 356 IOHardwareCursorInfo * hwCursorInfo); 357 358 359enum { 360 /* Version Release Stage Codes */ 361 developStage = 0x20, 362 alphaStage = 0x40, 363 betaStage = 0x60, 364 finalStage = 0x80 365}; 366 367/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 368 369typedef struct OpaqueIOCommandID* IOCommandID; 370 371typedef UInt32 IOCommandKind; 372typedef UInt32 IOCommandCode; 373 374/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 375 376#ifdef __cplusplus 377} 378#endif 379 380#endif /* __IONDRVLIBRARIES__ */ 381 382