Chameleon

Chameleon Svn Source Tree

Root/tags/2.3/i386/include/IOKit/scsi/IOSCSIPeripheralDeviceNub.h

Source at commit 2862 created 7 years 24 days ago.
By ifabio, Tag 2.3 release, bump svn to 2.4
1/*
2 * Copyright (c) 1998-2009 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
25#ifndef _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_NUB_H_
26#define _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_NUB_H_
27
28
29//-----------------------------------------------------------------------------
30//Constants
31//-----------------------------------------------------------------------------
32
33// Probe score values
34enum
35{
36kPeripheralDeviceTypeNoMatch = 0,
37kDefaultProbeRanking = 5000,
38kFirstOrderRanking = 10000,
39kSecondOrderRanking = 15000,
40kThirdOrderRanking = 20000
41};
42
43
44#if defined(KERNEL) && defined(__cplusplus)
45
46
47//-----------------------------------------------------------------------------
48//Includes
49//-----------------------------------------------------------------------------
50
51// General IOKit headers
52#include <IOKit/IOLib.h>
53#include <IOKit/IOService.h>
54#include <IOKit/IOSyncer.h>
55
56// SCSI Architecture Model Family includes
57#include <IOKit/scsi/IOSCSIProtocolServices.h>
58
59
60// Forward definitions for internal use only classes.
61class SCSIPrimaryCommands;
62
63//-----------------------------------------------------------------------------
64//Class Declarations
65//-----------------------------------------------------------------------------
66
67class IOSCSIPeripheralDeviceNub : public IOSCSIProtocolServices
68{
69
70OSDeclareDefaultStructors ( IOSCSIPeripheralDeviceNub )
71
72private:
73
74static boolsCompareIOProperty (
75IOService *object,
76OSDictionary *table,
77char *propertyKeyName,
78bool *matches );
79
80static voidTaskCallback ( SCSITaskIdentifier completedTask );
81voidTaskCompletion ( SCSITaskIdentifier completedTask );
82
83static IOReturnsWaitForTask ( void * object, SCSITask * request );
84IOReturnGatedWaitForTask ( SCSITask * request );
85
86protected:
87
88SCSIServiceResponse SendTask ( SCSITask * request );
89
90boolInterrogateDevice ( void );
91
92// Reserve space for future expansion.
93struct IOSCSIPeripheralDeviceNubExpansionData { };
94IOSCSIPeripheralDeviceNubExpansionData * fIOSCSIPeripheralDeviceNubReserved;
95
96IOSCSIProtocolInterface *fProvider;
97#ifndef __LP64__
98SCSIPrimaryCommands *fSCSIPrimaryCommandObject;
99#endif
100UInt8fDefaultInquiryCount;
101
102virtual boolSendSCSICommand ( SCSITaskIdentifier request,
103SCSIServiceResponse * serviceResponse,
104SCSITaskStatus * taskStatus );
105
106virtual SCSIServiceResponseAbortSCSICommand ( SCSITaskIdentifier request );
107
108// The IsProtocolServiceSupported will return true if the specified
109// feature is supported by the protocol layer. If the service has a value that must be
110// returned, it will be returned in the serviceValue output parameter.
111virtual boolIsProtocolServiceSupported ( SCSIProtocolFeature feature, void * serviceValue );
112
113virtual boolHandleProtocolServiceFeature ( SCSIProtocolFeature feature, void * serviceValue );
114
115// We override this method in order to NOT do power management
116virtual voidInitializePowerManagement ( IOService * provider );
117
118public:
119
120boolinit( OSDictionary * propTable );
121virtual boolstart( IOService * provider );
122virtual voidfree( void );
123
124virtual IOReturnmessage ( UInt32 type, IOService * nub, void * arg );
125
126virtual boolmatchPropertyTable ( OSDictionary * table,
127 SInt32 * score );
128
129// The ExecuteCommand method will take a SCSITask object and transport
130// it across the physical wires to the device
131virtualvoidExecuteCommand ( SCSITaskIdentifierrequest );
132
133// The Task Management function to allow the SCSI Application Layer client to request
134// that a specific task be aborted.
135virtual SCSIServiceResponseAbortTask ( UInt8 theLogicalUnit, SCSITaggedTaskIdentifier theTag );
136
137// The Task Management function to allow the SCSI Application Layer client to request
138// that a all tasks curerntly in the task set be aborted.
139virtual SCSIServiceResponseAbortTaskSet ( UInt8 theLogicalUnit );
140
141virtual SCSIServiceResponseClearACA ( UInt8 theLogicalUnit );
142
143virtual SCSIServiceResponseClearTaskSet ( UInt8 theLogicalUnit );
144
145virtual SCSIServiceResponseLogicalUnitReset ( UInt8 theLogicalUnit );
146
147virtual SCSIServiceResponseTargetReset ( void );
148
149 // ************* Obsoleted Member Routine ****************
150 // The AbortCommand method is replaced by the AbortTask Management function and
151 // should no longer be called.
152virtual SCSIServiceResponseAbortCommand ( SCSITaskIdentifier abortTask );
153
154private:
155
156// Space reserved for future expansion.
157OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 1 );
158OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 2 );
159OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 3 );
160OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 4 );
161OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 5 );
162OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 6 );
163OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 7 );
164OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 8 );
165OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 9 );
166OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 10 );
167OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 11 );
168OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 12 );
169OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 13 );
170OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 14 );
171OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 15 );
172OSMetaClassDeclareReservedUnused ( IOSCSIPeripheralDeviceNub, 16 );
173
174};
175
176
177
178class IOSCSILogicalUnitNub : public IOSCSIPeripheralDeviceNub
179{
180
181OSDeclareDefaultStructors ( IOSCSILogicalUnitNub )
182
183private:
184
185UInt8fLogicalUnitNumber;
186
187protected:
188
189// Reserve space for future expansion.
190struct IOSCSILogicalUnitNubExpansionData { };
191IOSCSILogicalUnitNubExpansionData * fIOSCSILogicalUnitNubReserved;
192
193public:
194
195virtual boolstart( IOService * provider );
196
197virtual voidSetLogicalUnitNumber ( UInt8 newLUN );
198
199UInt8GetLogicalUnitNumber ( void );
200
201// The ExecuteCommand method will take a SCSITask object and transport
202// it across the physical wires to the device
203virtualvoidExecuteCommand ( SCSITaskIdentifierrequest );
204
205// The AbortCommand method will abort the indicated SCSI Task object,
206// if it is possible and the SCSI Task has not already completed.
207virtual SCSIServiceResponseAbortCommand ( SCSITaskIdentifierabortTask );
208
209private:
210
211// Space reserved for future expansion.
212OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 1 );
213OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 2 );
214OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 3 );
215OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 4 );
216OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 5 );
217OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 6 );
218OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 7 );
219OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 8 );
220OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 9 );
221OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 10 );
222OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 11 );
223OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 12 );
224OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 13 );
225OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 14 );
226OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 15 );
227OSMetaClassDeclareReservedUnused ( IOSCSILogicalUnitNub, 16 );
228
229};
230
231#endif/* defined(KERNEL) && defined(__cplusplus) */
232
233#endif/* _IOKIT_IO_SCSI_PERIPHERAL_DEVICE_NUB_H_ */
234

Archive Download this file

Revision: 2862