Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 116666
Collapse All | Expand All

(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c (-1 / +7 lines)
Lines 2948-2961 Link Here
2948
        CheckGenericGA();
2948
        CheckGenericGA();
2949
    if (primaryBus.type != BUS_NONE) {
2949
    if (primaryBus.type != BUS_NONE) {
2950
	char *bus;
2950
	char *bus;
2951
	char *loc = xnfcalloc(1,9);
2951
	char *loc = xnfcalloc(1,14);
2952
	if (loc == NULL) return;
2952
	if (loc == NULL) return;
2953
2953
2954
	switch (primaryBus.type) {
2954
	switch (primaryBus.type) {
2955
	case BUS_PCI:
2955
	case BUS_PCI:
2956
	    bus = "PCI";
2956
	    bus = "PCI";
2957
	    if (pciNumBuses < 256)
2957
	    sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus,
2958
	    sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus,
2958
	    primaryBus.id.pci.device,primaryBus.id.pci.func);
2959
	    primaryBus.id.pci.device,primaryBus.id.pci.func);
2960
	    else
2961
		sprintf(loc," %2.2x@%4.4x:%2.2x:%1.1x",
2962
			primaryBus.id.pci.bus & 0xff,
2963
			primaryBus.id.pci.bus >> 8,
2964
			primaryBus.id.pci.device,primaryBus.id.pci.func);
2959
	    break;
2965
	    break;
2960
	case BUS_ISA:
2966
	case BUS_ISA:
2961
	    bus = "ISA";
2967
	    bus = "ISA";
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c (-1 / +10 lines)
Lines 1795-1803 Link Here
1795
	if (devBus) dev = devBus;  /* busID preferred */ 
1795
	if (devBus) dev = devBus;  /* busID preferred */ 
1796
	if (!dev) {
1796
	if (!dev) {
1797
	    if (xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) {
1797
	    if (xf86CheckPciSlot(pPci->bus, pPci->device, pPci->func)) {
1798
		xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
1798
		if (pciNumBuses < 256)
1799
		    xf86MsgVerb(X_WARNING, 0, 
1800
			    "%s: No matching Device section "
1799
			    "for instance (BusID PCI:%i:%i:%i) found\n",
1801
			    "for instance (BusID PCI:%i:%i:%i) found\n",
1800
			    driverName, pPci->bus, pPci->device, pPci->func);
1802
			    driverName, pPci->bus, pPci->device, pPci->func);
1803
		else
1804
		    xf86MsgVerb(X_WARNING, 0, 
1805
				"%s: No matching Device section "
1806
				"for instance (BusID "
1807
				"PCI:%2.2x@%4.4i:%2.2i:%2.2i) found\n",
1808
				driverName, pPci->bus & 0xff, pPci->bus >> 8, 
1809
				pPci->device, pPci->func);
1801
	    }
1810
	    }
1802
	} else {
1811
	} else {
1803
	    numClaimedInstances++;
1812
	    numClaimedInstances++;
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/etc/pcitweak.c (-1 / +8 lines)
Lines 213-227 Link Here
213
     * be zero, although it doing this isn't encouraged.
213
     * be zero, although it doing this isn't encouraged.
214
     */
214
     */
215
215
216
    char *p, *s, *end;
216
    char *p, *s, *d, *end;
217
217
218
    s = strdup(busID);
218
    s = strdup(busID);
219
    p = strtok(s, ":");
219
    p = strtok(s, ":");
220
    if (p == NULL || *p == 0)
220
    if (p == NULL || *p == 0)
221
	return FALSE;
221
	return FALSE;
222
    d = strpbrk(p,"@");
223
    if (d != NULL)
224
	*(d++) = 0;
222
    *bus = strtoul(p, &end, 16);
225
    *bus = strtoul(p, &end, 16);
223
    if (*end != '\0')
226
    if (*end != '\0')
224
	return FALSE;
227
	return FALSE;
228
    if (d != NULL && *d != 0)
229
	*bus += strtoul(d,&end,16) << 8;
230
    if (*end != '\0')
231
	return FALSE;
225
    p = strtok(NULL, ":");
232
    p = strtok(NULL, ":");
226
    if (p == NULL || *p == 0)
233
    if (p == NULL || *p == 0)
227
	return FALSE;
234
	return FALSE;
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/etc/scanpci.c (+8 lines)
Lines 226-236 Link Here
226
	exit(1);
226
	exit(1);
227
    }
227
    }
228
228
229
    if (pciNumBuses < 256) {
229
    printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:"
230
    printf("\npci bus 0x%04x cardnum 0x%02x function 0x%02x:"
230
	   " vendor 0x%04x device 0x%04x\n",
231
	   " vendor 0x%04x device 0x%04x\n",
231
	   pcr->busnum, pcr->devnum, pcr->funcnum,
232
	   pcr->busnum, pcr->devnum, pcr->funcnum,
232
	   pcr->pci_vendor, pcr->pci_device);
233
	   pcr->pci_vendor, pcr->pci_device);
234
    } else {
235
	printf("\npci bus 0x%02x @ 0x%04x cardnum 0x%02x function 0x%02x:"
236
	   " vendor 0x%04x device 0x%04x\n",
237
	   (pcr->busnum) & 0xff, (pcr->busnum >> 8), 
238
	   pcr->devnum, pcr->funcnum,
239
	   pcr->pci_vendor, pcr->pci_device);
233
240
241
    }
234
    ScanPciFindPciNamesByDevice(pcr->pci_vendor, pcr->pci_device,
242
    ScanPciFindPciNamesByDevice(pcr->pci_vendor, pcr->pci_device,
235
			     pcr->pci_subsys_vendor, pcr->pci_subsys_card,
243
			     pcr->pci_subsys_vendor, pcr->pci_subsys_card,
236
			     &vname, &dname, &svname, &sname);
244
			     &vname, &dname, &svname, &sname);
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c (-5 / +34 lines)
Lines 624-629 Link Here
624
    int sec_bus, pri_bus;
624
    int sec_bus, pri_bus;
625
    static int previousBus = 0;
625
    static int previousBus = 0;
626
    Bool speculativeProbe = FALSE;
626
    Bool speculativeProbe = FALSE;
627
    Bool inLoop = FALSE;
627
    unsigned char base_class, sub_class;
628
    unsigned char base_class, sub_class;
628
629
629
#ifdef DEBUGPCI
630
#ifdef DEBUGPCI
Lines 660-666 Link Here
660
		/*
661
		/*
661
		 * Is current dev a multifunction device?
662
		 * Is current dev a multifunction device?
662
		 */
663
		 */
663
		if (!speculativeProbe && pciMfDev(pciBusNum, pciDevNum))
664
		if (!inLoop && !speculativeProbe && pciMfDev(pciBusNum, pciDevNum))
664
		    /* Probe for other functions */
665
		    /* Probe for other functions */
665
		    pciFuncNum = 1;
666
		    pciFuncNum = 1;
666
		else
667
		else
Lines 693-698 Link Here
693
		    speculativeProbe = FALSE;
694
		    speculativeProbe = FALSE;
694
		}
