Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/firewire/IOFireWireFamilyCommon.h

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 * IOFireWireFamilyCommon.h
24 * IOFireWireUserClient/IOFireWireFamily
25 *
26 * Created by NWG on Fri Apr 28 2000.
27 * Copyright (c) 2000-2001 Apple Computer, Inc. All rights reserved.
28 *
29 */
30/*
31$Log: IOFireWireFamilyCommon.h,v $
32Revision 1.79 2008/07/15 01:29:44 collin
33<rdar://problem/5859733> & <rdar://problem/5843668>
34
35Revision 1.78 2008/05/08 02:33:22 collin
36more K64
37
38Revision 1.77 2008/04/24 00:01:39 collin
39more K640
40
41Revision 1.76 2007/12/05 04:52:08 collin
42integrate chex workaround
43
44Revision 1.75 2007/08/31 20:29:06 collin
45fixed 5437835
46
47Revision 1.74 2007/04/24 21:40:23 arulchan
48headerdoc changes
49
50Revision 1.73 2007/04/24 21:28:24 arulchan
51changes for headerdoc
52
53Revision 1.72 2007/04/13 19:37:01 calderon
54Integrated FireWireKPrintf implemented
55
56Revision 1.71 2007/03/14 18:41:43 collin
57*** empty log message ***
58
59Revision 1.70 2007/02/28 23:10:13 ayanowit
60Another IRMAllocation fix.
61
62Revision 1.69 2007/02/20 01:25:28 collin
63*** empty log message ***
64
65Revision 1.68 2007/02/17 00:26:51 collin
66*** empty log message ***
67
68Revision 1.67 2007/02/15 19:42:07 ayanowit
69For 4369537, eliminated support for legacy DCL SendPacketWithHeader, since it didn't work anyway, and NuDCL does support it.
70
71Revision 1.66 2007/02/15 01:23:39 arulchan
72changes in AssignCycleMaster
73
74Revision 1.65 2007/02/09 04:44:06 collin
75*** empty log message ***
76
77Revision 1.64 2007/01/26 20:52:31 ayanowit
78changes to user-space isoch stuff to support 64-bit apps.
79
80Revision 1.63 2007/01/16 01:41:02 gecko1
814159728 Add improved async lock based check for bad IRMs
82
83Revision 1.62 2007/01/15 23:29:05 arulchan
84Fixed Skipped Packet Handler Notifications
85
86Revision 1.61 2007/01/12 22:15:14 arulchan
87Added flag kIOFWEnableBeingRoot
88
89Revision 1.60 2007/01/10 22:14:44 calderon
90Fixed 4046607 Propagate vendor/model from IIDC UnitDepedantInfoDir
91Fixed some null termination shinanigans in getIndexValue(string)
92
93Revision 1.59 2007/01/08 18:47:19 ayanowit
94More 64-bit changes for isoch.
95
96Revision 1.58 2006/07/07 20:18:25 calderon
974227201: SpeedMap and HopCount table reductions.
98
99Revision 1.57 2006/04/03 21:29:48 collin
100*** empty log message ***
101
102Revision 1.56 2006/02/09 00:21:51 niels
103merge chardonnay branch to tot
104
105Revision 1.55.4.1 2005/08/06 01:31:31 collin
106*** empty log message ***
107
108Revision 1.55 2005/03/12 03:27:51 collin
109*** empty log message ***
110
111Revision 1.54 2005/01/12 06:34:53 collin
112*** empty log message ***
113
114Revision 1.53 2004/05/04 22:52:19 niels
115*** empty log message ***
116
117Revision 1.52 2004/03/26 01:42:53 gecko1
118Add code to disable any port directly connected to an iPod when we go to sleep.
119
120Revision 1.51 2004/03/05 00:33:59 calderon
121Fixed 3570909 - FireWire - iokit_fw_errs should be defined in hex
122All decimal #define errors in header changed to hex
123
124Revision 1.50 2003/11/07 21:01:18 niels
125Revision 1.49 2003/10/21 01:16:41 collin
126Revision 1.48 2003/10/17 00:25:24 collin
127Revision 1.47 2003/10/15 02:19:45 collin
128Revision 1.46 2003/07/22 10:49:47 niels
129Revision 1.45 2003/07/21 06:52:59 niels
130merge isoch to TOT
131
132Revision 1.44.4.5 2003/07/21 06:44:44 niels
133Revision 1.44.4.4 2003/07/18 00:17:42 niels
134Revision 1.44.4.3 2003/07/14 22:08:53 niels
135Revision 1.44.4.2 2003/07/09 21:24:01 niels
136Revision 1.44.4.1 2003/07/01 20:54:07 niels
137isoch merge
138
139Revision 1.44 2003/03/17 01:05:22 collin
140Revision 1.43 2003/03/07 01:26:06 collin
141Revision 1.42 2003/02/19 22:33:17 niels
142add skip cycle DCL
143
144Revision 1.41 2003/02/18 00:14:01 collin
145Revision 1.40 2003/02/17 21:47:52 collin
146Revision 1.39 2002/12/05 19:08:37 niels
147remove trailing commas from enums in IOFireWireFamilyCommon.h
148
149Revision 1.38 2002/11/01 20:45:57 collin
150add enhanced IRM with support for the BROADCAST_CHANNEL register
151
152Revision 1.37 2002/10/01 02:40:27 collin
153security mode support
154
155Revision 1.36 2002/09/25 21:17:14 collin
156fix headers again.
157
158Revision 1.35 2002/09/25 00:27:23 niels
159flip your world upside-down
160
161Revision 1.34 2002/09/12 22:41:53 niels
162add GetIRMNodeID() to user client
163
164*/
165
166/*! @header IOFireWireFamilyCommon.h
167This file contains useful definitions for working with FireWire
168in the kernel and in user space
169*/
170
171#ifndef __IOFireWireFamilyCommon_H__
172#define __IOFireWireFamilyCommon_H__
173
174#ifdef KERNEL
175#ifndef __IOKIT_IOTYPES_H
176#include <IOKit/IOTypes.h>
177#endif
178#else
179#include <IOKit/IOKitLib.h>
180#endif
181
182//#define LEGACY_SHUTDOWN
183
184#define FW_OLD_DCL_DEFS
185#define FW_OLD_BIT_DEFS
186
187// =================================================================
188// bit ranges and fields
189// =================================================================
190#pragma mark -
191#pragma mark BITS
192
193// FireWire bit defs.
194
195#define BIT(x)( 1 << (x) )
196#define FW_BIT(x)( 1 << (31 - (x) ) )
197
198#define FWBitRange(start, end)\
199(\
200((((UInt32) 0xFFFFFFFF) << (start)) >>\
201 ((start) + (31 - (end)))) <<\
202(31 - (end))\
203)
204
205#define FWBitRangePhase(start, end)\
206(31 - (end))
207
208#define BitRange(start, end)\
209(\
210((((UInt32) 0xFFFFFFFF) << (31 - (end))) >>\
211 ((31 - (end)) + (start))) <<\
212(start)\
213)
214
215
216#define BitRangePhase(start, end)\
217(start)
218
219// =================================================================
220// FireWire messages & errors
221// =================================================================
222#pragma mark -
223#pragma mark MESSAGES AND ERRORS
224
225#defineiokit_fw_err(return) (sys_iokit|sub_iokit_firewire|return)
226
227// e0008010 -> 0xe000801f Response codes from response packets
228
229// Base of Response error codes
230#define kIOFireWireResponseBaseiokit_fw_err(0x10)
231
232// e0008020 -- Bus reset during command execution (current bus generation does
233// not match that specified in command.)
234#define kIOFireWireBusReset(kIOFireWireResponseBase+kFWResponseBusResetError)
235
236// e0008001 -- Can't find requested entry in ROM
237#define kIOConfigNoEntryiokit_fw_err(0x1)
238
239// e0008002 -- In pending queue waiting to execute
240#define kIOFireWirePendingiokit_fw_err(0x2)
241
242// e0008003 -- Last DCL callback of program (internal use)
243#define kIOFireWireLastDCLTokeniokit_fw_err(0x3)
244
245// e0008004
246#define kIOFireWireConfigROMInvalidiokit_fw_err(0x4)
247
248// e0008005
249#define kIOFireWireAlreadyRegisterediokit_fw_err(0x5)
250
251// e0008006
252#define kIOFireWireMultipleTalkersiokit_fw_err(0x6)
253
254// e0008007
255#define kIOFireWireChannelActiveiokit_fw_err(0x7)
256
257// e0008008
258#define kIOFireWireNoListenerOrTalkeriokit_fw_err(0x8)
259
260// e0008009
261#define kIOFireWireNoChannelsiokit_fw_err(0x9)
262
263// e000800A
264#define kIOFireWireChannelNotAvailableiokit_fw_err(0xA)
265
266// e000800B
267#define kIOFireWireSeparateBusiokit_fw_err(0xB)
268
269// e000800C
270#define kIOFireWireBadSelfIDsiokit_fw_err(0xC)
271
272// e000800D
273#define kIOFireWireLowCableVoltageiokit_fw_err(0xD)
274
275// e000800E
276#define kIOFireWireInsufficientPoweriokit_fw_err(0xE)
277
278// e000800f
279#define kIOFireWireOutOfTLabelsiokit_fw_err(0xF)
280
281
282
283// e0008101
284#define kIOFireWireBogusDCLProgramiokit_fw_err(0x101)
285
286// e0008102
287#define kIOFireWireTalkingAndListeningiokit_fw_err(0x102)
288
289// e0008103
290#define kIOFireWireHardwareSleptiokit_fw_err(0x103)
291
292// e0008104// let's resume here...
293
294// e0008104 -- In the middle of completing
295#define kIOFireWireCompletingiokit_fw_err(0x104)
296
297// e0008105 -- Invalid Response Length
298#define kIOFireWireInvalidResponseLengthiokit_fw_err(0x105)
299
300// e0008106 -- Isoch Bandwidth Not Available
301#define kIOFireWireIsochBandwidthNotAvailableiokit_fw_err(0x106)
302
303
304// e00087d0
305#define kIOFWMessageServiceIsRequestingClose (UInt32)iokit_fw_err(0x7D0)
306#define kIOFWMessagePowerStateChanged (UInt32)iokit_fw_err(0x7D1)
307#define kIOFWMessageTopologyChanged(UInt32)iokit_fw_err(0x7D2)
308// =================================================================
309// Pseudo address space response codes
310// =================================================================
311#pragma mark -
312#pragma mark PSEDUO ADDRESS SPACE RESPONSE CODES
313enum
314{
315kFWResponseComplete= 0,// OK!
316kFWResponseConflictError= 4,// Resource conflict, may retry
317kFWResponseDataError= 5,// Data not available
318kFWResponseTypeError= 6,// Operation not supported
319kFWResponseAddressError= 7,// Address not valid in target device
320kFWResponseBusResetError= 16,// Pseudo response generated locally
321kFWResponsePending= 17// Pseudo response, real response sent later.
322};
323
324//
325// Pseudo address space response codes
326//
327enum
328{
329kFWAckTimeout= -1,// Pseudo ack generated locally
330kFWAckComplete= 1,
331kFWAckPending= 2,
332kFWAckBusyX= 4,
333kFWAckBusyA= 5,
334kFWAckBusyB= 6,
335kFWAckDataError= 13,
336kFWAckTypeError= 14
337};
338
339// =================================================================
340// FireWire bus speed numbers
341// =================================================================
342#pragma mark -
343#pragma mark BUS SPEED NUMBERS
344
345typedef enum
346{
347kFWSpeed100MBit= 0,
348kFWSpeed200MBit= 1,
349kFWSpeed400MBit= 2,
350kFWSpeed800MBit= 3,
351kFWSpeedReserved= 3,// In all cases, 1394B Devices report this speed,
352// each port of the PHY could be different
353
354kFWSpeedUnknownMask= 0x80,// If speed was reserved and we haven't probed it further
355
356kFWSpeedMaximum= 0x7FFFFFFF,
357kFWSpeedInvalid= 0x80000000
358} IOFWSpeed;
359
360// =================================================================
361// FWAddress
362// =================================================================
363#pragma mark -
364#pragma mark FWADDRESS
365//
366// The venerable FWAddress structure. This is the standard
367// struct to use for passing FireWire addresses.
368//
369
370typedef struct FWAddressStruct
371{
372 UInt16nodeID;// bus/node
373 UInt16addressHi;// Top 16 bits of node address.
374 UInt32addressLo;// Bottom 32 bits of node address
375
376//
377// Useful C++ only constructors
378//
379#ifdef __cplusplus
380FWAddressStruct(const FWAddressStruct & a):
381nodeID(a.nodeID), addressHi(a.addressHi), addressLo(a.addressLo) {};
382 FWAddressStruct(UInt16 h=0xdead, UInt32 l=0xcafebabe) :
383nodeID(0), addressHi(h), addressLo(l) {};
384FWAddressStruct(UInt16 h, UInt32 l, UInt16 n) :
385nodeID(n), addressHi(h), addressLo(l) {};
386#endif
387} FWAddress, *FWAddressPtr ;
388
389// =================================================================
390// Config ROM
391// =================================================================
392#pragma mark -
393#pragma mark CONFIG ROM
394
395//
396// CSR bit defs.
397//
398
399#define CSR_BIT(x) FW_BIT(x)
400
401#define CSRBitRange(start, end)\
402(\
403((((UInt32) 0xFFFFFFFF) << (start)) >>\
404((start) + (31 - (end)))) <<\
405(31 - (end))\
406)
407
408#define CSRBitRangePhase(start, end)\
409(31 - end)
410
411//
412// Key types.
413//
414
415typedef enum
416{
417kConfigImmediateKeyType= 0,
418kConfigOffsetKeyType= 1,
419kConfigLeafKeyType= 2,
420kConfigDirectoryKeyType= 3,
421kInvalidConfigROMEntryType= 0xff
422} IOConfigKeyType;
423
424//
425// Key values.
426//
427
428enum
429{
430kConfigTextualDescriptorKey= 0x01,
431kConfigBusDependentInfoKey= 0x02,
432kConfigModuleVendorIdKey= 0x03,
433kConfigModuleHwVersionKey= 0x04,
434kConfigModuleSpecIdKey= 0x05,
435kConfigModuleSwVersionKey= 0x06,
436kConfigModuleDependentInfoKey= 0x07,
437kConfigNodeVendorIdKey= 0x08,
438kConfigNodeHwVersionKey= 0x09,
439kConfigNodeSpecIdKey= 0x0A,
440kConfigNodeSwVersionKey= 0x0B,
441kConfigNodeCapabilitiesKey= 0x0C,
442kConfigNodeUniqueIdKey= 0x0D,
443kConfigNodeUnitsExtentKey= 0x0E,
444kConfigNodeMemoryExtentKey= 0x0F,
445kConfigNodeDependentInfoKey= 0x10,
446kConfigUnitDirectoryKey= 0x11,
447kConfigUnitSpecIdKey= 0x12,
448kConfigUnitSwVersionKey= 0x13,
449kConfigUnitDependentInfoKey= 0x14,
450kConfigUnitLocationKey= 0x15,
451kConfigUnitPollMaskKey= 0x16,
452kConfigModelIdKey= 0x17,
453kConfigGenerationKey= 0x38,// Apple-specific
454
455kConfigRootDirectoryKey= 0xffff// Not a real key
456};
457
458enum
459{
460kConfigSBP2LUN= 0x14,
461kConfigSBP2Revision= 0x21,
462kConfigSBP2MAO= 0x54
463};
464
465// Core CSR registers.
466enum
467{
468kCSRStateUnitDepend= CSRBitRange(0, 15),
469kCSRStateUnitDependPhase= CSRBitRangePhase(0, 15),
470
471kCSRStateBusDepend= CSRBitRange(16, 23),
472kCSRStateBusDependPhase= CSRBitRangePhase(16, 23),
473
474kCSRStateLost= CSR_BIT(24),
475kCSRStateDReq= CSR_BIT(25),
476kCSRStateELog= CSR_BIT(27),
477kCSRStateAtn= CSR_BIT(28),
478kCSRStateOff= CSR_BIT(29),
479
480kCSRStateState= CSRBitRange(30, 31),
481kCSRStateStatePhase= CSRBitRangePhase(30, 31),
482kCSRStateStateRunning= 0,
483kCSRStateStateInitializing= 1,
484kCSRStateStateTesting= 2,
485kCSRStateStateDead= 3
486};
487
488// Config ROM entry bit locations.
489
490enum
491{
492kConfigBusInfoBlockLength= CSRBitRange (0, 7),
493kConfigBusInfoBlockLengthPhase= CSRBitRangePhase (0, 7),
494
495kConfigROMCRCLength= CSRBitRange (8, 15),
496kConfigROMCRCLengthPhase= CSRBitRangePhase (8, 15),
497
498kConfigROMCRCValue= CSRBitRange (16, 31),
499kConfigROMCRCValuePhase= CSRBitRangePhase (16, 31),
500
501kConfigEntryKeyType= CSRBitRange (0, 1),
502kConfigEntryKeyTypePhase= CSRBitRangePhase (0, 1),
503
504kConfigEntryKeyValue= CSRBitRange (2, 7),
505kConfigEntryKeyValuePhase= CSRBitRangePhase (2, 7),
506
507kConfigEntryValue= CSRBitRange (8, 31),
508kConfigEntryValuePhase= CSRBitRangePhase (8, 31),
509
510kConfigLeafDirLength= CSRBitRange (0, 15),
511kConfigLeafDirLengthPhase= CSRBitRangePhase (0, 15),
512
513kConfigLeafDirCRC= CSRBitRange (16, 31),
514kConfigLeafDirCRCPhase= CSRBitRangePhase (16, 31)
515};
516
517//
518// Key types.
519//
520typedef enum
521{
522kCSRImmediateKeyType= 0,
523kCSROffsetKeyType= 1,
524kCSRLeafKeyType= 2,
525kCSRDirectoryKeyType= 3,
526 kInvalidCSRROMEntryType= 0xff
527} IOCSRKeyType;
528
529// CSR 64-bit fixed address defs.
530
531enum
532{
533kCSRNodeID= CSRBitRange (0, 15),
534kCSRNodeIDPhase= CSRBitRangePhase (0, 15),
535
536kCSRInitialMemorySpaceBaseAddressHi= 0x00000000,
537kCSRInitialMemorySpaceBaseAddressLo= 0x00000000,
538
539kCSRPrivateSpaceBaseAddressHi= 0x0000FFFF,
540kCSRPrivateSpaceBaseAddressLo= 0xE0000000,
541
542kCSRRegisterSpaceBaseAddressHi= 0x0000FFFF,
543kCSRRegisterSpaceBaseAddressLo= 0xF0000000,
544
545kCSRCoreRegistersBaseAddress= kCSRRegisterSpaceBaseAddressLo,
546kCSRStateClearAddress= kCSRCoreRegistersBaseAddress + 0x0000,
547kCSRStateSetAddress= kCSRCoreRegistersBaseAddress + 0x0004,
548kCSRNodeIDsAddress= kCSRCoreRegistersBaseAddress + 0x0008,
549kCSRResetStartAddress= kCSRCoreRegistersBaseAddress + 0x000C,
550kCSRIndirectAddressAddress= kCSRCoreRegistersBaseAddress + 0x0010,
551kCSRIndirectDataAddress= kCSRCoreRegistersBaseAddress + 0x0014,
552kCSRSplitTimeoutHiAddress= kCSRCoreRegistersBaseAddress + 0x0018,
553kCSRSplitTimeoutLoAddress= kCSRCoreRegistersBaseAddress + 0x001C,
554kCSRArgumentHiAddress= kCSRCoreRegistersBaseAddress + 0x0020,
555kCSRArgumentLoAddress= kCSRCoreRegistersBaseAddress + 0x0024,
556kCSRTestStartAddress= kCSRCoreRegistersBaseAddress + 0x0028,
557kCSRTestStatusAddress= kCSRCoreRegistersBaseAddress + 0x002C,
558kCSRUnitsBaseHiAddress= kCSRCoreRegistersBaseAddress + 0x0030,
559kCSRUnitsBaseLoAddress= kCSRCoreRegistersBaseAddress + 0x0034,
560kCSRUnitsBoundHiAddress= kCSRCoreRegistersBaseAddress + 0x0038,
561kCSRUnitsBoundLoAddress= kCSRCoreRegistersBaseAddress + 0x003C,
562kCSRMemoryBaseHiAddress= kCSRCoreRegistersBaseAddress + 0x0040,
563kCSRMemoryBaseLoAddress= kCSRCoreRegistersBaseAddress + 0x0044,
564kCSRMemoryBoundHiAddress= kCSRCoreRegistersBaseAddress + 0x0048,
565kCSRMemoryBoundLoAddress= kCSRCoreRegistersBaseAddress + 0x004C,
566kCSRInterruptTargetAddress= kCSRCoreRegistersBaseAddress + 0x0050,
567kCSRInterruptMaskAddress= kCSRCoreRegistersBaseAddress + 0x0054,
568kCSRClockValueHiAddress= kCSRCoreRegistersBaseAddress + 0x0058,
569kCSRClockValueMidAddress= kCSRCoreRegistersBaseAddress + 0x005C,
570kCSRClockTickPeriodMidAddress= kCSRCoreRegistersBaseAddress + 0x0060,
571kCSRClockTickPeriodLoAddress= kCSRCoreRegistersBaseAddress + 0x0064,
572kCSRClockStrobeArrivedHiAddress= kCSRCoreRegistersBaseAddress + 0x0068,
573kCSRClockStrobeArrivedMidAddress= kCSRCoreRegistersBaseAddress + 0x006C,
574kCSRClockInfo0Address= kCSRCoreRegistersBaseAddress + 0x0070,
575kCSRClockInfo1Address= kCSRCoreRegistersBaseAddress + 0x0074,
576kCSRClockInfo2Address= kCSRCoreRegistersBaseAddress + 0x0078,
577kCSRClockInfo3Address= kCSRCoreRegistersBaseAddress + 0x007C,
578kCSRMessageRequestAddress= kCSRCoreRegistersBaseAddress + 0x0080,
579kCSRMessageResponseAddress= kCSRCoreRegistersBaseAddress + 0x00C0,
580kCSRErrorLogBufferAddress= kCSRCoreRegistersBaseAddress + 0x0180,
581
582kCSRBusDependentRegistersBaseAddress= kCSRRegisterSpaceBaseAddressLo + 0x0200,
583kCSRBusyTimeout= kCSRRegisterSpaceBaseAddressLo + 0x0210,
584kCSRBusManagerID= kCSRRegisterSpaceBaseAddressLo + 0x021C,
585kCSRBandwidthAvailable= kCSRRegisterSpaceBaseAddressLo + 0x0220,
586kCSRChannelsAvailable31_0= kCSRRegisterSpaceBaseAddressLo + 0x0224,
587kCSRChannelsAvailable63_32= kCSRRegisterSpaceBaseAddressLo + 0x0228,
588kCSRBroadcastChannel= kCSRRegisterSpaceBaseAddressLo + 0x0234,
589
590kConfigROMBaseAddress= kCSRRegisterSpaceBaseAddressLo + 0x0400,
591kConfigBIBHeaderAddress= kConfigROMBaseAddress,
592kConfigBIBBusNameAddress= kConfigROMBaseAddress + 4,
593
594kPCRBaseAddress= kCSRRegisterSpaceBaseAddressLo + 0x900,
595kFCPCommandAddress= kCSRRegisterSpaceBaseAddressLo + 0xb00,
596kFCPResponseAddress= kCSRRegisterSpaceBaseAddressLo + 0xd00
597};
598
599// from figure 10-7 of 1394a
600#define kBroadcastChannelInitialValues 0x8000001f
601#define kBroadcastChannelValidMask 0x40000000
602
603// CSR defined 64 bit unique ID.
604
605typedef UInt64 CSRNodeUniqueID;
606
607// FireWire core CSR registers.
608
609enum
610{
611kFWCSRStateGone= FW_BIT(16),
612kFWCSRStateLinkOff= FW_BIT(22),
613kFWCSRStateCMstr= FW_BIT(23)
614};
615
616// FireWire bus/nodeID address defs.
617
618enum
619{
620kFWAddressBusID= FWBitRange (16, 25) << kCSRNodeIDPhase,
621kFWAddressBusIDPhase= FWBitRangePhase (16, 25) + kCSRNodeIDPhase,
622
623kFWAddressNodeID= FWBitRange (26, 31) << kCSRNodeIDPhase,
624kFWAddressNodeIDPhase= FWBitRangePhase (26, 31) + kCSRNodeIDPhase,
625
626kFWLocalBusID= 1023,
627kFWBroadcastNodeID= 63,
628kFWBadNodeID= 0xffff,
629
630kFWLocalBusAddress= kFWLocalBusID << kFWAddressBusIDPhase,
631kFWBroadcastAddress= kFWBroadcastNodeID << kFWAddressNodeIDPhase
632};
633
634#define FWNodeBaseAddress(busID, nodeID)\
635(\
636(busID << kFWAddressBusIDPhase) |\
637(nodeID << kFWAddressNodeIDPhase)\
638)
639
640#define FWNodeRegisterSpaceBaseAddressHi(busID, nodeID)\
641(\
642FWNodeBaseAddress (busID, nodeID) |\
643kCSRRegisterSpaceBaseAddressHi\
644)
645
646// FireWire CSR bus info block defs.
647
648enum
649{
650kFWBIBHeaderAddress= kConfigBIBHeaderAddress,
651kFWBIBBusNameAddress= kConfigBIBBusNameAddress,
652kFWBIBNodeCapabilitiesAddress= kConfigROMBaseAddress + 8,
653kFWBIBNodeUniqueIDHiAddress= kConfigROMBaseAddress + 12,
654kFWBIBNodeUniqueIDLoAddress= kConfigROMBaseAddress + 16,
655
656kFWBIBBusName= 0x31333934, //'1394'
657
658kFWBIBIrmc= FW_BIT(0),
659kFWBIBCmc= FW_BIT(1),
660kFWBIBIsc= FW_BIT(2),
661kFWBIBBmc= FW_BIT(3),
662kFWBIBCycClkAcc= FWBitRange (8, 15),
663kFWBIBCycClkAccPhase= FWBitRangePhase (8, 15),
664kFWBIBMaxRec= FWBitRange (16, 19),
665kFWBIBMaxRecPhase= FWBitRangePhase (16, 19),
666kFWBIBMaxROM= FWBitRange (20, 21),
667kFWBIBMaxROMPhase= FWBitRangePhase (20, 21),
668kFWBIBGeneration= FWBitRange (24, 27),
669kFWBIBGenerationPhase= FWBitRangePhase (24, 27),
670kFWBIBLinkSpeed= FWBitRange (29, 31),
671kFWBIBLinkSpeedPhase= FWBitRangePhase (29, 31)
672};
673
674enum
675{
676kConfigUnitSpecAppleA27= 0x000a27,
677kConfigUnitSpec1394TA1= 0x00a02d,
678
679kConfigUnitSWVersMacintosh10= 10,
680kConfigUnitSWVersIIDC100= 0x000100,
681kConfigUnitSWVersIIDC101= 0x000101,
682kConfigUnitSWVersIIDC102= 0x000102
683};
684
685
686// =================================================================
687// Isoch defines
688// =================================================================
689#pragma mark -
690#pragma mark ISOCH
691
692enum
693{
694kFWIsochDataLength= FWBitRange (0, 15),
695kFWIsochDataLengthPhase= FWBitRangePhase (0, 15),
696
697kFWIsochTag= FWBitRange (16, 17),
698kFWIsochTagPhase= FWBitRangePhase (16, 17),
699
700kFWIsochChanNum= FWBitRange (18, 23),
701kFWIsochChanNumPhase= FWBitRangePhase (18, 23),
702
703kFWIsochTCode= FWBitRange (24, 27),
704kFWIsochTCodePhase= FWBitRangePhase (24, 27),
705
706kFWIsochSy= FWBitRange (28, 31),
707kFWIsochSyPhase= FWBitRangePhase (28, 31)
708};
709
710#define CHAN_BIT(x) (((UInt64)1) << (63 - (x))
711#define CHAN_MASK(x) (~CHAN_BIT(X))
712
713typedef enum
714{
715kFWNeverMultiMode = 0,
716kFWAllowMultiMode,
717kFWSuggestMultiMode,
718kFWAlwaysMultiMode,
719
720kFWDefaultIsochResourceFlags = kFWNeverMultiMode
721} IOFWIsochResourceFlags ;
722
723enum
724{
725kFWIsochChannelDefaultFlags = 0,
726kFWIsochChannelDoNotResumeOnWake = BIT(1)
727} ;
728
729typedef enum
730{
731kFWIsochPortDefaultOptions = 0,
732kFWIsochPortUseSeparateKernelThread= BIT(1),
733kFWIsochEnableRobustness= BIT(2),
734kFWIsochBigEndianUpdates= BIT(3),// private
735kFWIsochRequireLastContext= BIT(4),// private
736} IOFWIsochPortOptions ;
737
738// =================================================================
739// DCL opcode defs.
740// =================================================================
741#pragma mark -
742#pragma mark DCL OPCODES
743
744enum
745{
746kFWDCLImmediateEvent= 0,
747kFWDCLCycleEvent= 1,
748kFWDCLSyBitsEvent= 2
749};
750
751typedef enum
752{
753kFWDCLInvalidNotification= 0
754, kFWDCLUpdateNotification= 1
755, kFWDCLModifyNotification= 2
756, kFWNuDCLModifyNotification= 3
757, kFWNuDCLModifyJumpNotification= 4
758, kFWNuDCLUpdateNotification= 5
759} IOFWDCLNotificationType ;
760
761enum
762{
763kFWDCLOpDynamicFlag= BIT(16),
764kFWDCLOpVendorDefinedFlag= BIT(17),
765kFWDCLOpFlagMask= BitRange (16, 31),
766kFWDCLOpFlagPhase= BitRangePhase (16, 31)
767};
768
769enum
770{
771kDCLInvalidOp= 0,
772kDCLSendPacketStartOp= 1,
773//kDCLSendPacketWithHeaderStartOp= 2, // Deprecated legacy DCL opcode! Use NuDCL instead!
774kDCLSendPacketOp= 3,
775kDCLSendBufferOp= 4,// obsolete - do not use
776kDCLReceivePacketStartOp= 5,
777kDCLReceivePacketOp= 6,
778kDCLReceiveBufferOp= 7,// obsolete - do not use
779kDCLCallProcOp= 8,
780kDCLLabelOp= 9,
781kDCLJumpOp= 10,
782kDCLSetTagSyncBitsOp= 11,
783kDCLUpdateDCLListOp= 12,
784kDCLTimeStampOp= 13,
785kDCLPtrTimeStampOp= 14,
786kDCLSkipCycleOp= 15,
787
788kDCLNuDCLLeaderOp= 20// compilerData field contains NuDCLRef to start of NuDCL
789// program.
790// Should not need to use this directly.
791};
792
793#ifdef FW_OLD_DCL_DEFS
794
795//typedef struct DCLCommandStruct ;
796//typedef void (DCLCallCommandProc)(DCLCommandStruct* command);
797
798#else
799
800//typedef struct DCLCommand ;
801//typedef void (DCLCallCommandProc)(DCLCommand* command);
802
803#endif
804
805// =================================================================
806// DCL structs
807// =================================================================
808#pragma mark -
809#pragma mark DCL
810
811#ifdef __LP64__
812typedef void* DCLCallProcDataType;
813#else
814typedef UInt32 DCLCallProcDataType;
815#endif
816
817#ifdef KERNEL
818#ifdef __LP64__
819typedef void* DCLCompilerDataType;
820#else
821typedef UInt32 DCLCompilerDataType;
822#endif
823#else
824typedef UInt32 DCLCompilerDataType;
825#endif
826
827typedef struct DCLCommandStruct
828{
829struct DCLCommandStruct *pNextDCLCommand;// Next DCL command.
830DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
831UInt32opcode;// DCL opcode.
832UInt32operands[1];// DCL operands (size varies)
833} DCLCommand;
834
835typedef void (DCLCallCommandProc)(DCLCommand * command);
836
837typedef struct DCLTransferPacketStruct
838{
839DCLCommand *pNextDCLCommand;// Next DCL command.
840DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
841UInt32opcode;// DCL opcode.
842void *buffer;// Packet buffer.
843UInt32size;// Buffer size.
844} DCLTransferPacket ;
845
846typedef struct DCLTransferBufferStruct
847{
848DCLCommand *pNextDCLCommand;// Next DCL command.
849DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
850UInt32opcode;// DCL opcode.
851void *buffer;// Buffer.
852UInt32size;// Buffer size.
853UInt16packetSize;// Size of packets to send.
854UInt16reserved;
855UInt32bufferOffset;// Current offset into buffer.
856} DCLTransferBuffer ;
857
858typedef struct DCLCallProcStruct
859{
860DCLCommand *pNextDCLCommand;// Next DCL command.
861DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
862UInt32opcode;// DCL opcode.
863DCLCallCommandProc *proc;// Procedure to call.
864DCLCallProcDataTypeprocData;// Data for use by called procedure.
865} DCLCallProc;
866
867typedef struct DCLLabelStruct
868{
869DCLCommand *pNextDCLCommand;// Next DCL command.
870DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
871UInt32opcode;// DCL opcode.
872} DCLLabel;
873
874typedef struct DCLJumpStruct
875{
876DCLCommand *pNextDCLCommand;// Next DCL command.
877DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
878UInt32opcode;// DCL opcode.
879DCLLabel *pJumpDCLLabel;// DCL label to jump to.
880} DCLJump;
881
882typedef struct DCLSetTagSyncBitsStruct
883{
884DCLCommand *pNextDCLCommand;// Next DCL command.
885DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
886UInt32opcode;// DCL opcode.
887UInt16tagBits;// Tag bits for following packets.
888UInt16syncBits;// Sync bits for following packets.
889} DCLSetTagSyncBits;
890
891typedef struct DCLUpdateDCLListStruct
892{
893DCLCommand *pNextDCLCommand;// Next DCL command.
894DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
895UInt32opcode;// DCL opcode.
896DCLCommand **dclCommandList;// List of DCL commands to update.
897UInt32numDCLCommands;// Number of DCL commands in list.
898} DCLUpdateDCLList;
899
900typedef struct DCLTimeStampStruct
901{
902DCLCommand *pNextDCLCommand;// Next DCL command.
903DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
904UInt32opcode;// DCL opcode.
905UInt32timeStamp;// Time stamp.
906} DCLTimeStamp;
907
908typedef struct DCLPtrTimeStampStruct
909{
910DCLCommand *pNextDCLCommand;// Next DCL command.
911DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
912UInt32opcode;// DCL opcode.
913UInt32 *timeStampPtr;// Where to store the time stamp.
914} DCLPtrTimeStamp ;
915
916typedef struct
917{
918DCLCommand *pNextDCLCommand ;// unused - always NULL
919DCLCompilerDataTypecompilerData;// Data for use by DCL compiler.
920UInt32opcode ;// must be kDCLNuDCLLeaderOp
921void* program ;// NuDCL program here...
922} DCLNuDCLLeader ;
923
924#ifdef FW_OLD_DCL_DEFS
925
926// should not use these...
927
928typedef DCLCommand*DCLCommandPtr ;
929typedef DCLTransferBuffer*DCLTransferBufferPtr ;
930typedef DCLTransferPacket*DCLTransferPacketPtr ;
931typedef DCLCallProc*DCLCallProcPtr ;
932typedef DCLLabel*DCLLabelPtr ;
933typedef DCLJump*DCLJumpPtr ;
934typedef DCLSetTagSyncBits*DCLSetTagSyncBitsPtr ;
935typedef DCLUpdateDCLList*DCLUpdateDCLListPtr ;
936typedef DCLTimeStamp*DCLTimeStampPtr ;
937typedef DCLPtrTimeStamp*DCLPtrTimeStampPtr ;
938typedef DCLCallCommandProc* DCLCallCommandProcPtr ;
939
940#endif
941
942
943// =================================================================
944// User-Lib Export DCL structs - Thses structus are used to pass
945// a user-created legacy DCL program down into kernel space. These
946// structs allow support for both 32-bit and 64-bit user-space clients.
947// These structs should only be used internally. They are not for
948// clients to create DCL programs with.
949// =================================================================
950
951typedef struct UserExportDCLCommandStruct
952{
953mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
954mach_vm_address_tpNextDCLCommand;// Next DCL command.
955uint64_tcompilerData;// Data for use by DCL compiler.
956UInt32opcode;// DCL opcode.
957UInt32operands[1];// DCL operands (size varies)
958} __attribute__ ((packed)) UserExportDCLCommand;
959
960typedef void (UserExportDCLCallCommandProc)(UserExportDCLCommand * command);
961
962typedef struct UserExportDCLTransferPacketStruct
963{
964mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
965mach_vm_address_tpNextDCLCommand;// Next DCL command.
966uint64_tcompilerData;// Data for use by DCL compiler.
967UInt32opcode;// DCL opcode.
968mach_vm_address_tbuffer;// Packet buffer.
969UInt32size;// Buffer size.
970} __attribute__ ((packed)) UserExportDCLTransferPacket ;
971
972typedef struct UserExportDCLTransferBufferStruct
973{
974mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
975mach_vm_address_tpNextDCLCommand;// Next DCL command.
976uint64_tcompilerData;// Data for use by DCL compiler.
977UInt32opcode;// DCL opcode.
978mach_vm_address_tbuffer;// Buffer.
979UInt32size;// Buffer size.
980UInt16packetSize;// Size of packets to send.
981UInt16reserved;
982UInt32bufferOffset;// Current offset into buffer.
983} __attribute__ ((packed)) UserExportDCLTransferBuffer ;
984
985typedef struct UserExportDCLCallProcStruct
986{
987mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
988mach_vm_address_tpNextDCLCommand;// Next DCL command.
989uint64_tcompilerData;// Data for use by DCL compiler.
990UInt32opcode;// DCL opcode.
991mach_vm_address_tproc;// Procedure to call.
992uint64_tprocData;// Data for use by called procedure.
993} __attribute__ ((packed)) UserExportDCLCallProc;
994
995typedef struct UserExportDCLLabelStruct
996{
997mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
998mach_vm_address_tpNextDCLCommand;// Next DCL command.
999uint64_tcompilerData;// Data for use by DCL compiler.
1000UInt32opcode;// DCL opcode.
1001} __attribute__ ((packed)) UserExportDCLLabel;
1002
1003typedef struct UserExportDCLJumpStruct
1004{
1005mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
1006mach_vm_address_tpNextDCLCommand;// Next DCL command.
1007uint64_tcompilerData;// Data for use by DCL compiler.
1008UInt32opcode;// DCL opcode.
1009mach_vm_address_tpJumpDCLLabel;// DCL label to jump to.
1010} __attribute__ ((packed)) UserExportDCLJump;
1011
1012typedef struct UserExportDCLSetTagSyncBitsStruct
1013{
1014mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
1015mach_vm_address_tpNextDCLCommand;// Next DCL command.
1016uint64_tcompilerData;// Data for use by DCL compiler.
1017UInt32opcode;// DCL opcode.
1018UInt16tagBits;// Tag bits for following packets.
1019UInt16syncBits;// Sync bits for following packets.
1020} __attribute__ ((packed)) UserExportDCLSetTagSyncBits;
1021
1022typedef struct UserExportDCLUpdateDCLListStruct
1023{
1024mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
1025mach_vm_address_tpNextDCLCommand;// Next DCL command.
1026uint64_tcompilerData;// Data for use by DCL compiler.
1027UInt32opcode;// DCL opcode.
1028mach_vm_address_tdclCommandList;// List of DCL commands to update.
1029UInt32numDCLCommands;// Number of DCL commands in list.
1030} __attribute__ ((packed)) UserExportDCLUpdateDCLList;
1031
1032typedef struct UserExportDCLTimeStampStruct
1033{
1034mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
1035mach_vm_address_tpNextDCLCommand;// Next DCL command.
1036uint64_tcompilerData;// Data for use by DCL compiler.
1037UInt32opcode;// DCL opcode.
1038UInt32timeStamp;// Time stamp.
1039} __attribute__ ((packed)) UserExportDCLTimeStamp;
1040
1041typedef struct UserExportDCLPtrTimeStampStruct
1042{
1043mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
1044mach_vm_address_tpNextDCLCommand;// Next DCL command.
1045uint64_tcompilerData;// Data for use by DCL compiler.
1046UInt32opcode;// DCL opcode.
1047mach_vm_address_ttimeStampPtr;// Where to store the time stamp.
1048} __attribute__ ((packed)) UserExportDCLPtrTimeStamp ;
1049
1050typedef struct
1051{
1052mach_vm_address_tpClientDCLStruct;// A pointer to the client's DCL struct
1053mach_vm_address_tpNextDCLCommand ;// unused - always NULL
1054uint64_tcompilerData;// Data for use by DCL compiler.
1055UInt32opcode ;// must be kDCLNuDCLLeaderOp
1056mach_vm_address_t program ;// NuDCL program here...
1057} __attribute__ ((packed)) UserExportDCLNuDCLLeader ;
1058
1059
1060// =================================================================
1061// NuDCL
1062// =================================================================
1063#pragma mark -
1064#pragma mark NUDCL
1065
1066typedef struct __NuDCL *NuDCLRef ;
1067typedef NuDCLRefNuDCLSendPacketRef ;
1068typedef NuDCLRefNuDCLSkipCycleRef ;
1069typedef NuDCLRefNuDCLReceivePacketRef ;
1070
1071typedef void (*NuDCLCallback)( void* refcon, NuDCLRef dcl );
1072
1073typedef enum
1074{
1075kNuDCLDynamic = BIT( 1 ),
1076kNuDCLUpdateBeforeCallback = BIT( 2 )
1077
1078} NuDCLFlags ;
1079
1080// =================================================================
1081// Miscellaneous
1082// =================================================================
1083#pragma mark -
1084#pragma mark MISCELLANEOUS
1085
1086typedef void* FWClientCommandID ;
1087
1088typedef struct IOFireWireSessionRefOpaqueStuct* IOFireWireSessionRef ;
1089
1090//
1091// bus management constants.
1092//
1093
1094enum
1095{
1096kFWBusManagerArbitrationTimeoutDuration= 625 // durationMillisecond
1097};
1098
1099//
1100// bus characteristics.
1101//
1102
1103enum
1104{
1105kFWMaxBusses= 1023,
1106kFWMaxNodesPerBus= 63,
1107kFWMaxNodeHops= 16
1108};
1109
1110/*! @enumNodeFlags
1111
1112@abstractFlags that specify characteristics of the FireWire device node.
1113
1114@constantkIOFWDisablePhysicalAccess Disable physical memory access
1115
1116@constantkIOFWDisableAllPhysicalAccessDisable all physical memory access
1117
1118@constantkIOFWEnableRetryOnAckDEnable retry on Ack D
1119
1120@constantkIOFWLimitAsyncPacketSizeLimit async packet size
1121
1122@constantkIOFWDisablePhyOnSleepDisable Phy, when machine is in Sleep mode
1123
1124@constantkIOFWMustBeRootAttempt to make this device root, There is no guarentee Mac OS will succeed in making the device
1125 root.
1126
1127@constantkIOFWMustNotBeRootAttempt to prevent this device from being root, There is no guarentee Mac OS will succeed in preventing the device
1128 from being root.
1129
1130@constantkIOFWMustHaveGap63Attempt to ensure the gap count is 63, when this device is on the bus. Gap 63 reduces bus performance significantly,
1131so this flag should be used only when absolutely necessary. There is no guarentee Mac OS will succeed in forcing
1132the gap count to 63.
1133*/
1134enum
1135{
1136 kIOFWDisablePhysicalAccess = (1 << 0),
1137kIOFWDisableAllPhysicalAccess = (1 << 1),
1138kIOFWEnableRetryOnAckD= (1 << 2),
1139kIOFWLimitAsyncPacketSize= (1 << 3),
1140kIOFWDisablePhyOnSleep= (1 << 4),
1141kIOFWMustBeRoot= (1 << 5),
1142kIOFWMustNotBeRoot= (1 << 6),
1143kIOFWMustHaveGap63= (1 << 7)
1144};
1145
1146//
1147// write flags
1148//
1149
1150enum IOFWWriteFlags
1151{
1152kIOFWWriteFlagsNone= 0x00000000,
1153kIOFWWriteFlagsDeferredNotify = 0x00000001,
1154kIOFWWriteFastRetryOnBusy= 0x00000002,
1155kIOFWWriteBlockRequest= 0x00000004,// force a block request
1156};
1157
1158//
1159// read flags
1160//
1161
1162enum IOFWReadFlags
1163{
1164kIOFWReadFlagsNone= 0x00000000,
1165kIOFWReadBlockRequest= 0x00000004,// force a block request
1166kIOFWReadPingTime= 0x00000008// ping time
1167};
1168
1169//
1170// security modes
1171//
1172
1173enum IOFWSecurityMode
1174{
1175kIOFWSecurityModeNormal = 0,
1176kIOFWSecurityModeSecure = 1,
1177kIOFWSecurityModeSecurePermanent = 2
1178};
1179
1180//
1181// physical access settings
1182//
1183
1184enum IOFWPhysicalAccessMode
1185{
1186kIOFWPhysicalAccessEnabled = 0,
1187kIOFWPhysicalAccessDisabled = 1,
1188kIOFWPhysicalAccessDisabledForGeneration = 2
1189};
1190
1191enum
1192{
1193kIOFWSpecID_AAPL = 0xa27,
1194kIOFWSWVers_KPF = 0x40
1195};
1196
1197// old style bit defs
1198#ifdef FW_OLD_BIT_DEFS
1199
1200#define kBit0BIT(0)
1201#define kBit1BIT(1)
1202#define kBit2BIT(2)
1203#define kBit3BIT(3)
1204#define kBit4BIT(4)
1205#define kBit5BIT(5)
1206#define kBit6BIT(6)
1207#define kBit7BIT(7)
1208#define kBit8BIT(8)
1209#define kBit9BIT(9)
1210#define kBit10BIT(10)
1211#define kBit11BIT(11)
1212#define kBit12BIT(12)
1213#define kBit13BIT(13)
1214#define kBit14BIT(14)
1215#define kBit15BIT(15)
1216#define kBit16BIT(16)
1217#define kBit17BIT(17)
1218#define kBit18BIT(18)
1219#define kBit19BIT(19)
1220#define kBit20BIT(20)
1221#define kBit21BIT(21)
1222#define kBit22BIT(22)
1223#define kBit23BIT(23)
1224#define kBit24BIT(24)
1225#define kBit25BIT(25)
1226#define kBit26BIT(26)
1227#define kBit27BIT(27)
1228#define kBit28BIT(28)
1229#define kBit29BIT(29)
1230#define kBit30BIT(30)
1231#define kBit31BIT(31)
1232
1233#endif
1234
1235#endif //__IOFireWireFamilyCommon_H__
1236

Archive Download this file

Revision: 2225