2 Copyright (c) 2006 - 2007, 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.
34 #define STALL_1_MILLI_SECOND 1000
35 #define USBFLPTIMEOUT STALL_1_MILLI_SECOND
36 #define USBDATATIMEOUT 2 * STALL_1_MILLI_SECOND
38 // ATAPI Packet Command
55 } TEST_UNIT_READY_CMD
;
63 UINT8 allocation_length
;
79 UINT8 allocation_length
;
94 UINT8 page_control
: 2;
99 UINT8 parameter_list_length_hi
;
100 UINT8 parameter_list_length_lo
;
104 } MODE_SENSE_CMD_UFI
;
108 UINT8 reserved_1
: 3;
110 UINT8 reserved_2
: 1;
113 UINT8 page_control
: 2;
115 UINT8 allocation_length
;
117 } MODE_SENSE_CMD_SCSI
;
121 UINT8 reserved_1
: 5;
143 UINT8 allocation_length_hi
;
144 UINT8 allocation_length_lo
;
148 } READ_FORMAT_CAP_CMD
;
152 TEST_UNIT_READY_CMD TestUnitReady
;
154 REQUEST_SENSE_CMD RequestSense
;
156 MODE_SENSE_CMD_UFI ModeSenseUFI
;
157 READ_FORMAT_CAP_CMD ReadFormatCapacity
;
158 MODE_SENSE_CMD_SCSI ModeSenseSCSI
;
159 } ATAPI_PACKET_COMMAND
;
163 // Packet Command Code
165 #define TEST_UNIT_READY 0x00
167 #define REQUEST_SENSE 0x03
168 #define FORMAT_UNIT 0x04
169 #define REASSIGN_BLOCKS 0x07
171 #define START_STOP_UNIT 0x1B
172 #define PREVENT_ALLOW_MEDIA_REMOVAL 0x1E
173 #define READ_FORMAT_CAPACITY 0x23
174 #define OLD_FORMAT_UNIT 0x24
175 #define READ_CAPACITY 0x25
177 #define WRITE_10 0x2A
179 #define SEND_DIAGNOSTICS 0x3D
180 #define WRITE_VERIFY 0x2E
182 #define READ_DEFECT_DATA 0x37
183 #define WRITE_BUFFER 0x38
184 #define READ_BUFFER 0x3C
185 #define READ_LONG 0x3E
186 #define WRITE_LONG 0x3F
187 #define MODE_SELECT 0x55
188 #define UFI_MODE_SENSE5A 0x5A
189 #define SCSI_MODE_SENSE1A 0x1A
191 #define WRITE_12 0xAA
192 #define MAX_ATAPI_BYTE_COUNT (0xfffe)
197 #define REQUEST_SENSE_ERROR (0x70)
198 #define SK_NO_SENSE (0x0)
199 #define SK_RECOVERY_ERROR (0x1)
200 #define SK_NOT_READY (0x2)
201 #define SK_MEDIUM_ERROR (0x3)
202 #define SK_HARDWARE_ERROR (0x4)
203 #define SK_ILLEGAL_REQUEST (0x5)
204 #define SK_UNIT_ATTENTION (0x6)
205 #define SK_DATA_PROTECT (0x7)
206 #define SK_BLANK_CHECK (0x8)
207 #define SK_VENDOR_SPECIFIC (0x9)
208 #define SK_RESERVED_A (0xA)
209 #define SK_ABORT (0xB)
210 #define SK_RESERVED_C (0xC)
211 #define SK_OVERFLOW (0xD)
212 #define SK_MISCOMPARE (0xE)
213 #define SK_RESERVED_F (0xF)
216 // Additional Sense Codes
218 #define ASC_NOT_READY (0x04)
219 #define ASC_MEDIA_ERR1 (0x10)
220 #define ASC_MEDIA_ERR2 (0x11)
221 #define ASC_MEDIA_ERR3 (0x14)
222 #define ASC_MEDIA_ERR4 (0x30)
223 #define ASC_MEDIA_UPSIDE_DOWN (0x06)
224 #define ASC_INVALID_CMD (0x20)
225 #define ASC_LBA_OUT_OF_RANGE (0x21)
226 #define ASC_INVALID_FIELD (0x24)
227 #define ASC_WRITE_PROTECTED (0x27)
228 #define ASC_MEDIA_CHANGE (0x28)
229 #define ASC_RESET (0x29) /* Power On Reset or Bus Reset occurred */
230 #define ASC_ILLEGAL_FIELD (0x26)
231 #define ASC_NO_MEDIA (0x3A)
232 #define ASC_ILLEGAL_MODE_FOR_THIS_TRACK (0x64)
233 #define ASC_LOGICAL_UNIT_STATUS (0x08)
236 // Additional Sense Code Qualifier
238 #define ASCQ_IN_PROGRESS (0x01)
239 #define ASCQ_DEVICE_BUSY (0xff)
240 #define ASCQ_LOGICAL_UNIT_FAILURE (0x00)
241 #define ASCQ_LOGICAL_UNIT_TIMEOUT (0x01)
242 #define ASCQ_LOGICAL_UNIT_OVERRUN (0x80)
244 #define SETFEATURE TRUE
245 #define CLEARFEATURE FALSE
248 // ATAPI Data structure
253 UINT8 peripheral_type
;
256 UINT8 response_data_format
;
261 UINT8 vendor_info
[8];
262 UINT8 product_id
[12];
263 UINT8 eeprom_product_code
[4];
264 UINT8 firmware_rev_level
[4];
268 UINT8 error_code
: 7;
272 UINT8 reserved_21
: 1;
274 UINT8 reserved_22
: 2;
275 UINT8 vendor_specific_3
;
276 UINT8 vendor_specific_4
;
277 UINT8 vendor_specific_5
;
278 UINT8 vendor_specific_6
;
279 UINT8 addnl_sense_length
; // n - 7
280 UINT8 vendor_specific_8
;
281 UINT8 vendor_specific_9
;
282 UINT8 vendor_specific_10
;
283 UINT8 vendor_specific_11
;
284 UINT8 addnl_sense_code
; // mandatory
285 UINT8 addnl_sense_code_qualifier
; // mandatory
286 UINT8 field_replaceable_unit_code
; // optional
291 // Followed by additional sense bytes : FIXME
293 } REQUEST_SENSE_DATA
;
304 } READ_CAPACITY_DATA
;
310 UINT8 Capacity_Length
;
316 UINT8 reserved_9
: 6;
320 } READ_FORMAT_CAPACITY_DATA
;
323 UINT8 mode_data_len_hi
;
324 UINT8 mode_data_len_lo
;
325 UINT8 media_type_code
;
326 UINT8 reserved_3_0
: 4;
328 UINT8 reserved_3_1
: 2;
329 UINT8 write_protected
: 1;
334 } UFI_MODE_PARAMETER_HEADER
;
338 UINT8 media_type_code
;
340 UINT8 buffered_mode
: 3;
341 UINT8 write_protected
: 1;
342 UINT8 block_descritptor_length
;
343 } SCSI_MODE_PARAMETER_HEADER6
;
347 UINT8 reserved_0
: 1;
348 UINT8 parameter_savable
: 1;
350 UINT8 transfer_rate_msb
;
351 UINT8 transfer_rate_lsb
;
352 UINT8 number_of_heads
;
353 UINT8 sectors_per_track
;
354 UINT8 databytes_per_sector_msb
;
355 UINT8 databytes_per_sector_lsb
;
356 UINT8 number_of_cylinders_msb
;
357 UINT8 number_of_cylinders_lsb
;
358 UINT8 reserved_10_18
[9];
359 UINT8 motor_on_delay
;
360 UINT8 motor_off_delay
;
361 UINT8 reserved_21_27
[7];
362 UINT8 medium_rotation_rate_msb
;
363 UINT8 medium_rotation_rate_lsb
;
364 UINT8 reserved_30_31
[2];
365 } FLEXIBLE_DISK_PAGE
;
368 UFI_MODE_PARAMETER_HEADER mode_param_header
;
369 FLEXIBLE_DISK_PAGE flex_disk_page
;
370 } UFI_MODE_PARAMETER_PAGE_5
;
374 UINT8 reserved_0
: 1;
375 UINT8 parameter_savable
: 1;
378 UINT8 inactive_time_multplier
: 4;
379 UINT8 reserved_3
: 4;
380 UINT8 software_write_protect
: 1;
381 UINT8 disable_media_access
: 1;
382 UINT8 reserved_4
: 6;
386 } TIMER_AND_PROTECT_PAGE
;
389 UFI_MODE_PARAMETER_HEADER mode_param_header
;
390 TIMER_AND_PROTECT_PAGE time_and_protect_page
;
391 } UFI_MODE_PARAMETER_PAGE_1C
;