Index: /trunk/src/VBox/Devices/PC/BIOS/orgs.asm
===================================================================
--- /trunk/src/VBox/Devices/PC/BIOS/orgs.asm	(revision 42391)
+++ /trunk/src/VBox/Devices/PC/BIOS/orgs.asm	(revision 42392)
@@ -61,5 +61,4 @@
 BIOS_COPYRIGHT	equ	'Oracle VM VirtualBox BIOS'
 
-;BX_PCIBIOS		equ	1		; defined in pcicfg.inc
 BX_ROMBIOS32		equ	0
 BX_CALL_INT15_4F	equ	1
Index: /trunk/src/VBox/Devices/PC/BIOS/pcibio32.asm
===================================================================
--- /trunk/src/VBox/Devices/PC/BIOS/pcibio32.asm	(revision 42391)
+++ /trunk/src/VBox/Devices/PC/BIOS/pcibio32.asm	(revision 42392)
@@ -1,4 +1,4 @@
 ;;
-;; Copyright (C) 2006-2011 Oracle Corporation
+;; Copyright (C) 2006-2012 Oracle Corporation
 ;;
 ;; This file is part of VirtualBox Open Source Edition (OSE), as
@@ -9,297 +9,87 @@
 ;; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
 ;; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+;;
 ;; --------------------------------------------------------------------
-;;
-;; This code is based on:
-;;
-;;  ROM BIOS for use with Bochs/Plex86/QEMU emulation environment
-;;
-;;  Copyright (C) 2002  MandrakeSoft S.A.
-;;
-;;    MandrakeSoft S.A.
-;;    43, rue d'Aboukir
-;;    75002 Paris - France
-;;    http://www.linux-mandrake.com/
-;;    http://www.mandrakesoft.com/
-;;
-;;  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
-;;  version 2 of the License, or (at your option) any later version.
-;;
-;;  This library is distributed in the hope that it will be useful,
-;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;;  Lesser General Public License for more details.
-;;
-;;  You should have received a copy of the GNU Lesser General Public
-;;  License along with this library; if not, write to the Free Software
-;;  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
-;;
-;;
 
-include	pcicfg.inc
 
-if BX_PCIBIOS
+; BIOS32 service directory and 32-bit PCI BIOS entry point
+
+; Public symbols for debugging only
+public		pcibios32_entry
+public		bios32_service
+
+; The BIOS32 service directory header must be located in the E0000h-FFFF0h
+; range on a paragraph boundary. Note that the actual 32-bit code need not
+; be located below 1MB at all.
+
+_DATA		segment public 'DATA'
+
+align   16
+bios32_directory:
+		db	'_32_'		; ASCII signature
+		dw	bios32_service	; Entry point address...
+		dw	000Fh 		; ...hardcoded to F000 segment
+		db	0		; Revision
+		db	1		; Length in paras - must be 1
+		db	0		; Checksum calculated later
+		db 	5 dup(0)	; Unused, must be zero
+
+_DATA		ends
 
 .386
 
+extrn	_pci32_function:near
+
 BIOS32		segment	public 'CODE' use32
 
-public		pcibios_protected
+;
+; The BIOS32 Service Directory - must be less than 4K in size (easy!).
+;
+bios32_service	proc	far
 
-align   16
-bios32_structure:
-		db	'_32_'		; signature
-		dw	bios32_entry_point, 0Fh ;; 32 bit physical address
-		db	0		; revision level
-		db	1		; length in paragraphs
-		db	0		; checksum (updated externally)
-		db 	0,0,0,0,0	; reserved
+		pushfd
 
-align 16
-bios32_entry_point:
-		pushfd
-		cmp	eax, 'ICP$'		; 0x49435024 "$PCI"
-		jne	unknown_service
+		cmp	bl, 0			; Only function 0 supported
+		jnz	b32_bad_func
 
-ifdef PCI_FIXED_HOST_BRIDGE_1
-		mov	eax, 80000000h
-		mov	dx, PCI_CFG1
-		out	dx, eax
-		mov	dx, PCI_CFG2
-		in	eax, dx
-		cmp	eax, PCI_FIXED_HOST_BRIDGE_1
-		je	device_ok
-endif
+		cmp	eax, 'ICP$'		; "$PCI"
+		mov	al, 80h			; Unknown service
+		jnz	b32_done
 
