$Id:$ Patch by Olivier Baudron Credit: Kevin E. Martin for an initial patch This patch is an attempt to fix: xorg-x11-6.8.2-use-linux-native-pciscan-by-default.patch --- xc/programs/Xserver/hw/xfree86/int10/helper_exec.c.int10h 2005-07-24 00:59:18.000000000 +0200 +++ xc/programs/Xserver/hw/xfree86/int10/helper_exec.c 2005-07-24 13:50:51.000000000 +0200 @@ -25,6 +25,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 @@ -319,7 +323,8 @@ } #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 @@ -341,7 +346,8 @@ (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); @@ -378,7 +384,8 @@ #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); } } @@ -389,7 +396,8 @@ ErrorF(" outw(%#x, %4.4x)\n", port, val); #endif - outw(Int10Current->ioBase + port, val); + if (!pciCfg1outw(port, val)) + outw(Int10Current->ioBase + port, val); } CARD32 @@ -480,7 +488,81 @@ 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;