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));
70 struct atapi_error_recovery {
74 uint8_t page_code : 6;
76 uint8_t page_ctrl : 1;
89 uint8_t data_strobe_offset;
94 uint16_t recovery_time_limit;
95 } __attribute__((packed));
96 } __attribute__((packed));
97 } __attribute__((packed));
102 struct atapi_read10_cmd {
104 uint8_t rel_addr : 1;
106 uint8_t force_access : 1; // can't use cache for data
107 uint8_t disable_pg_out : 1;
113 } __attribute__((packed));
116 struct atapi_mode_sense_cmd {
117 uint8_t atapi_cmd; // 0x5a
119 uint8_t disable_blk_desc : 1;
120 uint8_t long_lba_acc : 1;
122 uint8_t page_code : 6;
123 uint8_t page_ctrl : 2;
124 uint8_t sub_page_code;
131 uint8_t vendor_specific : 2;
132 } __attribute__((packed));
134 struct atapi_mode_sense_hdr {
135 uint16_t mode_data_len;
136 uint8_t media_type_code;
138 uint16_t blk_desc_len;
139 } __attribute__((packed));
142 struct atapi_rd_capacity_cmd {
143 uint8_t atapi_cmd; // 0x25
144 uint8_t obsolete : 1;
155 uint8_t vendor_spec : 2;
156 } __attribute__((packed));
159 struct atapi_rd_capacity_resp {
162 } __attribute__((packed));
164 struct atapi_config_cmd {
165 uint8_t atapi_cmd; // 0x46
169 uint16_t start_feature_num;
176 uint8_t vendor_specific : 2;
177 } __attribute__((packed));
179 struct atapi_config_resp {
182 uint16_t cur_profile;
183 } __attribute__((packed));
186 struct atapi_rd_toc_cmd {
187 uint8_t atapi_cmd; // 0x43
201 uint8_t vendor_specific : 2;
202 } __attribute__((packed));
204 struct atapi_rd_toc_resp {
206 uint8_t first_track_num;
207 uint8_t last_track_num;
216 } track_descs[0] __attribute__((packed)) ;
218 } __attribute__((packed));
221 struct atapi_mech_status_cmd {
222 uint8_t atapi_cmd; // 0xbd
232 uint8_t vendor_specific : 2;
233 } __attribute__((packed));
235 struct atapi_mech_status_resp {
236 uint8_t cur_slot : 5;
237 uint8_t changer_state : 2;
240 uint8_t door_open : 1;
241 uint8_t cd_dvd_mech_state : 3;
243 uint8_t num_slots : 6;
245 uint16_t slot_table_len;
246 } __attribute__((packed));
249 struct atapi_inquiry_cmd {
250 uint8_t atapi_cmd; // 0x12
252 uint8_t obsolete : 1;
261 uint8_t vendor_specific : 2;
262 } __attribute__((packed));
265 struct atapi_inquiry_resp {
266 #define DEV_TYPE_CDROM 0x05
267 uint8_t dev_type : 5;
268 uint8_t rsvd1 : 3; // not used in ATAPI
270 uint8_t removable_media : 1;
272 uint8_t resp_data_fmt : 4;
273 uint8_t atapi_trans_ver : 4;
274 uint8_t additional_len;
277 uint8_t spc_3pc : 1; // no idea
283 uint8_t ack_req_q : 1;
284 uint8_t media_changer : 1;
285 uint8_t multi_port : 1;
287 uint8_t enc_services : 1;
288 uint8_t basic_queueing : 1;
291 uint8_t cmd_queue : 1;
292 uint8_t tran_dis : 1;
297 uint8_t rel_addr : 1;
299 uint8_t t10_vendor_id[8];
300 uint8_t product_id[16];
301 uint8_t product_rev[4];
302 /* We'll ignore these for now...
303 uint8_t vendor_specific[20];
306 uint8_t clocking : 2;
309 uint16_t version_desc[8];
311 } __attribute__((packed));
317 struct atapi_cdrom_caps {
318 uint8_t page_code : 6;
320 uint8_t page_ctrl : 1;
325 uint8_t dvdrom_rd : 1;
327 uint8_t dvdram_rd : 1;
334 uint8_t dvdram_wr : 1;
336 uint8_t audio_play : 1;
337 uint8_t composite : 1;
338 uint8_t digi_port1 : 1;
339 uint8_t digi_port2 : 1;
340 uint8_t mode2_form1 : 1;
341 uint8_t mode2_form2 : 1;
342 uint8_t multisession : 1;
345 uint8_t cdda_str_acc : 1;
346 uint8_t rw_supported : 1;
348 uint8_t c2_ptrs_supp : 1;
351 uint8_t rd_bar_cd_cap : 1;
353 uint8_t lock_state : 1;
354 uint8_t prevent_jmpr : 1;
359 uint8_t sep_chnl_mute : 1;
362 uint8_t side_chg_cap : 1;
363 uint8_t rw_in_lead_rd : 1;
366 uint16_t num_vols_supp;
367 uint16_t lun_buf_size; // in KBytes
376 uint16_t obsolete4[2];
377 uint16_t cp_mgmnt_rev_supp;
379 uint8_t rot_ctrl_sel : 2;
381 uint16_t cur_wr_spd; // KBytes/sec
382 uint16_t num_lun_wr_spd_dsc_tbls;
383 // lun write speed descriptor tables
384 } __attribute__((packed));