[PATCH] X86EMU: pass the correct bus:dev:fn tag to pci emulation

Bart Trojanowski bart at jukie.net
Fri Jan 11 17:20:51 PST 2008


When in x86emu, the PCI emulation routines were being given the TAG of
the video device regardless of what the BIOS code that is being emulated
asked for.

This patch uses the bus:dev:fn numbers that were passed to 0xCF8 when
calling the pciRead*() and pciWrite*() functions after an access to
0xCFC.

Signed-off-by: Bart Trojanowski <bart at jukie.net>
---
 hw/xfree86/int10/helper_exec.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index 87e5c76..57b7370 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -549,7 +549,8 @@ Mem_wl(CARD32 addr, CARD32 val)
 
 static CARD32 PciCfg1Addr = 0;
 
-#define OFFSET(Cfg1Addr) (Cfg1Addr & 0xff)
+#define PCI_OFFSET(x) ((x) & 0x000000ff)
+#define PCI_TAG(x)    ((x) & 0x00ffff00)
 
 static int
 pciCfg1in(CARD16 addr, CARD32 *val)
@@ -559,7 +560,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
 	return 1;
     }
     if (addr == 0xCFC) {
-	*val = pciReadLong(Int10Current->Tag, OFFSET(PciCfg1Addr));
+	*val = pciReadLong(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr));
 	return 1;
     }
     return 0;
@@ -573,7 +574,7 @@ pciCfg1out(CARD16 addr, CARD32 val)
 	return 1;
     }
     if (addr == 0xCFC) {
-	pciWriteLong(Int10Current->Tag, OFFSET(PciCfg1Addr), val);
+	pciWriteLong(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr), val);
 	return 1;
     }
     return 0;
@@ -591,7 +592,7 @@ pciCfg1inw(CARD16 addr, CARD16 *val)
     }
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
 	offset = addr - 0xCFC;
-	*val = pciReadWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
+	*val = pciReadWord(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset);
 	return 1;
     }
     return 0;
@@ -610,7 +611,7 @@ pciCfg1outw(CARD16 addr, CARD16 val)
     }
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
 	offset = addr - 0xCFC;
-	pciWriteWord(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
+	pciWriteWord(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset, val);
 	return 1;
     }
     return 0;
@@ -628,7 +629,7 @@ pciCfg1inb(CARD16 addr, CARD8 *val)
     }
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
 	offset = addr - 0xCFC;
-	*val = pciReadByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset);
+	*val = pciReadByte(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset);
 	return 1;
     }
     return 0;
@@ -647,7 +648,7 @@ pciCfg1outb(CARD16 addr, CARD8 val)
     }
     if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
 	offset = addr - 0xCFC;
-	pciWriteByte(Int10Current->Tag, OFFSET(PciCfg1Addr) + offset, val);
+	pciWriteByte(PCI_TAG(PciCfg1Addr), PCI_OFFSET(PciCfg1Addr) + offset, val);
 	return 1;
     }
     return 0;
-- 
1.5.3.7.1150.g149d432




More information about the xorg mailing list