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_error_recovery {
192 uint8_t page_code : 6;
194 uint8_t page_ctrl : 1;
204 uint8_t rd_retry_cnt;
205 uint8_t correct_spin;
207 uint8_t data_strobe_offset;
210 uint8_t wr_retry_cnt;
212 uint16_t recovery_time_limit;
213 } __attribute__((packed));
216 struct atapi_cdrom_caps {
217 uint8_t page_code : 6;
219 uint8_t page_ctrl : 1;
224 uint8_t dvdrom_rd : 1;
226 uint8_t dvdram_rd : 1;
233 uint8_t dvdram_wr : 1;
235 uint8_t audio_play : 1;
236 uint8_t composite : 1;
237 uint8_t digi_port1 : 1;
238 uint8_t digi_port2 : 1;
239 uint8_t mode2_form1 : 1;
240 uint8_t mode2_form2 : 1;
241 uint8_t multisession : 1;
244 uint8_t cdda_str_acc : 1;
245 uint8_t rw_supported : 1;
247 uint8_t c2_ptrs_supp : 1;
250 uint8_t rd_bar_cd_cap : 1;
252 uint8_t lock_state : 1;
253 uint8_t prevent_jmpr : 1;
258 uint8_t sep_chnl_mute : 1;
261 uint8_t side_chg_cap : 1;
262 uint8_t rw_in_lead_rd : 1;
265 uint16_t num_vols_supp;
266 uint16_t lun_buf_size; // in KBytes
275 uint16_t obsolete4[2];
276 uint16_t cp_mgmnt_rev_supp;
278 uint8_t rot_ctrl_sel : 2;
280 uint16_t cur_wr_spd; // KBytes/sec
281 uint16_t num_lun_wr_spd_dsc_tbls;
282 // lun write speed descriptor tables
283 } __attribute__((packed));