695
		}
695
696
697
		do { 
696
		if (++pciBusNum >= pciMaxBusNum) {
698
		if (++pciBusNum >= pciMaxBusNum) {
697
#ifdef DEBUGPCI
699
#ifdef DEBUGPCI
698
		    ErrorF("pciGenFindNext: out of buses\n");
700
		    ErrorF("pciGenFindNext: out of buses\n");
Lines 700-705 Link Here
700
		    /* No more buses.  All done for now */
702
		    /* No more buses.  All done for now */
701
		    return(PCI_NOT_FOUND);
703
		    return(PCI_NOT_FOUND);
702
		}
704
		}
705
		} while (pciBusInfo[pciBusNum] &&
706
			(pciBusInfo[pciBusNum]->numDevices == 0));
703
707
704
		pciDevNum = 0;
708
		pciDevNum = 0;
705
	    }
709
	    }
Lines 730-737 Link Here
730
#ifdef DEBUGPCI
734
#ifdef DEBUGPCI
731
	ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid);
735
	ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid);
732
#endif
736
#endif
733
	if ((CARD16)(devid + 1U) <= (CARD16)1UL)
737
	if ((CARD16)(devid + 1U) <= (CARD16)1UL) {
738
	    inLoop = TRUE;
734
	    continue; /* Nobody home.  Next device please */
739
	    continue; /* Nobody home.  Next device please */
740
        }
