Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / seabios / src / std / bda.h
1 // BIOS Data Area (and similar) definitions
2 #ifndef __BDA_H
3 #define __BDA_H
4
5 #include "disk.h" // struct fdpt_s
6 #include "types.h" // u8
7
8
9 /****************************************************************
10  * Interupt vector table
11  ****************************************************************/
12
13 struct rmode_IVT {
14     struct segoff_s ivec[256];
15 };
16
17
18 /****************************************************************
19  * Bios Data Area (BDA)
20  ****************************************************************/
21
22 struct bios_data_area_s {
23     // 40:00
24     u16 port_com[4];
25     u16 port_lpt[3];
26     u16 ebda_seg;
27     // 40:10
28     u16 equipment_list_flags;
29     u8 pad1;
30     u16 mem_size_kb;
31     u8 pad2;
32     u8 ps2_ctrl_flag;
33     u8 kbd_flag0;
34     u8 kbd_flag1;
35     u8 alt_keypad;
36     u16 kbd_buf_head;
37     u16 kbd_buf_tail;
38     // 40:1e
39     u8 kbd_buf[32];
40     u8 floppy_recalibration_status;
41     u8 floppy_motor_status;
42     // 40:40
43     u8 floppy_motor_counter;
44     u8 floppy_last_status;
45     u8 floppy_return_status[7];
46     u8 video_mode;
47     u16 video_cols;
48     u16 video_pagesize;
49     u16 video_pagestart;
50     // 40:50
51     u16 cursor_pos[8];
52     // 40:60
53     u16 cursor_type;
54     u8 video_page;
55     u16 crtc_address;
56     u8 video_msr;
57     u8 video_pal;
58     struct segoff_s jump;
59     u8 other_6b;
60     u32 timer_counter;
61     // 40:70
62     u8 timer_rollover;
63     u8 break_flag;
64     u16 soft_reset_flag;
65     u8 disk_last_status;
66     u8 hdcount;
67     u8 disk_control_byte;
68     u8 port_disk;
69     u8 lpt_timeout[4];
70     u8 com_timeout[4];
71     // 40:80
72     u16 kbd_buf_start_offset;
73     u16 kbd_buf_end_offset;
74     u8 video_rows;
75     u16 char_height;
76     u8 video_ctl;
77     u8 video_switches;
78     u8 modeset_ctl;
79     u8 dcc_index;
80     u8 floppy_last_data_rate;
81     u8 disk_status_controller;
82     u8 disk_error_controller;
83     u8 disk_interrupt_flag;
84     u8 floppy_harddisk_info;
85     // 40:90
86     u8 floppy_media_state[4];
87     u8 floppy_track[2];
88     u8 kbd_flag2;
89     u8 kbd_led;
90     struct segoff_s user_wait_complete_flag;
91     u32 user_wait_timeout;
92     // 40:A0
93     u8 rtc_wait_flag;
94     u8 other_a1[7];
95     struct segoff_s video_savetable;
96     u8 other_ac[4];
97     // 40:B0
98     u8 other_b0[5*16];
99 } PACKED;
100
101 // BDA floppy_recalibration_status bitdefs
102 #define FRS_IRQ (1<<7)
103
104 // BDA rtc_wait_flag bitdefs
105 #define RWS_WAIT_PENDING (1<<0)
106 #define RWS_WAIT_ELAPSED (1<<7)
107
108 // BDA floppy_media_state bitdefs
109 #define FMS_DRIVE_STATE_MASK        (0x07)
110 #define FMS_MEDIA_DRIVE_ESTABLISHED (1<<4)
111 #define FMS_DOUBLE_STEPPING         (1<<5)
112 #define FMS_DATA_RATE_MASK          (0xc0)
113
114 // Limit of BDA timer_counter field
115 #define TICKS_PER_DAY 1573040
116
117
118 /****************************************************************
119  * Extended Bios Data Area (EBDA)
120  ****************************************************************/
121
122 struct extended_bios_data_area_s {
123     u8 size;
124     u8 reserved1[0x21];
125     struct segoff_s far_call_pointer;
126     u8 mouse_flag1;
127     u8 mouse_flag2;
128     u8 mouse_data[0x08];
129     // 0x30
130     u8 other1[0x0d];
131
132     // 0x3d
133     struct fdpt_s fdpt[2];
134
135     // 0x5d
136     u8 other2[0xC4];
137
138     // 0x121 - Begin custom storage.
139 } PACKED;
140
141
142 /****************************************************************
143  * Bios Config Table
144  ****************************************************************/
145
146 struct bios_config_table_s {
147     u16 size;
148     u8 model;
149     u8 submodel;
150     u8 biosrev;
151     u8 feature1, feature2, feature3, feature4, feature5;
152 } PACKED;
153
154 #endif // bda.h