-ifdef PCI_FIXED_HOST_BRIDGE_2
-		; 18h << 11
-		mov	eax, 8000c000h
-		mov	dx, PCI_CFG1
-		out	dx, eax
-		mov	dx, PCI_CFG2
-		in	eax, dx
-		cmp	eax, PCI_FIXED_HOST_BRIDGE_2
-		je	device_ok
-		; 19h << 11
-		mov	eax, 8000c800h
-		mov	dx, PCI_CFG1
-		out	dx, eax
-		mov	dx, PCI_CFG2
-		in	eax, dx
-		cmp	eax, PCI_FIXED_HOST_BRIDGE_2
-		je	device_ok
-endif
-		jmp	unknown_service
-device_ok:
-		mov	ebx, 000f0000h
-		mov	ecx, 0
-		mov	edx, pcibios_protected
-		xor	al, al
-		jmp	bios32_end
-
-unknown_service:
-		mov	al, 80h
-bios32_end:
+		mov	ebx, 000f0000h		; Base address (linear)
+		mov	ecx, 0f000h		; Length of service
+		mov	edx, pcibios32_entry	; Entry point offset from base
+		xor	al, al			; Indicate success
+b32_done:
 		popfd
 		retf
 
-align 16
-pcibios_protected:
-if 1
-;; The old implementation of pcibios_protected will eventually go,
-;; replaced by C code.
-else
+b32_bad_func:
+		mov	al, 81h			; Unsupported function
+		jmp	b32_done
 
-extrn	_pci32_function:near
+bios32_service	endp
 
-		pushfd
-		push	es
+;
+; The 32-bit PCI BIOS entry point - simply calls into C code.
+;
+pcibios32_entry	proc	far
+
+		pushfd				; Preserve flags
+		cld				; Just in case...
+
+		push	es			; Call into C implementation
 		pushad
 		call	_pci32_function
 		popad
 		pop	es
-		popfd
-		retf
-endif
-		pushfd
-		cli
-		push	esi
-		push	edi
-		cmp	al, 1		; installation check
-		jne	pci_pro_f02
 
-		mov	bx, 0210h
-		mov	cx, 0
-		mov	edx, ' ICP'	; 0x20494350 "PCI "
-		mov	al, 1
-		jmp	pci_pro_ok
-
-pci_pro_f02: ;; find pci device
-		cmp	al, 2
-		jne	pci_pro_f03
-
-		shl	ecx, 16
-		mov	cx, dx
-		xor	ebx, ebx
-		mov	di, 0
-pci_pro_devloop:
-		call	pci_pro_select_reg
-		mov	dx, PCI_CFG2
-		in	eax, dx
-		cmp	eax, ecx
-		jne	pci_pro_nextdev
-
-		cmp	si, 0
-		je	pci_pro_ok
-
-		dec	si
-pci_pro_nextdev:
-		inc	ebx
-		cmp	ebx, MAX_BUSDEVFN 
-		jne	pci_pro_devloop
-
-		mov	ah, 86h
-		jmp	pci_pro_fail
-
-pci_pro_f03: ;; find class code
-		cmp	al, 3
-		jne	pci_pro_f08
-
-		xor	ebx, ebx
-		mov	di, 8
-pci_pro_devloop2:
-		call	pci_pro_select_reg
-		mov	dx, PCI_CFG2
-		in	eax, dx
-		shr	eax, 8
-		cmp	eax, ecx
-		jne	pci_pro_nextdev2
-
-		cmp	si, 0
-		je	pci_pro_ok
-
-		dec	si
-pci_pro_nextdev2:
-		inc	ebx
-		cmp	ebx, MAX_BUSDEVFN 
-		jne	pci_pro_devloop2
-
-		mov	ah, 86h
-		jmp	pci_pro_fail
-
-pci_pro_f08: ;; read configuration byte
-		cmp	al, 8
-		jne	pci_pro_f09
-
-		call	pci_pro_select_reg
-		push	edx
-		mov	dx, di
-		and	dx, 3
-		add	dx, PCI_CFG2
-		in	al, dx
-		pop	edx
-		mov	cl, al
-		jmp	 pci_pro_ok
-
-pci_pro_f09: ;; read configuration word
-		cmp	al, 9
-		jne	pci_pro_f0a
-
-		call	pci_pro_select_reg
-		push	edx
-		mov	dx, di
-		and	dx, 2
-		add	dx, PCI_CFG2
-		in	ax, dx
-		pop	edx
-		mov	cx, ax
-		jmp	pci_pro_ok
-
-pci_pro_f0a: ;; read configuration dword
-		cmp	al, 0Ah
-		jne	pci_pro_f0b
-
-		call	pci_pro_select_reg
-		push	edx
-		mov	dx, PCI_CFG2
-		in	eax, dx
-		pop	edx
-		mov	ecx, eax
-		jmp	pci_pro_ok
-
-pci_pro_f0b: ;; write configuration byte
-		cmp	al, 0Bh
-		jne	pci_pro_f0c
-
-		call	pci_pro_select_reg
-		push	edx
-		mov	dx, di
-		and	dx, 3
-		add	dx, PCI_CFG2
-		mov	al, cl
-		out	dx, al
-		pop	edx
-		jmp	pci_pro_ok
-
-pci_pro_f0c: ;; write configuration word
-		cmp	al, 0Ch
-		jne	pci_pro_f0d
-
-		call	pci_pro_select_reg
-		push	edx
-		mov	dx, di
-		and	dx, 2
-		add	dx, PCI_CFG2
-		mov	ax, cx
-		out	dx, ax
-		pop	edx
-		jmp	pci_pro_ok
-
-pci_pro_f0d: ;; write configuration dword
-		cmp	al, 0Dh
-		jne	pci_pro_unknown
-		call	pci_pro_select_reg
-		push	edx
-		mov	dx, PCI_CFG2
-		mov	eax, ecx
-		out	dx, eax
-		pop	edx
-		jmp	pci_pro_ok
-
-pci_pro_unknown:
-		mov	ah, 81h
-pci_pro_fail:
-		pop	edi
-		pop	esi
-		popfd
-		stc
+		popfd				; Restore flags and return
 		retf
 