735
741
736
	/*
742
	/*
737
	 * Some devices mis-decode configuration cycles in such a way as to
743
	 * Some devices mis-decode configuration cycles in such a way as to
Lines 742-750 Link Here
742
	    for (;;) {
748
	    for (;;) {
743
	        if (++pciDevNum >= pciBusInfo[pciBusNum]->numDevices)
749
	        if (++pciDevNum >= pciBusInfo[pciBusNum]->numDevices)
744
		    goto NextSpeculativeBus;
750
		    goto NextSpeculativeBus;
745
		if (devid !=
751
		inProbe = TRUE;
746
		    pciReadLong(PCI_MAKE_TAG(pciBusNum, pciDevNum, 0),
752
		tmp = pciReadLong(PCI_MAKE_TAG(pciBusNum, pciDevNum, 0),
747
			        PCI_ID_REG))
753
			        PCI_ID_REG);
754
		inProbe = FALSE;
755
		if (devid != tmp)
748
		    break;
756
		    break;
749
	    }
757
	    }
750
758
Lines 1035-1040 Link Here
1035
		    devp->pci_vendor, devp->pci_device, devp->pci_rev_id,
1043
		    devp->pci_vendor, devp->pci_device, devp->pci_rev_id,
1036
		    devp->pci_base_class, devp->pci_sub_class);
1044
		    devp->pci_base_class, devp->pci_sub_class);
1037
#else
1045
#else
1046
	if (pciNumBuses < 256)
1038
	xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x"
1047
	xf86MsgVerb(X_INFO, 2, "PCI: %.2x:%02x:%1x: chip %04x,%04x"
1039
		    " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n",
1048
		    " card %04x,%04x rev %02x class %02x,%02x,%02x hdr %02x\n",
1040
		    devp->busnum, devp->devnum, devp->funcnum,
1049
		    devp->busnum, devp->devnum, devp->funcnum,
Lines 1043-1048 Link Here
1043
		    devp->pci_rev_id, devp->pci_base_class,
1052
		    devp->pci_rev_id, devp->pci_base_class,
1044
		    devp->pci_sub_class, devp->pci_prog_if,
1053
		    devp->pci_sub_class, devp->pci_prog_if,
1045
		    devp->pci_header_type);
1054
		    devp->pci_header_type);
1055
	else
1056
	    xf86MsgVerb(X_INFO, 2, "PCI: %.4x@%.2x:%02x:%1x: chip %04x,%04x"
1057
			" card %04x,%04x rev %02x class %02x,%02x,%02x"
1058
			" hdr %02x\n",
1059
			PCI_BUS_NO_DOMAIN(devp->busnum), 
1060
			PCI_DOM_FROM_BUS(devp->busnum), 
1061
			devp->devnum, devp->funcnum,
1062
			devp->pci_vendor, devp->pci_device,
1063
			devp->pci_subsys_vendor, devp->pci_subsys_card,
1064
			devp->pci_rev_id, devp->pci_base_class,
1065
			devp->pci_sub_class, devp->pci_prog_if,
1066
			devp->pci_header_type);
1046
#endif
1067
#endif
1047
1068
1048
	pci_devp[idx++] = devp;
1069
	pci_devp[idx++] = devp;
Lines 1190-1199 Link Here
1190
	/* if we use a mem base save it and move it out of the way */
1211
	/* if we use a mem base save it and move it out of the way */
1191
	if (b_reg >= 0 && b_reg <= 5) {
1212
	if (b_reg >= 0 && b_reg <= 5) {
1192
	    savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<2));
1213
	    savebase = pciReadLong(Tag, PCI_MAP_REG_START+(b_reg<<2));
1214
	    if (pciNumBuses < 256) 
1193
	    xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]"
1215
	    xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]"
1194
			" for device %i:%i:%i\n", basereg,
1216
			" for device %i:%i:%i\n", basereg,
1195
			(int)PCI_BUS_FROM_TAG(Tag), (int)PCI_DEV_FROM_TAG(Tag),
1217
			(int)PCI_BUS_FROM_TAG(Tag), (int)PCI_DEV_FROM_TAG(Tag),
1196
			(int)PCI_FUNC_FROM_TAG(Tag));
1218
			(int)PCI_FUNC_FROM_TAG(Tag));
1219
	    else 
1220
		xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]"
