2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #ifndef __DEVICES_ATAPI_TYPES_H__
22 #define __DEVICES_ATAPI_TYPES_H__
26 #include <palacios/vmm_types.h>
30 ATAPI_SEN_NOT_RDY = 2,
31 ATAPI_SEN_ILL_REQ = 5,
32 ATAPI_SEN_UNIT_ATTNT = 6
36 ASC_INV_CMD_FIELD = 0x24,
37 ASC_MEDIA_NOT_PRESENT = 0x3a,
38 ASC_SAVE_PARAM_NOT_SUPPORTED = 0x39,
39 ASC_LOG_BLK_OOR = 0x21 /* LOGICAL BLOCK OUT OF RANGE */
40 } atapi_add_sense_code_t ;
42 struct atapi_irq_flags {
47 } __attribute__((packed));
51 struct atapi_sense_data {
57 uint8_t sense_key; // atapi_sense_key_t
59 uint8_t read_len; // num bytes past this point
61 uint8_t asc; // atapi_add_sense_code_t
65 } __attribute__((packed));
66 } __attribute__((packed));
67 } __attribute__((packed));
72 struct atapi_read10_cmd {
76 uint8_t force_access : 1; // can't use cache for data
77 uint8_t disable_pg_out : 1;
83 } __attribute__((packed));
86 struct atapi_mode_sense_cmd {
87 uint8_t atapi_cmd; // 0x5a
89 uint8_t disable_blk_desc : 1;
90 uint8_t long_lba_acc : 1;
92 uint8_t page_code : 6;
93 uint8_t page_ctrl : 2;
94 uint8_t sub_page_code;
101 uint8_t vendor_specific : 2;
102 } __attribute__((packed));
104 struct atapi_mode_sense_hdr {
105 uint16_t mode_data_len;
106 uint8_t media_type_code;
108 uint16_t blk_desc_len;
109 } __attribute__((packed));
112 struct atapi_rd_capacity_cmd {
113 uint8_t atapi_cmd; // 0x25
114 uint8_t obsolete : 1;
125 uint8_t vendor_spec : 2;
126 } __attribute__((packed));
129 struct atapi_rd_capacity_resp {
132 } __attribute__((packed));
134 struct atapi_config_cmd {
135 uint8_t atapi_cmd; // 0x46
139 uint16_t start_feature_num;
146 uint8_t vendor_specific : 2;
147 } __attribute__((packed));
149 struct atapi_config_resp {
152 uint16_t cur_profile;
153 } __attribute__((packed));
156 struct atapi_rd_toc_cmd {
157 uint8_t atapi_cmd; // 0x43
171 uint8_t vendor_specific : 2;
172 } __attribute__((packed));
174 struct atapi_rd_toc_resp {
176 uint8_t first_track_num;
177 uint8_t last_track_num;
186 } track_descs[0] __attribute__((packed)) ;
188 } __attribute__((packed));
191 struct atapi_mech_status_cmd {
192 uint8_t atapi_cmd; // 0xbd
202 uint8_t vendor_specific : 2;
203 } __attribute__((packed));
205 struct atapi_mech_status_resp {
206 uint8_t cur_slot : 5;
207 uint8_t changer_state : 2;
210 uint8_t door_open : 1;
211 uint8_t cd_dvd_mech_state : 3;
213 uint8_t num_slots : 6;
215 uint16_t slot_table_len;
216 } __attribute__((packed));
219 struct atapi_inquiry_cmd {
220 uint8_t atapi_cmd; // 0x12
222 uint8_t obsolete : 1;
231 uint8_t vendor_specific : 2;
232 } __attribute__((packed));
235 struct atapi_inquiry_resp {
236 #define DEV_TYPE_CDROM 0x05
237 uint8_t dev_type : 5;
238 uint8_t rsvd1 : 3; // not used in ATAPI
240 uint8_t removable_media : 1;
242 uint8_t resp_data_fmt : 4;
243 uint8_t atapi_trans_ver : 4;
244 uint8_t additional_len;
247 uint8_t spc_3pc : 1; // no idea
253 uint8_t ack_req_q : 1;
254 uint8_t media_changer : 1;
255 uint8_t multi_port : 1;
257 uint8_t enc_services : 1;
258 uint8_t basic_queueing : 1;
261 uint8_t cmd_queue : 1;
262 uint8_t tran_dis : 1;
267 uint8_t rel_addr : 1;
269 uint8_t t10_vendor_id[8];
270 uint8_t product_id[16];
271 uint8_t product_rev[4];
272 /* We'll ignore these for now...
273 uint8_t vendor_specific[20];
276 uint8_t clocking : 2;
279 uint16_t version_desc[8];
281 } __attribute__((packed));
285 struct atapi_error_recovery {
286 uint8_t page_code : 6;
288 uint8_t page_ctrl : 1;
298 uint8_t rd_retry_cnt;
299 uint8_t correct_spin;
301 uint8_t data_strobe_offset;
304 uint8_t wr_retry_cnt;
306 uint16_t recovery_time_limit;
307 } __attribute__((packed));
310 struct atapi_cdrom_caps {
311 uint8_t page_code : 6;
313 uint8_t page_ctrl : 1;
318 uint8_t dvdrom_rd : 1;
320 uint8_t dvdram_rd : 1;
327 uint8_t dvdram_wr : 1;
329 uint8_t audio_play : 1;
330 uint8_t composite : 1;
331 uint8_t digi_port1 : 1;
332 uint8_t digi_port2 : 1;
333 uint8_t mode2_form1 : 1;
334 uint8_t mode2_form2 : 1;
335 uint8_t multisession : 1;
338 uint8_t cdda_str_acc : 1;
339 uint8_t rw_supported : 1;
341 uint8_t c2_ptrs_supp : 1;
344 uint8_t rd_bar_cd_cap : 1;
346 uint8_t lock_state : 1;
347 uint8_t prevent_jmpr : 1;
352 uint8_t sep_chnl_mute : 1;
355 uint8_t side_chg_cap : 1;
356 uint8_t rw_in_lead_rd : 1;
359 uint16_t num_vols_supp;
360 uint16_t lun_buf_size; // in KBytes
369 uint16_t obsolete4[2];
370 uint16_t cp_mgmnt_rev_supp;
372 uint8_t rot_ctrl_sel : 2;
374 uint16_t cur_wr_spd; // KBytes/sec
375 uint16_t num_lun_wr_spd_dsc_tbls;
376 // lun write speed descriptor tables
377 } __attribute__((packed));