6 #include <palacios/vmm_types.h>
10 typedef sint32_t ssize_t;
11 typedef unsigned int rd_bool;
12 typedef uchar_t Bit8u;
13 typedef ushort_t Bit16u;
14 typedef uint32_t Bit32u;
15 typedef uint64_t Bit64u;
19 #define MAX_ATA_CHANNEL 4
24 SENSE_ILLEGAL_REQUEST = 5,
25 SENSE_UNIT_ATTENTION = 6
29 ASC_INV_FIELD_IN_CMD_PACKET = 0x24,
30 ASC_MEDIUM_NOT_PRESENT = 0x3a,
31 ASC_SAVING_PARAMETERS_NOT_SUPPORTED = 0x39,
32 ASC_LOGICAL_BLOCK_OOR = 0x21
46 struct interrupt_reason_t {
54 struct controller_status {
58 rd_bool seek_complete;
60 rd_bool corrected_data;
62 unsigned int index_pulse_count;
91 struct error_recovery_t {
92 unsigned char data[8];
99 struct cdrom_interface * cd;
103 int remaining_blocks;
105 struct currentStruct {
106 struct error_recovery_t error_recovery;
114 int total_bytes_remaining;
118 typedef enum { IDE_NONE, IDE_DISK, IDE_CDROM } device_type_t;
120 struct controller_t {
121 struct controller_status status;
122 Bit8u error_register;
127 struct interrupt_reason_t interrupt_reason;
141 Bit8u current_command;
142 Bit8u sectors_per_block;
146 rd_bool reset; // 0=normal, 1=reset controller
147 rd_bool disable_irq; // 0=allow irq, 1=disable irq
150 Bit8u reset_in_progress;
158 device_image_t hard_drive;
159 device_type_t device_type;
160 // 512 byte buffer for ID drive command
161 // These words are stored in native word endian format, as
162 // they are fetched and returned via a return(), so
163 // there's no need to keep them in x86 endian format.
164 Bit16u id_drive[256];
166 struct controller_t controller;
167 struct cdrom_t cdrom;
168 struct sense_info_t sense;
169 struct atapi_t atapi;
176 // For each ATA channel we should have one controller struct
177 // and an array of two drive structs
179 struct drive_t drives[2];
180 unsigned drive_select;
190 struct channel_t channels[MAX_ATA_CHANNEL];
201 #endif // ! __V3VEE__