Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added atapi handlers
[palacios.git] / palacios / src / devices / ide-types.h
1 /* 
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
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.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20
21 #ifndef __DEVICES_IDE_TYPES_H__
22 #define __DEVICES_IDE_TYPES_H__
23
24 #ifdef __V3VEE__
25
26 #include <palacios/vmm_types.h>
27
28
29 struct ide_error_reg {
30     union {
31         uint8_t val;
32         struct {
33             uint_t addr_mark_nf     : 1;
34             uint_t track0_nf        : 1;
35             uint_t abort            : 1;
36             uint_t rsvd0            : 1;
37             uint_t ID_nf            : 1;
38             uint_t rsvd1            : 1;
39             uint_t data_error       : 1;
40             uint_t bad_block        : 1;
41         } __attribute__((packed));
42     } __attribute__((packed));
43 } __attribute__((packed));
44
45
46 struct ide_drive_head_reg {
47     union {
48         uint8_t val;
49         struct {
50             uint_t head_num      : 4;
51             uint_t drive_sel     : 1;
52             uint_t rsvd1         : 1;
53             uint_t lba_mode      : 1;
54             uint_t rsvd2         : 1;
55         } __attribute__((packed));
56     } __attribute__((packed));
57 } __attribute__((packed));
58
59 struct ide_status_reg {
60     union {
61         uint8_t val;
62         struct {
63             uint_t error         : 1;
64             uint_t index         : 1;
65             uint_t corrected     : 1;
66             uint_t data_req      : 1;
67             uint_t seek_complete : 1;
68             uint_t write_fault   : 1;
69             uint_t ready         : 1;
70             uint_t busy          : 1;
71         } __attribute__((packed));
72     } __attribute__((packed));
73 } __attribute__((packed));
74
75
76 struct ide_ctrl_reg {
77     union {
78         uint8_t val;
79         struct {
80             uint_t rsvd0        : 1;
81             uint_t irq_disable   : 1;
82             uint_t soft_reset   : 1;
83             uint_t rsvd1        : 5;
84         } __attribute__((packed));
85     } __attribute__((packed));
86 } __attribute__((packed));
87
88
89 struct ide_features_reg {
90     union {
91         uint8_t val;
92     } __attribute__((packed));
93 } __attribute__((packed));
94
95
96 typedef enum {IDE_CTRL_NOT_SPECIFIED, 
97               IDE_CTRL_SINGLE_PORT, 
98               IDE_CTRL_DUAL_PORT, 
99               IDE_CTRL_DUAL_PORT_CACHE} ide_controller_type;
100
101
102 struct ide_drive_id {
103     union {
104         uint16_t buf[256];
105         struct {
106             uint_t rsvd1           : 1;
107             uint_t hard_sectors    : 1;
108             uint_t no_soft_sectors : 1;
109             uint_t no_mfm_enc      : 1;
110             uint_t head_switch_time : 1;
111             uint_t spnd_mot_ctrl   : 1;
112             uint_t fixed_drive     : 1;
113             uint_t removable_media : 1;
114             uint_t disk_speed1     : 1;
115             uint_t disk_speed2     : 1;
116             uint_t disk_speed3     : 1;
117             uint_t rpm_tolerance   : 1;
118             uint_t data_strobe_offset : 1;
119             uint_t track_offset_option : 1;
120             uint_t fmt_speed_tol   : 1;
121             uint_t cdrom_flag      : 1;
122
123             uint16_t num_cylinders;
124             uint16_t rsvd2;
125             uint16_t num_heads;
126
127             uint16_t bytes_per_track;
128             uint16_t bytes_per_sector;
129             uint16_t sectors_per_track;
130
131             uint16_t sector_gap;
132             
133             uint8_t phase_lock_bytes;
134             uint8_t rsvd3;
135
136             uint16_t num_vendor_wds;
137             
138             uint8_t serial_num[20]; // right aligned, padded with 0x20
139             
140
141             uint16_t controller_type;
142
143             uint16_t buffer_size; // in 512 byte chunks
144
145             uint16_t num_ecc_bytes;
146
147             uint8_t firmware_rev[8]; // space padded
148             uint8_t model_num[40]; // space padded
149             
150             uint16_t rw_multiples;
151
152             uint16_t dword_io;
153
154             uint8_t rsvd4;
155             uint8_t lba_enable;
156             
157
158             uint16_t rsvd6;
159
160             uint16_t min_PIO_cycle;
161             uint16_t min_DMA_cycle;
162
163             uint16_t rsvd7[503];
164
165         } __attribute__((packed));
166     } __attribute__((packed));
167 } __attribute__((packed));
168
169
170 #endif // ! __V3VEE__
171
172 #endif