APM CPU idle fix
[qemu] / pc-bios / bios.diff
1 Index: apmbios.S
2 ===================================================================
3 RCS file: /cvsroot/bochs/bochs/bios/apmbios.S,v
4 retrieving revision 1.4
5 diff -u -w -r1.4 apmbios.S
6 --- apmbios.S   26 Dec 2005 10:35:51 -0000      1.4
7 +++ apmbios.S   28 Apr 2006 22:41:19 -0000
8 @@ -225,6 +225,7 @@
9  APMSYM(05):
10    cmp al, #0x05
11    jne APMSYM(07)
12 +  sti
13    hlt
14    jmp APMSYM(ok)
15  
16 Index: rombios.c
17 ===================================================================
18 RCS file: /cvsroot/bochs/bochs/bios/rombios.c,v
19 retrieving revision 1.160
20 diff -u -w -r1.160 rombios.c
21 --- rombios.c   25 Jan 2006 17:51:49 -0000      1.160
22 +++ rombios.c   28 Apr 2006 22:41:21 -0000
23 @@ -1816,6 +1816,7 @@
24  {
25    printf(BX_APPNAME" BIOS - build: %s\n%s\nOptions: ",
26      BIOS_BUILD_DATE, bios_cvs_version_string);
27 +#if 0
28    printf(
29  #ifdef BX_APM
30    "apmbios "
31 @@ -1827,6 +1828,9 @@
32    "eltorito "
33  #endif
34    "\n\n");
35 +#else
36 +  printf("apmbios pcibios eltorito \n\n");
37 +#endif
38  }
39  
40  //--------------------------------------------------------------------------
41 @@ -8713,6 +8717,7 @@
42    mov al, #0x80
43  bios32_end:
44    popf
45 +  and dword ptr[esp+4],0xfffffffc ;; reset CS.RPL for kqemu
46    retf
47  
48  .align 16
49 @@ -8823,17 +8828,17 @@
50  pci_pro_fail:
51    pop edi
52    pop esi
53 -  sti
54    popf
55    stc
56 +  and dword ptr[esp+4],0xfffffffc ;; reset CS.RPL for kqemu
57    retf
58  pci_pro_ok:
59    xor ah, ah
60    pop edi
61    pop esi
62 -  sti
63    popf
64    clc
65 +  and dword ptr[esp+4],0xfffffffc ;; reset CS.RPL for kqemu
66    retf
67  
68  pci_pro_select_reg:
69 @@ -8971,7 +8976,7 @@
70    jmp pci_real_ok
71  pci_real_f0d: ;; write configuration dword
72    cmp al, #0x0d
73 -  jne pci_real_unknown
74 +  jne pci_real_f0e
75    call pci_real_select_reg
76    push dx
77    mov dx, #0x0cfc
78 @@ -8979,6 +8984,46 @@
79    out dx, eax
80    pop dx
81    jmp pci_real_ok
82 +pci_real_f0e: ;; get irq routing options
83 +  cmp al, #0x0e
84 +  jne pci_real_unknown
85 +  SEG ES
86 +  cmp word ptr [di], #pci_routing_table_structure_end - pci_routing_table_structure_start
87 +  jb pci_real_too_small    
88 +  SEG ES
89 +  mov word ptr [di], #pci_routing_table_structure_end - pci_routing_table_structure_start        
90 +  pushf
91 +  push ds
92 +  push es
93 +  push cx
94 +  push si
95 +  push di
96 +  cld
97 +  mov si, #pci_routing_table_structure_start
98 +  push cs
99 +  pop ds
100 +  SEG ES
101 +  mov cx, [di+2]
102 +  SEG ES
103 +  mov es, [di+4]
104 +  mov di, cx
105 +  mov cx, #pci_routing_table_structure_end - pci_routing_table_structure_start
106 +  rep 
107 +      movsb
108 +  pop di
109 +  pop si
110 +  pop cx
111 +  pop es
112 +  pop ds
113 +  popf
114 +  mov bx, #(1 << 9) | (1 << 11)   ;; irq 9 and 11 are used
115 +  jmp pci_real_ok
116 +pci_real_too_small:
117 +  SEG ES
118 +  mov word ptr [di], #pci_routing_table_structure_end - pci_routing_table_structure_start        
119 +  mov ah, #0x89
120 +  jmp pci_real_fail
121 +
122  pci_real_unknown:
123    mov ah, #0x81
124  pci_real_fail:
125 @@ -9019,6 +9064,7 @@
126    dw 0,0 ;; Miniport data
127    db 0,0,0,0,0,0,0,0,0,0,0 ;; reserved
128    db 0x07 ;; checksum
129 +pci_routing_table_structure_start:
130    ;; first slot entry PCI-to-ISA (embedded)
131    db 0 ;; pci bus number
132    db 0x08 ;; pci device number (bit 7-3)
133 @@ -9097,6 +9143,7 @@
134    dw 0xdef8 ;; IRQ bitmap INTD#
135    db 5 ;; physical slot (0 = embedded)
136    db 0 ;; reserved
137 +pci_routing_table_structure_end:
138  
139  pci_irq_list:
140    db 11, 10, 9, 5;