1221
			    " for device %i@%i:%i:%i\n", basereg,
1222
			    (int)PCI_DOM_FROM_BUS(PCI_BUS_FROM_TAG(Tag)), 
1223
			    (int)PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(Tag)), 
1224
			    (int)PCI_DEV_FROM_TAG(Tag),
1225
			    (int)PCI_FUNC_FROM_TAG(Tag));
1197
	    pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2),
1226
	    pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2),
1198
			 (CARD32)~0);
1227
			 (CARD32)~0);
1199
	}
1228
	}
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h (-1 / +6 lines)
Lines 116-124 Link Here
116
				/* by xf86scanpci		     */
116
				/* by xf86scanpci		     */
117
#if defined(sun) && defined(SVR4) && defined(sparc)
117
#if defined(sun) && defined(SVR4) && defined(sparc)
118
# define MAX_PCI_BUSES   4096	/* Max number of PCI buses           */
118
# define MAX_PCI_BUSES   4096	/* Max number of PCI buses           */
119
#elif defined(__alpha__) && defined (linux)
119
#elif defined (linux) 
120
# if defined (__alpha__)
120
# define MAX_PCI_DOMAINS	512
121
# define MAX_PCI_DOMAINS	512
121
# define PCI_DOM_MASK	0x01fful
122
# define PCI_DOM_MASK	0x01fful
123
# else
124
#  define MAX_PCI_DOMAINS	64
125
#  define PCI_DOM_MASK  0x003ful
126
# endif
122
# define MAX_PCI_BUSES	(MAX_PCI_DOMAINS*256) /* 256 per domain      */
127
# define MAX_PCI_BUSES	(MAX_PCI_DOMAINS*256) /* 256 per domain      */
123
#else
128
#else
124
# define MAX_PCI_BUSES   256	/* Max number of PCI buses           */
129
# define MAX_PCI_BUSES   256	/* Max number of PCI buses           */
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c (-16 / +61 lines)
Lines 101-107 Link Here
101
static int
101
static int
102
linuxPciOpenFile(PCITAG tag)
102
linuxPciOpenFile(PCITAG tag)
103
{
103
{
104
	static int	lbus,ldev,lfunc,fd = -1;
104
	static int	lbus = -1,ldev,lfunc,fd = -1;
105
	static int	lbus_found = FALSE;
106
	static int	has_domain = -1;
105
	int		bus, dev, func;
107
	int		bus, dev, func;
106
	char		file[32];
108
	char		file[32];
107
	struct stat	ignored;
109
	struct stat	ignored;
Lines 109-138 Link Here
109
	bus  = PCI_BUS_FROM_TAG(tag);
111
	bus  = PCI_BUS_FROM_TAG(tag);
110
	dev  = PCI_DEV_FROM_TAG(tag);
112
	dev  = PCI_DEV_FROM_TAG(tag);
111
	func = PCI_FUNC_FROM_TAG(tag);
113
	func = PCI_FUNC_FROM_TAG(tag);
114
115
	if (has_domain == -1) {
116
	    if (lbus == bus)
117
			return -1;
118
		
119
		sprintf (file,"/proc/bus/pci/%02x", bus & 0xff);
120
		if (stat(file, &ignored) >= 0)
121
			has_domain = 0;
122
		else {
123
			sprintf (file,"/proc/bus/pci/%04x:%02x",
124
					PCI_DOM_FROM_BUS(bus), bus & 0xff);
125
			if (stat (file, &ignored) >= 0)
126
				has_domain = 1;
127
			else {
128
				lbus = bus;
129
				lbus_found = FALSE;
130
				return -1;
131
			}
132
		}
133
	}
134
	
112
	if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
135
	if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
136
			
137
		if (bus != lbus)
138
			lbus_found = FALSE;
139
		else if (!lbus_found)
140
			return -1;
141
142
		lbus = bus;
143
		ldev = dev;
144
		lfunc = func;
145
		
113
		if (fd != -1)
146
		if (fd != -1)
114
			close(fd);
147
			close(fd);
115
		if (bus < 256) {
148
		if (bus < 256) {	/* domain 0 or no domains */
116
		        sprintf(file,"/proc/bus/pci/%02x",bus);
149
			if (has_domain == 1)
117
			if (stat(file, &ignored) < 0)
150
				sprintf (file, "/proc/bus/pci/0000:%02x/%02x.%1x",
118
				sprintf(file, "/proc/bus/pci/0000:%02x/%02x.%1x",
119
					bus, dev, func);
151
					bus, dev, func);
120
			else
152
			else
121
				sprintf(file, "/proc/bus/pci/%02x/%02x.%1x",
153
				sprintf (file, "/proc/bus/pci/%02x/%02x.%1x",
122
					bus, dev, func);
154
					bus, dev, func);
123
		} else {
155
		} else {
124
		        sprintf(file,"/proc/bus/pci/%04x",bus);
156
			if (has_domain == 0)
125
			if (stat(file, &ignored) < 0)
157
				return -1;
126
				sprintf(file, "/proc/bus/pci/0000:%04x/%02x.%1x",
158
127
					bus, dev, func);
159
			sprintf (file, "/proc/bus/pci/%04x:%02x/%02x.%1x",
128
			else
160
							PCI_DOM_FROM_BUS(bus),
129
				sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
161
							bus & 0xff, dev, func);
130
					bus, dev, func);
131
		}
162
		}
132
		fd = open(file,O_RDWR);
163
		fd = open(file,O_RDWR);
133
		lbus  = bus;
164
		if (!lbus_found) {
134
		ldev  = dev;
165
			if (fd != -1)
135
		lfunc = func;
166
				lbus_found = TRUE;
167
			else {
168
				if (has_domain == 1)
169
					sprintf (file, "/proc/bus/pci/%04x:%02x",
170
								PCI_DOM_FROM_BUS(bus), bus & 0xff);
171
				else if (bus < 256)
172
					sprintf (file, "/proc/bus/pci/%02x", bus);
173
				else {
174
					lbus_found = FALSE;
175
					return -1;
176
				}
177
				if (stat(file, &ignored) >= 0)
178
					lbus_found = TRUE;
179
			}
180
		}
136
	}
