ide PCI ident fix, aka FreeBSD/amd64 bug fix (Jung-uk Kim)
[qemu] / pc-bios / bios.diff
index dee62e0..7ba84d7 100644 (file)
 Index: rombios.c
 ===================================================================
 RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
-retrieving revision 1.108
-diff -u -w -r1.108 rombios.c
---- rombios.c  9 Feb 2004 16:48:50 -0000       1.108
-+++ rombios.c  22 May 2004 15:47:51 -0000
-@@ -2254,6 +2254,7 @@
-       type      = read_byte(get_SS(),buffer+1) & 0x1f;
-       removable = (read_byte(get_SS(),buffer+0) & 0x80) ? 1 : 0;
-       mode      = read_byte(get_SS(),buffer+96) ? ATA_MODE_PIO32 : ATA_MODE_PIO16;
-+      blksize   = 2048;
-       write_byte(ebda_seg,&EbdaData->ata.devices[device].device, type);
-       write_byte(ebda_seg,&EbdaData->ata.devices[device].removable, removable);
-@@ -3378,6 +3379,8 @@
-       and al,#0x10
-       mov ah, al
-+      or ecx, ecx                    
-+      je int1586_tick_end
- int1586_tick:
-       in al, #0x61
-       and al,#0x10
-@@ -3386,6 +3389,7 @@
-       mov ah, al
-       dec ecx
-       jnz int1586_tick
-+int1586_tick_end:
- ASM_END
-       break;
-@@ -3781,7 +3785,17 @@
-           write_word(ebda_seg, 0x0022, mouse_driver_offset);
-           write_word(ebda_seg, 0x0024, mouse_driver_seg);
-           mouse_flags_2 = read_byte(ebda_seg, 0x0027);
-+          if (mouse_driver_offset == 0 && 
-+              mouse_driver_seg == 0) {
-+              /* remove handler */
-+              if ( (mouse_flags_2 & 0x80) != 0 ) {
-+                  mouse_flags_2 &= ~0x80;
-+                  inhibit_mouse_int_and_events(); // disable IRQ12 and packets
-+              }
-+          } else {
-+              /* install handler */
-           mouse_flags_2 |= 0x80;
-+          }
-           write_byte(ebda_seg, 0x0027, mouse_flags_2);
-           CLEAR_CF();
-           regs.u.r8.ah = 0;
-@@ -4409,7 +4423,8 @@
-   mouse_flags_2 = read_byte(ebda_seg, 0x0027);
-   if ( (mouse_flags_2 & 0x80) != 0x80 ) {
--    BX_PANIC("int74_function:\n");
-+      //    BX_PANIC("int74_function:\n");
-+      return;
-     }
-   package_count = mouse_flags_2 & 0x07;
-@@ -8401,57 +8416,69 @@
-   cmp al, #0x08
-   jne pci_pro_f09
-   call pci_pro_select_reg
-+  push edx
-   mov dx, di
-   and dx, #0x03
-   add dx, #0x0cfc
-   in  al, dx
-+  pop edx
-   mov cl, al
-   jmp pci_pro_ok
- pci_pro_f09: ;; read configuration word
-   cmp al, #0x09
-   jne pci_pro_f0a
-   call pci_pro_select_reg
-+  push edx
-   mov dx, di
-   and dx, #0x02
-   add dx, #0x0cfc
-   in  ax, dx
-+  pop edx
-   mov cx, ax
-   jmp pci_pro_ok
- pci_pro_f0a: ;; read configuration dword
-   cmp al, #0x0a
-   jne pci_pro_f0b
-   call pci_pro_select_reg
-+  push edx
-   mov dx, #0x0cfc
-   in  eax, dx
-+  pop edx
-   mov ecx, eax
-   jmp pci_pro_ok
- pci_pro_f0b: ;; write configuration byte
-   cmp al, #0x0b
-   jne pci_pro_f0c
-   call pci_pro_select_reg
-+  push edx
-   mov dx, di
-   and dx, #0x03
-   add dx, #0x0cfc
-   mov al, cl
-   out dx, al
-+  pop edx
-   jmp pci_pro_ok
- pci_pro_f0c: ;; write configuration word
-   cmp al, #0x0c
-   jne pci_pro_f0d
-   call pci_pro_select_reg
-+  push edx
-   mov dx, di
-   and dx, #0x02
-   add dx, #0x0cfc
-   mov ax, cx
-   out dx, ax
-+  pop edx
-   jmp pci_pro_ok
- pci_pro_f0d: ;; write configuration dword
-   cmp al, #0x0d
-   jne pci_pro_unknown
-   call pci_pro_select_reg
-+  push edx
-   mov dx, #0x0cfc
-   mov eax, ecx
-   out dx, eax
-+  pop edx
-   jmp pci_pro_ok
- pci_pro_unknown:
-   mov ah, #0x81
-@@ -8468,6 +8495,7 @@
-   retf
- pci_pro_select_reg:
-+  push edx
-   mov eax, #0x800000
-   mov ax,  bx
-   shl eax, #8
-@@ -8476,6 +8504,7 @@
-   and al,  #0xfc
-   mov dx, #0x0cf8
-   out dx,  eax
-+  pop edx
-   ret
+retrieving revision 1.130
+diff -u -w -r1.130 rombios.c
+--- rombios.c  13 Feb 2005 08:47:30 -0000      1.130
++++ rombios.c  6 Apr 2005 22:38:16 -0000
+@@ -8570,7 +8570,10 @@
+ use32 386
+ #define APM_PROT32
+ #include "apmbios.S"
++
  use16 386
