|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 24: * ! 25: * HISTORY ! 26: * ! 27: */ ! 28: ! 29: #ifndef __IOFIREWIREPRIV__ ! 30: #define __IOFIREWIREPRIV__ ! 31: ! 32: //////////////////////////////////////////////////////////////////////////////// ! 33: // ! 34: // Private FireWire defs. ! 35: // ! 36: ! 37: //////////////////////////////////////////////////////////////////////////////// ! 38: // ! 39: // CSR ROM defs. ! 40: // ! 41: ! 42: // Apple specific key values. ! 43: ! 44: enum ! 45: { ! 46: kCSRGenerationKey = 0x38, ! 47: kCSRInvalidKey = 0x39 ! 48: }; ! 49: ! 50: // Defs for local CSR ROM tree entries. ! 51: ! 52: struct CSRROMEntryDataStruct ! 53: { ! 54: struct CSRROMEntryDataStruct // Links to related entries. ! 55: *pParentCSRROMEntryData, ! 56: *pPrevCSRROMEntryData, ! 57: *pNextCSRROMEntryData; ! 58: UInt32 entryType; // Type of entry. ! 59: }; ! 60: typedef struct CSRROMEntryDataStruct ! 61: CSRROMEntryData, ! 62: *CSRROMEntryDataPtr; ! 63: ! 64: struct CSRROMBasicEntryDataStruct ! 65: { ! 66: UInt32 keyValue; // Key value of this entry. ! 67: }; ! 68: typedef struct CSRROMBasicEntryDataStruct ! 69: CSRROMBasicEntryData, ! 70: *CSRROMBasicEntryDataPtr; ! 71: ! 72: struct CSRROMImmediateDataStruct ! 73: { ! 74: CSRROMEntryData csrROMEntryData; // Data common to all CSR ROM entries. ! 75: CSRROMBasicEntryData csrROMBasicEntryData; // Data common to all basic entries. ! 76: UInt32 immediateData; // Data for this entry (only 24-bits worth). ! 77: }; ! 78: typedef struct CSRROMImmediateDataStruct ! 79: CSRROMImmediateData, ! 80: *CSRROMImmediateDataPtr; ! 81: ! 82: struct CSRROMOffsetDataStruct ! 83: { ! 84: CSRROMEntryData csrROMEntryData; // Data common to all CSR ROM entries. ! 85: CSRROMBasicEntryData csrROMBasicEntryData; // Data common to all basic entries. ! 86: UInt32 address; // Lower 32-bits of address of offset entry. ! 87: }; ! 88: typedef struct CSRROMOffsetDataStruct ! 89: CSRROMOffsetData, ! 90: *CSRROMOffsetDataPtr; ! 91: ! 92: struct CSRROMLeafDataStruct ! 93: { ! 94: CSRROMEntryData csrROMEntryData; // Data common to all CSR ROM entries. ! 95: CSRROMBasicEntryData csrROMBasicEntryData; // Data common to all basic entries. ! 96: UInt8 * leafData; // Data for this leaf. ! 97: UInt32 leafDataSize; // Size of above data. ! 98: }; ! 99: typedef struct CSRROMLeafDataStruct ! 100: CSRROMLeafData, ! 101: *CSRROMLeafDataPtr; ! 102: ! 103: struct CSRROMDirectoryDataStruct ! 104: { ! 105: CSRROMEntryData csrROMEntryData; // Data common to all CSR ROM entries. ! 106: CSRROMBasicEntryData csrROMBasicEntryData; // Data common to all basic entries. ! 107: CSRROMEntryDataPtr pChildCSRROMEntryData; // Pointer to first child. ! 108: UInt32 numChildren; // Number of children in this directory. ! 109: }; ! 110: typedef struct CSRROMDirectoryDataStruct ! 111: CSRROMDirectoryData, ! 112: *CSRROMDirectoryDataPtr; ! 113: ! 114: ! 115: // Defs for CSR ROM entry IDs. ! 116: ! 117: enum ! 118: { ! 119: kInvalidCSRROMEntryIDType = 0, ! 120: kLocalCSRROMEntryIDType = 1, ! 121: kRemoteCSRROMEntryIDType = 2 ! 122: }; ! 123: enum ! 124: { ! 125: kCSRROMPathBlockSize = 10 ! 126: }; ! 127: ! 128: ! 129: struct CSRROMEntryIDDataStruct ! 130: { ! 131: UInt32 entryType; // Type of entry ID. ! 132: }; ! 133: typedef struct CSRROMEntryIDDataStruct ! 134: CSRROMEntryIDData, ! 135: *CSRROMEntryIDDataPtr; ! 136: ! 137: struct CSRROMLocalIDDataStruct ! 138: { ! 139: CSRROMEntryIDData csrROMEntryIDData; // Data common to all CSR ROM entry IDs. ! 140: CSRROMEntryDataPtr pCSRROMEntryData; // Pointer to local entry data. ! 141: }; ! 142: typedef struct CSRROMLocalIDDataStruct ! 143: CSRROMLocalIDData, ! 144: *CSRROMLocalIDDataPtr; ! 145: ! 146: struct CSRROMRemoteIDDataStruct ! 147: { ! 148: CSRROMEntryIDData csrROMEntryIDData; // Data common to all CSR ROM entry IDs. ! 149: const UInt32 * data; // pointer to ROM. ! 150: UInt32 physicalPath[kCSRROMPathBlockSize]; ! 151: UInt32 pathSize; // Size of above paths. ! 152: }; ! 153: typedef struct CSRROMRemoteIDDataStruct ! 154: CSRROMRemoteIDData, ! 155: *CSRROMRemoteIDDataPtr; ! 156: ! 157: ! 158: //////////////////////////////////////////////////////////////////////////////// ! 159: // ! 160: // CSR ROM search defs. ! 161: // ! 162: ! 163: struct CSRROMDirectoryEntry ! 164: { ! 165: UInt32 entryAddress; ! 166: UInt32 directoryAddress; ! 167: UInt32 directorySize; ! 168: }; ! 169: typedef struct CSRROMDirectoryEntry ! 170: CSRROMDirectoryEntry, ! 171: *CSRROMDirectoryEntryPtr; ! 172: ! 173: struct CSRROMEntryIteratorRecStruct ! 174: { ! 175: const UInt32 * data; ! 176: UInt32 logicalPath[kCSRROMPathBlockSize]; ! 177: UInt32 physicalPath[kCSRROMPathBlockSize]; ! 178: UInt32 pathSize; ! 179: CSRROMIterationOp relationship; ! 180: bool reset; ! 181: }; ! 182: typedef struct CSRROMEntryIteratorRecStruct ! 183: CSRROMEntryIteratorRec, ! 184: *CSRROMEntryIteratorRecPtr; ! 185: ! 186: ! 187: #if 0 ! 188: //////////////////////////////////////////////////////////////////////////////// ! 189: // PCR defs ! 190: ! 191: enum ! 192: { ! 193: kFWPCRCount = 31, ! 194: kFWPCRSpaceSize = 0xFF, ! 195: kFWInputPCROffset = 0x80, ! 196: kFWPCRBase = 0x0900, ! 197: ! 198: ! 199: kFWPCRAllocated = 1 ! 200: }; ! 201: ! 202: typedef struct ! 203: { ! 204: FWAddressSpaceID addressSpace; ! 205: UInt32 *buffer; ! 206: UInt32 oPCRFlags[kFWPCRCount]; ! 207: UInt32 iPCRFlags[kFWPCRCount]; ! 208: } FWPCRSpaceData, *FWPCRSpaceDataPtr; ! 209: ! 210: #endif ! 211: ! 212: struct FWIRMRegistersStruct ! 213: { ! 214: UInt32 busManagerID; ! 215: UInt32 bandwidthAvailable; ! 216: UInt32 channelsAvailableHi; ! 217: UInt32 channelsAvailableLo; ! 218: }; ! 219: typedef struct FWIRMRegistersStruct FWIRMRegisters, *FWIRMRegistersPtr; ! 220: ! 221: #if 0 ! 222: struct FWIMDataStruct ! 223: { ! 224: FWReferenceData fwReferenceData; // Reference data. ! 225: struct FWIMDataStruct *pPrevFWIMData; // Link to previous FWIM data record. ! 226: struct FWIMDataStruct *pNextFWIMData; // Link to next FWIM data record. ! 227: FWIMID fwimID; // Our ID for the FWIM. ! 228: FWIMPluginDispatchTablePtr pFWIMPluginDispatchTable; // FWIM disaptch table (maybe dummy). ! 229: FWIMPluginDispatchTablePtr pRealFWIMPluginDispatchTable; // Real FWIM disaptch table. ! 230: RegEntryID fwimRegistryID; // Name registry ID of FireWire bus device. ! 231: RegEntryID baseRegistryID; // ID to hang devices off of. ! 232: ! 233: QHdrPtr fwimCommandQueue; // Queue for commands to FWIM. ! 234: QHdrPtr fwimPriorityCommandQueue; // Queue for commands to FWIM. ! 235: QHdrPtr fwimResponseCommandQueue; // Queue for response commands to FWIM. ! 236: QHdrPtr fwCommandQueue; // Queue for commands from FireWire services. ! 237: SInt32 fwCommandSIHQueued; // Number of SIH's we have queued for the FW command queue. ! 238: SInt32 fwimCommandSIHQueued; // Number of SIH's we have queued for the FWIM command queue. ! 239: ! 240: struct FWAddressHeapDataStruct ! 241: fwAddressHeapData; // Address heap. ! 242: ! 243: struct FWDeviceDataStruct *fwDeviceDataList; // Pointer to list of data for all devices ! 244: // controlled by this FWIM. ! 245: struct FWUnitDataStruct *fwUnitDataList; // Pointer to list of data for all units ! 246: // controlled by this FWIM. ! 247: struct FWClientDataStruct *fwClientDataList; // Pointer to list of data for all clients ! 248: // controlled by this FWIM. ! 249: struct FWDriverDataStruct *fwDriverDataList; // Pointer to list of data for all drivers ! 250: // controlled by this FWIM. ! 251: struct FWVDeviceDataStruct *fwVDeviceDataList; // Pointer to lisf of data for all virtual devices ! 252: // controlled by this FWIM. ! 253: struct FWPDriverDataStruct *fwPDriverDataList; // Pointer to list of data for all protocol drivers ! 254: // controlled by this FWIM. ! 255: ! 256: FWTopologyMapPtr pFWTopologyMap; // FireWire bus topology map. ! 257: UInt32 localNodeID; // Local node ID of host adapter. ! 258: FWSpeedMapPtr pFWSpeedMap; // FireWire speed map. ! 259: bool validFWTopologyMapTimerSIHQueued; // True if we've queued an SIH to start the valid topology map ! 260: // timeout timer. ! 261: bool validFWTopologyMapTimeoutResetCommandObjectIDInUse; // True if above command object is in use. ! 262: bool dialogInUse; // True if the dialog is already on screen ! 263: bool needDSAT; // True if we need to put up the dialog ! 264: ! 265: TimerID validFWTopologyMapTimer; // Timer for receiving a valid topology map. ! 266: SInt32 validFWTopologyMapTimersSet; // Number of above timers that have been set. ! 267: FWCommandObjectID validFWTopologyMapTimeoutResetCommandObjectID; // Command object for initiating a bus reset after ! 268: // a valid topology map timeout. ! 269: ! 270: FWDeviceID localFWDeviceID; // Reference to local FireWire device. ! 271: ! 272: FWCommandObjectID resetCommandObjectID; // Command object for resetting bus. ! 273: ! 274: UInt8 * configurationROM; // Storage for configuration ROM. ! 275: CSRROMDirectoryData csrROMRootDirectory; // Local CSR ROM root directory. ! 276: UInt32 csrROMUpdateInProgress; // Non-zero indicates CSR ROM being revised ! 277: ! 278: struct FWDeviceDataStruct *fwDeviceDataAllocation; // Pre-allocated block of device data record. ! 279: struct FWDeviceDataStruct *fwDeviceDataPool; // Pool of pre-allocated device data records. ! 280: ! 281: FWIsochResourceManagerID fwIsochResourceManagerID; // Reference to isochronous resource manager for this FWIM. ! 282: struct FWIsochResourceManagerDataStruct ! 283: *pFWIsochResourceManagerData; // Allocated data for isochronous resource manager. ! 284: FWIRMRegisters fwIRMRegisters; // FireWire isochronous resource manager registers. ! 285: FWCommandObjectID busManagementAsynchCommandObjectID; // Command object used for bus management. ! 286: struct IsochChannelDataStruct ! 287: *isochChannelDataList; // List of isochronous channels operating on this FWIM. ! 288: ! 289: UInt32 csrCoreState; // Value of core CSR state register. ! 290: FWIMCommandResources cmstrFWIMCommandResources; // FWIM command resources for executing cmstr state bit. ! 291: FWIMCommandParams cmstrFWIMCommandParams; // FWIM command params for executing cmstr state bit. ! 292: UInt32 cmstrFWIMCommandParamsInUse; // Lock for cmstrFWIMCommandParams. ! 293: ! 294: FWCommandObjectID fwDeviceScanAsynchCommandObjectID; // Command object for doing device scanning. ! 295: UInt32 fwDeviceScanAsynchCommandObjectIDInUse; // Lock for command object for doing device scanning. ! 296: CSRNodeUniqueID deviceScanUniqueID; // Storage for unique ID for device scan. ! 297: UInt32 deviceScanFiller; //zzz really need a better way to get CSR ROM generation. ! 298: UInt32 deviceScanCSRROMGeneration; // Storage for CSR ROM generation for device scan.//zzz must come afterdeviceScanUniqueID ! 299: UInt32 *pCurrentSelfID; // Pointer to current self ID in device scan. ! 300: UInt32 nextNodeNum; // Next node num in device scan. ! 301: ! 302: FWClientCommandResources resetNotifyFWClientCommandResources; // Resources for notifying clients of bus restes. ! 303: FWClientInterfaceParams resetNotifyFWClientInterfaceParams; // Interface params for notifying clients of bus resets. ! 304: UInt32 resetNotifyFWClientInterfaceParamsInUse; // Lock for resetNotifyFWClientInterfaceParams. ! 305: ! 306: FWClientCommandResources busManagementNotifyFWClientCommandResources; // Resources for notifying clients of bus ! 307: // resets when bus management has been established. ! 308: FWClientInterfaceParams busManagementNotifyFWClientInterfaceParams; // Interface params for notifying clients of bus ! 309: // resets when bus management has been established. ! 310: UInt32 busManagementNotifyFWClientInterfaceParamsInUse; // Lock for busManagementNotifyFWClientInterfaceParams. ! 311: ! 312: QHdrPtr fwimProcessQueue; // Queue for request processing. ! 313: SInt32 fwimProcessSIHQueued; // Number of SIH's we have queued for the FWIM process queue. ! 314: FWIMProcessResourcesPtr fwimProcessResourcesPool; // Pool of resources for processing requests. ! 315: QHdrPtr fwimProcessResourcesInactive; // List of inactive resources for processing requests. ! 316: ! 317: SoftwareInterruptID processBusResetSWIntID; // Software interrupt ID for processing bus resets. ! 318: ! 319: FWIMProcessAsynchParams fwimProcessLocalAsynchParams; // Params for processing local asynch requests. ! 320: FWPCRSpaceData pcrSpaceData; ! 321: FWAddressSpaceID csrAddressSpaceID; // Address space ID for Config ROM ! 322: FWAddressSpaceID irmAddressSpaceID; // ... For Isoch Resource Manager registers ! 323: FWAddressSpaceID coreCSRStateAddressSpaceID; // ... For core CSR state variablers ! 324: FWAddressSpaceID fcpAddressSpaceID; // ... For FCP registers ! 325: ! 326: UInt32 fwimFeatures; // Store feature flags provided by FWIM ! 327: UInt32 fwimCSRROMMapLength; // ... also provided by FWIM ! 328: UInt32 fwimDeciWatts; // Deciwatts provided by hardware ! 329: UInt32 fwimDeciVoltsMinimum; // Minimum decivolts at above load ! 330: UInt32 fwimDeciVoltsMaximum; // Maximum decivolts at no load ! 331: ! 332: UInt32 deciWattsAvailable; // How much local power is not being used ! 333: ! 334: FWAddressSpaceDataPtr fwPhysicalAddressSpaceDataList; // List of Physical allocations ! 335: ! 336: QHdrPtr fwDialogQueue; // Queue of "Hey put that back!" requests. ! 337: DeferredTask dialogDT; // Stupid Secondary Interrupts dont' always do what ! 338: // you want (see FWUIServices.c for gory details) ! 339: ! 340: UInt32 lastLocalSelfIDQuads[16]; // Last local self ID's we saw ! 341: UInt32 lastLocalSelfIDSize; // Last size returned (should never change) ! 342: ! 343: UInt8 retryOnAckDataErrorNodeIDs[64]; ! 344: ! 345: UInt32 fwimSpecificData; // Data specific to FWIM. ! 346: }; ! 347: typedef struct FWIMDataStruct FWIMData, *FWIMDataPtr; ! 348: ! 349: ! 350: ! 351: //////////////////////////////////////////////////////////////////////////////// ! 352: // ! 353: // FireWire device defs. ! 354: // ! 355: ! 356: struct FWDeviceDataStruct ! 357: { ! 358: FWReferenceData fwReferenceData; // Reference data. ! 359: ! 360: struct FWDeviceDataStruct *pPrevFWDeviceData; // Link to previous FireWire device data record ! 361: struct FWDeviceDataStruct *pNextFWDeviceData; // Link to next FireWire device data record ! 362: ! 363: FWIMID fwimID; // ID of our FWIM. ! 364: ! 365: UInt16 processingCommand; ! 366: UInt16 nextCommand; // command and pending command fields ! 367: ! 368: bool newDevice; // True if this device was just created. ! 369: bool scanningDevice; // True if we're still scanning for device. ! 370: bool deviceConnected; // True if device is connected. ! 371: bool driverRequestedReplug; // True if we need the "Hey put that back dialog" ! 372: ! 373: // zzz Need to go through all these structures to make sure everything is aligned right. Why ! 374: // make life difficult for the poor �P? ! 375: ! 376: UInt32 numConnections; // Number of connections to this device. ! 377: ! 378: UInt32 nodeID; // Node ID for this device. ! 379: UInt32 selfIDs[8]; // Self IDs sent by this device. ! 380: UInt32 numSelfIDs; // Number of self IDs above. ! 381: UInt32 csrROMGeneration; // Generation number of CSR ROM. ! 382: CSRNodeUniqueID uniqueID; // ID unique to this device. ! 383: ! 384: UInt32 maxPayloadSize; // Maximum payload size to use for device's bus transactions. ! 385: ! 386: RegEntryID fwDeviceRegistryID; // Name registry ID of FireWire device. ! 387: ! 388: UInt32 minimumDeciVolts; // Minimum volts to operate device ! 389: UInt32 totalDeciWattsAllocated;// Total power previously allocated to device ! 390: UInt32 totalDeciWattsRequested;// Notify device if this becomes available ! 391: UInt32 powerFlags; // Flags for power behavior ! 392: ! 393: bool retryOnAckDataErr; // Violate 1394-1995 and just send the packet again ! 394: }; ! 395: typedef struct FWDeviceDataStruct ! 396: FWDeviceData, ! 397: *FWDeviceDataPtr; ! 398: ! 399: ! 400: //////////////////////////////////////////////////////////////////////////////// ! 401: // ! 402: // FireWire unit defs. ! 403: // ! 404: ! 405: struct FWUnitDataStruct ! 406: { ! 407: FWReferenceData fwReferenceData; // Reference data. ! 408: ! 409: struct FWUnitDataStruct *pPrevFWUnitData; // Link to previous FireWire unit data record ! 410: struct FWUnitDataStruct *pNextFWUnitData; // Link to next FireWire unit data record ! 411: ! 412: FWDeviceID fwDeviceID; // ID of device this unit belongs to. ! 413: CSRROMEntryID csrUnitID; // CSR ROM entry ID of FireWire unit directory. ! 414: UInt32 specID; // Spec ID for this unit. ! 415: UInt32 swVersion; // Software version for this unit. ! 416: RegEntryID unitRegEntryID; // Name registry ID of FireWire unit. ! 417: UInt32 numConnections; // Number of connections to unit. ! 418: ! 419: bool newUnit; // True if this unit was just created. ! 420: bool unitAdded; // True if this unit was just added. ! 421: bool unitConnected; // True if unit is connected. ! 422: }; ! 423: typedef struct FWUnitDataStruct FWUnitData, ! 424: *FWUnitDataPtr; ! 425: ! 426: #endif ! 427: ! 428: //////////////////////////////////////////////////////////////////////////////// ! 429: // ! 430: // Private FireWire Services procedure defs. ! 431: // ! 432: ! 433: UInt16 FWComputeCRC16 (UInt32 *pQuads, UInt32 numQuads); ! 434: ! 435: CSRROMEntryID FWCSRROMCreateEntryID(void); ! 436: void FWCSRROMInvalidateEntryIDType(CSRROMEntryID csrROMEntryID); ! 437: void FWCSRROMDisposeEntryID(CSRROMEntryID csrROMEntryID); ! 438: ! 439: #endif /* __IOFIREWIREPRIV__ */ ! 440:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.