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_IDE_TYPES_H__
22 #define __DEVICES_IDE_TYPES_H__
26 #include <palacios/vmm_types.h>
29 struct ide_error_reg {
33 uint_t addr_mark_nf : 1;
39 uint_t data_error : 1;
41 } __attribute__((packed));
42 } __attribute__((packed));
43 } __attribute__((packed));
47 struct ide_drive_head_reg {
56 } __attribute__((packed));
61 } __attribute__((packed));
63 } __attribute__((packed));
64 } __attribute__((packed));
68 struct ide_status_reg {
76 uint_t seek_complete : 1;
77 uint_t write_fault : 1;
80 } __attribute__((packed));
81 } __attribute__((packed));
82 } __attribute__((packed));
90 uint_t irq_disable : 1;
91 uint_t soft_reset : 1;
93 } __attribute__((packed));
94 } __attribute__((packed));
95 } __attribute__((packed));
98 struct ide_features_reg {
101 uint8_t dma; // 1 == DMA, 0 = PIO
102 } __attribute__((packed));
103 } __attribute__((packed));
106 struct ide_dma_cmd_reg {
114 } __attribute__((packed));
115 } __attribute__((packed));
116 } __attribute__((packed));
120 struct ide_dma_status_reg {
128 uint8_t prd_int_status : 1;
129 } __attribute__((packed));
130 } __attribute__((packed));
131 } __attribute__((packed));
137 uint8_t end_of_table : 1;
138 } __attribute__((packed));
142 typedef enum {IDE_CTRL_NOT_SPECIFIED,
143 IDE_CTRL_SINGLE_PORT,
145 IDE_CTRL_DUAL_PORT_CACHE} ide_controller_type;
147 struct ide_drive_id {
153 uint_t hard_sectors : 1;
154 uint_t no_soft_sectors : 1;
155 uint_t no_mfm_enc : 1;
156 uint_t head_switch_time : 1;
157 uint_t spnd_mot_ctrl : 1;
158 uint_t fixed_drive : 1;
159 uint_t removable_media : 1;
160 uint_t disk_speed1 : 1;
161 uint_t disk_speed2 : 1;
162 uint_t disk_speed3 : 1;
163 uint_t rpm_tolerance : 1;
164 uint_t data_strobe_offset : 1;
165 uint_t track_offset_option : 1;
166 uint_t fmt_speed_tol : 1;
167 uint_t cdrom_flag : 1;
170 uint16_t num_cylinders;
178 uint16_t bytes_per_track;
180 uint16_t bytes_per_sector;
182 uint16_t sectors_per_track;
188 uint8_t phase_lock_bytes;
192 uint16_t num_vendor_wds;
195 uint8_t serial_num[20]; // right aligned, padded with 0x20
198 uint16_t controller_type;
201 uint16_t buffer_size; // in 512 byte chunks
204 uint16_t num_ecc_bytes;
207 uint8_t firmware_rev[8]; // space padded
210 uint8_t model_num[40]; // space padded
213 uint16_t rw_multiples;
220 uint8_t dma_enable : 1;
221 uint8_t lba_enable : 1;
223 uint8_t IORDYsup : 1;
231 uint16_t min_PIO_cycle; // 0=slow, 1=medium, 2=fast
233 uint16_t min_DMA_cycle; // 0=slow, 1=medium, 2=fast
236 uint16_t field_valid; // 2: ultra_ok word 88
237 // 1: eide_ok words 64-70
238 // 0: cur_ok words 54-58
244 uint16_t cur_sectors;
246 uint16_t cur_capacity0;
248 uint16_t cur_capacity1;
251 uint8_t cur_mult_sect_cnt;
252 uint8_t mult_sect_valid; // bit0==0: valid
255 uint32_t lba_capacity;
263 uint16_t eide_pio_modes; // 0: (mode 3), 1: (mode 4)
265 uint16_t eide_dma_min; /* min mword dma cycle time (ns) */
267 uint16_t eide_dma_time; /* recommended mword dma cycle time (ns) */
269 uint16_t eide_pio; /* min cycle time (ns), no IORDY */
271 uint16_t eide_pio_iordy; /* min cycle time (ns), with IORDY */
277 uint16_t queue_depth;
283 uint16_t major_rev_num;
285 uint16_t minor_rev_num;
287 uint16_t cmd_set_1; /* 15: Obsolete
292 * 10: Host Protected Area
294 * 8: SERVICE Interrupt
295 * 7: Release Interrupt
299 * 3: Power Management Feature Set
300 * 2: Removable Feature Set
301 * 1: Security Feature Set
306 uint16_t cmd_set_2; /* 15: Shall be ZERO
308 * 13: FLUSH CACHE EXT
310 * 11: Device Configuration Overlay
311 * 10: 48-bit Address Feature Set
312 * 9: Automatic Acoustic Management
313 * 8: SET MAX security
314 * 7: reserved 1407DT PARTIES
315 * 6: SetF sub-command Power-Up
316 * 5: Power-Up in Standby Feature Set
317 * 4: Removable Media Notification
320 * 1: READ/WRITE DMA QUEUED
321 * 0: Download MicroCode
325 uint16_t cfsse; /* cmd set-feature supported extensions
329 * 5: General Purpose Logging
330 * 4: Streaming Feature Set
331 * 3: Media Card Pass Through
332 * 2: Media Serial Number Valid
333 * 1: SMART selt-test supported
334 * 0: SMART error logging
338 uint16_t cfs_enable_1; /* command set-feature enabled
344 * 10: Host Protected Area
346 * 8: SERVICE Interrupt
347 * 7: Release Interrupt
351 * 3: Power Management Feature Set
352 * 2: Removable Feature Set
353 * 1: Security Feature Set
354 * 0: SMART Feature Set
357 uint16_t cfs_enable_2; /* command set-feature enabled
360 * 13: FLUSH CACHE EXT
362 * 11: Device Configuration Overlay
363 * 10: 48-bit Address Feature Set
364 * 9: Automatic Acoustic Management
365 * 8: SET MAX security
366 * 7: reserved 1407DT PARTIES
367 * 6: SetF sub-command Power-Up
368 * 5: Power-Up in Standby Feature Set
369 * 4: Removable Media Notification
372 * 1: READ/WRITE DMA QUEUED
373 * 0: Download MicroCode
376 uint16_t csf_default; /* command set-feature default
380 * 5: General Purpose Logging enabled
381 * 4: Valid CONFIGURE STREAM executed
382 * 3: Media Card Pass Through enabled
383 * 2: Media Serial Number Valid
384 * 1: SMART selt-test supported
385 * 0: SMART error logging
390 uint16_t trs_euc; /* time required for security erase */
392 uint16_t trs_Euc; /* time required for enhanced erase */
394 uint16_t cur_apm_values; /* current APM values */
396 uint16_t mprc; /* master password revision code */
398 uint16_t hw_config; /* hardware config (word 93)
406 uint16_t msrqs; /* min stream request size */
408 uint16_t sxfert; /* stream transfer time */
410 uint16_t sal; /* stream access latency */
412 uint32_t spg; /* stream performance granularity */
414 uint64_t lba_capacity_2; /* 48-bit total number of sectors */
421 uint16_t feature_set; // Removable Media Notification
424 uint16_t dlf; /* device lock function
426 * 8 security level 1:max 0:high
436 uint16_t csfo; /* current set features options
453 uint16_t cur_media_ser_num[30];
457 uint16_t integrity; /* 15:8 Checksum
462 } __attribute__((packed));
463 } __attribute__((packed));
464 } __attribute__((packed));
467 #endif // ! __V3VEE__