summaryrefslogtreecommitdiff
path: root/hw/xfree86/int10
diff options
context:
space:
mode:
authorKevin E Martin <kem@kem.org>2005-08-22 21:29:18 +0000
committerKevin E Martin <kem@kem.org>2005-08-22 21:29:18 +0000
commit4a19a33db6d04b5835830a665daa679ee2fcafe7 (patch)
treeef9ba4ca839a187ed91c463237d37dfc05fa1a0c /hw/xfree86/int10
parent5557a40a022b0ede36edd3370a60f5fc3d147796 (diff)
bugzilla #2880 (https://bugs.freedesktop.org/show_bug.cgi?id=2880)
attachment #2987 (https://bugs.freedesktop.org/attachment.cgi?id=2987) Use system method to access PCI config space for inb and inw in addition to inl (Olivier Baudron and Kevin Martin).
Diffstat (limited to 'hw/xfree86/int10')
-rw-r--r--hw/xfree86/int10/helper_exec.c92
1 files changed, 87 insertions, 5 deletions
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index a9538f6e4..eae6b5378 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -29,6 +29,10 @@
static int pciCfg1in(CARD16 addr, CARD32 *val);
static int pciCfg1out(CARD16 addr, CARD32 val);
+static int pciCfg1inw(CARD16 addr, CARD16 *val);
+static int pciCfg1outw(CARD16 addr, CARD16 val);
+static int pciCfg1inb(CARD16 addr, CARD8 *val);
+static int pciCfg1outb(CARD16 addr, CARD8 val);
#if defined (_PC)
static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
#endif
@@ -323,7 +327,8 @@ x_inb(CARD16 port)
}
#endif /* __NOT_YET__ */
} else {
- val = inb(Int10Current->ioBase + port);
+ if (!pciCfg1inb(port, &val))
+ val = inb(Int10Current->ioBase + port);
#ifdef PRINT_PORT
ErrorF(" inb(%#x) = %2.2x\n", port, val);
#endif
@@ -345,7 +350,8 @@ x_inw(CARD16 port)
(void)getsecs(&sec, &usec);
val = (CARD16)(usec / 3);
} else {
- val = inw(Int10Current->ioBase + port);
+ if (!pciCfg1inw(port, &val))
+ val = inw(Int10Current->ioBase + port);
}
#ifdef PRINT_PORT
ErrorF(" inw(%#x) = %4.4x\n", port, val);
@@ -382,7 +388,8 @@ x_outb(CARD16 port, CARD8 val)
#ifdef PRINT_PORT
ErrorF(" outb(%#x, %2.2x)\n", port, val);
#endif
- outb(Int10Current->ioBase + port, val);
+ if (!pciCfg1outb(port, val))
+ outb(Int10Current->ioBase + port, val);
}
}
@@ -393,7 +400,8 @@ x_outw(CARD16 port, CARD16 val)
ErrorF(" outw(%#x, %4.4x)\n", port, val);
#endif
- outw(Int10Current->ioBase + port, val);
+ if (!pciCfg1outw(port, val))
+ outw(Int10Current->ioBase + port, val);
}
CARD32
@@ -484,7 +492,81 @@ pciCfg1out(CARD16 addr, CARD32 val)
return 1;
}
if (addr == 0xCFC) {
- pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr),val);
+ pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr), val);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1inw(CARD16 addr, CARD16 *val)
+{
+ int offset, shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xffff;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ offset = addr - 0xCFC;
+ *val = pciReadWord(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1outw(CARD16 addr, CARD16 val)
+{
+ int offset, shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xffff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ offset = addr - 0xCFC;
+ pciWriteWord(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset, val);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1inb(CARD16 addr, CARD8 *val)
+{
+ int offset, shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ *val = (PciCfg1Addr >> shift) & 0xff;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ offset = addr - 0xCFC;
+ *val = pciReadByte(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset);
+ return 1;
+ }
+ return 0;
+}
+
+static int
+pciCfg1outb(CARD16 addr, CARD8 val)
+{
+ int offset, shift;
+
+ if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
+ shift = (addr - 0xCF8) * 8;
+ PciCfg1Addr &= ~(0xff << shift);
+ PciCfg1Addr |= ((CARD32) val) << shift;
+ return 1;
+ }
+ if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
+ offset = addr - 0xCFC;
+ pciWriteByte(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr) + offset, val);
return 1;
}
return 0;