Root/
Source at commit 1580 created 12 years 9 months ago. By blackosx, Attempted to enable 'exclusive' choices in auto generated boot options, but it's not working at present. I've added notes to remind me to look again at some point. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 2003 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 | *␊ |
25 | *␉IOFireWireAVCTargetSpace.h␊ |
26 | *␊ |
27 | * Class to centralize the AVC Target mode support␊ |
28 | *␊ |
29 | */␊ |
30 | ␊ |
31 | #ifndef _IOKIT_IOFIREWIREAVCTARGETSPACE_H␊ |
32 | #define _IOKIT_IOFIREWIREAVCTARGETSPACE_H␊ |
33 | ␊ |
34 | #include <IOKit/IOUserClient.h>␊ |
35 | #include <IOKit/IOBufferMemoryDescriptor.h>␊ |
36 | ␊ |
37 | #include <IOKit/firewire/IOFWAddressSpace.h>␊ |
38 | #include <IOKit/firewire/IOLocalConfigDirectory.h>␊ |
39 | #include <IOKit/avc/IOFireWireAVCConsts.h>␊ |
40 | #include <IOKit/avc/IOFireWireAVCUserClientCommon.h>␊ |
41 | ␊ |
42 | class IOFireWireAVCProtocolUserClient;␊ |
43 | class AVCCommandHandlerInfo;␊ |
44 | class AVCSubunitInfo;␊ |
45 | ␊ |
46 | typedef void (*IOFireWireAVCTargetCommandHandlerCallback)(const AVCCommandHandlerInfo *pCmdInfo,␊ |
47 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ UInt32 generation,␊ |
48 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ UInt16 nodeID,␊ |
49 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ const void *command,␊ |
50 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ UInt32 cmdLen,␊ |
51 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ IOFWSpeed &speed,␊ |
52 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ UInt32 handlerSearchIndex);␊ |
53 | ␊ |
54 | typedef void (*IOFireWireAVCSubunitPlugHandlerCallback)(const AVCSubunitInfo *pSubunitInfo,␊ |
55 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉IOFWAVCSubunitPlugMessages plugMessage,␊ |
56 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉IOFWAVCPlugTypes plugType,␊ |
57 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉UInt32 plugNum,␊ |
58 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉UInt32 messageParams,␊ |
59 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉UInt32 generation,␊ |
60 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉UInt16 nodeID);␊ |
61 | ␊ |
62 | /*!␊ |
63 | @class AVCCommandHandlerInfo␊ |
64 | @abstract internal class to manage installed command handlers␊ |
65 | */␊ |
66 | class AVCCommandHandlerInfo : public OSObject␊ |
67 | {␊ |
68 | OSDeclareDefaultStructors(AVCCommandHandlerInfo)␊ |
69 | public:␊ |
70 | ␉IOFireWireAVCProtocolUserClient * userClient;␊ |
71 | ␉IOFireWireAVCTargetCommandHandlerCallback callBack;␊ |
72 | ␉OSAsyncReference64 asyncRef;␊ |
73 | ␉UInt32 subUnitTypeAndID;␊ |
74 | ␉UInt32 opCode;␊ |
75 | ␉uint64_t userCallBack;␊ |
76 | ␉uint64_t userRefCon;␊ |
77 | };␊ |
78 | ␊ |
79 | typedef struct _AVCSubunitPlugRecord␊ |
80 | {␊ |
81 | ␉UInt32 plugSignalFormat;␊ |
82 | ␉UInt32 connectionCount;␊ |
83 | }AVCSubunitPlugRecord;␊ |
84 | ␊ |
85 | /*!␊ |
86 | @class AVCSubunitInfo␊ |
87 | @abstract internal class to manage installed subunits␊ |
88 | */␊ |
89 | class AVCSubunitInfo : public OSObject␊ |
90 | {␊ |
91 | OSDeclareDefaultStructors(AVCSubunitInfo)␊ |
92 | bool init();␊ |
93 | void free();␊ |
94 | public:␊ |
95 | ␉static AVCSubunitInfo *create();␊ |
96 | ␉IOFireWireAVCProtocolUserClient * userClient;␊ |
97 | ␉IOFireWireAVCSubunitPlugHandlerCallback callBack;␊ |
98 | ␉OSAsyncReference64 asyncRef;␊ |
99 | ␉UInt32 subunitTypeAndID;␊ |
100 | ␉UInt32 numSourcePlugs;␊ |
101 | ␉UInt32 numDestPlugs;␊ |
102 | ␉uint64_t userCallBack;␊ |
103 | ␉uint64_t userRefCon;␊ |
104 | ␉AVCSubunitPlugRecord *sourcePlugRecords;␊ |
105 | ␉AVCSubunitPlugRecord *destPlugRecords;␊ |
106 | };␊ |
107 | ␊ |
108 | typedef struct _AVCUnitPlugRecord␊ |
109 | {␊ |
110 | ␉UInt32 connectionCount;␊ |
111 | }AVCUnitPlugRecord;␊ |
112 | ␊ |
113 | typedef struct _AVCUnitPlugs␊ |
114 | {␊ |
115 | ␉UInt32 numIsochInPlugs;␊ |
116 | ␉UInt32 numIsochOutPlugs;␊ |
117 | ␉UInt32 numExternalInPlugs;␊ |
118 | ␉UInt32 numExternalOutPlugs;␊ |
119 | ␉AVCUnitPlugRecord isochInPlugRecord[kAVCMaxNumPlugs];␊ |
120 | ␉AVCUnitPlugRecord isochOutPlugRecord[kAVCMaxNumPlugs];␊ |
121 | ␉AVCUnitPlugRecord externalInPlugRecord[kAVCMaxNumPlugs];␊ |
122 | ␉AVCUnitPlugRecord externalOutPlugRecord[kAVCMaxNumPlugs];␊ |
123 | }AVCUnitPlugs;␊ |
124 | ␊ |
125 | /*!␊ |
126 | @class UCInfo␊ |
127 | @abstract internal class to manage multiple protocol user clients␊ |
128 | */␊ |
129 | class UCInfo : public OSObject␊ |
130 | {␊ |
131 | OSDeclareDefaultStructors(UCInfo)␊ |
132 | public:␊ |
133 | IOFireWireAVCProtocolUserClient *fUserClient;␊ |
134 | };␊ |
135 | ␊ |
136 | /*!␊ |
137 | @class AVCConnectionRecord␊ |
138 | @abstract internal class to manage AVC connections␊ |
139 | */␊ |
140 | class AVCConnectionRecord : public OSObject␊ |
141 | {␊ |
142 | OSDeclareDefaultStructors(AVCConnectionRecord)␊ |
143 | public:␊ |
144 | ␉UInt32 sourceSubunitTypeAndID;␊ |
145 | ␉IOFWAVCPlugTypes sourcePlugType;␊ |
146 | ␉UInt32 sourcePlugNum;␊ |
147 | ␉UInt32 destSubunitTypeAndID;␊ |
148 | ␉IOFWAVCPlugTypes destPlugType;␊ |
149 | ␉UInt32 destPlugNum;␊ |
150 | ␉bool lockConnection;␊ |
151 | ␉bool permConnection;␊ |
152 | };␊ |
153 | ␊ |
154 | /*!␊ |
155 | @class IOFireWireAVCTargetSpace␊ |
156 | @abstract object to centralize the AVC Target mode support␊ |
157 | */␊ |
158 | class IOFireWireAVCTargetSpace : public IOFWPseudoAddressSpace␊ |
159 | {␊ |
160 | OSDeclareDefaultStructors(IOFireWireAVCTargetSpace)␊ |
161 | ␊ |
162 | protected:␊ |
163 | UInt32 fBuf[512];␊ |
164 | UInt32 fActivations;␊ |
165 | ␉IOFireWireController *fController;␊ |
166 | ␉IOLocalConfigDirectory * fAVCLocalConfigDirectory;␊ |
167 | OSArray * fUserClients;␊ |
168 | ␉OSArray * fCommandHandlers;␊ |
169 | ␉OSArray * fSubunits;␊ |
170 | ␉OSArray * fConnectionRecords;␊ |
171 | ␉AVCUnitPlugs fUnitPlugs;␊ |
172 | ␉IORecursiveLock * fLock;␊ |
173 | ␊ |
174 | ␉/*! @struct ExpansionData␊ |
175 | ␉@discussion This structure will be used to expand the capablilties of the class in the future.␊ |
176 | ␉*/␊ |
177 | struct ExpansionData { };␊ |
178 | ␊ |
179 | ␉/*! @var reserved␊ |
180 | ␉Reserved for future use. (Internal use only) */␊ |
181 | ExpansionData *reserved;␊ |
182 | ␊ |
183 | virtual UInt32 doWrite(UInt16 nodeID, IOFWSpeed &speed, FWAddress addr, UInt32 len,␊ |
184 | const void *buf, IOFWRequestRefCon refcon);␊ |
185 | ␊ |
186 | ␊ |
187 | ␉IOReturn targetSendAVCResponse(UInt32 generation, UInt16 nodeID, IOBufferMemoryDescriptor *pBufMemDesc, UInt32 size);␊ |
188 | ␊ |
189 | ␉// Internal AVC Target Command Handlers␊ |
190 | ␉IOReturn handleUnitInfoCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
191 | ␉IOReturn handleSubUnitInfoCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
192 | ␉IOReturn handlePlugInfoCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
193 | ␉IOReturn handlePowerCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
194 | ␉IOReturn handleConnectCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
195 | ␉IOReturn handleDisconnectCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
196 | ␉IOReturn handleInputPlugSignalFormatCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
197 | ␉IOReturn handleOutputPlugSignalFormatCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
198 | ␉IOReturn handleConnectionsCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
199 | ␉IOReturn handleSignalSourceCommand(UInt16 nodeID, UInt32 generation, const char *buf, UInt32 len);␊ |
200 | ␊ |
201 | ␉UInt32 subUnitOfTypeCount(UInt32 type);␊ |
202 | ␉AVCSubunitInfo *getSubunitInfo(UInt32 subunitTypeAndID);␊ |
203 | ␉bool canConnectDestPlug(UInt32 destSubunitTypeAndID,␊ |
204 | ␉␉␉␉␉␉ IOFWAVCPlugTypes destPlugType,␊ |
205 | ␉␉␉␉␉␉ UInt32 *destPlugNum);␊ |
206 | ␉␊ |
207 | public:␊ |
208 | ␊ |
209 | ␉// Activate/Deactivate Functions␊ |
210 | ␉virtual IOReturn activateWithUserClient(IOFireWireAVCProtocolUserClient *userClient);␊ |
211 | virtual void deactivateWithUserClient(IOFireWireAVCProtocolUserClient *userClient);␊ |
212 | ␊ |
213 | ␉/*!␊ |
214 | ␉@function init␊ |
215 | ␉@abstract initializes the IOFireWireAVCTargetSpace object␊ |
216 | ␉*/␊ |
217 | virtual bool init(IOFireWireController *controller);␊ |
218 | ␊ |
219 | ␉/*!␊ |
220 | ␉@function getAVCTargetSpace␊ |
221 | ␉@abstract returns the IOFireWireAVCTargetSpace object for the given FireWire bus␊ |
222 | ␉@param bus The FireWire bus␊ |
223 | ␉*/␊ |
224 | static IOFireWireAVCTargetSpace *getAVCTargetSpace(IOFireWireController *controller);␊ |
225 | ␊ |
226 | ␉/*!␊ |
227 | ␉@function publishAVCUnitDirectory␊ |
228 | ␉@abstract Creates a local AVC Unit directory if it doesn't already exist␊ |
229 | ␉*/␊ |
230 | virtual IOReturn publishAVCUnitDirectory(void);␊ |
231 | ␊ |
232 | ␉virtual IOReturn installAVCCommandHandler(IOFireWireAVCProtocolUserClient *userClient,␊ |
233 | ␉␉␉␉␉␉␉␉␉␉ IOFireWireAVCTargetCommandHandlerCallback callBack,␊ |
234 | ␉␉␉␉␉␉␉␉␉␉ OSAsyncReference64 asyncRef,␊ |
235 | ␉␉␉␉␉␉␉␉␉␉ UInt32 subUnitTypeAndID,␊ |
236 | ␉␉␉␉␉␉␉␉␉␉ UInt32 opCode,␊ |
237 | ␉␉␉␉␉␉␉␉␉␉ uint64_t userCallBack,␊ |
238 | ␉␉␉␉␉␉␉␉␉␉ uint64_t userRefCon);␊ |
239 | ␊ |
240 | ␉virtual IOReturn addSubunit(IOFireWireAVCProtocolUserClient *userClient,␊ |
241 | ␉␉␉␉␉␉␉ IOFireWireAVCSubunitPlugHandlerCallback callBack,␊ |
242 | ␉␉␉␉␉␉␉ OSAsyncReference64 asyncRef,␊ |
243 | ␉␉␉␉␉␉␉ UInt32 subunitType,␊ |
244 | ␉␉␉␉␉␉␉ UInt32 numSourcePlugs,␊ |
245 | ␉␉␉␉␉␉␉ UInt32 numDestPlugs,␊ |
246 | ␉␉␉␉␉␉␉ uint64_t userCallBack,␊ |
247 | ␉␉␉␉␉␉␉ uint64_t userRefCon,␊ |
248 | ␉␉␉␉␉␉␉ UInt32 *subUnitID);␊ |
249 | ␊ |
250 | ␉virtual IOReturn setSubunitPlugSignalFormat(IOFireWireAVCProtocolUserClient *userClient,␊ |
251 | ␉␉␉␉␉␉␉␉␉␉␉ UInt32 subunitTypeAndID,␊ |
252 | ␉␉␉␉␉␉␉␉␉␉␉ IOFWAVCPlugTypes plugType,␊ |
253 | ␉␉␉␉␉␉␉␉␉␉␉ UInt32 plugNum,␊ |
254 | ␉␉␉␉␉␉␉␉␉␉␉ UInt32 signalFormat);␊ |
255 | ␊ |
256 | ␉virtual IOReturn getSubunitPlugSignalFormat(IOFireWireAVCProtocolUserClient *userClient,␊ |
257 | ␉␉␉␉␉␉␉␉␉␉␉ UInt32 subunitTypeAndID,␊ |
258 | ␉␉␉␉␉␉␉␉␉␉␉ IOFWAVCPlugTypes plugType,␊ |
259 | ␉␉␉␉␉␉␉␉␉␉␉ UInt32 plugNum,␊ |
260 | ␉␉␉␉␉␉␉␉␉␉␉ UInt32 *pSignalFormat);␊ |
261 | ␊ |
262 | ␉virtual IOReturn connectTargetPlugs(IOFireWireAVCProtocolUserClient *userClient,␊ |
263 | ␉␉␉␉␉␉␉␉␉ AVCConnectTargetPlugsInParams *inParams,␊ |
264 | ␉␉␉␉␉␉␉␉␉ AVCConnectTargetPlugsOutParams *outParams);␊ |
265 | ␊ |
266 | ␉virtual IOReturn disconnectTargetPlugs(IOFireWireAVCProtocolUserClient *userClient,␊ |
267 | ␉␉␉␉␉␉␉␉␉␉UInt32 sourceSubunitTypeAndID,␊ |
268 | ␉␉␉␉␉␉␉␉␉␉IOFWAVCPlugTypes sourcePlugType,␊ |
269 | ␉␉␉␉␉␉␉␉␉␉UInt32 sourcePlugNum,␊ |
270 | ␉␉␉␉␉␉␉␉␉␉UInt32 destSubunitTypeAndID,␊ |
271 | ␉␉␉␉␉␉␉␉␉␉IOFWAVCPlugTypes destPlugType,␊ |
272 | ␉␉␉␉␉␉␉␉␉␉UInt32 destPlugNum);␊ |
273 | ␊ |
274 | ␉virtual IOReturn getTargetPlugConnection(IOFireWireAVCProtocolUserClient *userClient,␊ |
275 | ␉␉␉␉␉␉␉␉␉␉ AVCGetTargetPlugConnectionInParams *inParams,␊ |
276 | ␉␉␉␉␉␉␉␉␉␉ AVCGetTargetPlugConnectionOutParams *outParams);␊ |
277 | ␊ |
278 | virtual IOReturn findAVCRequestHandler(IOFireWireAVCProtocolUserClient *userClient,␊ |
279 | ␉␉␉␉␉␉␉␉␉␉ UInt32 generation,␊ |
280 | ␉␉␉␉␉␉␉␉␉␉ UInt16 nodeID,␊ |
281 | ␉␉␉␉␉␉␉␉␉␉ IOFWSpeed speed,␊ |
282 | ␉␉␉␉␉␉␉␉␉␉ UInt32 handlerSearchIndex,␊ |
283 | ␉␉␉␉␉␉␉␉␉␉ const char *pCmdBuf,␊ |
284 | ␉␉␉␉␉␉␉␉␉␉ UInt32 cmdLen);␊ |
285 | ␉␊ |
286 | ␉virtual void pcrModified(IOFWAVCPlugTypes plugType,␊ |
287 | ␉␉␉␉␉␉ UInt32 plugNum,␊ |
288 | ␉␉␉␉␉␉ UInt32 newValue);␊ |
289 | ␉␊ |
290 | private:␊ |
291 | ␉OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 0);␊ |
292 | OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 1);␊ |
293 | OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 2);␊ |
294 | OSMetaClassDeclareReservedUnused(IOFireWireAVCTargetSpace, 3);␊ |
295 | };␊ |
296 | ␊ |
297 | #endif /*_IOKIT_IOFIREWIREAVCTARGETSPACE_H */ |