Annotation of XNU/iokit/IOKit/firewire/IOFWRegs.h, revision 1.1.1.1

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:        File:           IOFWRegs.h
                     24: 
                     25:        Contains:       Definitions of standard FireWire CSR registers.
                     26: 
                     27:        Version:        1.0
                     28: 
                     29:        Copyright:      � 1996-1999 by Apple Computer, Inc., all rights reserved.
                     30: 
                     31: */
                     32: 
                     33: #ifndef __IOFWREGS_H__
                     34: #define __IOFWREGS_H__
                     35: 
                     36: #ifndef        __IOKIT_IOTYPES_H
                     37: #include <IOKit/IOTypes.h>
                     38: #endif
                     39: 
                     40: // Something we should add to IOTypes?
                     41: //typedef SInt8 *      Ptr;
                     42: //typedef UInt8 Boolean;
                     43: 
                     44: // Generic bit defs.
                     45: 
                     46: enum
                     47: {
                     48:        kBit0                                           = (1 << 0),
                     49:        kBit1                                           = (1 << 1),
                     50:        kBit2                                           = (1 << 2),
                     51:        kBit3                                           = (1 << 3),
                     52:        kBit4                                           = (1 << 4),
                     53:        kBit5                                           = (1 << 5),
                     54:        kBit6                                           = (1 << 6),
                     55:        kBit7                                           = (1 << 7),
                     56:        kBit8                                           = (1 << 8),
                     57:        kBit9                                           = (1 << 9),
                     58:        kBit10                                          = (1 << 10),
                     59:        kBit11                                          = (1 << 11),
                     60:        kBit12                                          = (1 << 12),
                     61:        kBit13                                          = (1 << 13),
                     62:        kBit14                                          = (1 << 14),
                     63:        kBit15                                          = (1 << 15),
                     64:        kBit16                                          = (1 << 16),
                     65:        kBit17                                          = (1 << 17),
                     66:        kBit18                                          = (1 << 18),
                     67:        kBit19                                          = (1 << 19),
                     68:        kBit20                                          = (1 << 20),
                     69:        kBit21                                          = (1 << 21),
                     70:        kBit22                                          = (1 << 22),
                     71:        kBit23                                          = (1 << 23),
                     72:        kBit24                                          = (1 << 24),
                     73:        kBit25                                          = (1 << 25),
                     74:        kBit26                                          = (1 << 26),
                     75:        kBit27                                          = (1 << 27),
                     76:        kBit28                                          = (1 << 28),
                     77:        kBit29                                          = (1 << 29),
                     78:        kBit30                                          = (1 << 30),
                     79:        kBit31                                          = (1 << 31)
                     80: };
                     81: 
                     82: #define BitRange(start, end)                                           \
                     83: (                                                                                                      \
                     84:        ((((UInt32) 0xFFFFFFFF) << (31 - (end))) >>             \
                     85:         ((31 - (end)) + (start))) <<                                   \
                     86:        (start)                                                                                 \
                     87: )
                     88: 
                     89: #define BitRangePhase(start, end)                                      \
                     90:        (start)
                     91: 
                     92: 
                     93: ////////////////////////////////////////////////////////////////////////////////
                     94: //
                     95: // Standard FireWire defs.
                     96: //
                     97: 
                     98: // FireWire bit defs.
                     99: 
                    100: enum
                    101: {
                    102:        kFWBit0                                         = (1 << 31),
                    103:        kFWBit1                                         = (1 << 30),
                    104:        kFWBit2                                         = (1 << 29),
                    105:        kFWBit3                                         = (1 << 28),
                    106:        kFWBit4                                         = (1 << 27),
                    107:        kFWBit5                                         = (1 << 26),
                    108:        kFWBit6                                         = (1 << 25),
                    109:        kFWBit7                                         = (1 << 24),
                    110:        kFWBit8                                         = (1 << 23),
                    111:        kFWBit9                                         = (1 << 22),
                    112:        kFWBit10                                        = (1 << 21),
                    113:        kFWBit11                                        = (1 << 20),
                    114:        kFWBit12                                        = (1 << 19),
                    115:        kFWBit13                                        = (1 << 18),
                    116:        kFWBit14                                        = (1 << 17),
                    117:        kFWBit15                                        = (1 << 16),
                    118:        kFWBit16                                        = (1 << 15),
                    119:        kFWBit17                                        = (1 << 14),
                    120:        kFWBit18                                        = (1 << 13),
                    121:        kFWBit19                                        = (1 << 12),
                    122:        kFWBit20                                        = (1 << 11),
                    123:        kFWBit21                                        = (1 << 10),
                    124:        kFWBit22                                        = (1 << 9),
                    125:        kFWBit23                                        = (1 << 8),
                    126:        kFWBit24                                        = (1 << 7),
                    127:        kFWBit25                                        = (1 << 6),
                    128:        kFWBit26                                        = (1 << 5),
                    129:        kFWBit27                                        = (1 << 4),
                    130:        kFWBit28                                        = (1 << 3),
                    131:        kFWBit29                                        = (1 << 2),
                    132:        kFWBit30                                        = (1 << 1),
                    133:        kFWBit31                                        = (1 << 0)
                    134: };
                    135: 
                    136: #define FWBitRange(start, end)                                         \
                    137: (                                                                                                      \
                    138:        ((((UInt32) 0xFFFFFFFF) << (start)) >>                  \
                    139:         ((start) + (31 - (end)))) <<                                   \
                    140:        (31 - (end))                                                                    \
                    141: )
                    142: 
                    143: #define FWBitRangePhase(start, end)                                    \
                    144:        (31 - end)
                    145: 
                    146: 
                    147: /*zzz Put in IEEE1212.h */
                    148: ////////////////////////////////////////////////////////////////////////////////
                    149: //
                    150: // Define some CSR stuff.
                    151: //
                    152: 
                    153: // CSR bit defs.
                    154: 
                    155: enum
                    156: {
                    157:        kCSRBit0                                        = (1 << 31),
                    158:        kCSRBit1                                        = (1 << 30),
                    159:        kCSRBit2                                        = (1 << 29),
                    160:        kCSRBit3                                        = (1 << 28),
                    161:        kCSRBit4                                        = (1 << 27),
                    162:        kCSRBit5                                        = (1 << 26),
                    163:        kCSRBit6                                        = (1 << 25),
                    164:        kCSRBit7                                        = (1 << 24),
                    165:        kCSRBit8                                        = (1 << 23),
                    166:        kCSRBit9                                        = (1 << 22),
                    167:        kCSRBit10                                       = (1 << 21),
                    168:        kCSRBit11                                       = (1 << 20),
                    169:        kCSRBit12                                       = (1 << 19),
                    170:        kCSRBit13                                       = (1 << 18),
                    171:        kCSRBit14                                       = (1 << 17),
                    172:        kCSRBit15                                       = (1 << 16),
                    173:        kCSRBit16                                       = (1 << 15),
                    174:        kCSRBit17                                       = (1 << 14),
                    175:        kCSRBit18                                       = (1 << 13),
                    176:        kCSRBit19                                       = (1 << 12),
                    177:        kCSRBit20                                       = (1 << 11),
                    178:        kCSRBit21                                       = (1 << 10),
                    179:        kCSRBit22                                       = (1 << 9),
                    180:        kCSRBit23                                       = (1 << 8),
                    181:        kCSRBit24                                       = (1 << 7),
                    182:        kCSRBit25                                       = (1 << 6),
                    183:        kCSRBit26                                       = (1 << 5),
                    184:        kCSRBit27                                       = (1 << 4),
                    185:        kCSRBit28                                       = (1 << 3),
                    186:        kCSRBit29                                       = (1 << 2),
                    187:        kCSRBit30                                       = (1 << 1),
                    188:        kCSRBit31                                       = (1 << 0)
                    189: };
                    190: 
                    191: #define CSRBitRange(start, end)                                                \
                    192: (                                                                                                      \
                    193:        ((((UInt32) 0xFFFFFFFF) << (start)) >>                  \
                    194:         ((start) + (31 - (end)))) <<                                   \
                    195:        (31 - (end))                                                                    \
                    196: )
                    197: 
                    198: #define CSRBitRangePhase(start, end)                           \
                    199:        (31 - end)
                    200: 
                    201: // Core CSR registers.
                    202: 
                    203: enum
                    204: {
                    205:        kCSRStateUnitDepend                     = CSRBitRange (0, 15),
                    206:        kCSRStateUnitDependPhase        = CSRBitRangePhase (0, 15),
                    207: 
                    208:        kCSRStateBusDepend                      = CSRBitRange (16, 23),
                    209:        kCSRStateBusDependPhase         = CSRBitRangePhase (16, 23),
                    210: 
                    211:        kCSRStateLost                           = kCSRBit24,
                    212:        kCSRStateDReq                           = kCSRBit25,
                    213:        kCSRStateELog                           = kCSRBit27,
                    214:        kCSRStateAtn                            = kCSRBit28,
                    215:        kCSRStateOff                            = kCSRBit29,
                    216: 
                    217:        kCSRStateState                          = CSRBitRange (30, 31),
                    218:        kCSRStateStatePhase                     = CSRBitRangePhase (30, 31),
                    219:        kCSRStateStateRunning           = 0,
                    220:        kCSRStateStateInitializing      = 1,
                    221:        kCSRStateStateTesting           = 2,
                    222:        kCSRStateStateDead                      = 3
                    223: };
                    224: 
                    225: // Key values.
                    226: 
                    227: enum
                    228: {
                    229:        kCSRTextualDescriptorKey        = 0x01,
                    230:        kCSRBusDependentInfoKey         = 0x02,
                    231:        kCSRModuleVendorIDKey           = 0x03,
                    232:        kCSRModuleHwVersionKey          = 0x04,
                    233:        kCSRModuleSpecIdKey                     = 0x05,
                    234:        kCSRModuleSwVersionKey          = 0x06,
                    235:        kCSRModuleDependentInfoKey      = 0x07,
                    236:        kCSRNodeVendorIdKey                     = 0x08,
                    237:        kCSRNodeHwVersionKey            = 0x09,
                    238:        kCSRNodeSpecIdKey                       = 0x0A,
                    239:        kCSRNodeSwVersionKey            = 0x0B,
                    240:        kCSRNodeCapabilitiesKey         = 0x0C,
                    241:        kCSRNodeUniqueIdKey                     = 0x0D,
                    242:        kCSRNodeUnitsExtentKey          = 0x0E,
                    243:        kCSRNodeMemoryExtentKey         = 0x0F,
                    244:        kCSRNodeDependentInfoKey        = 0x10,
                    245:        kCSRUnitDirectoryKey            = 0x11,
                    246:        kCSRUnitSpecIdKey                       = 0x12,
                    247:        kCSRUnitSwVersionKey            = 0x13,
                    248:        kCSRUnitDependentInfoKey        = 0x14,
                    249:        kCSRUnitLocationKey                     = 0x15,
                    250:        kCSRUnitPollMaskKey                     = 0x16
                    251: };
                    252: 
                    253: 
                    254: // Key value bits for searching.
                    255: 
                    256: enum
                    257: {
                    258:        kCSREveryKey                            = 0xFFFFFFFF,
                    259: 
                    260:        kCSRTextualDescriptorKeyLoBit   = (1 << kCSRTextualDescriptorKey),
                    261:        kCSRTextualDescriptorKeyHiBit   = 0,
                    262:        kCSRBusDependentInfoKeyLoBit    = (1 << kCSRBusDependentInfoKey),
                    263:        kCSRBusDependentInfoKeyHiBit    = 0,
                    264:        kCSRModuleVendorIDKeyLoBit              = (1 << kCSRModuleVendorIDKey),
                    265:        kCSRModuleVendorIDKeyHiBit              = 0,
                    266:        kCSRModuleHwVersionKeyLoBit             = (1 << kCSRModuleHwVersionKey),
                    267:        kCSRModuleHwVersionKeyHiBit             = 0,
                    268:        kCSRModuleSpecIdKeyLoBit                = (1 << kCSRModuleSpecIdKey),
                    269:        kCSRModuleSpecIdKeyHiBit                = 0,
                    270:        kCSRModuleSwVersionKeyLoBit             = (1 << kCSRModuleSwVersionKey),
                    271:        kCSRModuleSwVersionKeyHiBit             = 0,
                    272:        kCSRModuleDependentInfoKeyLoBit = (1 << kCSRModuleDependentInfoKey),
                    273:        kCSRModuleDependentInfoKeyHiBit = 0,
                    274:        kCSRNodeVendorIdKeyLoBit                = (1 << kCSRNodeVendorIdKey),
                    275:        kCSRNodeVendorIdKeyHiBit                = 0,
                    276:        kCSRNodeHwVersionKeyLoBit               = (1 << kCSRNodeHwVersionKey),
                    277:        kCSRNodeHwVersionKeyHiBit               = 0,
                    278:        kCSRNodeSpecIdKeyLoBit                  = (1 << kCSRNodeSpecIdKey),
                    279:        kCSRNodeSpecIdKeyHiBit                  = 0,
                    280:        kCSRNodeSwVersionKeyLoBit               = (1 << kCSRNodeSwVersionKey),
                    281:        kCSRNodeSwVersionKeyHiBit               = 0,
                    282:        kCSRNodeCapabilitiesKeyLoBit    = (1 << kCSRNodeCapabilitiesKey),
                    283:        kCSRNodeCapabilitiesKeyHiBit    = 0,
                    284:        kCSRNodeUniqueIdKeyLoBit                = (1 << kCSRNodeUniqueIdKey),
                    285:        kCSRNodeUniqueIdKeyHiBit                = 0,
                    286:        kCSRNodeUnitsExtentKeyLoBit             = (1 << kCSRNodeUnitsExtentKey),
                    287:        kCSRNodeUnitsExtentKeyHiBit             = 0,
                    288:        kCSRNodeMemoryExtentKeyLoBit    = (1 << kCSRNodeMemoryExtentKey),
                    289:        kCSRNodeMemoryExtentKeyHiBit    = 0,
                    290:        kCSRNodeDependentInfoKeyLoBit   = (1 << kCSRNodeDependentInfoKey),
                    291:        kCSRNodeDependentInfoKeyHiBit   = 0,
                    292:        kCSRUnitDirectoryKeyLoBit               = (1 << kCSRUnitDirectoryKey),
                    293:        kCSRUnitDirectoryKeyHiBit               = 0,
                    294:        kCSRUnitSpecIdKeyLoBit                  = (1 << kCSRUnitSpecIdKey),
                    295:        kCSRUnitSpecIdKeyHiBit                  = 0,
                    296:        kCSRUnitSwVersionKeyLoBit               = (1 << kCSRUnitSwVersionKey),
                    297:        kCSRUnitSwVersionKeyHiBit               = 0,
                    298:        kCSRUnitDependentInfoKeyLoBit   = (1 << kCSRUnitDependentInfoKey),
                    299:        kCSRUnitDependentInfoKeyHiBit   = 0,
                    300:        kCSRUnitLocationKeyLoBit                = (1 << kCSRUnitLocationKey),
                    301:        kCSRUnitLocationKeyHiBit                = 0,
                    302:        kCSRUnitPollMaskKeyLoBit                = (1 << kCSRUnitPollMaskKey),
                    303:        kCSRUnitPollMaskKeyHiBit                = 0
                    304: };
                    305: 
                    306: 
                    307: // Key types.
                    308: 
                    309: enum
                    310: {
                    311:        kCSRImmediateKeyType            = 0,
                    312:        kCSROffsetKeyType                       = 1,
                    313:        kCSRLeafKeyType                         = 2,
                    314:        kCSRDirectoryKeyType            = 3
                    315: };
                    316: 
                    317: 
                    318: // Key type bits for searching.
                    319: 
                    320: enum
                    321: {
                    322:        kCSREveryKeyType                        = 0xFFFFFFFF,
                    323: 
                    324:        kCSRImmediateKeyTypeBit         = (1 << kCSRImmediateKeyType),
                    325:        kCSROffsetKeyTypeBit            = (1 << kCSROffsetKeyType),
                    326:        kCSRLeafKeyTypeBit                      = (1 << kCSRLeafKeyType),
                    327:        kCSRDirectoryKeyTypeBit         = (1 << kCSRDirectoryKeyType)
                    328: };
                    329: 
                    330: // CSR ROM entry bit locations.
                    331: 
                    332: enum
                    333: {
                    334:        kCSRBusInfoBlockLength          = CSRBitRange (0, 7),
                    335:        kCSRBusInfoBlockLengthPhase     = CSRBitRangePhase (0, 7),
                    336: 
                    337:        kCSRROMCRCLength                        = CSRBitRange (8, 15),
                    338:        kCSRROMCRCLengthPhase           = CSRBitRangePhase (8, 15),
                    339: 
                    340:        kCSRROMCRCValue                         = CSRBitRange (16, 31),
                    341:        kCSRROMCRCValuePhase            = CSRBitRangePhase (16, 31),
                    342: 
                    343:        kCSREntryKeyType                        = CSRBitRange (0, 1),
                    344:        kCSREntryKeyTypePhase           = CSRBitRangePhase (0, 1),
                    345: 
                    346:        kCSREntryKeyValue                       = CSRBitRange (2, 7),
                    347:        kCSREntryKeyValuePhase          = CSRBitRangePhase (2, 7),
                    348: 
                    349:        kCSREntryValue                          = CSRBitRange (8, 31),
                    350:        kCSREntryValuePhase                     = CSRBitRangePhase (8, 31),
                    351: 
                    352:        kCSRLeafDirLength                       = CSRBitRange (0, 15),
                    353:        kCSRLeafDirLengthPhase          = CSRBitRangePhase (0, 15),
                    354: 
                    355:        kCSRLeafDirCRC                          = CSRBitRange (16, 31),
                    356:        kCSRLeafDirCRCPhase                     = CSRBitRangePhase (16, 31)
                    357: };
                    358: 
                    359: // CSR 64-bit fixed address defs.
                    360: 
                    361: enum
                    362: {
                    363:     kCSRNodeID                         = CSRBitRange (0, 15),
                    364:     kCSRNodeIDPhase                    = CSRBitRangePhase (0, 15),
                    365: 
                    366:     kCSRInitialMemorySpaceBaseAddressHi        = 0x00000000,
                    367:     kCSRInitialMemorySpaceBaseAddressLo        = 0x00000000,
                    368: 
                    369:     kCSRPrivateSpaceBaseAddressHi      = 0x0000FFFF,
                    370:     kCSRPrivateSpaceBaseAddressLo      = 0xE0000000,
                    371: 
                    372:     kCSRRegisterSpaceBaseAddressHi     = 0x0000FFFF,
                    373:     kCSRRegisterSpaceBaseAddressLo     = 0xF0000000,
                    374: 
                    375:     kCSRCoreRegistersBaseAddress       = kCSRRegisterSpaceBaseAddressLo,
                    376:     kCSRStateClearAddress              = kCSRCoreRegistersBaseAddress + 0x0000,
                    377:     kCSRStateSetAddress                        = kCSRCoreRegistersBaseAddress + 0x0004,
                    378:     kCSRNodeIDsAddress                 = kCSRCoreRegistersBaseAddress + 0x0008,
                    379:     kCSRResetStartAddress              = kCSRCoreRegistersBaseAddress + 0x000C,
                    380:     kCSRIndirectAddressAddress         = kCSRCoreRegistersBaseAddress + 0x0010,
                    381:     kCSRIndirectDataAddress            = kCSRCoreRegistersBaseAddress + 0x0014,
                    382:     kCSRSplitTimeoutHiAddress          = kCSRCoreRegistersBaseAddress + 0x0018,
                    383:     kCSRSplitTimeoutLoAddress          = kCSRCoreRegistersBaseAddress + 0x001C,
                    384:     kCSRArgumentHiAddress              = kCSRCoreRegistersBaseAddress + 0x0020,
                    385:     kCSRArgumentLoAddress              = kCSRCoreRegistersBaseAddress + 0x0024,
                    386:     kCSRTestStartAddress               = kCSRCoreRegistersBaseAddress + 0x0028,
                    387:     kCSRTestStatusAddress              = kCSRCoreRegistersBaseAddress + 0x002C,
                    388:     kCSRUnitsBaseHiAddress             = kCSRCoreRegistersBaseAddress + 0x0030,
                    389:     kCSRUnitsBaseLoAddress             = kCSRCoreRegistersBaseAddress + 0x0034,
                    390:     kCSRUnitsBoundHiAddress            = kCSRCoreRegistersBaseAddress + 0x0038,
                    391:     kCSRUnitsBoundLoAddress            = kCSRCoreRegistersBaseAddress + 0x003C,
                    392:     kCSRMemoryBaseHiAddress            = kCSRCoreRegistersBaseAddress + 0x0040,
                    393:     kCSRMemoryBaseLoAddress            = kCSRCoreRegistersBaseAddress + 0x0044,
                    394:     kCSRMemoryBoundHiAddress           = kCSRCoreRegistersBaseAddress + 0x0048,
                    395:     kCSRMemoryBoundLoAddress           = kCSRCoreRegistersBaseAddress + 0x004C,
                    396:     kCSRInterruptTargetAddress         = kCSRCoreRegistersBaseAddress + 0x0050,
                    397:     kCSRInterruptMaskAddress           = kCSRCoreRegistersBaseAddress + 0x0054,
                    398:     kCSRClockValueHiAddress            = kCSRCoreRegistersBaseAddress + 0x0058,
                    399:     kCSRClockValueMidAddress           = kCSRCoreRegistersBaseAddress + 0x005C,
                    400:     kCSRClockTickPeriodMidAddress      = kCSRCoreRegistersBaseAddress + 0x0060,
                    401:     kCSRClockTickPeriodLoAddress       = kCSRCoreRegistersBaseAddress + 0x0064,
                    402:     kCSRClockStrobeArrivedHiAddress    = kCSRCoreRegistersBaseAddress + 0x0068,
                    403:     kCSRClockStrobeArrivedMidAddress   = kCSRCoreRegistersBaseAddress + 0x006C,
                    404:     kCSRClockInfo0Address              = kCSRCoreRegistersBaseAddress + 0x0070,
                    405:     kCSRClockInfo1Address              = kCSRCoreRegistersBaseAddress + 0x0074,
                    406:     kCSRClockInfo2Address              = kCSRCoreRegistersBaseAddress + 0x0078,
                    407:     kCSRClockInfo3Address              = kCSRCoreRegistersBaseAddress + 0x007C,
                    408:     kCSRMessageRequestAddress          = kCSRCoreRegistersBaseAddress + 0x0080,
                    409:     kCSRMessageResponseAddress         = kCSRCoreRegistersBaseAddress + 0x00C0,
                    410:     kCSRErrorLogBufferAddress          = kCSRCoreRegistersBaseAddress + 0x0180,
                    411: 
                    412:     kCSRBusDependentRegistersBaseAddress
                    413:                                        = kCSRRegisterSpaceBaseAddressLo + 0x0200,
                    414:     kCSRBusyTimeout                    = kCSRRegisterSpaceBaseAddressLo + 0x0210,
                    415:     kCSRBandwidthAvailable             = kCSRRegisterSpaceBaseAddressLo + 0x0220,
                    416:     kCSRChannelsAvailable31_0          = kCSRRegisterSpaceBaseAddressLo + 0x0224,
                    417:     kCSRChannelsAvailable63_32         = kCSRRegisterSpaceBaseAddressLo + 0x0228,
                    418:     kCSRROMBaseAddress                 = kCSRRegisterSpaceBaseAddressLo + 0x0400,
                    419:     kCSRBIBHeaderAddress               = kCSRROMBaseAddress,
                    420:     kCSRBIBBusNameAddress              = kCSRROMBaseAddress + 4
                    421: };
                    422: 
                    423: 
                    424: // CSR ROM search data types and structures.
                    425: 
                    426: enum {
                    427:        /*
                    428:        ** Absolute locations
                    429:        */
                    430:        kIterateRoot                            = 0x2L,
                    431:        /*
                    432:        ** "Upward" Relationships       
                    433:        */
                    434:        kIterateParents                         = 0x3L,         /* include all  parent(s) of entry */
                    435:        /*
                    436:        ** "Downward" Relationships
                    437:        */
                    438:        kIterateChildren                        = 0x4L,         /* include all children */
                    439:        kIterateSubTrees                        = 0x5L,         /* include all sub trees of entry */
                    440:        kIterateDescendants                     = 0x5L,         /* include all descendants of entry */
                    441:        /*
                    442:        ** "Horizontal" Relationships   
                    443:        */
                    444:        kIterateSibling                         = 0x6L,         /* include all siblings */
                    445:        /*
                    446:        ** Keep doing the same thing
                    447:        */
                    448:        kIterateContinue                        = 0x1L
                    449: };
                    450: 
                    451: enum
                    452: {
                    453:        kInvalidCSRROMIterator          = 0
                    454: };
                    455: 
                    456: enum
                    457: {
                    458:        kCSRROMSearchForKey                     = 1
                    459: };
                    460: 
                    461: enum
                    462: {
                    463:        kInvalidCSRROMEntryType         = 0xFFFFFFFF,
                    464:        kImmediateCSRROMEntryType       = 0,
                    465:        kOffsetCSRROMEntryType          = 1,
                    466:        kLeafCSRROMEntryType            = 2,
                    467:        kDirectoryCSRROMEntryType       = 3
                    468: };
                    469: 
                    470: // CSR defined 64 bit unique ID.
                    471: 
                    472: typedef UInt64 CSRNodeUniqueID;
                    473: typedef CSRNodeUniqueID *CSRNodeUniqueIDPtr;
                    474: 
                    475: typedef UInt32                                 CSRROMEntryIterator;
                    476: typedef UInt32                                 CSRROMIterationOp;
                    477: typedef struct OpaqueCSRROMEntryID*            CSRROMEntryID;
                    478: #define kInvalidCSRROMEntryID ((CSRROMEntryID)0)
                    479: 
                    480: struct CSRROMSearchCriteriaStruct
                    481: {
                    482:        UInt32  csrROMSearchType;       // Type of search record.
                    483:        UInt32  keyType;                // Key types to search for.
                    484:        UInt32  keyHi;                  // Key values to search for.
                    485:         UInt32 keyLo;                  //zzz ought to provide nice way to set these.
                    486: };
                    487: typedef struct CSRROMSearchCriteriaStruct
                    488:        CSRROMSearchCriteria, *CSRROMSearchCriteriaPtr;
                    489: 
                    490: void FWCSRROMDisposeIterator (CSRROMEntryIterator csrROMIterator);
                    491: 
                    492: IOReturn FWCSRROMSetIterator (CSRROMEntryIterator csrROMIterator,
                    493:                        CSRROMEntryID csrROMEntryID, CSRROMIterationOp relationship);
                    494: 
                    495: IOReturn FWCSRROMEntrySearch (CSRROMEntryIterator csrROMIterator, CSRROMIterationOp relationship,
                    496:        CSRROMEntryID *pEntryID, int *pDone, CSRROMSearchCriteriaPtr pSearchCriteria,
                    497:        UInt8 * pEntryValue, UInt32 *pEntrySize);
                    498: 
                    499: /*zzz End put in IEEE1212.h */
                    500: 
                    501: 
                    502: ////////////////////////////////////////////////////////////////////////////////
                    503: //
                    504: // FireWire CSR defs.
                    505: //
                    506: 
                    507: // FireWire core CSR registers.
                    508: 
                    509: enum
                    510: {
                    511:        kFWCSRStateGone                         = kFWBit16,
                    512:        kFWCSRStateLinkOff                      = kFWBit22,
                    513:        kFWCSRStateCMstr                        = kFWBit23
                    514: };
                    515: 
                    516: // FireWire bus/nodeID address defs.
                    517: 
                    518: enum
                    519: {
                    520:        kFWAddressBusID                         = FWBitRange (16, 25) << kCSRNodeIDPhase,
                    521:        kFWAddressBusIDPhase            = FWBitRangePhase (16, 25) + kCSRNodeIDPhase,
                    522: 
                    523:        kFWAddressNodeID                        = FWBitRange (26, 31) << kCSRNodeIDPhase,
                    524:        kFWAddressNodeIDPhase           = FWBitRangePhase (26, 31) + kCSRNodeIDPhase,
                    525: 
                    526:        kFWLocalBusID                           = 1023,
                    527:        kFWBroadcastNodeID                      = 63,
                    528:         kFWBadNodeID                           = 0xffff,
                    529: 
                    530:        kFWLocalBusAddress                      = kFWLocalBusID << kFWAddressBusIDPhase,
                    531:        kFWBroadcastAddress                     = kFWBroadcastNodeID << kFWAddressNodeIDPhase
                    532: };
                    533: 
                    534: #define FWNodeBaseAddress(busID, nodeID)                                                                                               \
                    535: (                                                                                                                                                                              \
                    536:        (busID << kFWAddressBusIDPhase) |                                                                                                       \
                    537:        (nodeID << kFWAddressNodeIDPhase)                                                                                                       \
                    538: )
                    539: 
                    540: #define FWNodeRegisterSpaceBaseAddressHi(busID, nodeID)                                                                        \
                    541: (                                                                                                                                                                              \
                    542:        FWNodeBaseAddress (busID, nodeID) |                                                                                                     \
                    543:        kCSRRegisterSpaceBaseAddressHi                                                                                                          \
                    544: )
                    545: 
                    546: 
                    547: // FireWire CSR bus info block defs.
                    548: 
                    549: enum
                    550: {
                    551:        kFWBIBHeaderAddress                     = kCSRBIBHeaderAddress,
                    552:        kFWBIBBusNameAddress            = kCSRBIBBusNameAddress,
                    553:        kFWBIBNodeCapabilitiesAddress
                    554:                                                                = kCSRROMBaseAddress + 8,
                    555:        kFWBIBNodeUniqueIDHiAddress     = kCSRROMBaseAddress + 12,
                    556:        kFWBIBNodeUniqueIDLoAddress     = kCSRROMBaseAddress + 16,
                    557: 
                    558:        kFWBIBBusName                           = 0x31333934, //'1394'
                    559: 
                    560:        kFWBIBIrmc                                      = kFWBit0,
                    561:        kFWBIBCmc                                       = kFWBit1,
                    562:        kFWBIBIsc                                       = kFWBit2,
                    563:        kFWBIBBmc                                       = kFWBit3,
                    564:        kFWBIBCycClkAcc                         = FWBitRange (8, 15),
                    565:        kFWBIBCycClkAccPhase            = FWBitRangePhase (8, 15),
                    566:        kFWBIBMaxRec                            = FWBitRange (16, 19),
                    567:        kFWBIBMaxRecPhase                       = FWBitRangePhase (16, 19)
                    568: };
                    569: 
                    570: 
                    571: ////////////////////////////////////////////////////////////////////////////////
                    572: //
                    573: // Define some bus management constants.
                    574: //
                    575: enum
                    576: {
                    577:        kFWBusManagerArbitrationTimeoutDuration = 625 // durationMillisecond
                    578: };
                    579: 
                    580: ////////////////////////////////////////////////////////////////////////////////
                    581: //
                    582: // Define some bus characteristics.
                    583: //
                    584: 
                    585: enum
                    586: {
                    587:        kFWMaxBusses                            = 1023,
                    588:        kFWMaxNodesPerBus                       = 63,
                    589:        kFWMaxNodeHops                          = 16
                    590: };
                    591: 
                    592: 
                    593: ////////////////////////////////////////////////////////////////////////////////
                    594: //
                    595: // Packet defs.
                    596: //
                    597: 
                    598: // Phy packet defs.
                    599: 
                    600: enum
                    601: {
                    602:        kFWPhyPacketID                          = FWBitRange (0, 1),
                    603:        kFWPhyPacketIDPhase                     = FWBitRangePhase (0, 1),
                    604: 
                    605:        kFWPhyPacketPhyID                       = FWBitRange (2, 7),
                    606:        kFWPhyPacketPhyIDPhase          = FWBitRangePhase (2, 7)
                    607: };
                    608: 
                    609: enum
                    610: {
                    611:     kSelfIDPacketSize  = 8,
                    612:     kMaxSelfIDs                = 4     // SelfID 0,1,3,8
                    613: };
                    614: 
                    615: enum
                    616: {
                    617:     kFWConfigurationPacketID   = 0,
                    618:     kFWLinkOnPacketID          = 1,
                    619:     kFWSelfIDPacketID          = 2
                    620: };
                    621: 
                    622: enum
                    623: {
                    624:        kFWPhyConfigurationR            = kFWBit8,
                    625:        kFWPhyConfigurationT            = kFWBit9,
                    626:        kFWPhyConfigurationGapCnt       = FWBitRange (10, 15),
                    627:        kFWPhyConfigurationGapCntPhase
                    628:                                                                = FWBitRangePhase (10, 15)
                    629: };
                    630: 
                    631: enum
                    632: {
                    633:        kFWSelfIDPortStatusChild        = 3,
                    634:        kFWSelfIDPortStatusParent       = 2,
                    635:        kFWSelfIDPortStatusNotConnected = 1,
                    636:        kFWSelfIDPortStatusNotPresent   = 0,
                    637: 
                    638:        kFWSelfIDNoPower                        = 0,
                    639:        kFWSelfIDSelfPowered15W         = 1,
                    640:        kFWSelfIDSelfPowered30W         = 2,
                    641:        kFWSelfIDSelfPowered45W         = 3,
                    642:        kFWSelfIDBusPowered1W           = 4,
                    643:        kFWSelfIDBusPowered3W           = 5,
                    644:        kFWSelfIDBusPowered6W           = 6,
                    645:        kFWSelfIDBusPowered10W          = 7,
                    646: 
                    647:        kFWSelfIDPhyID                          = kFWPhyPacketPhyID,//zzz do we need or want this?
                    648:        kFWSelfIDPhyIDPhase                     = kFWPhyPacketPhyIDPhase,
                    649:        kFWSelfIDM                                      = kFWBit31,
                    650: 
                    651:        kFWSelfID0L                                     = kFWBit9,
                    652:        kFWSelfID0GapCnt                        = FWBitRange (10, 15),
                    653:        kFWSelfID0GapCntPhase           = FWBitRangePhase (10, 15),
                    654:        kFWSelfID0SP                            = FWBitRange (16, 17),
                    655:        kFWSelfID0SPPhase                       = FWBitRangePhase (16, 17),
                    656:        kFWSelfID0Del                           = FWBitRange (18, 19),
                    657:        kFWSelfID0DelPhase                      = FWBitRangePhase (18, 19),
                    658:        kFWSelfID0C                                     = kFWBit20,
                    659:        kFWSelfID0Pwr                           = FWBitRange (21, 23),
                    660:        kFWSelfID0PwrPhase                      = FWBitRangePhase (21, 23),
                    661:        kFWSelfID0P0                            = FWBitRange (24, 25),
                    662:        kFWSelfID0P0Phase                       = FWBitRangePhase (24, 25),
                    663:        kFWSelfID0P1                            = FWBitRange (26, 27),
                    664:        kFWSelfID0P1Phase                       = FWBitRangePhase (26, 27),
                    665:        kFWSelfID0P2                            = FWBitRange (28, 29),
                    666:        kFWSelfID0P2Phase                       = FWBitRangePhase (28, 29),
                    667:        kFWSelfID0I                                     = kFWBit30,
                    668: 
                    669:        kFWSelfIDPacketType                     = kFWBit8,
                    670:        kFWSelfIDNN                                     = FWBitRange (9, 11),
                    671:        kFWSelfIDNNPhase                        = FWBitRangePhase (9, 11),
                    672:        kFWSelfIDNPa                            = FWBitRange (14, 15),
                    673:        kFWSelfIDNPaPhase                       = FWBitRangePhase (14, 15),
                    674:        kFWSelfIDNPb                            = FWBitRange (16, 17),
                    675:        kFWSelfIDNPbPhase                       = FWBitRangePhase (16, 17),
                    676:        kFWSelfIDNPc                            = FWBitRange (18, 19),
                    677:        kFWSelfIDNPcPhase                       = FWBitRangePhase (18, 19),
                    678:        kFWSelfIDNPd                            = FWBitRange (20, 21),
                    679:        kFWSelfIDNPdPhase                       = FWBitRangePhase (20, 21),
                    680:        kFWSelfIDNPe                            = FWBitRange (22, 23),
                    681:        kFWSelfIDNPePhase                       = FWBitRangePhase (22, 23),
                    682:        kFWSelfIDNPf                            = FWBitRange (24, 25),
                    683:        kFWSelfIDNPfPhase                       = FWBitRangePhase (24, 25),
                    684:        kFWSelfIDNPg                            = FWBitRange (26, 27),
                    685:        kFWSelfIDNPgPhase                       = FWBitRangePhase (26, 27),
                    686:        kFWSelfIDNPh                            = FWBitRange (28, 29),
                    687:        kFWSelfIDNPhPhase                       = FWBitRangePhase (28, 29),
                    688:        kFWSelfIDMore                           = kFWBit31
                    689: };
                    690: 
                    691: // Primary packet defs.
                    692: enum
                    693: {
                    694:        kFWPacketTCode                          = FWBitRange (24, 27),
                    695:        kFWPacketTCodePhase                     = FWBitRangePhase (24, 27)
                    696: };
                    697: 
                    698: 
                    699: enum
                    700: {
                    701:        kFWAsynchSpd                            = FWBitRange (14, 15),
                    702:        kFWAsynchSpdPhase                       = FWBitRangePhase (14, 15),
                    703: 
                    704:        kFWAsynchTLabel                         = FWBitRange (16, 21),
                    705:        kFWAsynchTLabelPhase            = FWBitRangePhase (16, 21),
                    706:         kFWAsynchTTotal        = ((0xffffffff & kFWAsynchTLabel) >> kFWAsynchTLabelPhase)+1,
                    707:        kFWAsynchRt                                     = FWBitRange (22, 23),
                    708:        kFWAsynchRtPhase                        = FWBitRangePhase (22, 23),
                    709:        kFWAsynchNew                            = 0,
                    710:        kFWAsynchRetryA                         = 2,
                    711:        kTIAsycnhRetryB                         = 3,
                    712: 
                    713:        kFWAsynchPriority                       = FWBitRange (28, 31),
                    714:        kFWAsynchPriorityPhase          = FWBitRangePhase (28, 31),
                    715: 
                    716:        kFWAsynchDestinationID          = FWBitRange (0, 15),
                    717:        kFWAsynchDestinationIDPhase     = FWBitRangePhase (0, 15),
                    718: 
                    719:        kFWAsynchSourceID                       = FWBitRange (0, 15),
                    720:        kFWAsynchSourceIDPhase          = FWBitRangePhase (0, 15),
                    721: 
                    722:        kFWAsynchDestinationOffsetHigh  = FWBitRange (16, 31),
                    723:        kFWAsynchDestinationOffsetHighPhase     = FWBitRangePhase (16, 31),
                    724: 
                    725:        kFWAsynchDestinationOffsetLow   = FWBitRange (0, 31),
                    726:        kFWAsynchDestinationOffsetLowPhase      = FWBitRangePhase (0, 31),
                    727: 
                    728:        kFWAsynchDataLength                     = FWBitRange (0, 15),
                    729:        kFWAsynchDataLengthPhase        = FWBitRangePhase (0, 15),
                    730: 
                    731:        kFWAsynchExtendedTCode          = FWBitRange (16, 31),
                    732:        kFWAsynchExtendedTCodePhase     = FWBitRangePhase (16, 31),
                    733: 
                    734:        kFWAsynchAckSent                        = FWBitRange (28, 31),
                    735:        kFWAsynchAckSentPhase           = FWBitRangePhase (28, 31),
                    736: 
                    737:        kFWAsynchRCode                          = FWBitRange (16, 19),
                    738:        kFWAsynchRCodePhase                     = FWBitRangePhase (16, 19)
                    739: };
                    740: 
                    741: 
                    742: typedef enum
                    743: {
                    744:        kFWSpeed100MBit                         = 0,
                    745:        kFWSpeed200MBit                         = 1,
                    746:        kFWSpeed400MBit                         = 2,
                    747:        kFWSpeedMaximum                         = 0x7FFFFFFF,   //zzz what are the best numbers???
                    748:        kFWSpeedInvalid                         = 0x80000000
                    749: } IOFWSpeed;
                    750: 
                    751: enum
                    752: {
                    753:        kFWTCodeWriteQuadlet            = 0,
                    754:        kFWTCodeWriteBlock                      = 1,
                    755:        kFWTCodeWriteResponse           = 2,
                    756:        kFWTCodeReadQuadlet                     = 4,
                    757:        kFWTCodeReadBlock                       = 5,
                    758:        kFWTCodeReadQuadletResponse     = 6,
                    759:        kFWTCodeReadBlockResponse       = 7,
                    760:        kFWTCodeCycleStart                      = 8,
                    761:        kFWTCodeLock                            = 9,
                    762:        kFWTCodeIsochronousBlock        = 10,
                    763:        kFWTCodeLockResponse            = 11,
                    764:        kFWTCodePHYPacket                       = 14
                    765: };
                    766: 
                    767: enum
                    768: {
                    769:        kFWExtendedTCodeMaskSwap        = 1,
                    770:        kFWExtendedTCodeCompareSwap     = 2,
                    771:        kFWExtendedTCodeFetchAdd        = 3,
                    772:        kFWExtendedTCodeLittleAdd       = 4,
                    773:        kFWExtendedTCodeBoundedAdd      = 5,
                    774:        kFWExtendedTCodeWrapAdd         = 6,
                    775:        kFWExtendedTCodeVendorDependent = 7
                    776: };
                    777: 
                    778: enum
                    779: {
                    780:        kFWResponseComplete             = 0,    // OK!
                    781:        kFWResponseConflictError        = 4,    // Resource conflict, may retry
                    782:        kFWResponseDataError            = 5,    // Data not available
                    783:        kFWResponseTypeError            = 6,    // Operation not supported
                    784:        kFWResponseAddressError         = 7,    // Address not valid in target device
                    785:         kFWResponseBusResetError       = 16    // Psuedo response generated locally
                    786: };
                    787: 
                    788: enum
                    789: {
                    790:         kFWAckTimeout                  = -1,   // Psuedo ack generated locally
                    791:        kFWAckComplete                  = 1,
                    792:        kFWAckPending                   = 2,
                    793:        kFWAckBusyX                     = 4,
                    794:        kFWAckBusyA                     = 5,
                    795:        kFWAckBusyB                     = 6,
                    796:        kFWAckDataError                 = 13,
                    797:        kFWAckTypeError                 = 14
                    798: };
                    799: 
                    800: 
                    801: enum
                    802: {
                    803:        kFWIsochDataLength              = FWBitRange (0, 15),
                    804:        kFWIsochDataLengthPhase         = FWBitRangePhase (0, 15),
                    805:        
                    806:        kFWIsochTag                     = FWBitRange (16, 17),
                    807:        kFWIsochTagPhase                = FWBitRangePhase (16, 17),
                    808: 
                    809:        kFWIsochChanNum                 = FWBitRange (18, 23),
                    810:        kFWIsochChanNumPhase            = FWBitRangePhase (18, 23),
                    811: 
                    812:        kFWIsochTCode                   = FWBitRange (24, 27),
                    813:        kFWIsochTCodePhase              = FWBitRangePhase (24, 27),
                    814: 
                    815:        kFWIsochSy                      = FWBitRange (28, 31),
                    816:        kFWIsochSyPhase                 = FWBitRangePhase (28, 31)
                    817: };
                    818: 
                    819: struct FWAddressStruct
                    820: {
                    821:     UInt16     nodeID;         // bus/node
                    822:     UInt16     addressHi;      // Top 16 bits of node address.
                    823:     UInt32     addressLo;      // Bottom 32 bits of node address
                    824: #ifdef __cplusplus
                    825:     FWAddressStruct(UInt16 h=0xdead, UInt32 l=0xcafebabe) : 
                    826:                        nodeID(0), addressHi(h), addressLo(l) {};
                    827: #endif
                    828: };
                    829: typedef struct FWAddressStruct FWAddress, *FWAddressPtr;
                    830: 
                    831: 
                    832: #define        iokit_fw_err(return) (sys_iokit|sub_iokit_firewire|return)
                    833: #define kIOFireWireResponseBase iokit_fw_err(0x10)     /*  Base of Response error codes  */
                    834: #define kIOFireWireBusReset    (kIOFireWireResponseBase+kFWResponseBusResetError)
                    835:                                                        /*  Bus reset during command execution  */
                    836: 
                    837: //zzz Put in Errors.h
                    838: 
                    839: enum {
                    840:        inUseErr                                        = -4160,                                // Item already in use
                    841:        notFoundErr                                     = -4161,                                // Item not found
                    842:        timeoutErr                                      = -4162,                                // Something timed out
                    843:        busReconfiguredErr                      = -4163,                                // Bus was reconfigured
                    844:        insufficientBandwidthErr        = -4164,                                // Not enough bandwidth was available
                    845:        invalidIDErr                            = -4165,                                // Given ID is not valid.
                    846:        invalidIDTypeErr                        = -4166,                                // Given ID is of an invalid type for the requested operation.
                    847:        accessErr                                       = -4167,                                // Requested access not allowed.
                    848:        alreadyRegisteredErr            = -4168,                        // Item has already been registered.
                    849:        disconnectedErr                         = -4169,                // Target of request has been disconnected.
                    850:        retryExceededErr                        = -4170,                // Retry limit was exceeded.
                    851:        addressRangeErr                         = -4171,                // Address is not in range.
                    852:        addressAlignmentErr                     = -4172,                // Address is not of proper alignment.
                    853: 
                    854:        multipleTalkerErr                       = -4180,                // Tried to install multiple talkers
                    855:        channelActiveErr                        = -4181,                // Operation not permitted when channel is active
                    856:        noListenerOrTalkerErr           = -4182,                        // Every isochronous channel must have one talker and at least
                    857:                                                                        // one listener
                    858:        noChannelsAvailableErr          = -4183,                        // No supported isochronous channels are available
                    859:        channelNotAvailableErr          = -4184,                        // Required channel was not available.
                    860:        invalidIsochPortIDErr           = -4185,                        // An isochronous port ID is invalid.
                    861:        invalidFWReferenceTypeErr       = -4186,                        // Operation does not support type of given reference ID
                    862:        separateBusErr                          = -4187,                // Two or more entities are on two or more busses and cannot be associated with eachother.
                    863:        badSelfIDsErr                           = -4188,                // Received self IDs are bad.
                    864: 
                    865: //zzz Do we own these next ID numbers?
                    866:        cableVoltageTooLowErr           = -4190,                        // Cable power below device's minimum voltage
                    867:        cablePowerInsufficientErr       = -4191                         // Can't grant power request at this time
                    868: };
                    869: 
                    870: // end - Put in Errors.h
                    871: 
                    872: #endif /* __IOFWREGS_H */
                    873: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.