-@@ -8536,57 +8565,69 @@
-   cmp al, #0x08
-   jne pci_real_f09
-   call pci_real_select_reg
-+  push dx
-   mov dx, di
-   and dx, #0x03
-   add dx, #0x0cfc
-   in  al, dx
-+  pop dx
-   mov cl, al
-   jmp pci_real_ok
- pci_real_f09: ;; read configuration word
-   cmp al, #0x09
-   jne pci_real_f0a
-   call pci_real_select_reg
-+  push dx
-   mov dx, di
-   and dx, #0x02
-   add dx, #0x0cfc
-   in  ax, dx
-+  pop dx
-   mov cx, ax
-   jmp pci_real_ok
- pci_real_f0a: ;; read configuration dword
-   cmp al, #0x0a
-   jne pci_real_f0b
-   call pci_real_select_reg
-+  push dx
-   mov dx, #0x0cfc
-   in  eax, dx
-+  pop dx
-   mov ecx, eax
-   jmp pci_real_ok
- pci_real_f0b: ;; write configuration byte
-   cmp al, #0x0b
-   jne pci_real_f0c
-   call pci_real_select_reg
-+  push dx
-   mov dx, di
-   and dx, #0x03
-   add dx, #0x0cfc
-   mov al, cl
-   out dx, al
-+  pop dx
-   jmp pci_real_ok
- pci_real_f0c: ;; write configuration word
-   cmp al, #0x0c
-   jne pci_real_f0d
-   call pci_real_select_reg
-+  push dx
-   mov dx, di
-   and dx, #0x02
-   add dx, #0x0cfc
-   mov ax, cx
-   out dx, ax
-+  pop dx
-   jmp pci_real_ok
- pci_real_f0d: ;; write configuration dword
-   cmp al, #0x0d
-   jne pci_real_unknown
-   call pci_real_select_reg
-+  push dx
-   mov dx, #0x0cfc
-   mov eax, ecx
-   out dx, eax
-+  pop dx
-   jmp pci_real_ok
- pci_real_unknown:
-   mov ah, #0x81
-@@ -8599,6 +8640,7 @@
-   ret
++#define APM_PROT16
++#include "apmbios.S"
  
- pci_real_select_reg:
-+  push dx
-   mov eax, #0x800000
-   mov ax,  bx
-   shl eax, #8
-@@ -8607,6 +8649,7 @@
-   and al,  #0xfc
-   mov dx, #0x0cf8
-   out dx,  eax
-+  pop dx
-   ret
+ #define APM_REAL
+ #include "apmbios.S"
+Index: apmbios.S
+===================================================================
+RCS file: /cvsroot/bochs/bochs/bios/apmbios.S,v
+retrieving revision 1.1
+diff -u -w -r1.1 apmbios.S
+--- apmbios.S  20 Jun 2004 18:27:09 -0000      1.1
++++ apmbios.S  6 Apr 2005 22:38:16 -0000
+@@ -1,6 +1,9 @@
+ //  APM BIOS support for the Bochs BIOS
+ //  Copyright (C) 2004 Fabrice Bellard
+ //
++//  16-bit interface activation
++//  Copyright (C) 2005 Struan Bartlett
++//
+ //  This library is free software; you can redistribute it and/or
+ //  modify it under the terms of the GNU Lesser General Public
+ //  License as published by the Free Software Foundation; either
+@@ -111,13 +114,28 @@
+   mov bl, #0x4d // 'M'
+   // bit 0 : 16 bit interface supported
+   // bit 1 : 32 bit interface supported
+-  mov cx, #0x2 
++  mov cx, #0x3
+   jmp APMSYM(ok)
    
- .align 16
+ ;-----------------
+ ; APM real mode interface connect
+ APMSYM(01):
+   cmp al, #0x01
++  jne APMSYM(02)
++  jmp APMSYM(ok)
++
++;-----------------
++; APM 16 bit protected mode interface connect
++APMSYM(02):
++  cmp al, #0x02
++  jne APMSYM(03)
++
++  mov bx, #_apm16_entry
++  
++  mov ax, #0xf000 // 16 bit code segment base
++  mov si, #0xfff0 // 16 bit code segment size
++  mov cx, #0xf000 // data segment address
++  mov di, #0xfff0 // data segment length
+   jne APMSYM(03)
+   jmp APMSYM(ok)