2 * Copyright (C) 2012, The AROS Development Team. All rights reserved.
3 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
5 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
13 #include <scsi/commands.h>
15 struct scsi_vpd_supported_page_list
{
18 #define SVPD_SUPPORTED_PAGE_LIST 0
19 #define SVPD_SUPPORTED_PAGES_HDR_LEN 4
22 #define SVPD_SUPPORTED_PAGES_SIZE 251
23 UBYTE list
[SVPD_SUPPORTED_PAGES_SIZE
];
26 struct scsi_vpd_unit_serial_number
{
29 #define SVPD_UNIT_SERIAL_NUMBER 0x80
32 #define SVPD_SERIAL_NUM_SIZE 251
33 UBYTE serial_num
[SVPD_SERIAL_NUM_SIZE
];
36 struct scsi_vpd_unit_devid
{
39 #define SVPD_UNIT_DEVID 0x83
40 #define SVPD_UNIT_DEVID_MAX_SIZE 252
45 #define SHORT_INQUIRY_LENGTH 36
54 #define SI_EVPD (1 << 0)
60 struct scsi_inquiry_data
{
65 #define SCSI_REV_SPC2 4
66 UBYTE response_format
;
67 UBYTE additional_length
;
71 #define SID_VENDOR_SIZE 8
72 UBYTE vendor
[SID_VENDOR_SIZE
];
73 #define SID_PRODUCT_SIZE 16
74 UBYTE product
[SID_PRODUCT_SIZE
];
75 #define SID_REVISION_SIZE 4
76 UBYTE revision
[SID_REVISION_SIZE
];
88 #define SID_VENDOR_SPECIFIC_1_SIZE 160
89 UBYTE vendor_specific
[SID_VENDOR_SPECIFIC_1_SIZE
];
92 struct scsi_sense_data
{
94 #define SSD_ERRCODE 0x7f
95 #define SSD_CURRENT_ERROR 0x70
96 #define SSD_DEFERRED_ERROR 0x71
97 #define SSD_ERRCODE_VALID 0x80
98 #define SSD_FULL_SIZE 252
102 #define SSD_KEY_NO_SENSE 0x00
103 #define SSD_KEY_RECOVERED_ERROR 0x01
104 #define SSD_KEY_NOT_READY 0x02
105 #define SSD_KEY_MEDIUM_ERROR 0x03
106 #define SSD_KEY_HARDWARE_ERROR 0x04
107 #define SSD_KEY_ILLEGAL_REQUEST 0x05
108 #define SSD_KEY_UNIT_ATTENTION 0x06
109 #define SSD_KEY_DATA_PROTECT 0x07
110 #define SSD_KEY_BLANK_CHECK 0x08
111 #define SSD_KEY_VENDOR_SPECIFIC 0x09
112 #define SSD_KEY_COPY_ABORTED 0x0a
113 #define SSD_KEY_ABORTED_COMMAND 0x0b
114 #define SSD_KEY_EQUAL 0x0c
115 #define SSD_KEY_VOLUME_OVERFLOW 0x0d
116 #define SSD_KEY_MISCOMPARE 0x0e
117 #define SSD_KEY_COMPLETED 0x0f
120 #define SSD_FILEMARK 0x80
123 UBYTE cmd_spec_info
[4];
124 UBYTE add_sense_code
;
125 UBYTE add_sense_qual
;
127 UBYTE sense_key_spec
[3];
128 UBYTE extra_bytes
[14];
143 #define SRW_TOPADDR 0x1f
175 struct scsi_read_capacity_data
{
180 struct scsi_read_capacity
{
183 #define SRC_RELADR 0x01
191 struct scsi_read_capacity_16
{
193 #define SRC16_SERVICE_ACTION 0x10
194 UBYTE service_action
;
197 #define SRC16_PMI 0x01
198 #define SRC16_RELADR 0x02
203 typedef union scsi_cdb
{
204 struct scsi_generic generic
;
205 struct scsi_inquiry inquiry
;
206 struct scsi_read_capacity read_capacity
;
207 struct scsi_rw_6 rw_6
;
208 struct scsi_rw_10 rw_10
;
209 struct scsi_rw_12 rw_12
;
210 struct scsi_rw_16 rw_16
;
211 struct scsi_sense sense
;
215 BOOL
ahci_scsi_disk_io(struct IORequest
*io
, struct SCSICmd
*scsi
);
216 BOOL
ahci_scsi_atapi_io(struct IORequest
*io
, struct SCSICmd
*scsi
);
218 #endif /* AHCI_SCSI_H */