diff -r -u xc.org/config/cf/xorg.cf xc/config/cf/xorg.cf --- xc.org/config/cf/xorg.cf 2005-01-19 17:53:42.000000000 +0100 +++ xc/config/cf/xorg.cf 2005-01-24 15:24:05.511157250 +0100 @@ -504,11 +504,11 @@ # ifdef SunArchitecture # define XF86CardDrivers /* sunffb */ sunleo suncg6 suncg3 suncg14 \ suntcx sunbw2 glint mga tdfx ati vesa vga \ - XF86OSCardDrivers XF86ExtraCardDrivers \ + dummy XF86OSCardDrivers XF86ExtraCardDrivers \ DevelDrivers # else # define XF86CardDrivers sunffb sunleo suncg6 suncg3 suncg14 suntcx \ - sunbw2 glint mga tdfx ati vesa vga \ + sunbw2 glint mga tdfx ati vesa vga dummy \ XF86OSCardDrivers XF86ExtraCardDrivers \ DevelDrivers # endif @@ -543,7 +543,7 @@ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers -# define XF86CardDrivers ati \ +# define XF86CardDrivers ati dummy \ DevelDrivers \ XF86OSCardDrivers XF86ExtraCardDrivers # endif @@ -567,7 +567,7 @@ # ifndef XF86CardDrivers # define XF86CardDrivers mga glint nv s3 s3virge sis savage \ - trident chips tdfx ati \ + trident chips tdfx ati dummy \ DevelDrivers newport \ XF86OSCardDrivers XF86ExtraCardDrivers # endif @@ -594,7 +594,8 @@ # ifndef XF86CardDrivers # define XF86CardDrivers mga tdfx glint s3 s3virge rendition tga ati \ savage nv cirrus DevelDrivers siliconmotion \ - vga XF86OSCardDrivers XF86ExtraCardDrivers + vga dummy XF86OSCardDrivers \ + XF86ExtraCardDrivers # endif /* * Glide is available for Alpha, therefore build tdfx DRM module. @@ -630,7 +631,7 @@ # ifndef XF86CardDrivers # define XF86CardDrivers ati mga glint nv s3 s3virge sis savage\ trident chips tdfx \ - DevelDrivers vga \ + DevelDrivers vga dummy \ XF86OSCardDrivers XF86ExtraCardDrivers # endif /* The tdfx driver needs Glide, which is not available for PPC. */ @@ -660,7 +661,7 @@ # ifndef XF86CardDrivers # define XF86CardDrivers ati mga glint nv s3 s3virge sis savage\ trident chips tdfx \ - DevelDrivers vga \ + DevelDrivers vga dummy \ XF86OSCardDrivers XF86ExtraCardDrivers # endif # ifndef DriDrivers @@ -738,7 +739,7 @@ /* vgahw module */ # ifndef XF86VgaHw -# define XF86VgaHw NO +# define XF86VgaHw YES # endif /* Amiga framebuffer module */ # ifndef XF86AFB @@ -755,7 +756,7 @@ /* Pure PCI drivers should go first */ # ifndef XF86CardDrivers -# define XF86CardDrivers ati mga \ +# define XF86CardDrivers ati mga dummy \ DevelDrivers \ XF86OSCardDrivers XF86ExtraCardDrivers # endif diff -r -u xc.org/programs/Xserver/hw/xfree86/common/xf86Bus.c xc/programs/Xserver/hw/xfree86/common/xf86Bus.c --- xc.org/programs/Xserver/hw/xfree86/common/xf86Bus.c 2005-01-19 17:55:10.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/common/xf86Bus.c 2005-01-24 12:25:42.000000000 +0100 @@ -2954,8 +2954,14 @@ switch (primaryBus.type) { case BUS_PCI: bus = "PCI"; - sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, - primaryBus.id.pci.device,primaryBus.id.pci.func); + if (pciNumBuses < 256) + sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, + primaryBus.id.pci.device,primaryBus.id.pci.func); + else + sprintf(loc," %2.2x@%4.4x:%2.2x:%1.1x", + primaryBus.id.pci.bus & 0xff, + primaryBus.id.pci.bus >> 8, + primaryBus.id.pci.device,primaryBus.id.pci.func); break; case BUS_ISA: bus = "ISA"; diff -r -u xc.org/programs/Xserver/hw/xfree86/common/xf86Helper.c xc/programs/Xserver/hw/xfree86/common/xf86Helper.c --- xc.org/programs/Xserver/hw/xfree86/common/xf86Helper.c 2005-01-19 17:55:10.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/common/xf86Helper.c 2005-01-24 15:08:18.705160333 +0100 @@ -1795,9 +1795,16 @@ if (devBus) dev = devBus; /* busID preferred */ if (!dev) { if (xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) { - xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " - "for instance (BusID PCI:%i:%i:%i) found\n", - driverName, pPci->bus, pPci->device, pPci->func); + if (pciNumBuses < 256) + xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " + "for instance (BusID PCI:%2.2x:%2.2x:%2.2x) " + "found\n", driverName, pPci->bus, pPci->device, + pPci->func); + xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section " + "for instance (BusID " + "PCI:%2.2x@%4.4i:%2.2i:%i2.2) found\n", + driverName, pPci->bus & 0xff, pPci->bus >> 8, + pPci->device, pPci->func); } } else { numClaimedInstances++; diff -r -u xc.org/programs/Xserver/hw/xfree86/common/xf86pciBus.c xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c --- xc.org/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2005-01-19 17:55:10.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2005-01-24 15:20:05.654215081 +0100 @@ -417,7 +417,7 @@ for (i = 0; i < num; i++) { info = xf86PciVideoInfo[i]; pcrp = info->thisCard; - + if ((pcrp->pci_command & PCI_CMD_MEM_ENABLE) && (num == 1 || ((info->class == PCI_CLASS_DISPLAY) && @@ -1846,7 +1846,6 @@ PciBus->brbus = pcrp->busnum; PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; - PciBus->subclass = sub_class; PciBus->interface = pcrp->pci_prog_if; diff -r -u xc.org/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c --- xc.org/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c 2005-01-19 17:55:02.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c 2005-01-20 12:46:43.000000000 +0100 @@ -1950,8 +1950,8 @@ int w, int bpp ){ -#ifdef XF86DRI RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef XF86DRI if ( info->directRenderingEnabled && info->DMAForXv ) { @@ -2041,8 +2041,8 @@ CARD32 *dptr; CARD8 *sptr; int i,j; -#ifdef XF86DRI RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef XF86DRI if ( info->directRenderingEnabled && info->DMAForXv ) { @@ -2113,8 +2113,8 @@ int h, int w ){ -#ifdef XF86DRI RADEONInfoPtr info = RADEONPTR(pScrn); +#ifdef XF86DRI if ( info->directRenderingEnabled && info->DMAForXv ) { diff -r -u xc.org/programs/Xserver/hw/xfree86/etc/pcitweak.c xc/programs/Xserver/hw/xfree86/etc/pcitweak.c --- xc.org/programs/Xserver/hw/xfree86/etc/pcitweak.c 2005-01-19 17:54:57.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/etc/pcitweak.c 2005-01-24 09:28:08.000000000 +0100 @@ -213,15 +213,22 @@ * be zero, although it doing this isn't encouraged. */ - char *p, *s, *end; + char *p, *s, *d, *end; s = strdup(busID); p = strtok(s, ":"); if (p == NULL || *p == 0) return FALSE; + d = strpbrk(p, "@"); + if (d != NULL) + *(d++) = 0; *bus = strtoul(p, &end, 16); if (*end != '\0') return FALSE; + if (d != NULL && *d !=0) + *bus += strtoul(d,&end,16) << 8; + if (*end != '\0') + return FALSE; p = strtok(NULL, ":"); if (p == NULL || *p == 0) return FALSE; diff -r -u xc.org/programs/Xserver/hw/xfree86/etc/pcitweak.man xc/programs/Xserver/hw/xfree86/etc/pcitweak.man --- xc.org/programs/Xserver/hw/xfree86/etc/pcitweak.man 2005-01-19 17:54:57.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/etc/pcitweak.man 2005-01-24 09:14:42.000000000 +0100 @@ -28,8 +28,8 @@ .TP 8 .B \-l Probe the PCI buses and print a line for each detected device. Each line -contains the bus location (bus:device:function), chip vendor/device, card -(subsystem) vendor/card, revision, class and header type. All values +contains the bus location (bus[@domain]:device:function), chip vendor/device, +card (subsystem) vendor/card, revision, class and header type. All values printed are in hexadecimal. .TP 8 .BI "\-r " PCI-ID diff -r -u xc.org/programs/Xserver/hw/xfree86/etc/scanpci.c xc/programs/Xserver/hw/xfree86/etc/scanpci.c --- xc.org/programs/Xserver/hw/xfree86/etc/scanpci.c 2005-01-19 17:54:58.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/etc/scanpci.c 2005-01-24 09:59:24.000000000 +0100 @@ -226,10 +226,18 @@ exit(1); } - printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:" - " vendor 0x%04x device 0x%04x\n", - pcr->busnum, pcr->devnum, pcr->funcnum, - pcr->pci_vendor, pcr->pci_device); + if (pciNumBuses < 256) + printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:" + " vendor 0x%04x device 0x%04x\n", + pcr->busnum, pcr->devnum, pcr->funcnum, + pcr->pci_vendor, pcr->pci_device); + else + printf("\n" + "pci bus 0x%02x @ 0x%04x cardnum 0x%02x function 0x%02x:" + " vendor 0x%04x device 0x%04x\n", + (pcr->busnum) & 0xff, (pcr->busnum >> 8), + pcr->devnum, pcr->funcnum, + pcr->pci_vendor, pcr->pci_device); ScanPciFindPciNamesByDevice(pcr->pci_vendor, pcr->pci_device, pcr->pci_subsys_vendor, pcr->pci_subsys_card, diff -r -u xc.org/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c --- xc.org/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c 2005-01-19 17:55:11.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/ix86Pci.c 2005-01-19 18:02:14.000000000 +0100 @@ -507,35 +507,6 @@ xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found or probed for\n"); } -#if 0 -static pciTagRec -ix86PcibusTag(CARD8 bus, CARD8 cardnum, CARD8 func) -{ - pciTagRec tag; - - tag.cfg1 = 0; - - if (func > 7 || cardnum >= pciBusInfo[bus]->numDevices) - return tag; - - switch (ix86Pci0.configMech) { - case PCI_CFG_MECH_1: - tag.cfg1 = PCI_EN | ((CARD32)bus << 16) | - ((CARD32)cardnum << 11) | - ((CARD32)func << 8); - break; - - case PCI_CFG_MECH_2: - tag.cfg2.port = 0xc000 | ((CARD16)cardnum << 8); - tag.cfg2.enable = 0xf0 | (func << 1); - tag.cfg2.forward = bus; - break; - } - - return tag; -} -#endif - static CARD32 ix86PciReadLongSetup(PCITAG Tag, int reg) { @@ -551,6 +522,8 @@ #ifdef DEBUGPCI ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); #endif + if (PCI_DOM_FROM_TAG(tag) > 0) + return (CARD32)-1; addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); outl(PCI_CFGMECH1_ADDRESS_REG, addr); @@ -573,6 +546,8 @@ #ifdef DEBUGPCI ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); #endif + if (PCI_DOM_FROM_TAG(tag) > 0) + return (CARD32)-1; forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); @@ -603,6 +578,9 @@ { CARD32 addr; + if (PCI_DOM_FROM_TAG(tag) > 0) + return; + addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); outl(PCI_CFGMECH1_ADDRESS_REG, addr); outl(PCI_CFGMECH1_DATA_REG, data); @@ -615,6 +593,9 @@ CARD32 addr; CARD8 forward, enable; + if (PCI_DOM_FROM_TAG(tag) > 0) + return; + forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); @@ -641,6 +622,8 @@ #ifdef DEBUGPCI ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); #endif + if (PCI_DOM_FROM_TAG(tag) > 0) + return; addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); outl(PCI_CFGMECH1_ADDRESS_REG, addr); @@ -659,6 +642,8 @@ #ifdef DEBUGPCI ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); #endif + if (PCI_DOM_FROM_TAG(tag) > 0) + return; forward = PCI_FORWARD_FROM_TAG(Tag); enable = PCI_ENABLE_FROM_TAG(Tag); diff -r -u xc.org/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c --- xc.org/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2005-01-19 17:55:11.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2005-01-21 18:18:34.000000000 +0100 @@ -101,7 +101,9 @@ static int linuxPciOpenFile(PCITAG tag) { - static int lbus,ldev,lfunc,fd = -1; + static int lbus = -1, ldev,lfunc,fd = -1; + static int lbus_found = FALSE; + static int has_domain = -1; int bus, dev, func; char file[32]; struct stat ignored; @@ -109,30 +111,79 @@ bus = PCI_BUS_FROM_TAG(tag); dev = PCI_DEV_FROM_TAG(tag); func = PCI_FUNC_FROM_TAG(tag); - if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) { + + if (has_domain == -1) { + if (lbus == bus) + return -1; + + sprintf(file,"/proc/bus/pci/%02x",bus && 0xff); + if (stat(file, &ignored) >= 0) + has_domain = 0; + else { + sprintf(file,"/proc/bus/pci/%04x:%02x", + PCI_DOM_FROM_BUS(bus), bus & 0xff); + if (stat(file, &ignored) >= 0) + has_domain = 1; + else { + lbus = bus; + lbus_found = FALSE; + return -1; + } + } + } + + + if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) { + + if (bus != lbus) + lbus_found = FALSE; + else if (!lbus_found) + return -1; + + lbus = bus; + ldev = dev; + lfunc = func; + if (fd != -1) close(fd); - if (bus < 256) { - sprintf(file,"/proc/bus/pci/%02x",bus); - if (stat(file, &ignored) < 0) - sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x", + + if (bus < 256) { /* domain 0 or no domain */ + if (has_domain == 1) + sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x", bus, dev, func); - else - sprintf(file, "/proc/bus/pci/%02x/%02x.%1x", + else + sprintf(file, "/proc/bus/pci/%02x/%02x.%1x", bus, dev, func); } else { - sprintf(file,"/proc/bus/pci/%04x",bus); - if (stat(file, &ignored) < 0) - sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x", - bus, dev, func); - else - sprintf(file, "/proc/bus/pci/%04x/%02x.%1x", - bus, dev, func); + if (has_domain == 0) + return -1; + + sprintf(file, + "/proc/bus/pci/%04x:%02x/%02x.%1x", + PCI_DOM_FROM_BUS(bus), + bus & 0xff, dev, func); } fd = open(file,O_RDWR); - lbus = bus; - ldev = dev; - lfunc = func; + + if (!lbus_found) { + if (fd != -1) + lbus_found = TRUE; + else { + if (has_domain == 1) + sprintf(file,"/proc/bus/pci/%04x:%02x", + PCI_DOM_FROM_BUS(bus), + bus & 0xff); + else if (bus < 256) + sprintf(file, "/proc/bus/pci/%02x", + bus); + else { + lbus_found = FALSE; + return -1; + } + if (stat(file,&ignored) >= 0) + lbus_found = TRUE; + } + } } return fd; } diff -r -u xc.org/programs/Xserver/hw/xfree86/os-support/bus/Pci.c xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c --- xc.org/programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2005-01-19 17:55:11.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c 2005-01-24 15:03:43.360428551 +0100 @@ -248,12 +248,9 @@ /* * pciInit - choose correct platform/OS specific PCI init routine */ -void +static void pciInit() { - if (pciInitialized) - return; - pciInitialized = 1; /* XXX */ @@ -269,13 +266,15 @@ #endif } +#define PCI_INIT if (!pciInitialized) pciInit() + PCITAG pciFindFirst(CARD32 id, CARD32 mask) { #ifdef DEBUGPCI ErrorF("pciFindFirst(0x%lx, 0x%lx), pciInit = %d\n", id, mask, pciInitialized); #endif - pciInit(); + PCI_INIT; pciDevid = id & mask; pciDevidMask = mask; @@ -289,7 +288,7 @@ #ifdef DEBUGPCI ErrorF("pciFindNext(), pciInit = %d\n", pciInitialized); #endif - pciInit(); + PCI_INIT; return((*pciFindNextFP)()); } @@ -302,7 +301,7 @@ #ifdef DEBUGPCI ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); #endif - pciInit(); + PCI_INIT; if ((bus >= 0) && ((bus < pciNumBuses) || inProbe) && pciBusInfo[bus] && pciBusInfo[bus]->funcs->pciReadLong) { @@ -349,7 +348,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - pciInit(); + PCI_INIT; if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && pciBusInfo[bus]->funcs->pciWriteLong) @@ -398,7 +397,7 @@ #ifdef DEBUGPCI ErrorF("pciReadLong(0x%lx, %d)\n", tag, offset); #endif - pciInit(); + PCI_INIT; if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && pciBusInfo[bus]->funcs->pciSetBitsLong) { @@ -423,7 +422,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - pciInit(); + PCI_INIT; if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && pciBusInfo[bus]->funcs->pciAddrBusToHost) @@ -437,7 +436,7 @@ { int bus = PCI_BUS_FROM_TAG(tag); - pciInit(); + PCI_INIT; if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && pciBusInfo[bus]->funcs->pciAddrHostToBus) @@ -481,7 +480,7 @@ if (index < 0 || index > 6) return 0; - pciInit(); + PCI_INIT; if (xf86GetPciSizeFromOS(tag, index, &bits)) { if (min) @@ -624,6 +623,7 @@ int sec_bus, pri_bus; static int previousBus = 0; Bool speculativeProbe = FALSE; + Bool inLoop = FALSE; unsigned char base_class, sub_class; #ifdef DEBUGPCI @@ -660,7 +660,7 @@ /* * Is current dev a multifunction device? */ - if (!speculativeProbe && pciMfDev(pciBusNum, pciDevNum)) + if (!inLoop && !speculativeProbe && pciMfDev(pciBusNum, pciDevNum)) /* Probe for other functions */ pciFuncNum = 1; else @@ -700,13 +700,13 @@ /* No more buses. All done for now */ return(PCI_NOT_FOUND); } - + pciDevNum = 0; } } #ifdef DEBUGPCI - ErrorF("pciGenFindNext: pciBusInfo[%d] = 0x%lx\n", pciBusNum, pciBusInfo[pciBusNum]); + ErrorF("pciGenFindNext: pciBusInfo[%d] = 0x%lx\n", pciBusNum, pciBusInfo[pciBusNum]); #endif if (!pciBusInfo[pciBusNum]) { pciBusInfo[pciBusNum] = xnfalloc(sizeof(pciBusInfo_t)); @@ -721,7 +721,14 @@ * device/vendor ID field. */ #ifdef DEBUGPCI - ErrorF("pciGenFindNext: [%d, %d, %d]\n", pciBusNum, pciDevNum, pciFuncNum); + if (pciNumBuses < 256) + ErrorF("pciGenFindNext: [%d, %d, %d]\n", pciBusNum, pciDevNum, pciFuncNum); + else + ErrorF("pciGenFindNext: [%d@%d, %d, %d]\n", + PCI_BUS_NO_DOMAIN(pciBusNum), + PCI_DOM_FROM_BUS(pciBusNum), + pciDevNum, + pciFuncNum); #endif pciDeviceTag = PCI_MAKE_TAG(pciBusNum, pciDevNum, pciFuncNum); inProbe = TRUE; @@ -730,9 +737,10 @@ #ifdef DEBUGPCI ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid); #endif - if ((CARD16)(devid + 1U) <= (CARD16)1UL) + if ((CARD16)(devid + 1U) <= (CARD16)1UL) { + inLoop = TRUE; continue; /* Nobody home. Next device please */ - + } /* * Some devices mis-decode configuration cycles in such a way as to * create phantom buses. @@ -779,11 +787,23 @@ if (pciBusNum != pri_bus) { /* Some bridges do not implement the primary bus register */ if ((PCI_BUS_NO_DOMAIN(pri_bus) != 0) || - (sub_class != PCI_SUBCLASS_BRIDGE_CARDBUS)) - xf86Msg(X_WARNING, - "pciGenFindNext: primary bus mismatch on PCI" - " bridge 0x%08lx (0x%02x, 0x%02x)\n", - pciDeviceTag, pciBusNum, pri_bus); + (sub_class != PCI_SUBCLASS_BRIDGE_CARDBUS)) { + if (pciNumBuses < 256) + xf86Msg(X_WARNING, + "pciGenFindNext: primary bus mismatch on PCI" + " bridge 0x%08lx (0x%02x, 0x%02x)\n", + pciDeviceTag, pciBusNum, pri_bus); + else + xf86Msg(X_WARNING, + "pciGenFindNext: primary bus mismatch on PCI" + " bridge 0x%08lx" + " (0x%02@0x%04x, 0x%04, 0x%02x)\n", + pciDeviceTag, + PCI_BUS_NO_DOMAIN(pciBusNum), + PCI_DOM_FROM_BUS(pciBusNum), + PCI_DOM_FROM_BUS(pri_bus), + PCI_BUS_NO_DOMAIN(pri_bus)); + } pri_bus = pciBusNum; } if ((pri_bus < sec_bus) && (sec_bus < pciMaxBusNum) && @@ -966,7 +986,7 @@ done = TRUE; - pciInit(); + PCI_INIT; #ifdef XF86SCANPCI_WRAPPER XF86SCANPCI_WRAPPER(SCANPCI_INIT); @@ -1034,23 +1054,46 @@ } #ifdef OLD_FORMAT - xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " - "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", - devp->busnum, devp->devnum, devp->funcnum, - devp->pci_vendor, devp->pci_device, devp->pci_rev_id, - devp->pci_base_class, devp->pci_sub_class); + if (pciNumBuses < 256) + xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.2x,0x%02x,0x%1x " + "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", + devp->busnum, devp->devnum, devp->funcnum, + devp->pci_vendor, devp->pci_device, devp->pci_rev_id, + devp->pci_base_class, devp->pci_sub_class); + else + xf86MsgVerb(X_INFO, 2, "PCI: BusID 0x%.4@0x%.2x,0x%02x,0x%1x " + "ID 0x%04x,0x%04x Rev 0x%02x Class 0x%02x,0x%02x\n", + PCI_BUS_NO_DOMAIN(devp->busnum), + PCI_DOM_FROM_BUS(devp->busnum), + devp->devnum, devp->funcnum, + devp->pci_vendor, devp->pci_device, devp->pci_rev_id, + devp->pci_base_class, devp->pci_sub_class); #else - xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" - " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n", - devp->busnum, devp->devnum, devp->funcnum, - devp->pci_vendor, devp->pci_device, - devp->pci_subsys_vendor, devp->pci_subsys_card, - devp->pci_rev_id, devp->pci_base_class, - devp->pci_sub_class, devp->pci_prog_if, - devp->pci_header_type); + if (pciNumBuses < 256) + xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x" + " card %04x,%04x rev %02x class %02x,%02x,%02x" + " hdr %02x\n", + devp->busnum, devp->devnum, devp->funcnum, + devp->pci_vendor, devp->pci_device, + devp->pci_subsys_vendor, devp->pci_subsys_card, + devp->pci_rev_id, devp->pci_base_class, + devp->pci_sub_class, devp->pci_prog_if, + devp->pci_header_type); + else + xf86MsgVerb(X_INFO, 2, "PCI: %.4x@%.2x:%02x:%1x: chip %04x,%04x" + " card %04x,%04x rev %02x class %02x,%02x,%02x" + " hdr %02x\n", + PCI_BUS_NO_DOMAIN(devp->busnum), + PCI_DOM_FROM_BUS(devp->busnum), + devp->devnum, devp->funcnum, + devp->pci_vendor, devp->pci_device, + devp->pci_subsys_vendor, devp->pci_subsys_card, + devp->pci_rev_id, devp->pci_base_class, + devp->pci_sub_class, devp->pci_prog_if, + devp->pci_header_type); #endif - pci_devp[idx++] = devp; + tag = pciFindNext(); #ifdef DEBUGPCI @@ -1195,10 +1238,19 @@ /* if we use a mem base save it and move it out of the way */ if (b_reg >= 0 && b_reg <= 5) { savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<2)); - xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" - " for device %i:%i:%i\n", basereg, - (int)PCI_BUS_FROM_TAG(Tag), (int)PCI_DEV_FROM_TAG(Tag), - (int)PCI_FUNC_FROM_TAG(Tag)); + if (pciNumBuses < 256) + xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" + " for device %i:%i:%i\n", basereg, + (int)PCI_BUS_FROM_TAG(Tag), + (int)PCI_DEV_FROM_TAG(Tag), + (int)PCI_FUNC_FROM_TAG(Tag)); + else + xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" + " for device %i@%i:%i:%i\n", basereg, + (int)PCI_DOM_FROM_BUS(PCI_BUS_FROM_TAG(Tag)), + (int)PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)), + (int)PCI_DEV_FROM_TAG(Tag), + (int)PCI_FUNC_FROM_TAG(Tag)); pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), (CARD32)~0); } diff -r -u xc.org/programs/Xserver/hw/xfree86/os-support/bus/Pci.h xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h --- xc.org/programs/Xserver/hw/xfree86/os-support/bus/Pci.h 2005-01-19 17:55:11.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h 2005-01-21 18:23:38.000000000 +0100 @@ -116,9 +116,14 @@ /* by xf86scanpci */ #if defined(sun) && defined(SVR4) && defined(sparc) # define MAX_PCI_BUSES 4096 /* Max number of PCI buses */ -#elif defined(__alpha__) && defined (linux) -# define MAX_PCI_DOMAINS 512 -# define PCI_DOM_MASK 0x01fful +#elif defined (linux) +# if defined (__alpha__) +# define MAX_PCI_DOMAINS 512 +# define PCI_DOM_MASK 0x01fful +# else +# define MAX_PCI_DOMAINS 64 +# define PCI_DOM_MASK 0x003ful +# endif # define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */ #else # define MAX_PCI_BUSES 256 /* Max number of PCI buses */ @@ -131,7 +136,6 @@ # define PCI_DOM_MASK 0x0ffu #endif #define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu) - /* * "b" contains an optional domain number. */ diff -r -u xc.org/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h --- xc.org/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h 2005-01-19 17:55:11.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h 2005-01-21 18:19:25.000000000 +0100 @@ -754,7 +754,6 @@ } PciBiosType; /* Public PCI access functions */ -void pciInit(void); PCITAG pciFindFirst(CARD32 id, CARD32 mask); PCITAG pciFindNext(void); CARD32 pciReadLong(PCITAG tag, int offset); diff -r -u xc.org/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c --- xc.org/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c 2005-01-19 17:55:01.000000000 +0100 +++ xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c 2005-01-21 19:17:49.000000000 +0100 @@ -338,15 +338,28 @@ xf86MsgVerb(X_NONE,0,"No PCI info available\n"); return; } - xf86MsgVerb(X_NONE,0,"Probing for PCI devices (Bus:Device:Function)\n\n"); + if (pciNumBuses < 256) + xf86MsgVerb(X_NONE,0, + "Probing for PCI devices (Bus:Device:Function)\n\n"); + else + xf86MsgVerb(X_NONE,0, + "Probing for PCI devices (Bus@Domain:Device:Function)\n\n"); + for (i = 0; (pcrp = pcrpp[i]); i++) { const char *svendorname = NULL, *subsysname = NULL; const char *vendorname = NULL, *devicename = NULL; Bool noCard = FALSE; const char *prefix1 = "", *prefix2 = ""; - xf86MsgVerb(X_NONE, -verbosity, "(%d:%d:%d) ", - pcrp->busnum, pcrp->devnum, pcrp->funcnum); + if (pciNumBuses < 256) + xf86MsgVerb(X_NONE, -verbosity, "(%d:%d:%d) ", + pcrp->busnum, pcrp->devnum, pcrp->funcnum); + else + xf86MsgVerb(X_NONE, -verbosity, "(%d@%d:%d:%d) ", + pcrp->busnum && 0xff, + pcrp->busnum >> 8, + pcrp->devnum, + pcrp->funcnum); /* * Lookup as much as we can about the device.