1/*
2 * Copyright (c) 2002-2008 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef __IOKIT_IO_SCSI_PARALLEL_INTERFACE_DEVICE_H__
25#define __IOKIT_IO_SCSI_PARALLEL_INTERFACE_DEVICE_H__
26
27
28 /*!
29  @header IOSCSIParallelInterfaceDevice
30	The IOSCSIParallelInterfaceDevice class represents a target device
31	on a SCSI bus.
32*/
33
34
35//-----------------------------------------------------------------------------
36//	Includes
37//-----------------------------------------------------------------------------
38
39#include <kern/queue.h>
40
41// SCSI Architecture Model Family includes
42#include <IOKit/scsi/IOSCSIProtocolServices.h>
43
44// SCSI Parallel Family Headers
45#include "IOSCSIParallelInterfaceController.h"
46#include "SCSIParallelTask.h"
47
48
49//-----------------------------------------------------------------------------
50//	Class Declarations
51//-----------------------------------------------------------------------------
52
53class IOSCSIParallelInterfaceDevice: public IOSCSIProtocolServices
54{
55
56	OSDeclareDefaultStructors ( IOSCSIParallelInterfaceDevice )
57
58#if 0
59#pragma mark -
60#pragma mark Client API
61#endif
62
63public:
64
65	/*!
66		@function IsProtocolServiceSupported
67		@abstract Called by SCSI Protocol Layer to determine if a specific SCSIProtocolFeature
68		is supported by this protocol layer driver and the device it controls.
69		@discussion	Called by SCSI Protocol Layer to determine if a specific SCSIProtocolFeature
70		is supported by this protocol layer driver and the device it controls.
71		@param feature Requested feature selector.
72		@param serviceValue pointer to service value see enum comment for type information
73		@result returns true if requested feature is supported.
74	*/
75	virtual bool	IsProtocolServiceSupported (
76									SCSIProtocolFeature 		feature,
77									void * 						serviceValue );
78
79	/*!
80		@function HandleProtocolServiceFeature
81		@abstract Called by SCSI Protocol Layer to handle a specific SCSIProtocolFeature.
82		@discussion	Called by SCSI Protocol Layer to handle a specific SCSIProtocolFeature.
83		@param feature requested feature selector
84		@param serviceValue pointer to service value see enum comment for type information
85		@result returns true if service feature is handled properly.
86	*/
87	virtual bool	HandleProtocolServiceFeature (
88									SCSIProtocolFeature 		feature,
89									void * 						serviceValue );
90
91
92	/*
93	 * Member routines for services available to the client and controller.
94	 */
95
96	/*!
97		@function GetTargetIdentifier
98		@abstract Method to retrieve the SCSITargetIdentifier.
99		@discussion	Method to allow the client to query for the SCSITargetIndentifier
100		of the SCSI device represented by the object.
101		@result returns SCSITargetIdentifier.
102	*/
103	SCSITargetIdentifier	GetTargetIdentifier ( void );
104
105	/*!
106		@function FindTaskForAddress
107		@abstract Method to retrieve a SCSIParallelTaskIdentifier given a Lun and Tag.
108		@discussion	Find the outstanding task for the Task Address of this Target and the
109		specified Lun and Tag.
110		@param theL the LUN
111		@param theQ the tagged task identifier which represents the queue.
112		@result returns A valid SCSIParallelTaskIdentifier or NULL.
113	*/
114	SCSIParallelTaskIdentifier	FindTaskForAddress (
115									SCSILogicalUnitNumber		theL,
116									SCSITaggedTaskIdentifier	theQ );
117
118
119	SCSIParallelTaskIdentifier	FindTaskForControllerIdentifier (
120									UInt64						theIdentifier );
121
122	bool	SetInitialTargetProperties ( OSDictionary * properties );
123
124	bool	SetTargetProperty (
125					const char * 	key,
126					OSObject *		value );
127
128	void	RemoveTargetProperty ( const char * key );
129
130	bool	IsFeatureNegotiationNecessary ( SCSIParallelFeature	feature );
131
132	/*
133	 * Member routines for services available only to controller.
134	 */
135
136	/*!
137		@function GetHBADataPointer
138		@abstract Method to retrieve the HBA Data Pointer for HBA specific data associated
139		with the target device.
140		@discussion	Method to retrieve the HBA Data Pointer for HBA specific data associated
141		with the target device.
142		@result returns pointer to HBA data buffer or NULL if not found or size is zero.
143	*/
144	void *	GetHBADataPointer ( void );
145
146	/*!
147		@function GetHBADataSize
148		@abstract Method to retrieve the HBA Data Size in bytes.
149		@discussion	Method to retrieve the HBA Data Size in bytes.
150		@result returns size of HBA data buffer in bytes.
151	*/
152	UInt32	GetHBADataSize ( void );
153
154	/*!
155		@function CompleteSCSITask
156		@abstract Method called to complete a SCSIParallelTask.
157		@discussion	Method called to complete a SCSIParallelTask.
158		@param completedTask A valid SCSIParallelTaskIdentifier.
159		@param serviceResponse A valid SCSIServiceResponse.
160		@param taskStatus A valid SCSITaskStatus.
161	*/
162	virtual void	CompleteSCSITask (
163									SCSIParallelTaskIdentifier 	completedTask,
164									SCSIServiceResponse 		serviceResponse,
165									SCSITaskStatus 				taskStatus );
166
167
168	/*
169	 * Member routines for services available only to SCSI Parallel Family.
170	 */
171
172	/*!
173		@function CreateTarget
174		@abstract Creates a IOSCSIParallelInterfaceDevice object which represents
175		the target device at the specified target ID.
176		@discussion	Creates a IOSCSIParallelInterfaceDevice object which represents
177		the target device at the specified target ID.
178		@param targetID A valid SCSITargetIdentifier.
179		@param sizeOfHBAData Size in bytes of HBA specific data required
180		by the controller. This value can be zero if no data is required.
181		@result return a pointer to IOSCSIParallelInterfaceDevice
182	*/
183	static IOSCSIParallelInterfaceDevice *	CreateTarget (
184									SCSITargetIdentifier 		targetID,
185									UInt32 						sizeOfHBAData,
186									IORegistryEntry *			entry = NULL );
187
188	/*!
189		@function DestroyTarget
190		@abstract Destroys a IOSCSIParallelInterfaceDevice object which represents
191		the target device.
192		@discussion	The object will be destroyed.
193	*/
194	void	DestroyTarget ( void );
195
196	/*!
197		@function GetPreviousDeviceInList
198		@abstract Method to retrieve previous device in internal device list.
199		@discussion	Method to retrieve previous device in internal device list.
200		@result returns a pointer to IOSCSIParallelInterfaceDevice, or NULL if none found.
201	*/
202	IOSCSIParallelInterfaceDevice *	GetPreviousDeviceInList ( void );
203
204	/*!
205		@function SetPreviousDeviceInList
206		@abstract Method to set previous device in internal device list.
207		@discussion	Method to set previous device in internal device list.
208		@param device is a pointer to a valid IOSCSIParallelInterfaceDevice object.
209	*/
210	void	SetPreviousDeviceInList ( IOSCSIParallelInterfaceDevice * device );
211
212	/*!
213		@function GetNextDeviceInList
214		@abstract Method to retrieve next device in internal device list.
215		@discussion	Method to retrieve next device in internal device list.
216		@result returns a pointer to IOSCSIParallelInterfaceDevice, or NULL if none found.
217	*/
218	IOSCSIParallelInterfaceDevice *	GetNextDeviceInList ( void );
219
220	/*!
221		@function SetNextDeviceInList
222		@abstract Method to set next device in internal device list.
223		@discussion	Method to set next device in internal device list.
224		@param device is a pointer to a valid IOSCSIParallelInterfaceDevice object.
225	*/
226	void 	SetNextDeviceInList ( IOSCSIParallelInterfaceDevice * device );
227
228#if 0
229#pragma mark -
230#pragma mark Child Class API
231#endif
232
233protected:
234
235	/*!
236		@function InitTarget
237		@asbtract Method called to initialize a device.
238		@discussion Method called to initialize a device.
239		@param targetID A valid SCSITargetIdentifier.
240		@param sizeOfHBAData The size of the HBA specific data to allocate.
241		@param entry A registry entry.
242		@result returns a boolean value indicating successful initialization.
243	*/
244	bool	InitTarget ( SCSITargetIdentifier 		targetID,
245						 UInt32 					sizeOfHBAData,
246						 IORegistryEntry *			entry );
247
248	/*!
249		@function ExecuteParallelTask
250		@abstract Method called to execute a client request.
251		@discussion	Method called to execute a client request.
252		@param parallelRequest A valid SCSIParallelTaskIdentifier
253		which represents the client request.
254		@result returns A valid SCSIServiceResponse.
255	*/
256	SCSIServiceResponse	ExecuteParallelTask (
257							SCSIParallelTaskIdentifier parallelRequest );
258
259	/*!
260		@function GetSCSIParallelTask
261		@abstract Method to retrieve a SCSIParallelTaskIdentifier in order
262		to process a client request.
263		@discussion	Method to retrieve a SCSIParallelTaskIdentifier in order
264		to process a client request.
265		@param blockForCommand If true, the thread calling this method will
266		block until a command becomes available. If false, it will not block
267		and could possibly return NULL.
268		@result returns If blockForCommand is true, this call is guaranteed
269		to return a valid SCSIParallelTaskIdentifier. If blockForCommand is
270		false, it may return a valid SCSIParallelTaskIdentifier or NULL.
271	*/
272	SCSIParallelTaskIdentifier 	GetSCSIParallelTask ( bool blockForCommand );
273
274	/*!
275		@function FreeSCSIParallelTask
276		@abstract Method to free a SCSIParallelTaskIdentifier after processing
277		a client request.
278		@discussion	Method to free a SCSIParallelTaskIdentifier after processing
279		a client request.
280		@param returnTask A valid SCSIParallelTaskIdentifier.
281	*/
282	void	FreeSCSIParallelTask ( SCSIParallelTaskIdentifier returnTask );
283
284	/*!
285		@function DoesHBASupportSCSIParallelFeature
286		@abstract Method to query the HBA for support of a specific SCSIParallelFeature.
287		@discussion	Method to query the HBA for support of a specific SCSIParallelFeature.
288		@param theFeature A valid SCSIParallelFeature.
289		@result returns true if requested feature is supported.
290	*/
291	bool	DoesHBASupportSCSIParallelFeature ( SCSIParallelFeature theFeature );
292
293	// SCSI Parallel Task access member routines
294
295	/*!
296		@function AddToOutstandingTaskList
297		@abstract Adds specified SCSIParallelTaskIdentifier to outstanding task list.
298		@discussion	Adds specified SCSIParallelTaskIdentifier to outstanding task list.
299		@param parallelTask A valid SCSIParallelTaskIdentifier.
300		@result returns true if successful
301	*/
302	bool	AddToOutstandingTaskList (
303							SCSIParallelTaskIdentifier 	parallelTask );
304
305	/*!
306		@function RemoveFromOutstandingTaskList
307		@abstract Removes specified SCSIParallelTaskIdentifier from outstanding task list.
308		@discussion	Removes specified SCSIParallelTaskIdentifier from outstanding task list.
309		@param parallelTask A valid SCSIParallelTaskIdentifier.
310	*/
311	void	RemoveFromOutstandingTaskList (
312					SCSIParallelTaskIdentifier 	parallelTask );
313
314	bool	AddToResendTaskList (
315					SCSIParallelTaskIdentifier	parallelTask );
316
317	void	RemoveFromResendTaskList (
318					SCSIParallelTaskIdentifier 	parallelTask );
319
320	void	SendFromResendTaskList ( void );
321
322	// ---- Methods for Accessing the local data in the SCSI Parallel Task Object ----
323
324	/*!
325		@function SetSCSITaskIdentifier
326		@abstract Method to set the SCSITaskIdentifier to be associated
327		with a SCSIParallelTaskIdentifier.
328		@discussion Method to set the SCSITaskIdentifier to be associated
329		with a SCSIParallelTaskIdentifier.
330		@param parallelTask A valid SCSIParallelTaskIdentifier.
331		@param scsiRequest SCSITaskIdentifier that represents the original request from the SCSI
332		Application Layer client.
333		@result returns true if successful.
334	*/
335	bool	SetSCSITaskIdentifier (
336					SCSIParallelTaskIdentifier	parallelTask,
337					SCSITaskIdentifier			scsiRequest );
338
339	/*!
340		@function GetSCSITaskIdentifier
341		@abstract Method to retrieve the SCSITaskIdentifier associated
342		with a SCSIParallelTaskIdentifier.
343		@discussion Method to retrieve the SCSITaskIdentifier associated
344		with a SCSIParallelTaskIdentifier.
345		@param parallelTask A valid SCSIParallelTaskIdentifier.
346		@result returns SCSITaskIdentifier that represents the original request from the SCSI
347		Application Layer client.
348	*/
349	SCSITaskIdentifier	GetSCSITaskIdentifier (
350								SCSIParallelTaskIdentifier 	parallelTask );
351
352	/*!
353		@function SetDevice
354		@abstract Method to set the device to be associated
355		with a SCSIParallelTaskIdentifier.
356		@discussion Method to set the device to be associated
357		with a SCSIParallelTaskIdentifier.
358		@param parallelTask A valid SCSIParallelTaskIdentifier.
359		@param device A pointer to a valid  IOSCSIParallelInterfaceDevice.
360		@result returns true if successful.
361	*/
362	bool				SetDevice (
363							SCSIParallelTaskIdentifier			parallelTask,
364							IOSCSIParallelInterfaceDevice * 	device );
365
366	/*!
367		@function SetTargetIdentifier
368		@abstract Set Target Identifier
369		@discussion xxx
370		@param parallelTask A valid SCSIParallelTaskIdentifier.
371		@param theTargetID
372		@result returns true if successful
373	*/
374	bool	SetTargetIdentifier (
375								SCSIParallelTaskIdentifier 	parallelTask,
376								SCSITargetIdentifier 		theTargetID );
377
378	/*!
379		@function GetTargetIdentifier
380		@abstract Get Target Identifier
381		@discussion Method to retrieve the Target Identifier for this request.
382		@param parallelTask A valid SCSIParallelTaskIdentifier.
383		@result returns SCSITargetIdentifier
384	*/
385	SCSITargetIdentifier	GetTargetIdentifier (
386								SCSIParallelTaskIdentifier 	parallelTask );
387
388	/*!
389		@function SetDMABuffer
390		@abstract Set DMA buffer
391		@discussion xxx
392		@param parallelTask A valid SCSIParallelTaskIdentifier.
393		@param buffer A valid IOMemoryDescriptor.
394		@result returns IOReturn value.
395	*/
396	IOReturn	SetDMABuffer (
397							SCSIParallelTaskIdentifier 	parallelTask,
398							IOMemoryDescriptor *		buffer );
399
400	// ---- Methods for Accessing data in the client's SCSI Task Object ----
401	// Method to retrieve the LUN that identifies the Logical Unit whose Task
402	// Set to which this task is to be added.
403	/*!
404		@function GetLogicalUnitNumber
405		@abstract Get Logical Unit Number
406		@discussion xxx
407		@param parallelTask A valid SCSIParallelTaskIdentifier.
408		@result returns a SCSILogicalUnitNumber
409	*/
410	SCSILogicalUnitNumber	GetLogicalUnitNumber ( SCSIParallelTaskIdentifier parallelTask );
411
412	/*!
413		@function GetTaggedTaskIdentifier
414		@abstract Method to retrieve the SCSI Tagged Task Identifier of the
415		task.  If the returned value is equal to kSCSIUntaggedTaskIdentifier,
416		then this task is untagged.
417		@param parallelTask A valid SCSIParallelTaskIdentifier.
418		@result an SCSITaskAttribute value.
419	*/
420
421	SCSITaggedTaskIdentifier GetTaggedTaskIdentifier (
422							SCSIParallelTaskIdentifier	parallelTask );
423
424	/*!
425		@function GetTaskAttribute
426		@abstract Method to retrieve the SCSI Task Attribute of the task
427		@param parallelTask A valid SCSIParallelTaskIdentifier.
428		@result an SCSITaskAttribute value.
429	*/
430
431	SCSITaskAttribute		GetTaskAttribute (
432							SCSIParallelTaskIdentifier	parallelTask );
433
434	/*!
435		@function GetCommandDescriptorBlockSize
436		@abstract Get the size of Command Descriptor Block(CDB) Size
437		@param parallelTask A valid SCSIParallelTaskIdentifier.
438		@result returns the size of the Command Descriptor Block in bytes
439	*/
440	UInt8	GetCommandDescriptorBlockSize ( SCSIParallelTaskIdentifier parallelTask );
441
442	/*!
443		@function GetCommandDescriptorBlock
444		@abstract xxx
445		@discussion This will always return a 16 Byte CDB.  If the Protocol Layer driver
446		does not support 16 Byte CDBs, it will have to create a local SCSICommandDescriptorBlock
447		variable to get the CDB data and then transfer the needed bytes from there.
448		@param parallelTask A valid SCSIParallelTaskIdentifier.
449		@param cdbData is a SCSICommandDescriptorBlock pointer to 16 byte CDB
450		@result returns true if data was copied to cdbData pointer
451	*/
452	bool	GetCommandDescriptorBlock (
453							SCSIParallelTaskIdentifier 		parallelTask,
454							SCSICommandDescriptorBlock * 	cdbData );
455
456	/*!
457		@function GetDataTransferDirection
458		@abstract Get Data Transfer Direction
459		@param parallelTask A valid SCSIParallelTaskIdentifier.
460		@result xxx
461	*/
462	UInt8	GetDataTransferDirection ( SCSIParallelTaskIdentifier parallelTask );
463
464	/*!
465		@function GetRequestedDataTransferCount
466		@abstract Get Requested Data Transfer Count
467		@param parallelTask A valid SCSIParallelTaskIdentifier.
468		@result xxx
469	*/
470	UInt64	GetRequestedDataTransferCount ( SCSIParallelTaskIdentifier parallelTask );
471
472	/*!
473		@function GetRealizedDataTransferCount
474		@abstract Get Realized Data Transfer Count
475		@param parallelTask A valid SCSIParallelTaskIdentifier.
476		@result xxx
477	*/
478	UInt64	GetRealizedDataTransferCount (
479							SCSIParallelTaskIdentifier 	parallelTask );
480
481	/*!
482		@function SetRealizedDataTransferCount
483		@abstract Set Realized Data Transfer Count
484		@param parallelTask A valid SCSIParallelTaskIdentifier.
485		@param realizedTransferCountInBytes
486		@result xxx
487	*/
488	bool	SetRealizedDataTransferCount (
489							SCSIParallelTaskIdentifier 	parallelTask,
490							UInt64 						realizedTransferCountInBytes );
491
492	/*!
493		@function IncrementRealizedDataTransferCount
494		@abstract Increment Realized Data Transfer Count
495		@param parallelTask A valid SCSIParallelTaskIdentifier.
496		@param realizedTransferCountInBytes
497	*/
498	void	IncrementRealizedDataTransferCount (
499							SCSIParallelTaskIdentifier 	parallelTask,
500							UInt64 						realizedTransferCountInBytes );
501	/*!
502		@function GetDataBuffer
503		@abstract Accessor to get client buffer
504		@param parallelTask A valid SCSIParallelTaskIdentifier.
505		@result returns pointer IOMemoryDescriptor of data buffer
506	*/
507	IOMemoryDescriptor * GetDataBuffer ( SCSIParallelTaskIdentifier parallelTask );
508
509	/*!
510		@function GetDataBufferOffset
511		@abstract Accessor to get offset into client buffer
512		@param parallelTask A valid SCSIParallelTaskIdentifier.
513		@result returns offset in bytes
514	*/
515	UInt64	GetDataBufferOffset ( SCSIParallelTaskIdentifier parallelTask );
516
517	/*!
518		@function GetTimeoutDuration
519		@abstract Accessor to get client timeout duration
520		@param parallelTask A valid SCSIParallelTaskIdentifier.
521		@result returns timeout duration in microseconds
522	*/
523	UInt32	GetTimeoutDuration ( SCSIParallelTaskIdentifier parallelTask );
524
525	/*!
526		@function SetWideDataTransferNegotiationResult
527		@abstract Set Wide Data Transfer Negotiation Result
528		@discussion Set SCSI Parallel Device object if Wide Data Transfers need to be negotiated.
529		@param parallelTask A valid SCSIParallelTaskIdentifier.
530		@param newControl SCSIParallelFeatureControl
531	*/
532	void	SetSCSIParallelFeatureNegotiation (
533							SCSIParallelTaskIdentifier 	parallelTask,
534							SCSIParallelFeature 		requestedFeature,
535							SCSIParallelFeatureRequest 	newRequest );
536
537	/*!
538		@function GetWideDataTransferNegotiation
539		@abstract Get Wide Data Transfer Negotiation
540		@discussion Query as to whether the SCSI Parallel Device object has negotiated
541		Wide Data Transfers.
542		@param parallelTask A valid SCSIParallelTaskIdentifier.
543		@param newControl SCSIParallelFeatureControl
544	*/
545	SCSIParallelFeatureRequest		GetSCSIParallelFeatureNegotiation (
546							SCSIParallelTaskIdentifier 	parallelTask,
547							SCSIParallelFeature 		requestedFeature );
548
549	/*!
550		@function GetSCSIParallelFeatureNegotiationCount
551		@abstract Method to retrieve the number of requested negotiations.
552		@discussion Query as to the number of SCSI Parallel Features that are
553		requested to either be negotitated or cleared.  These are all features
554		that are set to either kSCSIParallelFeature_AttemptNegotiation or
555		kSCSIParallelFeature_ClearNegotiation.  If the return value is zero,
556		then all features are set to kSCSIParallelFeature_NoNegotiation
557		and all feature negotiations are to remain as they currently exist.
558		@param parallelTask A valid SCSIParallelTaskIdentifier.
559		@result an unsigned integer up to 64 bits in size.
560	*/
561
562	UInt64		GetSCSIParallelFeatureNegotiationCount (
563							SCSIParallelTaskIdentifier 	parallelTask);
564
565	/*!
566		@function GetWideDataTransferNegotiationResult
567		@abstract Get Wide Data Transfer Negotiation Result
568		@discussion Query as to whether the SCSI Parallel Controller object has negotiated
569		Wide Data Transfers.
570		@param parallelTask A valid SCSIParallelTaskIdentifier.
571		@param newControl SCSIParallelFeatureControl
572	*/
573	SCSIParallelFeatureResult		GetSCSIParallelFeatureNegotiationResult (
574							SCSIParallelTaskIdentifier 	parallelTask,
575							SCSIParallelFeature 		requestedFeature );
576
577	/*!
578		@function GetSCSIParallelFeatureNegotiationResultCount
579		@abstract Method to retrieve the number of changed negotiations.
580		@discussion Query as to the number of SCSI Parallel Features that have
581		been changed to either negotitated or cleared.  These are all features
582		that are set to either kSCSIParallelFeature_NegotitiationCleared or
583		kSCSIParallelFeature_NegotitiationSuccess.  If the return value is zero,
584		then all features are set to kSCSIParallelFeature_NegotitiationUnchanged.
585		@param parallelTask A valid SCSIParallelTaskIdentifier.
586		@result an unsigned integer up to 64 bits in size.
587	*/
588
589	UInt64		GetSCSIParallelFeatureNegotiationResultCount (
590							SCSIParallelTaskIdentifier 	parallelTask);
591
592	UInt64		GetControllerTaskIdentifier (
593							SCSIParallelTaskIdentifier 	parallelTask);
594
595
596	// The HBA Data related fields
597
598	/*!
599		@function GetHBADataSize
600		@abstract Accessor to Get HBA Data Size
601		@discussion xxx
602		@param parallelTask A valid SCSIParallelTaskIdentifier.
603		@result returns HBA Data size in bytes
604	*/
605	UInt32	GetHBADataSize ( SCSIParallelTaskIdentifier parallelTask );
606
607	/*!
608		@function GetHBADataPointer
609		@abstract Accessor to Get HBA Data Pointer
610		@discussion xxx
611		@param parallelTask A valid SCSIParallelTaskIdentifier.
612		@result returns pointer to buffer for HBA specific data, NULL if
613		none found or GetHBADataSize is zero.
614	*/
615	void *	GetHBADataPointer ( SCSIParallelTaskIdentifier parallelTask );
616
617	/*!
618		@function GetHBADataDescriptor
619		@abstract Accessor to Get HBA Data Descriptor
620		@discussion xxx
621		@param parallelTask A valid SCSIParallelTaskIdentifier.
622		@result returns pointer to IOMemoryDescriptor that wraps the HBA specific
623		data buffer, NULL if none found or GetHBADataSize is zero.
624	*/
625	IOMemoryDescriptor * 	GetHBADataDescriptor (
626								SCSIParallelTaskIdentifier 	parallelTask );
627
628
629	void 					InitializePowerManagement ( IOService * provider );
630
631
632#if 0
633#pragma mark -
634#pragma mark For Internal Use Only
635#endif
636
637public:
638
639	/*
640	 * IOService support member routines.
641	 */
642	bool		start ( IOService * provider );
643	void		stop ( IOService *  provider );
644	void		free ( void );
645	bool		finalize ( IOOptionBits options );
646
647	IOReturn	message ( UInt32 clientMsg, IOService * forProvider, void * forArg = 0 );
648	IOReturn	requestProbe ( IOOptionBits options );
649
650	/*
651	 * IOSCSIProtocolServices support member routines.
652	 */
653
654	// return false when we are busy and command can't be taken
655	virtual bool SendSCSICommand ( 	SCSITaskIdentifier 			request,
656									SCSIServiceResponse * 		serviceResponse,
657									SCSITaskStatus * 			taskStatus );
658
659	// This member routine is obsoleted and should not be used by a client.
660	virtual SCSIServiceResponse AbortSCSICommand ( SCSITaskIdentifier request );
661
662protected:
663
664
665	SCSIServiceResponse		HandleAbortTask (
666											UInt8 						theLogicalUnit,
667											SCSITaggedTaskIdentifier 	theTag );
668
669	SCSIServiceResponse		HandleAbortTaskSet (
670											UInt8 						theLogicalUnit );
671
672	SCSIServiceResponse		HandleClearACA (
673											UInt8 						theLogicalUnit );
674
675	SCSIServiceResponse		HandleClearTaskSet (
676											UInt8 						theLogicalUnit );
677
678	SCSIServiceResponse		HandleLogicalUnitReset (
679											UInt8 						theLogicalUnit );
680
681	SCSIServiceResponse		HandleTargetReset ( void );
682
683private:
684
685	// The SCSI Target Identifer for this device
686	SCSITargetIdentifier		fTargetIdentifier;
687
688	// Member variables that indicate if the target supports wide transfers
689	// and if it has been succesfully negotiated.
690	bool						fITNexusSupportsFeature[kSCSIParallelFeature_TotalFeatureCount];
691	bool						fFeatureIsNegotiated[kSCSIParallelFeature_TotalFeatureCount];
692
693	// This is the size and space of the HBA data as requested
694	// when the device object was created.
695	UInt32						fHBADataSize;
696	void *						fHBAData;
697
698	// Lock for controlling access to the queues.
699	IOSimpleLock *				fQueueLock;
700	queue_head_t				fOutstandingTaskList;
701	queue_head_t				fResendTaskList;
702	bool						fAllowResends;
703	bool						fResendThreadScheduled;
704	bool						fMultiPathSupport;
705
706	IOSCSIParallelInterfaceController *	fController;
707
708	// Member variables to maintain the previous and next element in the
709	// Parallel device list.
710	IOSCSIParallelInterfaceDevice *		fPreviousParallelDevice;
711	IOSCSIParallelInterfaceDevice *		fNextParallelDevice;
712
713	// Member routine to query the device for SCSI Parallel Features supported
714	// such as synchronous negotiation, wide negotiation, qas,
715	// tagged command queueing, etc.
716	void 		DetermineParallelFeatures ( UInt8 * inqData );
717
718};
719
720
721#endif	/* __IOKIT_IO_SCSI_PARALLEL_INTERFACE_DEVICE_H__ */