Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/IOKit/scsi/SCSICmds_MODE_Definitions.h

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

Archive Download this file

Revision: 2045