init VGA with default config
[qemu] / pc-bios / bios.diff
1 Index: rombios.c
2 ===================================================================
3 RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
4 retrieving revision 1.108
5 diff -u -w -r1.108 rombios.c
6 --- rombios.c   9 Feb 2004 16:48:50 -0000       1.108
7 +++ rombios.c   23 May 2004 15:48:52 -0000
8 @@ -2254,6 +2254,7 @@
9        type      = read_byte(get_SS(),buffer+1) & 0x1f;
10        removable = (read_byte(get_SS(),buffer+0) & 0x80) ? 1 : 0;
11        mode      = read_byte(get_SS(),buffer+96) ? ATA_MODE_PIO32 : ATA_MODE_PIO16;
12 +      blksize   = 2048;
13  
14        write_byte(ebda_seg,&EbdaData->ata.devices[device].device, type);
15        write_byte(ebda_seg,&EbdaData->ata.devices[device].removable, removable);
16 @@ -3378,6 +3379,8 @@
17        and al,#0x10
18        mov ah, al
19  
20 +      or ecx, ecx                    
21 +      je int1586_tick_end
22  int1586_tick:
23        in al, #0x61
24        and al,#0x10
25 @@ -3386,6 +3389,7 @@
26        mov ah, al
27        dec ecx
28        jnz int1586_tick
29 +int1586_tick_end:
30  ASM_END
31  
32        break;
33 @@ -3781,7 +3785,17 @@
34            write_word(ebda_seg, 0x0022, mouse_driver_offset);
35            write_word(ebda_seg, 0x0024, mouse_driver_seg);
36            mouse_flags_2 = read_byte(ebda_seg, 0x0027);
37 +          if (mouse_driver_offset == 0 && 
38 +              mouse_driver_seg == 0) {
39 +              /* remove handler */
40 +              if ( (mouse_flags_2 & 0x80) != 0 ) {
41 +                  mouse_flags_2 &= ~0x80;
42 +                  inhibit_mouse_int_and_events(); // disable IRQ12 and packets
43 +              }
44 +          } else {
45 +              /* install handler */
46            mouse_flags_2 |= 0x80;
47 +          }
48            write_byte(ebda_seg, 0x0027, mouse_flags_2);
49            CLEAR_CF();
50            regs.u.r8.ah = 0;
51 @@ -4409,7 +4423,8 @@
52    mouse_flags_2 = read_byte(ebda_seg, 0x0027);
53  
54    if ( (mouse_flags_2 & 0x80) != 0x80 ) {
55 -    BX_PANIC("int74_function:\n");
56 +      //    BX_PANIC("int74_function:\n");
57 +      return;
58      }
59  
60    package_count = mouse_flags_2 & 0x07;
61 @@ -4833,8 +4848,10 @@
62  // ---------------------------------------------------------------------------
63  
64    void
65 -int13_cdrom(DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS)
66 -  Bit16u DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS;
67 +int13_cdrom(DI, DIH, SI, SIH, BP, BPH, SP, SPH, BX, BXH, DX, DXH, CX, CXH, AX, AXH, 
68 +            DS, ES, FLAGS)
69 +  Bit16u DI, DIH, SI, SIH, BP, BPH, SP, SPH, BX, BXH, DX, DXH, CX, CXH, AX, AXH,
70 +         DS, ES, FLAGS;
71  {
72    Bit16u ebda_seg=read_word(0x0040,0x000E);
73    Bit8u  device, status, locks;
74 @@ -7692,9 +7709,12 @@
75    push  ds
76    push  ss
77    pop   ds
78 -  pusha
79 +  // ebx is modified: BSD 5.2.1 boot loader problem, so we save all
80 +  // the 32 bit registers. It should be done in all the bios or no 32
81 +  // bit register should be used without saving it first.
82 +  pushad
83    call  _int13_cdrom
84 -  popa
85 +  popad
86    pop   ds
87    pop   es
88    popf
89 @@ -8401,57 +8421,69 @@
90    cmp al, #0x08
91    jne pci_pro_f09
92    call pci_pro_select_reg
93 +  push edx
94    mov dx, di
95    and dx, #0x03
96    add dx, #0x0cfc
97    in  al, dx
98 +  pop edx
99    mov cl, al
100    jmp pci_pro_ok
101  pci_pro_f09: ;; read configuration word
102    cmp al, #0x09
103    jne pci_pro_f0a
104    call pci_pro_select_reg
105 +  push edx
106    mov dx, di
107    and dx, #0x02
108    add dx, #0x0cfc
109    in  ax, dx
110 +  pop edx
111    mov cx, ax
112    jmp pci_pro_ok
113  pci_pro_f0a: ;; read configuration dword
114    cmp al, #0x0a
115    jne pci_pro_f0b
116    call pci_pro_select_reg
117 +  push edx
118    mov dx, #0x0cfc
119    in  eax, dx
120 +  pop edx
121    mov ecx, eax
122    jmp pci_pro_ok
123  pci_pro_f0b: ;; write configuration byte
124    cmp al, #0x0b
125    jne pci_pro_f0c
126    call pci_pro_select_reg
127 +  push edx
128    mov dx, di
129    and dx, #0x03
130    add dx, #0x0cfc
131    mov al, cl
132    out dx, al
133 +  pop edx
134    jmp pci_pro_ok
135  pci_pro_f0c: ;; write configuration word
136    cmp al, #0x0c
137    jne pci_pro_f0d
138    call pci_pro_select_reg
139 +  push edx
140    mov dx, di
141    and dx, #0x02
142    add dx, #0x0cfc
143    mov ax, cx
144    out dx, ax
145 +  pop edx
146    jmp pci_pro_ok
147  pci_pro_f0d: ;; write configuration dword
148    cmp al, #0x0d
149    jne pci_pro_unknown
150    call pci_pro_select_reg
151 +  push edx
152    mov dx, #0x0cfc
153    mov eax, ecx
154    out dx, eax
155 +  pop edx
156    jmp pci_pro_ok
157  pci_pro_unknown:
158    mov ah, #0x81
159 @@ -8468,6 +8500,7 @@
160    retf
161  
162  pci_pro_select_reg:
163 +  push edx
164    mov eax, #0x800000
165    mov ax,  bx
166    shl eax, #8
167 @@ -8476,6 +8509,7 @@
168    and al,  #0xfc
169    mov dx, #0x0cf8
170    out dx,  eax
171 +  pop edx
172    ret
173  
174  use16 386
175 @@ -8536,57 +8570,69 @@
176    cmp al, #0x08
177    jne pci_real_f09
178    call pci_real_select_reg
179 +  push dx
180    mov dx, di
181    and dx, #0x03
182    add dx, #0x0cfc
183    in  al, dx
184 +  pop dx
185    mov cl, al
186    jmp pci_real_ok
187  pci_real_f09: ;; read configuration word
188    cmp al, #0x09
189    jne pci_real_f0a
190    call pci_real_select_reg
191 +  push dx
192    mov dx, di
193    and dx, #0x02
194    add dx, #0x0cfc
195    in  ax, dx
196 +  pop dx
197    mov cx, ax
198    jmp pci_real_ok
199  pci_real_f0a: ;; read configuration dword
200    cmp al, #0x0a
201    jne pci_real_f0b
202    call pci_real_select_reg
203 +  push dx
204    mov dx, #0x0cfc
205    in  eax, dx
206 +  pop dx
207    mov ecx, eax
208    jmp pci_real_ok
209  pci_real_f0b: ;; write configuration byte
210    cmp al, #0x0b
211    jne pci_real_f0c
212    call pci_real_select_reg
213 +  push dx
214    mov dx, di
215    and dx, #0x03
216    add dx, #0x0cfc
217    mov al, cl
218    out dx, al
219 +  pop dx
220    jmp pci_real_ok
221  pci_real_f0c: ;; write configuration word
222    cmp al, #0x0c
223    jne pci_real_f0d
224    call pci_real_select_reg
225 +  push dx
226    mov dx, di
227    and dx, #0x02
228    add dx, #0x0cfc
229    mov ax, cx
230    out dx, ax
231 +  pop dx
232    jmp pci_real_ok
233  pci_real_f0d: ;; write configuration dword
234    cmp al, #0x0d
235    jne pci_real_unknown
236    call pci_real_select_reg
237 +  push dx
238    mov dx, #0x0cfc
239    mov eax, ecx
240    out dx, eax
241 +  pop dx
242    jmp pci_real_ok
243  pci_real_unknown:
244    mov ah, #0x81
245 @@ -8599,6 +8645,7 @@
246    ret
247  
248  pci_real_select_reg:
249 +  push dx
250    mov eax, #0x800000
251    mov ax,  bx
252    shl eax, #8
253 @@ -8607,6 +8654,7 @@
254    and al,  #0xfc
255    mov dx, #0x0cf8
256    out dx,  eax
257 +  pop dx
258    ret
259    
260  .align 16