|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: File: DriverServicesPriv.h ! 27: ! 28: Contains: Defs for private DriverServices interfaces. ! 29: ! 30: Version: ! 31: ! 32: DRI: Jonathan Sand ! 33: ! 34: Copyright: � 1985-1998 by Apple Computer, Inc., all rights reserved ! 35: ! 36: Warning: *** APPLE INTERNAL USE ONLY *** ! 37: This file contains unreleased SPI's ! 38: ! 39: BuildInfo: Built by: Naga Pappireddi ! 40: With Interfacer: 3.0d9 (PowerPC native) ! 41: From: DriverServicesPriv.i ! 42: Revision: 32 ! 43: Dated: 1/22/98 ! 44: Last change by: ngk ! 45: Last comment: Change Types.i to MacTypes.i ! 46: ! 47: Bugs: Report bugs to Radar component "System Interfaces", "Latest" ! 48: List the version information (from above) in the Problem Description. ! 49: ! 50: */ ! 51: /* naga ! 52: #ifndef __DRIVERSERVICESPRIV__ ! 53: #define __DRIVERSERVICESPRIV__ ! 54: ! 55: #ifndef __CONDITIONALMACROS__ ! 56: #include <ConditionalMacros.h> ! 57: #endif ! 58: #ifndef __MACTYPES__ ! 59: #include <MacTypes.h> ! 60: #endif ! 61: #ifndef __OSUTILS__ ! 62: #include <OSUtils.h> ! 63: #endif ! 64: #ifndef __MIXEDMODE__ ! 65: #include <MixedMode.h> ! 66: #endif ! 67: #ifndef __INTERRUPTSPRIV__ ! 68: #include <InterruptsPriv.h> ! 69: #endif ! 70: #ifndef __DRIVERSERVICES__ ! 71: #include <DriverServices.h> ! 72: #endif ! 73: #ifndef __KERNEL__ ! 74: #include <Kernel.h> ! 75: #endif ! 76: #ifndef __TIMER__ ! 77: #include <Timer.h> ! 78: #endif ! 79: ! 80: ! 81: ! 82: #if PRAGMA_ONCE ! 83: #pragma once ! 84: #endif ! 85: ! 86: #ifdef __cplusplus ! 87: extern "C" { ! 88: #endif ! 89: ! 90: #if PRAGMA_IMPORT ! 91: #pragma import on ! 92: #endif ! 93: ! 94: #if PRAGMA_STRUCT_ALIGN ! 95: #pragma options align=mac68k ! 96: #elif PRAGMA_STRUCT_PACKPUSH ! 97: #pragma pack(push, 2) ! 98: #elif PRAGMA_STRUCT_PACK ! 99: #pragma pack(2) ! 100: #endif ! 101: */ ! 102: /* ! 103: ** ! 104: ** Our private types and constants... ! 105: ** ! 106: ** We Make sure all longs that we compare and swap on are aligned on long boundaries. ! 107: ** ! 108: ** Swis, SIHs, and Timers are preallocated arrays of structures. Each of these structs ! 109: ** must start on a long word boundary for CompareAndSwap to work. ! 110: ** ! 111: */ ! 112: /* ! 113: ////////////////////////////////////////////////////////////////////////// ! 114: Secondary Interrupts ! 115: */ ! 116: ! 117: /* # preallocated SIHs from PoolAllocateResident*/ ! 118: #define SIHTaskPoolSize 40 ! 119: ! 120: struct SIH_Routine { ! 121: QElem qElement; /* on either available OR*/ ! 122: /* in-use lists*/ ! 123: /* OSType name; // 'SIHT' (Macsbug ready)*/ ! 124: SecondaryInterruptHandler2 theHandler; /* -> handler*/ ! 125: //naga ExceptionHandler theExceptionHandler; /* not used in this implementation*/ ! 126: void * p1; /* first param for handler*/ ! 127: void * p2; /* second param for handler*/ ! 128: UInt32 sihSequenceNumber; /* counts queued sihs*/ ! 129: void * reserved; /* room to grow*/ ! 130: }; ! 131: typedef struct SIH_Routine SIH_Routine; ! 132: typedef SIH_Routine * SIH_RoutinePtr; ! 133: ! 134: struct SIHGlobalsStruct { ! 135: /* OSType globalsName; // 'SIHG' (Macsbug ready)*/ ! 136: SIH_RoutinePtr taskPool; /* pre-allocated queue records*/ ! 137: UInt32 sihSequenceNumber; /* counts queued sihs*/ ! 138: UInt32 sihLastExecSequenceNumber; /* last sequence number executed.*/ ! 139: void * reserved; /* room to grow*/ ! 140: ! 141: }; ! 142: typedef struct SIHGlobalsStruct SIHGlobalsStruct; ! 143: ! 144: typedef SIHGlobalsStruct * SIHGlobalsPtr; ! 145: /* ! 146: ////////////////////////////////////////////////////////////////////////// ! 147: Memory Management ! 148: */ ! 149: ! 150: enum { ! 151: kCacheLineSize = 32 ! 152: }; ! 153: ! 154: typedef UInt32 LogicalAddressLval; ! 155: typedef UInt32 PhysicalAddressLval; ! 156: /* ! 157: ////////////////////////////////////////////////////////////////////////// ! 158: Software Interrupts ! 159: */ ! 160: /* # preallocated Swis from PoolAllocateResident*/ ! 161: #define N_SWIS 24 ! 162: ! 163: struct Swi_Information { ! 164: QElem Link; /* next SWI sent to this task*/ ! 165: /* OSType Name; // 'SWI!' (Macsbug ready)*/ ! 166: SoftwareInterruptHandler Handler; /* &TVector of handler routine*/ ! 167: SoftwareInterruptID The_Id; ! 168: TaskID The_Task; /* task to which SWI was or will be sent*/ ! 169: Boolean Privileged; /* whether SWI will run on master stack*/ ! 170: Boolean Temporary; /* whether SWI will be deleted after delivery*/ ! 171: Boolean Sent; /* whether SWI has been sent*/ ! 172: Boolean Overrun; /* whether non-temporary SWI has been sent twice before delivery*/ ! 173: void * P1; /* set at CreateSwi time*/ ! 174: void * P2; /* set at SendSwi time*/ ! 175: void * reserved; /* room to grow*/ ! 176: }; ! 177: typedef struct Swi_Information Swi_Information; ! 178: ! 179: typedef Swi_Information * Swi_Info; ! 180: /* ! 181: ////////////////////////////////////////////////////////////////////////// ! 182: Timer ! 183: */ ! 184: /* # preallocated TimerTasks from PoolAllocateResident*/ ! 185: #define TimerTaskPoolSize 32 ! 186: ! 187: struct TimerTaskStruct { ! 188: //nagaTMTask tmTask; /* Time Manager Task Elements */ ! 189: UInt16 Pad; /* align to long*/ ! 190: /* OSType name; // 'TIMT' (Macsbug ready)*/ ! 191: struct TimerTaskStruct * pNextTask; /* Timer list elements */ ! 192: TimerID timerID; /* Timer elements */ ! 193: SecondaryInterruptHandler2 theHandler; /* -> SIH to queue*/ ! 194: void * p1; /* == param to SIH*/ ! 195: long frequency; /* persistence frequency*/ ! 196: Boolean persistent; /* if true, task is persistent*/ ! 197: }; ! 198: typedef struct TimerTaskStruct TimerTaskStruct; ! 199: ! 200: typedef TimerTaskStruct * TimerTaskPtr; ! 201: ! 202: struct TimerGlobalsStruct { ! 203: /* OSType globalsName; // 'TIMG' (Macsbug ready)*/ ! 204: /* Timer list elements */ ! 205: TimerTaskPtr taskPool; /* pool of pre-allocated */ ! 206: /* task records */ ! 207: TimerTaskPtr taskFreeList; /* list of free tasks */ ! 208: TimerTaskPtr taskList; /* list of pending tasks */ ! 209: TimerID nextUniqueID; /* next unique timer ID */ ! 210: ! 211: /* Time Manager elements */ ! 212: //nagaTimerUPP tmTaskHandler; /* Timer Manager interrupt */ ! 213: /* handler */ ! 214: void * reserved; /* room to grow*/ ! 215: }; ! 216: typedef struct TimerGlobalsStruct TimerGlobalsStruct; ! 217: ! 218: typedef TimerGlobalsStruct * TimerGlobalsPtr; ! 219: ! 220: /* ! 221: ** ! 222: ** Our private globals and external routines... ! 223: ** ! 224: */ ! 225: /* ! 226: ** Device Probe ! 227: */ ! 228: extern OSStatus ProbeSuccess; ! 229: /* ! 230: ** InterruptManager.c ! 231: */ ! 232: //naga ! 233: #define extern ! 234: //nagaextern InterruptSetObject *theRootSetOfAllTrees; ! 235: extern UInt32 gInterruptCount; ! 236: extern SInt32 inNativeIntDispatcher; ! 237: EXTERN_API_C( void ) ! 238: _SIHDeferredTaskHandler (void); ! 239: ! 240: extern void (*nullInterruptHook)( void ); ! 241: /* ! 242: ** SynchronizationUnAligned.c ! 243: */ ! 244: extern UInt32 UnAlignAddAtomicCount; ! 245: extern UInt32 AddAtomicCount; ! 246: extern UInt32 UnAlignIncrementAtomicCount; ! 247: extern UInt32 IncrementAtomicCount; ! 248: extern UInt32 UnAlignDecrementAtomicCount; ! 249: extern UInt32 DecrementAtomicCount; ! 250: extern UInt32 UnAlignBitOrAtomicCount; ! 251: extern UInt32 BitOrAtomicCount; ! 252: extern UInt32 UnAlignBitAndAtomicCount; ! 253: extern UInt32 BitAndAtomicCount; ! 254: extern UInt32 UnAlignBitXorAtomicCount; ! 255: extern UInt32 BitXorAtomicCount; ! 256: extern UInt32 UnAlignCompareAndSwapCount; ! 257: extern UInt32 CompareAndSwapCount; ! 258: extern UInt32 UnAlignAddByteAtomicCount; ! 259: extern UInt32 AddByteAtomicCount; ! 260: extern UInt32 UnAlignIncrementByteAtomicCount; ! 261: extern UInt32 IncrementByteAtomicCount; ! 262: extern UInt32 UnAlignDecrementByteAtomicCount; ! 263: extern UInt32 DecrementByteAtomicCount; ! 264: extern UInt32 UnAlignAddHalfwordAtomicCount; ! 265: extern UInt32 AddHalfwordAtomicCount; ! 266: extern UInt32 UnAlignIncrementHalfwordAtomicCount; ! 267: extern UInt32 IncrementHalfwordAtomicCount; ! 268: extern UInt32 UnAlignDecrementHalfwordAtomicCount; ! 269: extern UInt32 DecrementHalfwordAtomicCount; ! 270: extern UInt32 UnAlignBitAndAtomic8Count; ! 271: extern UInt32 BitAndAtomic8Count; ! 272: extern UInt32 UnAlignBitOrAtomic8Count; ! 273: extern UInt32 BitOrAtomic8Count; ! 274: extern UInt32 UnAlignBitXorAtomic8Count; ! 275: extern UInt32 BitXorAtomic8Count; ! 276: extern UInt32 UnAlignBitAndAtomic16Count; ! 277: extern UInt32 BitAndAtomic16Count; ! 278: extern UInt32 UnAlignBitOrAtomic16Count; ! 279: extern UInt32 BitOrAtomic16Count; ! 280: extern UInt32 UnAlignBitXorAtomic16Count; ! 281: extern UInt32 BitXorAtomic16Count; ! 282: extern UInt32 UnAlignTestAndSetCount; ! 283: extern UInt32 TestAndSetCount; ! 284: extern UInt32 UnAlignTestAndClearCount; ! 285: extern UInt32 TestAndClearCount; ! 286: /* ! 287: ** Timer.c ! 288: */ ! 289: extern TimerGlobalsPtr gTimer; ! 290: /* ! 291: ** Don't know ! 292: */ ! 293: EXTERN_API_C( void ) ! 294: FlushRange (LogicalAddressLval theLogicalAddress, ! 295: ByteCount theLength); ! 296: ! 297: EXTERN_API_C( void ) ! 298: InvalidateRange (LogicalAddressLval theLogicalAddress, ! 299: ByteCount theLength); ! 300: ! 301: /* ! 302: ** DriverServices.c ! 303: */ ! 304: extern QHdrPtr CreatedSwis; ! 305: extern QHdrPtr AvailableSwis; ! 306: extern Swi_Information *AllSwis; ! 307: /* ! 308: ** InterruptsControl.c ! 309: */ ! 310: EXTERN_API_C( UInt16 ) ! 311: Disable68kInterrupts (void); ! 312: ! 313: EXTERN_API_C( void ) ! 314: Restore68kInterrupts (UInt16 currentSR); ! 315: ! 316: /* ! 317: ** InterruptManagerSAL.c ! 318: */ ! 319: //nagaextern Vector * vectorTable; ! 320: /* ! 321: ** MemoryManagement.c ! 322: */ ! 323: extern Ptr gDeallocateQueueHead; ! 324: extern Ptr gDeallocateQueueTail; ! 325: /* ! 326: ** SecondaryInterrupt.c ! 327: */ ! 328: extern SIHGlobalsPtr gSIH; ! 329: extern UInt32 atSecondaryInterruptLevel; ! 330: extern QHdrPtr Available_SIHsPtr; ! 331: extern QHdrPtr Deferred_SIHsPtr; ! 332: /* ! 333: ** Timing.c ! 334: */ ! 335: typedef AbsoluteTime (*UpTimeProcPtr) (void); ! 336: extern UpTimeProcPtr gUpTimeProc; ! 337: extern AbsoluteTime gElapsedTime; ! 338: extern Boolean gProcessorConversionChanged; ! 339: extern UInt32 gMinAbsoluteTimeDelta; ! 340: extern UInt32 gAbsoluteTimeToNanosecondsNumerator; ! 341: extern UInt32 gAbsoluteTimeToNanosecondsDenominator; ! 342: extern UInt32 gProcessorToAbsoluteTimeNumerator; ! 343: extern UInt32 gProcessorToAbsoluteTimeDenominator; ! 344: EXTERN_API_C( AbsoluteTime ) ! 345: UpTime601 (void); ! 346: ! 347: EXTERN_API_C( AbsoluteTime ) ! 348: UpTimePowerPC (void); ! 349: ! 350: EXTERN_API_C( void ) ! 351: InitializeTiming601 (void); ! 352: ! 353: EXTERN_API_C( void ) ! 354: InitializeTimingPowerPC (void); ! 355: ! 356: EXTERN_API_C( void ) ! 357: SetTimeBaseInfo (UInt32 minAbsoluteTimeDelta, ! 358: UInt32 theAbsoluteTimeToNanosecondNumerator, ! 359: UInt32 theAbsoluteTimeToNanosecondDenominator, ! 360: UInt32 theProcessorToAbsoluteTimeNumerator, ! 361: UInt32 theProcessorToAbsoluteTimeDenominator); ! 362: ! 363: typedef OSStatus (*DelayForHwdrProcPtr)(AbsoluteTime theAbsolute); ! 364: extern DelayForHwdrProcPtr gDelayForHdwrProc; ! 365: EXTERN_API_C( UInt32 ) ! 366: DSLGetProcessorVersion (void); ! 367: ! 368: EXTERN_API_C( OSStatus ) ! 369: DelayForHardwarePPC (AbsoluteTime theAbsolute); ! 370: ! 371: EXTERN_API_C( OSStatus ) ! 372: DelayForHardware601 (AbsoluteTime theAbsolute); ! 373: ! 374: EXTERN_API_C( UInt32 ) ! 375: DeviceProbe32 (UInt32 * theAddress); ! 376: ! 377: EXTERN_API_C( UInt16 ) ! 378: DeviceProbe16 (UInt16 * theAddress); ! 379: ! 380: EXTERN_API_C( UInt8 ) ! 381: DeviceProbe8 (UInt8 * theAddress); ! 382: //naga ! 383: #undef extern ! 384: /*naga ! 385: #if PRAGMA_STRUCT_ALIGN ! 386: #pragma options align=reset ! 387: #elif PRAGMA_STRUCT_PACKPUSH ! 388: #pragma pack(pop) ! 389: #elif PRAGMA_STRUCT_PACK ! 390: #pragma pack() ! 391: #endif ! 392: ! 393: #ifdef PRAGMA_IMPORT_OFF ! 394: #pragma import off ! 395: #elif PRAGMA_IMPORT ! 396: #pragma import reset ! 397: #endif ! 398: ! 399: #ifdef __cplusplus ! 400: } ! 401: #endif ! 402: ! 403: #endif __DRIVERSERVICESPRIV__ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.