-pci_pro_ok:
-		xor	ah, ah
-		pop	edi
-		pop	esi
-		popfd
-		clc
-		retf
+pcibios32_entry	endp
 
-pci_pro_select_reg:
-		push	edx
-		mov	eax, 800000h
-		mov	ax,  bx
-		shl	eax, 8
-		and	di,  0FFh
-		or	ax,  di
-		and	al,  0FCh
-		mov	dx,  PCI_CFG1
-		out	dx,  eax
-		pop	edx
-		ret
 
 BIOS32		ends
 
-endif		 ; BX_PCIBIOS
-
 		end
Index: /trunk/src/VBox/Devices/PC/BIOS/pcibios.c
===================================================================
--- /trunk/src/VBox/Devices/PC/BIOS/pcibios.c	(revision 42391)
+++ /trunk/src/VBox/Devices/PC/BIOS/pcibios.c	(revision 42392)
@@ -21,5 +21,4 @@
 #include "inlines.h"
 
-//#define DEBUG_PCI  1 //@todo!
 #if DEBUG_PCI
 #  define BX_DEBUG_PCI(...) BX_DEBUG(__VA_ARGS__)
@@ -280,6 +279,8 @@
             data >>= 8;
 
+#if 0
         BX_DEBUG_PCI("PCI: Data is %08lX @ %02X:%%02X:%01X\n", data,
                      bus_dev_fn >> 8, bus_dev_fn >> 3 & 31, bus_dev_fn & 7);
+#endif
 
         if (data == search_item)
@@ -386,4 +387,6 @@
         } else {
             rep_movsb(route_buf->buf_ptr, pci_routing_table, pci_routing_table_size);
+            /* IRQs 9 and 11 are PCI only. */
+            BX = (1 << 9) | (1 << 11);
         }
         break;
Index: /trunk/src/VBox/Devices/PC/BIOS/pcibios.inc
===================================================================
--- /trunk/src/VBox/Devices/PC/BIOS/pcibios.inc	(revision 42391)
+++ /trunk/src/VBox/Devices/PC/BIOS/pcibios.inc	(revision 42392)
@@ -42,6 +42,4 @@
 
 if BX_PCIBIOS
-
-extrn		pcibios_protected:near	; in a 32-bit segment
 
 ifdef DEBUG
