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.


fab4fa09a45727c7b2a968de8d36957091ebb721
[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 typedef enum {IDE_CTRL_NOT_SPECIFIED, 
96               IDE_CTRL_SINGLE_PORT, 
97               IDE_CTRL_DUAL_PORT, 
98               IDE_CTRL_DUAL_PORT_CACHE} ide_controller_type;
99
100 struct ide_drive_id {
101     union {
102         uint16_t buf[256];
103         struct {
104             uint_t rsvd1           : 1;
105             uint_t hard_sectors    : 1;
106             uint_t no_soft_sectors : 1;
107             uint_t no_mfm_enc      : 1;
108             uint_t head_switch_time : 1;
109             uint_t spnd_mot_ctrl   : 1;
110             uint_t fixed_drive     : 1;
111             uint_t removable_media : 1;
112             uint_t disk_speed1     : 1;
113             uint_t disk_speed2     : 1;
114             uint_t disk_speed3     : 1;
115             uint_t rpm_tolerance   : 1;
116             uint_t data_strobe_offset : 1;
117             uint_t track_offset_option : 1;
118             uint_t fmt_speed_tol   : 1;
119             uint_t cdrom_flag      : 1;
120
121             uint16_t num_cylinders;
122             uint16_t rsvd2;
123             uint16_t num_heads;
124
125             uint16_t bytes_per_track;
126             uint16_t bytes_per_sector;
127             uint16_t sectors_per_track;
128
129             uint16_t sector_gap;
130             
131             uint8_t phase_lock_bytes;
132             uint8_t rsvd3;
133
134             uint16_t num_vendor_wds;
135             
136             uint8_t serial_num[20]; // right aligned, padded with 0x20
137             
138
139             uint16_t controller_type;
140
141             uint16_t buffer_size; // in 512 byte chunks
142
143             uint16_t num_ecc_bytes;
144
145             uint8_t firmware_rev[8]; // space padded
146             uint8_t model_num[40]; // space padded
147             
148             uint16_t rw_multiples;
149
150             uint16_t dword_io;
151
152             uint8_t rsvd4;
153             uint8_t lba_enable;
154             
155
156             uint16_t rsvd6;
157
158             uint16_t min_PIO_cycle;
159             uint16_t min_DMA_cycle;
160
161             uint16_t rsvd7[503];
162
163         } __attribute__((packed));
164     } __attribute__((packed));
165 } __attribute__((packed));
166
167
168 #endif // ! __V3VEE__
169
170 #endif