Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / seabios / src / std / disk.h
1 // Standard disk BIOS definitions.
2 #ifndef __DISK_H
3 #define __DISK_H
4
5 #include "types.h" // u8
6
7 #define DISK_RET_SUCCESS       0x00
8 #define DISK_RET_EPARAM        0x01
9 #define DISK_RET_EADDRNOTFOUND 0x02
10 #define DISK_RET_EWRITEPROTECT 0x03
11 #define DISK_RET_ECHANGED      0x06
12 #define DISK_RET_EBOUNDARY     0x09
13 #define DISK_RET_EBADTRACK     0x0c
14 #define DISK_RET_ECONTROLLER   0x20
15 #define DISK_RET_ETIMEOUT      0x80
16 #define DISK_RET_ENOTLOCKED    0xb0
17 #define DISK_RET_ELOCKED       0xb1
18 #define DISK_RET_ENOTREMOVABLE 0xb2
19 #define DISK_RET_ETOOMANYLOCKS 0xb4
20 #define DISK_RET_EMEDIA        0xC0
21 #define DISK_RET_ENOTREADY     0xAA
22
23
24 /****************************************************************
25  * Interface structs
26  ****************************************************************/
27
28 // Bios disk structures.
29 struct int13ext_s {
30     u8  size;
31     u8  reserved;
32     u16 count;
33     struct segoff_s data;
34     u64 lba;
35 } PACKED;
36
37 // DPTE definition
38 struct dpte_s {
39     u16 iobase1;
40     u16 iobase2;
41     u8  prefix;
42     u8  unused;
43     u8  irq;
44     u8  blkcount;
45     u8  dma;
46     u8  pio;
47     u16 options;
48     u16 reserved;
49     u8  revision;
50     u8  checksum;
51 };
52
53 // Disk Physical Table definition
54 struct int13dpt_s {
55     u16 size;
56     u16 infos;
57     u32 cylinders;
58     u32 heads;
59     u32 spt;
60     u64 sector_count;
61     u16 blksize;
62     struct segoff_s dpte;
63     u16 key;
64     u8  dpi_length;
65     u8  reserved1;
66     u16 reserved2;
67     u8  host_bus[4];
68     u8  iface_type[8];
69     u64 iface_path;
70     union {
71         struct {
72             u64 device_path;
73             u8  reserved3;
74             u8  checksum;
75         } phoenix;
76         struct {
77             u64 device_path[2];
78             u8  reserved3;
79             u8  checksum;
80         } t13;
81     };
82 } PACKED;
83
84 // Floppy info
85 struct fdpt_s {
86     u16 cylinders;
87     u8 heads;
88     u8 a0h_signature;
89     u8 phys_sectors;
90     u16 precompensation;
91     u8 reserved;
92     u8 drive_control_byte;
93     u16 phys_cylinders;
94     u8 phys_heads;
95     u16 landing_zone;
96     u8 sectors;
97     u8 checksum;
98 } PACKED;
99
100 // Floppy "Disk Base Table"
101 struct floppy_dbt_s {
102     u8 specify1;
103     u8 specify2;
104     u8 shutoff_ticks;
105     u8 bps_code;
106     u8 sectors;
107     u8 interblock_len;
108     u8 data_len;
109     u8 gap_len;
110     u8 fill_byte;
111     u8 settle_time;
112     u8 startup_time;
113 } PACKED;
114
115 struct floppy_ext_dbt_s {
116     struct floppy_dbt_s dbt;
117     // Extra fields
118     u8 max_track;
119     u8 data_rate;
120     u8 drive_type;
121 } PACKED;
122
123
124 /****************************************************************
125  * Master boot record
126  ****************************************************************/
127
128 struct packed_chs_s {
129     u8 heads;
130     u8 sptcyl;
131     u8 cyllow;
132 } PACKED;
133
134 struct partition_s {
135     u8 status;
136     struct packed_chs_s first;
137     u8 type;
138     struct packed_chs_s last;
139     u32 lba;
140     u32 count;
141 } PACKED;
142
143 struct mbr_s {
144     u8 code[440];
145     // 0x01b8
146     u32 diskseg;
147     // 0x01bc
148     u16 null;
149     // 0x01be
150     struct partition_s partitions[4];
151     // 0x01fe
152     u16 signature;
153 } PACKED;
154
155 #define MBR_SIGNATURE 0xaa55
156
157
158 /****************************************************************
159  * ElTorito CDROM interface
160  ****************************************************************/
161
162 struct eltorito_s {
163     u8 size;
164     u8 media;
165     u8 emulated_drive;
166     u8 controller_index;
167     u32 ilba;
168     u16 device_spec;
169     u16 buffer_segment;
170     u16 load_segment;
171     u16 sector_count;
172     struct packed_chs_s chs;
173 } PACKED;
174
175 #endif // disk.h