Added a test for MUIA_Listview_SelectChange.
[AROS.git] / rom / devs / ahci / ahci_scsi.h
blob1e8f3e80c01b298adc969de207d367bf25126739
1 /*
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
6 */
8 #ifndef AHCI_SCSI_H
9 #define AHCI_SCSI_H
11 #include <exec/io.h>
13 #include <scsi/commands.h>
15 struct scsi_vpd_supported_page_list {
16 UBYTE device;
17 UBYTE page_code;
18 #define SVPD_SUPPORTED_PAGE_LIST 0
19 #define SVPD_SUPPORTED_PAGES_HDR_LEN 4
20 UBYTE resv;
21 UBYTE length;
22 #define SVPD_SUPPORTED_PAGES_SIZE 251
23 UBYTE list[SVPD_SUPPORTED_PAGES_SIZE];
26 struct scsi_vpd_unit_serial_number {
27 UBYTE device;
28 UBYTE page_code;
29 #define SVPD_UNIT_SERIAL_NUMBER 0x80
30 UBYTE resv;
31 UBYTE length;
32 #define SVPD_SERIAL_NUM_SIZE 251
33 UBYTE serial_num[SVPD_SERIAL_NUM_SIZE];
36 struct scsi_vpd_unit_devid {
37 UBYTE device;
38 UBYTE page_code;
39 #define SVPD_UNIT_DEVID 0x83
40 #define SVPD_UNIT_DEVID_MAX_SIZE 252
41 UBYTE length[2];
42 UBYTE desc_list[];
45 #define SHORT_INQUIRY_LENGTH 36
47 struct scsi_generic {
48 UBYTE opcode;
49 UBYTE resv[5];
51 struct scsi_inquiry {
52 UBYTE opcode;
53 UBYTE byte2;
54 #define SI_EVPD (1 << 0)
55 UBYTE page_code;
56 UBYTE length;
57 UBYTE control;
60 struct scsi_inquiry_data {
61 #define T_DIRECT 0x00
62 UBYTE device;
63 UBYTE dev_qual2;
64 UBYTE version;
65 #define SCSI_REV_SPC2 4
66 UBYTE response_format;
67 UBYTE additional_length;
68 UBYTE spc3_flags;
69 UBYTE spc2_flags;
70 UBYTE flags;
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];
77 UBYTE spi3data;
78 UBYTE reserved2;
79 UBYTE version1[2];
80 UBYTE version2[2];
81 UBYTE version3[2];
82 UBYTE version4[2];
83 UBYTE version5[2];
84 UBYTE version6[2];
85 UBYTE version7[2];
86 UBYTE version8[2];
87 UBYTE reserved3[22];
88 #define SID_VENDOR_SPECIFIC_1_SIZE 160
89 UBYTE vendor_specific[SID_VENDOR_SPECIFIC_1_SIZE];
92 struct scsi_sense_data {
93 UBYTE error_code;
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
99 UBYTE segment;
100 UBYTE flags;
101 #define SSD_KEY 0x0f
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
118 #define SSD_ILI 0x20
119 #define SSD_EOM 0x40
120 #define SSD_FILEMARK 0x80
121 UBYTE info[4];
122 UBYTE extra_len;
123 UBYTE cmd_spec_info[4];
124 UBYTE add_sense_code;
125 UBYTE add_sense_qual;
126 UBYTE fru;
127 UBYTE sense_key_spec[3];
128 UBYTE extra_bytes[14];
131 /* Commands */
132 struct scsi_sense {
133 UBYTE opcode;
134 UBYTE byte2;
135 UBYTE unused[2];
136 UBYTE length;
137 UBYTE control;
140 struct scsi_rw_6 {
141 UBYTE opcode;
142 UBYTE addr[3];
143 #define SRW_TOPADDR 0x1f
144 UBYTE length;
145 UBYTE control;
148 struct scsi_rw_10 {
149 UBYTE opcode;
150 UBYTE byte2;
151 UBYTE addr[4];
152 UBYTE reserved;
153 UBYTE length[2];
154 UBYTE control;
157 struct scsi_rw_12 {
158 UBYTE opcode;
159 UBYTE byte2;
160 UBYTE addr[4];
161 UBYTE length[4];
162 UBYTE resv;
163 UBYTE control;
166 struct scsi_rw_16 {
167 UBYTE opcode;
168 UBYTE byte2;
169 UBYTE addr[8];
170 UBYTE length[4];
171 UBYTE resv;
172 UBYTE control;
175 struct scsi_read_capacity_data {
176 UBYTE addr[4];
177 UBYTE length[4];
180 struct scsi_read_capacity {
181 UBYTE opcode;
182 UBYTE byte2;
183 #define SRC_RELADR 0x01
184 UBYTE addr[4];
185 UBYTE unused[2];
186 UBYTE pmi;
187 #define SRC_PMI 0x01
188 UBYTE control;
191 struct scsi_read_capacity_16 {
192 UBYTE opcode;
193 #define SRC16_SERVICE_ACTION 0x10
194 UBYTE service_action;
195 UBYTE addr[8];
196 UBYTE alloc_len[4];
197 #define SRC16_PMI 0x01
198 #define SRC16_RELADR 0x02
199 UBYTE reladr;
200 UBYTE control;
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;
212 } *scsi_cdb_t;
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 */