Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/IOKit/scsi/SCSICmds_MODE_Definitions.h

Source at commit 1129 created 12 years 11 months ago.
By meklort, Change options.o so that it reloads the system config as well. Also change it so that it uses that config for variables (NOTE: if the calue exists in chameleonConfig, it's used instead.
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#ifndef _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_
25#define _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_
26
27
28//-----------------------------------------------------------------------------
29//Includes
30//-----------------------------------------------------------------------------
31
32#if KERNEL
33#include <IOKit/IOTypes.h>
34#else
35#include <CoreFoundation/CoreFoundation.h>
36#endif
37
38
39/*! @header SCSI Request Sense Definitions
40@discussion
41This file contains all definitions for the data returned from
42the MODE_SENSE_6 and MODE_SENSE_10 commands.
43*/
44
45#pragma pack(1)
46
47/*!
48@struct SPCModeParameterHeader6
49@discussion
50Mode Parameter Header for the MODE_SENSE_6 command.
51*/
52typedef struct SPCModeParameterHeader6
53{
54UInt8MODE_DATA_LENGTH;
55UInt8MEDIUM_TYPE;
56UInt8DEVICE_SPECIFIC_PARAMETER;
57UInt8BLOCK_DESCRIPTOR_LENGTH;
58} SPCModeParameterHeader6;
59
60
61/*!
62@struct SPCModeParameterHeader10
63@discussion
64Mode Parameter Header for the MODE_SENSE_10 command.
65*/
66typedef struct SPCModeParameterHeader10
67{
68UInt16MODE_DATA_LENGTH;
69UInt8MEDIUM_TYPE;
70UInt8DEVICE_SPECIFIC_PARAMETER;
71UInt8LONGLBA;
72UInt8RESERVED;
73UInt16BLOCK_DESCRIPTOR_LENGTH;
74} SPCModeParameterHeader10;
75
76
77/*!
78@enum Long LBA Bitfield definitions
79@discussion
80Long LBA Bitfield definitions for Mode Parameter Header
81for MODE_SENSE_10 command.
82@constant kModeSenseParameterHeader10_LongLBABit
83Bit to indicate Long LBA block descriptors follow.
84@constant kModeSenseParameterHeader10_LongLBAMask
85Mask to test for kModeSenseParameterHeader10_LongLBABit.
86*/
87enum
88{
89kModeSenseParameterHeader10_LongLBABit= 0,
90kModeSenseParameterHeader10_LongLBAMask= (1 << kModeSenseParameterHeader10_LongLBABit),
91};
92
93
94/*!
95@enum Device Specific Parameter Bitfield definitions
96@discussion
97SBC definitions for Device Specific Parameter in the
98Mode Sense Header Block.
99@constant kModeSenseSBCDeviceSpecific_DPOFUABit
100Bit to indicate DPO and FUA bits are accepted by the device server.
101@constant kModeSenseSBCDeviceSpecific_WriteProtectBit
102Bit to indicate medium is write protected.
103@constant kModeSenseSBCDeviceSpecific_DPOFUAMask
104Mask to test for kModeSenseSBCDeviceSpecific_DPOFUABit.
105@constant kModeSenseSBCDeviceSpecific_WriteProtectMask
106Mask to test for kModeSenseSBCDeviceSpecific_WriteProtectBit.
107*/
108enum
109{
110kModeSenseSBCDeviceSpecific_DPOFUABit = 4,
111kModeSenseSBCDeviceSpecific_WriteProtectBit = 7,
112kModeSenseSBCDeviceSpecific_DPOFUAMask = (1 << kModeSenseSBCDeviceSpecific_DPOFUABit),
113kModeSenseSBCDeviceSpecific_WriteProtectMask = (1 << kModeSenseSBCDeviceSpecific_WriteProtectBit)
114};
115
116
117/*!
118@struct ModeParameterBlockDescriptor
119@discussion
120General mode parameter block descriptor.
121*/
122typedef struct ModeParameterBlockDescriptor
123{
124UInt8DENSITY_CODE;
125UInt8NUMBER_OF_BLOCKS[3];
126UInt8RESERVED;
127UInt8BLOCK_LENGTH[3];
128} ModeParameterBlockDescriptor;
129
130
131/*!
132@struct DASDModeParameterBlockDescriptor
133@discussion
134Direct Access Storage Device mode parameter block descriptor.
135*/
136typedef struct DASDModeParameterBlockDescriptor
137{
138UInt32NUMBER_OF_BLOCKS;
139UInt8DENSITY_CODE;
140UInt8BLOCK_LENGTH[3];
141} DASDModeParameterBlockDescriptor;
142
143
144/*!
145@struct LongLBAModeParameterBlockDescriptor
146@discussion
147Long LBA mode parameter block descriptor.
148*/
149typedef struct LongLBAModeParameterBlockDescriptor
150{
151UInt64NUMBER_OF_BLOCKS;
152UInt8DENSITY_CODE;
153UInt8RESERVED[3];
154UInt32BLOCK_LENGTH;
155} LongLBAModeParameterBlockDescriptor;
156
157
158/*!
159@struct ModePageFormatHeader
160@discussion
161Mode Page format header.
162*/
163typedef struct ModePageFormatHeader
164{
165UInt8PS_PAGE_CODE;
166UInt8PAGE_LENGTH;
167} ModePageFormatHeader;
168
169
170/*!
171@enum Mode Page Format bit definitions
172@discussion
173Mode Page Format bit definitions.
174@constant kModePageFormat_PS_Bit
175Bit to indicate Parameters Saveable.
176@constant kModePageFormat_PAGE_CODE_Mask
177Mask to obtain the PAGE_CODE from the PS_PAGE_CODE field.
178@constant kModePageFormat_PS_Mask
179Mask to test for kModePageFormat_PS_Bit.
180*/
181enum
182{
183kModePageFormat_PS_Bit= 7,
184
185kModePageFormat_PAGE_CODE_Mask= 0x3F,
186kModePageFormat_PS_Mask= (1 << kModePageFormat_PS_Bit)
187};
188
189
190#if 0
191#pragma mark -
192#pragma mark SPC Mode Pages
193#pragma mark -
194#endif
195
196
197/*!
198@enum SPC Mode Pages
199@discussion
200SPC Mode Page definitions.
201@constant kSPCModePagePowerConditionCode
202Power Conditions Mode Page value.
203@constant kSPCModePageAllPagesCode
204All Mode Pages value.
205*/
206enum
207{
208kSPCModePagePowerConditionCode= 0x1A,
209kSPCModePageAllPagesCode= 0x3F
210};
211
212/*!
213@struct SPCModePagePowerCondition
214@discussion
215Power Conditions Mode Page (PAGE CODE 0x1A) format.
216*/
217typedef struct SPCModePagePowerCondition
218{
219ModePageFormatHeaderheader;
220UInt8RESERVED;
221UInt8IDLE_STANDBY;
222UInt32IDLE_CONDITION_TIMER;
223UInt32STANDBY_CONDITION_TIMER;
224} SPCModePagePowerCondition;
225
226
227#if 0
228#pragma mark -
229#pragma mark 0x00 SBC Direct Access Mode Pages
230#pragma mark -
231#endif
232
233
234/*!
235@enum SBC Mode Pages
236@discussion
237SBC Mode Page definitions.
238@constant kSBCModePageFormatDeviceCode
239Format Device Mode Page value.
240@constant kSBCModePageRigidDiskGeometryCode
241Rigid Disk Geometry Page value.
242@constant kSBCModePageFlexibleDiskCode
243Flexible Disk Page value.
244@constant kSBCModePageCachingCode
245Caching Page value.
246*/
247enum
248{
249kSBCModePageFormatDeviceCode= 0x03,
250kSBCModePageRigidDiskGeometryCode= 0x04,
251kSBCModePageFlexibleDiskCode= 0x05,
252kSBCModePageCachingCode= 0x08
253};
254
255
256/*!
257@struct SBCModePageFormatDevice
258@discussion
259Format Device Mode Page (PAGE CODE 0x03) format.
260*/
261typedef struct SBCModePageFormatDevice
262{
263ModePageFormatHeaderheader;
264UInt16TRACKS_PER_ZONE;
265UInt16ALTERNATE_SECTORS_PER_ZONE;
266UInt16ALTERNATE_TRACKS_PER_ZONE;
267UInt16ALTERNATE_TRACKS_PER_LOGICAL_UNIT;
268UInt16SECTORS_PER_TRACK;
269UInt16DATA_BYTES_PER_PHYSICAL_SECTOR;
270UInt16INTERLEAVE;
271UInt16TRACK_SKEW_FACTOR;
272UInt16CYLINDER_SKEW_FACTOR;
273UInt8SSEC_HSEC_RMB_SURF;
274UInt8RESERVED[3];
275} SBCModePageFormatDevice;
276
277
278/*!
279@struct SBCModePageRigidDiskGeometry
280@discussion
281Rigid Disk Geometry Mode Page (PAGE CODE 0x04) format.
282*/
283typedef struct SBCModePageRigidDiskGeometry
284{
285ModePageFormatHeaderheader;
286UInt8NUMBER_OF_CYLINDERS[3];
287UInt8NUMBER_OF_HEADS;
288UInt8STARTING_CYLINDER_WRITE_PRECOMPENSATION[3];
289UInt8STARTING_CYLINDER_REDUCED_WRITE_CURRENT[3];
290UInt16DEVICE_STEP_RATE;
291UInt8LANDING_ZONE_CYLINDER[3];
292UInt8RPL;
293UInt8ROTATIONAL_OFFSET;
294UInt8RESERVED;
295UInt16MEDIUM_ROTATION_RATE;
296UInt8RESERVED1[2];
297} SBCModePageRigidDiskGeometry;
298
299
300/*!
301@enum Rigid Disk Geometry bitfields
302@discussion
303Bit field masks for Rigid Disk Geometry structure fields.
304@constant kSBCModePageRigidDiskGeometry_RPL_Mask
305Mask for use with the RPL field.
306*/
307enum
308{
309kSBCModePageRigidDiskGeometry_RPL_Mask= 0x03
310};
311
312
313/*!
314@struct SBCModePageFlexibleDisk
315@discussion
316Flexible Disk Mode Page (PAGE CODE 0x05) format.
317*/
318typedef struct SBCModePageFlexibleDisk
319{
320ModePageFormatHeaderheader;
321UInt16TRANSFER_RATE;
322UInt8NUMBER_OF_HEADS;
323UInt8SECTORS_PER_TRACK;
324UInt16DATA_BYTES_PER_SECTOR;
325UInt16NUMBER_OF_CYLINDERS;
326UInt16STARTING_CYLINDER_WRITE_PRECOMPENSATION;
327UInt16STARTING_CYLINDER_REDUCED_WRITE_CURRENT;
328UInt16DEVICE_STEP_RATE;
329UInt8DEVICE_STEP_PULSE_WIDTH;
330UInt16HEAD_SETTLE_DELAY;
331UInt8MOTOR_ON_DELAY;
332UInt8MOTOR_OFF_DELAY;
333UInt8TRDY_SSN_MO;
334UInt8SPC;
335UInt8WRITE_COMPENSATION;
336UInt8HEAD_LOAD_DELAY;
337UInt8HEAD_UNLOAD_DELAY;
338UInt8PIN_34_PIN_2;
339UInt8PIN_4_PIN_1;
340UInt16MEDIUM_ROTATION_RATE;
341UInt8RESERVED[2];
342} SBCModePageFlexibleDisk;
343
344
345/*!
346@enum TRDY_SSN_MO bitfields
347@discussion
348Bit field definitions and masks for Flexible Disk TRDY_SSN_MO field.
349@constant kSBCModePageFlexibleDisk_MO_Bit
350MO Bit definition.
351@constant kSBCModePageFlexibleDisk_SSN_Bit
352SSN Bit definition.
353@constant kSBCModePageFlexibleDisk_TRDY_Bit
354TRDY Bit definition.
355@constant kSBCModePageFlexibleDisk_MO_Mask
356Mask for use with TRDY_SSN_MO field.
357@constant kSBCModePageFlexibleDisk_SSN_Mask
358Mask for use with TRDY_SSN_MO field.
359@constant kSBCModePageFlexibleDisk_TRDY_Mask
360Mask for use with TRDY_SSN_MO field.
361*/
362enum
363{
364// Bits 0:4 Reserved
365kSBCModePageFlexibleDisk_MO_Bit= 5,
366kSBCModePageFlexibleDisk_SSN_Bit= 6,
367kSBCModePageFlexibleDisk_TRDY_Bit= 7,
368
369kSBCModePageFlexibleDisk_MO_Mask= (1 << kSBCModePageFlexibleDisk_MO_Bit),
370kSBCModePageFlexibleDisk_SSN_Mask= (1 << kSBCModePageFlexibleDisk_SSN_Bit),
371kSBCModePageFlexibleDisk_TRDY_Mask= (1 << kSBCModePageFlexibleDisk_TRDY_Bit)
372};
373
374
375/*!
376@enum SPC bitfields
377@discussion
378Bit field definitions and masks for Flexible Disk SPC field.
379@constant kSBCModePageFlexibleDisk_SPC_Mask
380Mask for use with SPC field.
381*/
382enum
383{
384kSBCModePageFlexibleDisk_SPC_Mask= 0x0F
385};
386
387
388/*!
389@enum PIN_34_PIN_2 bitfields
390@discussion
391Bit field definitions and masks for Flexible Disk PIN_34_PIN_2 field.
392@constant kSBCModePageFlexibleDisk_PIN_2_Mask
393Mask for use with PIN_34_PIN_2 field.
394@constant kSBCModePageFlexibleDisk_PIN_34_Mask
395Mask for use with PIN_34_PIN_2 field.
396*/
397enum
398{
399kSBCModePageFlexibleDisk_PIN_2_Mask= 0x0F,
400kSBCModePageFlexibleDisk_PIN_34_Mask= 0xF0
401};
402
403
404/*!
405@enum PIN_4_PIN_1 bitfields
406@discussion
407Bit field definitions and masks for Flexible Disk PIN_4_PIN_1 field.
408@constant kSBCModePageFlexibleDisk_PIN_1_Mask
409Mask for use with PIN_4_PIN_1 field.
410@constant kSBCModePageFlexibleDisk_PIN_4_Mask
411Mask for use with PIN_4_PIN_1 field.
412*/
413enum
414{
415kSBCModePageFlexibleDisk_PIN_1_Mask= 0x0F,
416kSBCModePageFlexibleDisk_PIN_4_Mask= 0xF0
417};
418
419
420/*!
421@struct SBCModePageCaching
422@discussion
423Caching Mode Page (PAGE CODE 0x08) format.
424*/
425typedef struct SBCModePageCaching
426{
427ModePageFormatHeaderheader;
428UInt8flags;
429UInt8DEMAND_READ_WRITE_RETENTION_PRIORITY;
430UInt16DISABLE_PREFETCH_TRANSFER_LENGTH;
431UInt16MINIMUM_PREFETCH;
432UInt16MAXIMUM_PREFETCH;
433UInt16MAXIMUM_PREFETCH_CEILING;
434UInt8flags2;
435UInt8NUMBER_OF_CACHE_SEGMENTS;
436UInt16CACHE_SEGMENT_SIZE;
437UInt8RESERVED;
438UInt8NON_CACHE_SEGMENT_SIZE[3];
439} SBCModePageCaching;
440
441
442/*!
443@enum Caching flags bitfields
444@discussion
445Bit field definitions and masks for Caching flags field.
446@constant kSBCModePageCaching_RCD_Bit
447RCD Bit definition.
448@constant kSBCModePageCaching_MF_Bit
449MF Bit definition.
450@constant kSBCModePageCaching_WCE_Bit
451WCE Bit definition.
452@constant kSBCModePageCaching_SIZE_Bit
453SIZE Bit definition.
454@constant kSBCModePageCaching_DISC_Bit
455DISC Bit definition.
456@constant kSBCModePageCaching_CAP_Bit
457CAP Bit definition.
458@constant kSBCModePageCaching_ABPF_Bit
459ABPF Bit definition.
460@constant kSBCModePageCaching_IC_Bit
461IC Bit definition.
462@constant kSBCModePageCaching_RCD_Mask
463Mask for use with flags field.
464@constant kSBCModePageCaching_MF_Mask
465Mask for use with flags field.
466@constant kSBCModePageCaching_WCE_Mask
467Mask for use with flags field.
468@constant kSBCModePageCaching_SIZE_Mask
469Mask for use with flags field.
470@constant kSBCModePageCaching_DISC_Mask
471Mask for use with flags field.
472@constant kSBCModePageCaching_CAP_Mask
473Mask for use with flags field.
474@constant kSBCModePageCaching_ABPF_Mask
475Mask for use with flags field.
476@constant kSBCModePageCaching_IC_Mask
477Mask for use with flags field.
478*/
479enum
480{
481kSBCModePageCaching_RCD_Bit= 0,
482kSBCModePageCaching_MF_Bit= 1,
483kSBCModePageCaching_WCE_Bit= 2,
484kSBCModePageCaching_SIZE_Bit= 3,
485kSBCModePageCaching_DISC_Bit= 4,
486kSBCModePageCaching_CAP_Bit= 5,
487kSBCModePageCaching_ABPF_Bit= 6,
488kSBCModePageCaching_IC_Bit= 7,
489
490kSBCModePageCaching_RCD_Mask= (1 << kSBCModePageCaching_RCD_Bit),
491kSBCModePageCaching_MF_Mask= (1 << kSBCModePageCaching_MF_Bit),
492kSBCModePageCaching_WCE_Mask= (1 << kSBCModePageCaching_WCE_Bit),
493kSBCModePageCaching_SIZE_Mask= (1 << kSBCModePageCaching_SIZE_Bit),
494kSBCModePageCaching_DISC_Mask= (1 << kSBCModePageCaching_DISC_Bit),
495kSBCModePageCaching_CAP_Mask= (1 << kSBCModePageCaching_CAP_Bit),
496kSBCModePageCaching_ABPF_Mask= (1 << kSBCModePageCaching_ABPF_Bit),
497kSBCModePageCaching_IC_Mask= (1 << kSBCModePageCaching_IC_Bit)
498};
499
500
501/*!
502@enum Demand Read/Write Retention masks
503@discussion
504Demand Read/Write Retention masks.
505@constant kSBCModePageCaching_DEMAND_WRITE_Mask
506Mask for the DEMAND_READ_WRITE_RETENTION_PRIORITY field.
507@constant kSBCModePageCaching_DEMAND_READ_Mask
508Mask for the DEMAND_READ_WRITE_RETENTION_PRIORITY field.
509*/
510enum
511{
512kSBCModePageCaching_DEMAND_WRITE_Mask= 0x00FF,
513kSBCModePageCaching_DEMAND_READ_Mask = 0xFF00
514};
515
516/*!
517@enum Caching flags2 bitfields
518@discussion
519Bit field definitions and masks for Caching flags2 field.
520@constant kSBCModePageCaching_VS1_Bit
521VS1 Bit definition.
522@constant kSBCModePageCaching_VS2_Bit
523VS2 Bit definition.
524@constant kSBCModePageCaching_DRA_Bit
525DRA Bit definition.
526@constant kSBCModePageCaching_LBCSS_Bit
527LBCSS Bit definition.
528@constant kSBCModePageCaching_FSW_Bit
529FSW Bit definition.
530@constant kSBCModePageCaching_VS1_Mask
531Mask for use with flags2 field.
532@constant kSBCModePageCaching_VS2_Mask
533Mask for use with flags2 field.
534@constant kSBCModePageCaching_DRA_Mask
535Mask for use with flags2 field.
536@constant kSBCModePageCaching_LBCSS_Mask
537Mask for use with flags2 field.
538@constant kSBCModePageCaching_FSW_Mask
539Mask for use with flags2 field.
540*/
541enum
542{
543// Bits 0:2 Reserved
544kSBCModePageCaching_VS1_Bit= 3,
545kSBCModePageCaching_VS2_Bit= 4,
546kSBCModePageCaching_DRA_Bit= 5,
547kSBCModePageCaching_LBCSS_Bit= 6,
548kSBCModePageCaching_FSW_Bit= 7,
549
550kSBCModePageCaching_VS1_Mask= (1 << kSBCModePageCaching_VS1_Bit),
551kSBCModePageCaching_VS2_Mask= (1 << kSBCModePageCaching_VS2_Bit),
552kSBCModePageCaching_DRA_Mask= (1 << kSBCModePageCaching_DRA_Bit),
553kSBCModePageCaching_LBCSS_Mask= (1 << kSBCModePageCaching_LBCSS_Bit),
554kSBCModePageCaching_FSW_Mask= (1 << kSBCModePageCaching_FSW_Bit)
555};
556
557#pragma options align=reset
558
559#endif/* _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_ */
560

Archive Download this file

Revision: 1129