Root/
Source at commit 2740 created 8 years 11 months ago. By ifabio, sync with trunk. | |
---|---|
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 | /*!␊ |
24 | @header IOFireWireSBP2Target␊ |
25 | Contains the class definition for IOFireWireSBP2Target.␊ |
26 | */␊ |
27 | ␊ |
28 | #ifndef _IOKIT_IOFIREWIRESBP2TARGET_H␊ |
29 | #define _IOKIT_IOFIREWIRESBP2TARGET_H␊ |
30 | ␊ |
31 | #include <IOKit/firewire/IOFireWireUnit.h>␊ |
32 | #include <IOKit/IOService.h>␊ |
33 | ␊ |
34 | enum␊ |
35 | {␊ |
36 | kIOFWSBP2FailsOnAckBusy = (1 << 0),␊ |
37 | ␉kIOFWSBP2FailsOnBusResetsDuringIO = (1 << 1),␊ |
38 | ␉kIOFWSBP2DontUsePTPacketLimit = (1 << 2)␊ |
39 | };␊ |
40 | ␊ |
41 | /*!␊ |
42 | @class IOFireWireSBP2Target␊ |
43 | @abstract Serves as bridge between IOFireWireUnit and IOFireWireLUN.␊ |
44 | @discussion Matches against IOFireWireUnits supporting the SBP2 protocol. Creates IOFireWireSBP2LUN nubs ␉for matching. Most drivers will match against an IOFireWireSBP2LUN, but matching against an ␉IOFireWireSBP2Target is also supported. This can be useful in cases where a single driver wishes to ␊ |
45 | control all LUNs on a device. Support for this technique is minimal, however, and the driver will be␊ |
46 | required to discover it's LUNs through the registry.␊ |
47 | */␊ |
48 | ␊ |
49 | class IOFireWireSBP2Target : public IOService␊ |
50 | {␊ |
51 | OSDeclareDefaultStructors(IOFireWireSBP2Target);␊ |
52 | ␊ |
53 | protected:␊ |
54 | ␉␊ |
55 | ␉/////////////////////////////////////////␊ |
56 | // rom keys␊ |
57 | ␉␊ |
58 | enum␊ |
59 | {␊ |
60 | kCmdSpecIDKey ␉␉␉␉= 0x38,␊ |
61 | kCmdSetKey␉␉␉␉␉= 0x39,␊ |
62 | kSoftwareRevKey␉␉␉␉= 0x3b,␊ |
63 | kFirmwareRevKey␉ ␉␉␉= 0x3c,␊ |
64 | kLUNKey␉␉␉␉␉␉= 0x14,␊ |
65 | kLUNDirectoryKey␉␉␉= 0xd4,␊ |
66 | kManagementAgentOffsetKey␉= 0x54,␊ |
67 | ␉␉kUnitCharacteristicsKey ␉= 0x3A,␊ |
68 | ␉␉kRevisionKey␉␉␉␉= 0x21,␊ |
69 | ␉␉kFastStartKey␉␉␉␉= 0x3E␊ |
70 | };␊ |
71 | ␊ |
72 | typedef struct␊ |
73 | {␊ |
74 | ␉␉UInt32 cmdSpecID; ␊ |
75 | ␉␉UInt32 cmdSet;␊ |
76 | ␉␉UInt32 vendorID;␊ |
77 | ␉␉UInt32 softwareRev;␊ |
78 | ␉␉UInt32 firmwareRev; ␊ |
79 | ␉␉UInt32 lun;␊ |
80 | ␉␉UInt32 devType;␊ |
81 | ␉␉UInt32 unitCharacteristics;␊ |
82 | ␉␉UInt32 managementOffset;␊ |
83 | ␉␉UInt32 revision;␊ |
84 | ␉␉bool fastStartSupported;␊ |
85 | ␉␉UInt32 fastStart;␊ |
86 | } LUNInfo;␊ |
87 | ␉␊ |
88 | // reserved for future use␊ |
89 | struct ExpansionData ␊ |
90 | ␉{␊ |
91 | ␉␉bool␉␉␉␉fStarted;␊ |
92 | ␉␉OSArray *␉␉␉fPendingMgtAgentCommands ;␊ |
93 | ␉␉UInt32␉␉␉␉fNumberPendingMgtAgentOrbs;␊ |
94 | ␉␉UInt32␉␉␉␉fNumLUNs;␊ |
95 | ␉};␊ |
96 | ExpansionData * fExpansionData; ␊ |
97 | ␊ |
98 | ␉/////////////////////////////////////////␊ |
99 | ␉// private fields␊ |
100 | ␉␊ |
101 | bool ␉␉␉␉fOpenFromTarget;␊ |
102 | UInt32␉␉␉␉fOpenFromLUNCount; ␊ |
103 | IOFireWireUnit * ␉fProviderUnit;␊ |
104 | UInt32␉␉␉␉fFlags;␊ |
105 | ␊ |
106 | ␉IOFireWireController * fControl;␊ |
107 | ␉␊ |
108 | ␉UInt32 ␉␉␉␉fIOCriticalSectionCount;␊ |
109 | ␉␊ |
110 | ␉/////////////////////////////////////////␊ |
111 | ␉// private internals␊ |
112 | ␊ |
113 | virtual void free( void );␉␊ |
114 | virtual IOReturn message( ␉UInt32 type, ␊ |
115 | ␉␉␉␉␉␉␉␉IOService * provider,␊ |
116 | ␉␉␉␉␉␉␉␉void * argument = 0);␊ |
117 | ␊ |
118 | virtual void scanForLUNs( void );␊ |
119 | IOReturn createLUN( LUNInfo * info );␊ |
120 | ␊ |
121 | public:␊ |
122 | ␊ |
123 | ␉/////////////////////////////////////////␊ |
124 | ␉// public methods␊ |
125 | ␉␊ |
126 | ␉/*! @function handleOpen␊ |
127 | ␉␉@abstract Overrideable method to control the open / close behaviour of an IOService.␊ |
128 | ␉␉@discussion See IOService for discussion.␉␉␊ |
129 | ␉␉@param forClient Designates the client of the provider requesting the open.␊ |
130 | ␉␉@param options Options for the open, may be interpreted by the implementor of handleOpen.␊ |
131 | ␉␉@result Return true if the open was successful, false otherwise. */␊ |
132 | ␊ |
133 | virtual bool handleOpen( IOService * forClient, IOOptionBits options, void * arg );␊ |
134 | ␉␊ |
135 | ␉/*! ␊ |
136 | ␉␉@function handleClose␊ |
137 | ␉␉@abstract Overrideable method to control the open / close behaviour of an IOService.␊ |
138 | ␉␉@discussion See IOService for discussion.␊ |
139 | ␉␉@param forClient Designates the client of the provider requesting the close.␊ |
140 | ␉␉@param options Options for the close, may be interpreted by the implementor of handleOpen. ␊ |
141 | ␉*/␊ |
142 | ␊ |
143 | ␉virtual void handleClose( IOService * forClient, IOOptionBits options );␊ |
144 | ␊ |
145 | ␉/*! ␊ |
146 | ␉␉@function handleIsOpen␊ |
147 | ␉␉@abstract Overrideable method to control the open / close behaviour of an IOService.␊ |
148 | ␉␉@discussion See IOService for discussion.␉␉␊ |
149 | ␉␉@param forClient If non-zero, isOpen returns the open state for that client. If zero is passed, isOpen returns the open state for all clients.␊ |
150 | ␉␉@result Returns true if the specific, or any, client has the IOService open. ␊ |
151 | ␉*/␊ |
152 | ␉␊ |
153 | virtual bool handleIsOpen( const IOService * forClient ) const;␊ |
154 | ␊ |
155 | ␉/*! ␊ |
156 | ␉␉@function start␊ |
157 | ␉␉@abstract During an IOService instantiation, the start method is called when the IOService has been selected to run on the provider.␊ |
158 | ␉␉@discussion See IOService for discussion.␊ |
159 | ␉␉@result Return true if the start was successful, false otherwise (which will cause the instance to be detached and usually freed).␊ |
160 | ␉*/␊ |
161 | ␉␊ |
162 | virtual bool start( IOService *provider );␊ |
163 | ␊ |
164 | ␉/*! ␊ |
165 | ␉␉@function stop␊ |
166 | ␉␉@abstract During an IOService termination, the stop method is called in its clients before they are detached & it is destroyed.␊ |
167 | ␉␉@discussion See IOService for discussion.␊ |
168 | ␉*/␊ |
169 | ␊ |
170 | ␉virtual void stop( IOService *provider );␊ |
171 | ␊ |
172 | ␉/*!␊ |
173 | ␉␉@function getFireWireUnit␊ |
174 | ␉␉@abstract Returns an IOFireWireUnit object.␊ |
175 | ␉␉@discussion An IOFireWireUnit is the provider of an IOFireWireSBP2Target. In order to use the base FireWire services␊ |
176 | ␉␉you will need a reference to the unit. This method returns that reference.␊ |
177 | ␉␉@result Returns a pointer to an IOFireWireUnit.␊ |
178 | ␉*/␊ |
179 | ␉␊ |
180 | virtual IOFireWireUnit * getFireWireUnit( void );␊ |
181 | ␉␊ |
182 | ␉/*! ␊ |
183 | ␉␉@function matchPropertyTable␊ |
184 | ␉␉@abstract Implements SBP2 specific matching.␊ |
185 | ␉␉@discussion See IOService for discussion.␊ |
186 | ␉ @param table The dictionary of properties to be matched against.␊ |
187 | ␉␉@result Returns false if the family considers the matching dictionary does not match in properties it understands, true otherwise.␊ |
188 | ␉*/␊ |
189 | ␉␊ |
190 | ␉virtual bool matchPropertyTable( OSDictionary * table );␊ |
191 | ␊ |
192 | virtual void setTargetFlags( UInt32 flags );␊ |
193 | virtual UInt32 getTargetFlags( void );␊ |
194 | ␊ |
195 | protected:␊ |
196 | virtual void configurePhysicalFilter( void );␊ |
197 | ␊ |
198 | public:␊ |
199 | virtual void clearTargetFlags( UInt32 flags );␊ |
200 | ␉virtual IOReturn beginIOCriticalSection( void );␊ |
201 | ␉virtual void endIOCriticalSection( void );␊ |
202 | ␊ |
203 | virtual bool finalize( IOOptionBits options );␊ |
204 | ␊ |
205 | IOReturn ␉synchMgmtAgentAccess( IOFWCommand * mgmtOrbCommand );␊ |
206 | ␉void␉␉completeMgmtAgentAccess( );␊ |
207 | ␉void ␉␉clearMgmtAgentAccess( );␊ |
208 | ␉void␉␉cancelMgmtAgentAccess( IOFWCommand * mgmtOrbCommand );␊ |
209 | ␊ |
210 | protected:␊ |
211 | ␊ |
212 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 0);␊ |
213 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 1);␊ |
214 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 2);␊ |
215 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 3);␊ |
216 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 4);␊ |
217 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 5);␊ |
218 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 6);␊ |
219 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 7);␊ |
220 | OSMetaClassDeclareReservedUnused(IOFireWireSBP2Target, 8);␉␊ |
221 | ␊ |
222 | };␊ |
223 | ␊ |
224 | #endif␊ |
225 |