181
	}
137
	return fd;
182
	return fd;
138
}
183
}
(-)/var/tmp/portage/xorg-x11-6.8.2-r6/work/xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c (-1 / +13 lines)
Lines 338-352 Link Here
338
        xf86MsgVerb(X_NONE,0,"No PCI info available\n");
338
        xf86MsgVerb(X_NONE,0,"No PCI info available\n");
339
	return;
339
	return;
340
    }
340
    }
341
    xf86MsgVerb(X_NONE,0,"Probing for PCI devices (Bus:Device:Function)\n\n");
341
    if (pciNumBuses < 256)
342
    	xf86MsgVerb(X_NONE,0,
343
		"Probing for PCI devices (Bus:Device:Function)\n\n");
344
    else
345
	xf86MsgVerb(X_NONE,0,
346
		"Probing for PCI devices (Bus@Domain:Device:Function)\n\n");
342
    for (i = 0; (pcrp = pcrpp[i]); i++) {
347
    for (i = 0; (pcrp = pcrpp[i]); i++) {
343
	const char *svendorname = NULL, *subsysname = NULL;
348
	const char *svendorname = NULL, *subsysname = NULL;
344
	const char *vendorname = NULL, *devicename = NULL;
349
	const char *vendorname = NULL, *devicename = NULL;
345
	Bool noCard = FALSE;
350
	Bool noCard = FALSE;
346
	const char *prefix1 = "", *prefix2 = "";
351
	const char *prefix1 = "", *prefix2 = "";
347
352
353
	if (pciNumBuses < 256)
348
	xf86MsgVerb(X_NONE, -verbosity, "(%d:%d:%d) ",
354
	xf86MsgVerb(X_NONE, -verbosity, "(%d:%d:%d) ",
349
		    pcrp->busnum, pcrp->devnum, pcrp->funcnum);
355
		    pcrp->busnum, pcrp->devnum, pcrp->funcnum);
356
	else
357
	    xf86MsgVerb(X_NONE, -verbosity, "(%d@%d:%d:%d) ",
358
			(int) pcrp->busnum && 0xff,
359
			(int) pcrp->busnum >> 8, 
360
			(int) pcrp->devnum, 
361
			(int) pcrp->funcnum);
350
362
351
	/*
363
	/*
352
	 * Lookup as much as we can about the device.
364
	 * Lookup as much as we can about the device.

Return to bug 116666