2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 Header file for USB Mass Storage Device related Data Structures
22 #ifndef _USB_FLP_DATA_H
23 #define _USB_FLP_DATA_H
28 #define bit(a) 1 << (a)
31 // timeout unit is in millisecond.
33 #define USBFLPTIMEOUT 2000
34 #define STALL_1_MILLI_SECOND 1000
37 // ATAPI Packet Command
54 } TEST_UNIT_READY_CMD
;
62 UINT8 allocation_length
;
78 UINT8 allocation_length
;
93 UINT8 page_control
: 2;
98 UINT8 parameter_list_length_hi
;
99 UINT8 parameter_list_length_lo
;
103 } MODE_SENSE_CMD_UFI
;
107 UINT8 reserved_1
: 3;
109 UINT8 reserved_2
: 1;
112 UINT8 page_control
: 2;
114 UINT8 allocation_length
;
116 } MODE_SENSE_CMD_SCSI
;
120 UINT8 reserved_1
: 5;
142 UINT8 allocation_length_hi
;
143 UINT8 allocation_length_lo
;
147 } READ_FORMAT_CAP_CMD
;
151 TEST_UNIT_READY_CMD TestUnitReady
;
153 REQUEST_SENSE_CMD RequestSense
;
155 MODE_SENSE_CMD_UFI ModeSenseUFI
;
156 READ_FORMAT_CAP_CMD ReadFormatCapacity
;
157 MODE_SENSE_CMD_SCSI ModeSenseSCSI
;
158 } ATAPI_PACKET_COMMAND
;
162 // Packet Command Code
164 #define TEST_UNIT_READY 0x00
166 #define REQUEST_SENSE 0x03
167 #define FORMAT_UNIT 0x04
168 #define REASSIGN_BLOCKS 0x07
170 #define START_STOP_UNIT 0x1B
171 #define PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
172 #define READ_FORMAT_CAPACITY 0x23
173 #define OLD_FORMAT_UNIT 0x24
174 #define READ_CAPACITY 0x25
176 #define WRITE_10 0x2A
178 #define SEND_DIAGNOSTICS 0x3D
179 #define WRITE_VERIFY 0x2E
181 #define READ_DEFECT_DATA 0x37
182 #define WRITE_BUFFER 0x38
183 #define READ_BUFFER 0x3C
184 #define READ_LONG 0x3E
185 #define WRITE_LONG 0x3F
186 #define MODE_SELECT 0x55
187 #define UFI_MODE_SENSE5A 0x5A
188 #define SCSI_MODE_SENSE1A 0x1A
190 #define WRITE_12 0xAA
191 #define MAX_ATAPI_BYTE_COUNT (0xfffe)
196 #define REQUEST_SENSE_ERROR (0x70)
197 #define SK_NO_SENSE (0x0)
198 #define SK_RECOVERY_ERROR (0x1)
199 #define SK_NOT_READY (0x2)
200 #define SK_MEDIUM_ERROR (0x3)
201 #define SK_HARDWARE_ERROR (0x4)
202 #define SK_ILLEGAL_REQUEST (0x5)
203 #define SK_UNIT_ATTENTION (0x6)
204 #define SK_DATA_PROTECT (0x7)
205 #define SK_BLANK_CHECK (0x8)
206 #define SK_VENDOR_SPECIFIC (0x9)
207 #define SK_RESERVED_A (0xA)
208 #define SK_ABORT (0xB)
209 #define SK_RESERVED_C (0xC)
210 #define SK_OVERFLOW (0xD)
211 #define SK_MISCOMPARE (0xE)
212 #define SK_RESERVED_F (0xF)
215 // Additional Sense Codes
217 #define ASC_NOT_READY (0x04)
218 #define ASC_MEDIA_ERR1 (0x10)
219 #define ASC_MEDIA_ERR2 (0x11)
220 #define ASC_MEDIA_ERR3 (0x14)
221 #define ASC_MEDIA_ERR4 (0x30)
222 #define ASC_MEDIA_UPSIDE_DOWN (0x06)
223 #define ASC_INVALID_CMD (0x20)
224 #define ASC_LBA_OUT_OF_RANGE (0x21)
225 #define ASC_INVALID_FIELD (0x24)
226 #define ASC_WRITE_PROTECTED (0x27)
227 #define ASC_MEDIA_CHANGE (0x28)
228 #define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */
229 #define ASC_ILLEGAL_FIELD (0x26)
230 #define ASC_NO_MEDIA (0x3A)
231 #define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)
232 #define ASC_LOGICAL_UNIT_STATUS (0x08)
235 // Additional Sense Code Qualifier
237 #define ASCQ_IN_PROGRESS (0x01)
238 #define ASCQ_DEVICE_BUSY (0xff)
239 #define ASCQ_LOGICAL_UNIT_FAILURE (0x00)
240 #define ASCQ_LOGICAL_UNIT_TIMEOUT (0x01)
241 #define ASCQ_LOGICAL_UNIT_OVERRUN (0x80)
243 #define SETFEATURE TRUE
244 #define CLEARFEATURE FALSE
247 // ATAPI Data structure
252 UINT8 peripheral_type
;
255 UINT8 response_data_format
;
260 UINT8 vendor_info
[8];
261 UINT8 product_id
[12];
262 UINT8 eeprom_product_code
[4];
263 UINT8 firmware_rev_level
[4];
267 UINT8 error_code
: 7;
271 UINT8 reserved_21
: 1;
273 UINT8 reserved_22
: 2;
274 UINT8 vendor_specific_3
;
275 UINT8 vendor_specific_4
;
276 UINT8 vendor_specific_5
;
277 UINT8 vendor_specific_6
;
278 UINT8 addnl_sense_length
; // n - 7
279 UINT8 vendor_specific_8
;
280 UINT8 vendor_specific_9
;
281 UINT8 vendor_specific_10
;
282 UINT8 vendor_specific_11
;
283 UINT8 addnl_sense_code
; // mandatory
284 UINT8 addnl_sense_code_qualifier
; // mandatory
285 UINT8 field_replaceable_unit_code
; // optional
290 // Followed by additional sense bytes : FIXME
292 } REQUEST_SENSE_DATA
;
303 } READ_CAPACITY_DATA
;
309 UINT8 Capacity_Length
;
315 UINT8 reserved_9
: 6;
319 } READ_FORMAT_CAPACITY_DATA
;
322 UINT8 mode_data_len_hi
;
323 UINT8 mode_data_len_lo
;
324 UINT8 media_type_code
;
325 UINT8 reserved_3_0
: 4;
327 UINT8 reserved_3_1
: 2;
328 UINT8 write_protected
: 1;
333 } UFI_MODE_PARAMETER_HEADER
;
337 UINT8 media_type_code
;
339 UINT8 buffered_mode
: 3;
340 UINT8 write_protected
: 1;
341 UINT8 block_descritptor_length
;
342 } SCSI_MODE_PARAMETER_HEADER6
;
346 UINT8 reserved_0
: 1;
347 UINT8 parameter_savable
: 1;
349 UINT8 transfer_rate_msb
;
350 UINT8 transfer_rate_lsb
;
351 UINT8 number_of_heads
;
352 UINT8 sectors_per_track
;
353 UINT8 databytes_per_sector_msb
;
354 UINT8 databytes_per_sector_lsb
;
355 UINT8 number_of_cylinders_msb
;
356 UINT8 number_of_cylinders_lsb
;
357 UINT8 reserved_10_18
[9];
358 UINT8 motor_on_delay
;
359 UINT8 motor_off_delay
;
360 UINT8 reserved_21_27
[7];
361 UINT8 medium_rotation_rate_msb
;
362 UINT8 medium_rotation_rate_lsb
;
363 UINT8 reserved_30_31
[2];
364 } FLEXIBLE_DISK_PAGE
;
367 UFI_MODE_PARAMETER_HEADER mode_param_header
;
368 FLEXIBLE_DISK_PAGE flex_disk_page
;
369 } UFI_MODE_PARAMETER_PAGE_5
;
373 UINT8 reserved_0
: 1;
374 UINT8 parameter_savable
: 1;
377 UINT8 inactive_time_multplier
: 4;
378 UINT8 reserved_3
: 4;
379 UINT8 software_write_protect
: 1;
380 UINT8 disable_media_access
: 1;
381 UINT8 reserved_4
: 6;
385 } TIMER_AND_PROTECT_PAGE
;
388 UFI_MODE_PARAMETER_HEADER mode_param_header
;
389 TIMER_AND_PROTECT_PAGE time_and_protect_page
;
390 } UFI_MODE_PARAMETER_PAGE_1C
;