2 * Copyright 2008, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Michael Lotz <mmlr@mlotz.ch>
9 #ifndef _USB_DISK_SCSI_H_
10 #define _USB_DISK_SCSI_H_
13 SCSI_TEST_UNIT_READY_6
= 0x00,
14 SCSI_REQUEST_SENSE_6
= 0x03,
15 SCSI_INQUIRY_6
= 0x12,
16 SCSI_MODE_SENSE_6
= 0x1a,
17 SCSI_START_STOP_UNIT_6
= 0x1b,
18 SCSI_SEND_DIAGNOSTIC
= 0x1d,
19 SCSI_READ_CAPACITY_10
= 0x25,
22 SCSI_SYNCHRONIZE_CACHE_10
= 0x35,
25 // parameters = returned data
26 typedef struct scsi_request_sense_6_parameter_s
{
33 uint8 additional_sense_length
;
34 uint32 command_specific_information
;
35 uint8 additional_sense_code
;
36 uint8 additional_sense_code_qualifier
;
37 uint8 field_replacable_unit_code
;
38 uint8 sense_key_specific
[3];
39 } _PACKED scsi_request_sense_6_parameter
;
41 typedef struct scsi_inquiry_6_parameter_s
{
42 uint8 peripherial_device_type
: 5;
43 uint8 peripherial_qualifier
: 3;
45 uint8 removable_medium
: 1;
47 uint8 response_data_format
: 4;
49 uint8 additional_length
;
51 char vendor_identification
[8];
52 char product_identification
[16];
53 char product_revision_level
[4];
54 } _PACKED scsi_inquiry_6_parameter
;
56 typedef struct scsi_mode_sense_6_parameter_s
{
59 uint8 device_specific
;
60 uint8 block_descriptor_length
;
64 uint8 block_length
[3];
65 } _PACKED scsi_mode_sense_6_parameter
;
67 typedef struct scsi_read_capacity_10_parameter_s
{
68 uint32 last_logical_block_address
;
69 uint32 logical_block_length
;
70 } _PACKED scsi_read_capacity_10_parameter
;
72 // request sense keys/codes
74 SCSI_SENSE_KEY_NO_SENSE
= 0x00,
75 SCSI_SENSE_KEY_RECOVERED_ERROR
= 0x01,
76 SCSI_SENSE_KEY_NOT_READY
= 0x02,
77 SCSI_SENSE_KEY_MEDIUM_ERROR
= 0x03,
78 SCSI_SENSE_KEY_HARDWARE_ERROR
= 0x04,
79 SCSI_SENSE_KEY_ILLEGAL_REQUEST
= 0x05,
80 SCSI_SENSE_KEY_UNIT_ATTENTION
= 0x06,
81 SCSI_SENSE_KEY_DATA_PROTECT
= 0x07,
82 SCSI_SENSE_KEY_ABORTED_COMMAND
= 0x0b,
85 // request sense additional sense codes
86 #define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3a
88 // mode sense page code/parameter
89 #define SCSI_MODE_PAGE_DEVICE_CONFIGURATION 0x10
90 #define SCSI_DEVICE_SPECIFIC_WRITE_PROTECT 0x80
92 #endif // _USB_DISK_SCSI_H_