xserver/hw/xorg/scanpci Imakefile, NONE, 1.1 pci.ids, NONE, 1.1 pciid2c.pl, NONE, 1.1 xf86PciData.h, NONE, 1.1 xf86PciIds.h, NONE, 1.1 xf86PciStdIds.h, NONE, 1.1 xf86PciStr.h, NONE, 1.1 xf86ScanPci.c, NONE, 1.1 xf86ScanPci.h, NONE, 1.1

Daniel Stone xserver-commit at pdx.freedesktop.org
Sun Apr 25 23:52:25 EST 2004


Committed by: daniel

Update of /cvs/xserver/xserver/hw/xorg/scanpci
In directory pdx:/tmp/cvs-serv17025/hw/xorg/scanpci

Added Files:
	Imakefile pci.ids pciid2c.pl xf86PciData.h xf86PciIds.h 
	xf86PciStdIds.h xf86PciStr.h xf86ScanPci.c xf86ScanPci.h 
Log Message:
Xizzle is dead, long live Xorg.

Re-import the DDX from X11R6.7, complete with automakey goodness, and do the
requisite configure.ac, et al, updates; also import the XKB extension from the
6.7 DIX.

Currently it'll link and then hang solid in RADEONInitAccel(), or the next
function if you enable NoAccel.


--- NEW FILE: Imakefile ---

XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/Imakefile,v 1.10 2002/07/25 05:06:16 tsi Exp $

#if DoLoadableServer
#define IHaveSubdirs
SUBDIRS = module
#endif

#include <Server.tmpl>

MODPATHDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\"
   INCLUDES =	-I$(XF86SRC)/common -I$(XF86OSSRC) -I$(XF86OSSRC)/bus \
		-I$(SERVERSRC)/include -I$(SERVERSRC)/os \
		-I$(XINCLUDESRC) -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \
		-I$(SERVERSRC)/Xi \
		-I$(FONTLIBSRC)/include -I$(XF86PARSERSRC) \
		-I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac

SRCS = xf86ScanPci.c xf86PciData.c

NormalLibraryObjectRule()

NormalLibraryTarget(scanpci,xf86ScanPci.o)

NormalLibraryTarget(pcidata,xf86PciData.o)

#if HasPerl5
PCIIDSRCS = ../etc/pci.ids ../etc/extrapci.ids
PCIIDS = pci.ids

$(PCIIDS): $(PCIIDSRCS)
	RemoveFile($@)
	cat $(PCIIDSRCS) > $@

includes:: xf86PciIds.h

xf86PciIds.h: $(PCIIDS) pciid2c.pl ../common/xf86PciInfo.h
	RemoveFile($@)
	RunPerlScript(pciid2c.pl, ../common/xf86PciInfo.h < $(PCIIDS) > $@)

clean::
	RemoveFile($(PCIIDS))
	RemoveFile(xf86PciIds.h)

#else
LinkFile(xf86PciIds.h,xf86PciStdIds.h)
#endif

LinkFile(xf86PciData.c,xf86ScanPci.c)

SpecialCObjectRule(xf86PciData,NullParameter,-DPCIDATA)

#if DoLoadableServer
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
#endif

DependTarget()

--- NEW FILE: pci.ids ---
#
#	List of PCI ID's
#
#	Maintained by Martin Mares <mj at ucw.cz> and other volunteers from the
#	Linux PCI ID's Project at http://pciids.sf.net/. New data are always
#	welcome (if they are accurate), we're eagerly expecting new entries,
#	so if you have anything to contribute, please visit the home page or
#	send a diff -u against the most recent pci.ids to pci-ids at ucw.cz.
#
#	Daily snapshot on Sun 2004-02-15 11:00:07
#

# Vendors, devices and subsystems. Please keep sorted.

# Syntax:
# vendor  vendor_name
#	device  device_name				<-- single tab
#		subvendor subdevice  subsystem_name	<-- two tabs

[...7782 lines suppressed...]
# Some NVIDIA cards that are not in the master pci.ids file yet.
10de	"
	0314	GeForce FX 5600SE
	031a	GeForce FX Go5600
	031b	GeForce FX Go5650
	031c	Quadro FX Go700
	0323	GeForce FX 5200SE
	0324	GeForce FX Go5200
	0325	GeForce FX Go5250
	0328	GeForce FX Go5200 32M/64M
	0329	GeForce FX 5200 (Mac)
	032a	Quadro NVS 280 PCI
	032c	GeForce FX Go5300
	032d	GeForce FX Go5100
	0332	GeForce FX 5900XT
	0333	GeForce FX 5950 Ultra
	0341	GeForce FX 5700 Ultra
	0342	GeForce FX 5700
	034e	Quadro FX 1100


--- NEW FILE: pciid2c.pl ---
#!/usr/bin/perl

# Automatically generate the data structures for PCI vendor/device lists
# from the pci.ids file.
#
# It should be run as:
#
#   perl pciid2c.pl ../common/xf86PciInfo.h < pci.ids > xf86PciStdIds.h
#
#
# Copyright © 2002 by The XFree86 Project, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the copyright holder(s)
# and author(s) shall not be used in advertising or otherwise to promote
# the sale, use or other dealings in this Software without prior written
# authorization from the copyright holder(s) and author(s).
#

#
# Author: David Dawes
#
# $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/pciid2c.pl,v 1.3 2003/08/24 17:37:10 dawes Exp $
#

if (@ARGV[0]) {
    $infofile = @ARGV[0];
}

#
# The basic pci.ids format is:
#   - Vendor lines start with four (lower case) hex digits
#   - Device lines start with one tab followed by four hex digits
#   - Subsystem lines start with two tabs followed by two sets of four
#     hex digits.
#   - Class overrides for devices start with two tabs followed by a "C",
#     followed by four hex digits with the class/subclass value.
#   - Class lines start with a "C".
#   - Comment lines start with a '#'.
#   - Blank lines are ignored.
#
# We allow for extra lines to be appended to modify existing entries or
# add new ones.  To add/modify Device entries without modifying the
# Vendor name, a special vendor name of '"' is used (mnemonic: "ditto").
# Similarly for adding subsystem names without modifying (or adding)
# a corresponding device entry.  To rename an existing entry, simply
# provide the new name.  To remove an existing entry, use the special
# name '-'.
#

while (<STDIN>) {
    # Process data lines
    if (/^([0-9a-f]{4})\s+(.*)/) {
	$vendor = $1;
	if ($2 eq '-') {
	    delete($vendors{$vendor});
	} elsif ($2 ne '"') {
	    $vendors{$vendor} = $2;
	    # Remove " characters
	    $vendors{$vendor} =~ s/"//g;
	    # Remove multiple "?" sequences to avoid trigraphs
	    $vendors{$vendor} =~ s/\?+/\?/g;
	}
    } elsif (/^\t([0-9a-f]{4})\s+(.*)/) {
	$device = $1;
	if ($2 eq '-') {
	    delete($devices{$vendor}{$device});
	} elsif ($2 ne '"') {
	    $devices{$vendor}{$device} = $2;
	    # Remove " characters
	    $devices{$vendor}{$device} =~ s/"//g;
	    # Remove multiple "?" sequences to avoid trigraphs
	    $devices{$vendor}{$device} =~ s/\?+/\?/g;
	}
    } elsif (/^\t\t([0-9a-f]{4})\s+([0-9a-f]{4})\s+(.*)/) {
	$v = $1;
	$s = $2;
	if ($3 eq '-') {
	    delete($subsystems{$v}{$s});
	    delete($devsubsystems{$vendor}{$device}{"$v-$s"});
	} elsif ($3 ne '"') {
	    if ($subsystems{$v}{$s}) {
		#print STDERR "Duplicate subsytem: $v, $s, \"$subsystems{$v}{$s}\", \"$3\"\n";
	    }
	    $subsystems{$v}{$s} = $3;
	    # Remove " characters
	    $subsystems{$v}{$s} =~ s/"//g;
	    # Remove multiple "?" sequences to avoid trigraphs
	    $subsystems{$v}{$s} =~ s/\?+/\?/g;
	    $devsubsystems{$vendor}{$device}{"$v-$s"} = $subsystems{$v}{$s};
	}
    } elsif (/^\t\tC\s+([0-9a-f]{4})/) {
	$classes{$vendor}{$device} = $1;
    }
    # Ignore all other lines.
}

# Find which vendors are "video" vendors.
if ($infofile) {
    open(INFO, "<$infofile") || die "Can't open $infofile";
    while (<INFO>) {
	if (/^#define\s+PCI_VENDOR_.*0x([0-9a-fA-F]{4})/) {
	    $vendor = $1;
	    $vendor =~ tr/A-F/a-f/;
	    $video{$vendor} = 1;
	}
    }
}

#
# This layout is quite different from that used in the old xf86PciInfo.h
# file.  One main difference is that the list is initialised at runtime.
# It's currently a flat list.  This could be improved.
#

# Print out header information.

$proj = "XFree86";
print "/* \$$proj\$ */

/*
 * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
 *
 * It is generated by pciid2c.pl using data from the following files:
 *
 *    ../etc/pci.ids
 *    ../etc/extrapci.ids
 *    ../common/xf86PciInfo.h
 */

/*
 * Copyright © 2002 by the XFree86 Project, Inc.
 *
 * The pci.ids file and the data it contains are from the Linux PCI ID's
 * Project (http://pciids.sf.net/).  It is maintained by Martin Mares
 * <mj\@ucw.cz> and other volunteers.  The pci.ids file contains no
 * copyright notice.
 */

#include \"xf86PciInfo.h\"
#ifndef NULL
#define NULL (void *)0
#endif

";

# The following #ifdefs are used:
#  - INIT_SUBSYS_INFO -- initialise subsystem data
#  - INIT_VENDOR_SUBSYS_INFO -- initialise a vendor<->subsystem table.
#  - VENDOR_INCLUDE_NONVIDEO -- include data for non-video vendors.

# Define static variables with all of the strings.

foreach $vendor (sort keys %vendors) {
    if ($infofile && !$video{$vendor}) {
	print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
    }
    print "static const char pci_vendor_${vendor}[] = \"$vendors{$vendor}\";\n";
    foreach $device (sort keys %{$devices{$vendor}}) {
	print "static const char pci_device_${vendor}_${device}[] = " .
	      "\"$devices{$vendor}{$device}\";\n";
	foreach $subsys (sort keys %{$devsubsystems{$vendor}{$device}}) {
	    $s = $subsys;
	    ($v) = split /-/, $s;
	    if ($infofile && !$video{$vendor} && $video{$v}) {
		print "#endif\n";
	    }
	    $s =~ s/-/_/;
	    print "#ifdef INIT_SUBSYS_INFO\n";
	    print "static const char pci_subsys_${vendor}_${device}_${s}[] = " .
		  "\"$devsubsystems{$vendor}{$device}{$subsys}\";\n";
	    print "#endif\n";
	    if ($infofile && !$video{$vendor} && $video{$v}) {
		print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
	    }
	}
    }
    if ($infofile && !$video{$vendor}) {
	print "#endif\n";
    }
}


# Pre-initialise the table structures (from the inner to the outer).

# First, the subsys structures.

print "#ifdef INIT_SUBSYS_INFO\n";
foreach $vendor (sort keys %vendors) {
    if ($infofile && !$video{$vendor}) {
	$pre = "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
    } else {
	undef($pre);
	undef($post);
    }
    foreach $device (sort keys %{$devices{$vendor}}) {
	foreach $subsys (sort keys %{$devsubsystems{$vendor}{$device}}) {
	    $s = $subsys;
	    $s =~ tr/-/_/;
	    ($vid, $sid) = split /_/, $s;
	    if ($pre) {
		print $pre;
		undef($pre);
		$post = "#endif\n";
	    }
	    if ($infofile && !$video{$vendor} && $video{$vid}) {
		print "#endif\n";
	    }
	    print "static const pciSubsystemInfo " .
		  "pci_ss_info_${vendor}_${device}_$s =\n";
	    print "\t{0x$vid, 0x$sid, pci_subsys_${vendor}_${device}_$s, 0};\n";
	    print "#undef pci_ss_info_$s\n";
	    print "#define pci_ss_info_$s pci_ss_info_${vendor}_${device}_$s\n";
	    if ($infofile && !$video{$vendor} && $video{$vid}) {
		print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
	    }
	}
    }
    if ($post) {
	print $post;
	undef($post);
    }
}

# Next, the list of per vendor+device subsystem arrays

foreach $vendor (sort keys %vendors) {
    if ($infofile && !$video{$vendor}) {
	$pre = "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
    } else {
	undef($pre);
	undef($post);
    }
    foreach $device (sort keys %{$devices{$vendor}}) {
	if (scalar(keys %{$devsubsystems{$vendor}{$device}}) > 0) {
	    if ($pre) {
		print $pre;
		undef($pre);
		$post = "#endif\n";
	    }
	    print "static const pciSubsystemInfo *pci_ss_list_${vendor}_${device}[] = {\n";
	    foreach $sub (sort keys %{$devsubsystems{$vendor}{$device}}) {
		$sub =~ s/-/_/;
		print "\t&pci_ss_info_${vendor}_${device}_${sub},\n";
	    }
	    print "\tNULL\n};\n";
	} else {
	    print "#define pci_ss_list_${vendor}_${device} NULL\n";
	}
    }
    if ($post) {
	print $post;
	undef($post);
    }
}

# Next, the list of per vendor subsystem arrays

print "#ifdef INIT_VENDOR_SUBSYS_INFO\n";
foreach $vendor (sort keys %vendors) {
    if (scalar(keys %{$subsystems{$vendor}}) > 0) {
	if ($infofile && !$video{$vendor}) {
	    print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
	}
	print "static const pciSubsystemInfo *pci_ss_list_${vendor}[] = {\n";
	foreach $sub (sort keys %{$subsystems{$vendor}}) {
	    print "\t&pci_ss_info_${vendor}_${sub},\n";
	}
	print "\tNULL\n};\n";
	if ($infofile && !$video{$vendor}) {
	    print "#endif\n";
	}
    } else {
	print "#define pci_ss_list_${vendor} NULL\n";
    }
}
print "#endif /* INIT_VENDOR_SUBSYS_INFO */\n";
print "#endif /* INIT_SUBSYS_INFO */\n";

# Next the device structures

foreach $vendor (sort keys %vendors) {
    if ($infofile && !$video{$vendor}) {
	$pre = "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
    } else {
	undef($pre);
	undef($post);
    }
    foreach $device (sort keys %{$devices{$vendor}}) {
	if ($pre) {
	    print $pre;
	    undef($pre);
	    $post = "#endif\n";
	}
	if ($classes{$vendor}{$device}) {
	    $class = "0x$classes{$vendor}{$device}";
	} else {
	    $class = "0";
	}
	print "static const pciDeviceInfo " .
	      "pci_dev_info_${vendor}_${device} = {\n";
	print "\t0x$device, pci_device_${vendor}_${device},\n";
	print "#ifdef INIT_SUBSYS_INFO\n";
	print "\tpci_ss_list_${vendor}_${device},\n";
	print "#else\n";
	print "\tNULL,\n";
	print "#endif\n";
	print "\t$class\n};\n";
    }
    if ($post) {
	print $post;
	undef($post);
    }
}

# Next, the list of per vendor device arrays

foreach $vendor (sort keys %vendors) {
    if (scalar(keys %{$devices{$vendor}}) > 0) {
	if ($infofile && !$video{$vendor}) {
	    print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
	}
	print "static const pciDeviceInfo *pci_dev_list_${vendor}[] = {\n";
	foreach $device (sort keys %{$devices{$vendor}}) {
	    print "\t&pci_dev_info_${vendor}_${device},\n";
	}
	print "\tNULL\n};\n";
	if ($infofile && !$video{$vendor}) {
	    print "#endif\n";
	}
    } else {
	print "#define pci_dev_list_${vendor} NULL\n";
    }
}

# Next, the main vendor list

print "
static const pciVendorInfo pciVendorInfoList[] = {
";

foreach $vendor (sort keys %vendors) {
    if ($infofile && !$video{$vendor}) {
	print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
    }
    print "\t{0x$vendor, pci_vendor_$vendor, pci_dev_list_$vendor},\n";
    if ($infofile && !$video{$vendor}) {
	print "#endif\n";
    }
}
print "\t{0x0000, NULL, NULL}\n};\n";

# Finally, the main vendor/subsystem list

print "
#if defined(INIT_VENDOR_SUBSYS_INFO) && defined(INIT_SUBSYS_INFO)
static const pciVendorSubsysInfo pciVendorSubsysInfoList[] = {
";

foreach $vendor (sort keys %vendors) {
    if ($infofile && !$video{$vendor}) {
	print "#ifdef VENDOR_INCLUDE_NONVIDEO\n";
    }
    print "\t{0x$vendor, pci_vendor_$vendor, pci_ss_list_$vendor},\n";
    if ($infofile && !$video{$vendor}) {
	print "#endif\n";
    }
}
print "\t{0x0000, NULL, NULL}\n};\n";
print "#endif\n";

--- NEW FILE: xf86PciData.h ---
/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciData.h,v 1.3 2003/08/24 17:37:10 dawes Exp $ */

/*
 * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name of the copyright holder(s)
 * and author(s) shall not be used in advertising or otherwise to promote
 * the sale, use or other dealings in this Software without prior written
 * authorization from the copyright holder(s) and author(s).
 */

#ifndef PCI_DATA_H_
#define PCI_DATA_H_

#define NOVENDOR 0xFFFF
#define NODEVICE 0xFFFF
#define NOSUBSYS 0xFFFF

typedef Bool (*ScanPciSetupProcPtr)(void);
typedef void (*ScanPciCloseProcPtr)(void);
typedef int (*ScanPciFindByDeviceProcPtr)(
			unsigned short vendor, unsigned short device,
			unsigned short svendor, unsigned short subsys,
			const char **vname, const char **dname,
			const char **svname, const char **sname);
typedef int (*ScanPciFindBySubsysProcPtr)(
			unsigned short svendor, unsigned short subsys,
			const char **svname, const char **sname);
typedef CARD32 (*ScanPciFindClassBySubsysProcPtr)(
			unsigned short vendor, unsigned short subsystem);
typedef CARD32 (*ScanPciFindClassByDeviceProcPtr)(
			unsigned short vendor, unsigned short device);

/*
 * Whoever loads this module needs to define these and initialise them
 * after loading.
 */
extern ScanPciSetupProcPtr xf86SetupPciIds;
extern ScanPciCloseProcPtr xf86ClosePciIds;
extern ScanPciFindByDeviceProcPtr xf86FindPciNamesByDevice;
extern ScanPciFindBySubsysProcPtr xf86FindPciNamesBySubsys;
extern ScanPciFindClassBySubsysProcPtr xf86FindPciClassBySubsys;
extern ScanPciFindClassByDeviceProcPtr xf86FindPciClassByDevice;

Bool ScanPciSetupPciIds(void);
void ScanPciClosePciIds(void);
int ScanPciFindPciNamesByDevice(unsigned short vendor, unsigned short device,
				unsigned short svendor, unsigned short subsys,
				const char **vname, const char **dname,
				const char **svname, const char **sname);
int ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys,
				const char **svname, const char **sname);
CARD32 ScanPciFindPciClassBySubsys(unsigned short vendor,
				   unsigned short subsystem);
CARD32 ScanPciFindPciClassByDevice(unsigned short vendor,
				   unsigned short device);

#endif

--- NEW FILE: xf86PciIds.h ---
/* $XFree86$ */

/*
 * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
 *
 * It is generated by pciid2c.pl using data from the following files:
 *
 *    ../etc/pci.ids
 *    ../etc/extrapci.ids
 *    ../common/xf86PciInfo.h
 */

/*
 * Copyright © 2002 by the XFree86 Project, Inc.
 *
 * The pci.ids file and the data it contains are from the Linux PCI ID's
 * Project (http://pciids.sf.net/).  It is maintained by Martin Mares
 * <mj at ucw.cz> and other volunteers.  The pci.ids file contains no
 * copyright notice.
[...73342 lines suppressed...]
	{0xe159, pci_vendor_e159, pci_ss_list_e159},
	{0xe4bf, pci_vendor_e4bf, pci_ss_list_e4bf},
	{0xe55e, pci_vendor_e55e, pci_ss_list_e55e},
	{0xea01, pci_vendor_ea01, pci_ss_list_ea01},
	{0xea60, pci_vendor_ea60, pci_ss_list_ea60},
	{0xeabb, pci_vendor_eabb, pci_ss_list_eabb},
	{0xeace, pci_vendor_eace, pci_ss_list_eace},
	{0xec80, pci_vendor_ec80, pci_ss_list_ec80},
	{0xecc0, pci_vendor_ecc0, pci_ss_list_ecc0},
	{0xedd8, pci_vendor_edd8, pci_ss_list_edd8},
	{0xf1d0, pci_vendor_f1d0, pci_ss_list_f1d0},
	{0xfa57, pci_vendor_fa57, pci_ss_list_fa57},
	{0xfebd, pci_vendor_febd, pci_ss_list_febd},
	{0xfeda, pci_vendor_feda, pci_ss_list_feda},
	{0xfede, pci_vendor_fede, pci_ss_list_fede},
	{0xfffe, pci_vendor_fffe, pci_ss_list_fffe},
	{0xffff, pci_vendor_ffff, pci_ss_list_ffff},
	{0x0000, NULL, NULL}
};
#endif

--- NEW FILE: xf86PciStdIds.h ---
/* $XFree86$ */

/*
 * THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
 *
 * It is generated by pciid2c.pl using data from the following files:
 *
 *    ../etc/pci.ids
 *    ../etc/extrapci.ids
 *    ../common/xf86PciInfo.h
 */

/*
 * Copyright © 2002 by the XFree86 Project, Inc.
 *
 * The pci.ids file and the data it contains are from the Linux PCI ID's
 * Project (http://pciids.sf.net/).  It is maintained by Martin Mares
 * <mj at ucw.cz> and other volunteers.  The pci.ids file contains no
 * copyright notice.
[...89766 lines suppressed...]
	{0xfa57, pci_vendor_fa57, pci_ss_list_fa57},
#endif
#ifdef VENDOR_INCLUDE_NONVIDEO
	{0xfebd, pci_vendor_febd, pci_ss_list_febd},
#endif
#ifdef VENDOR_INCLUDE_NONVIDEO
	{0xfeda, pci_vendor_feda, pci_ss_list_feda},
#endif
#ifdef VENDOR_INCLUDE_NONVIDEO
	{0xfede, pci_vendor_fede, pci_ss_list_fede},
#endif
#ifdef VENDOR_INCLUDE_NONVIDEO
	{0xfffe, pci_vendor_fffe, pci_ss_list_fffe},
#endif
#ifdef VENDOR_INCLUDE_NONVIDEO
	{0xffff, pci_vendor_ffff, pci_ss_list_ffff},
#endif
	{0x0000, NULL, NULL}
};
#endif

--- NEW FILE: xf86PciStr.h ---
/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86PciStr.h,v 1.2 2003/08/24 17:37:10 dawes Exp $ */
/*
 * Copyright (c) 2002 by The XFree86 Project, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name of the copyright holder(s)
 * and author(s) shall not be used in advertising or otherwise to promote
 * the sale, use or other dealings in this Software without prior written
 * authorization from the copyright holder(s) and author(s).
 */

/*
 * Structs used to hold the pre-parsed pci.ids data.  These are private
 * to the scanpci and pcidata modules.
 */

#ifndef _XF86_PCISTR_H
#define _XF86_PCISTR_H

typedef struct {
    unsigned short VendorID;
    unsigned short SubsystemID;
    const char *SubsystemName;
    unsigned short class;
} pciSubsystemInfo;

typedef struct {
    unsigned short DeviceID;
    const char *DeviceName;
    const pciSubsystemInfo **Subsystem;
    unsigned short class;
} pciDeviceInfo;

typedef struct {
    unsigned short VendorID;
    const char *VendorName;
    const pciDeviceInfo **Device;
} pciVendorInfo;

typedef struct {
    unsigned short VendorID;
    const char *VendorName;
    const pciSubsystemInfo **Subsystem;
} pciVendorSubsysInfo;

#endif /* _XF86_PCISTR_H */

--- NEW FILE: xf86ScanPci.c ---
/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.c,v 1.13 2003/08/24 17:37:10 dawes Exp $ */
/*
 * Display the Subsystem Vendor Id and Subsystem Id in order to identify
 * the cards installed in this computer
 *
 * A lot of this comes from Robin Cutshaw's scanpci
 *
 */
/*
 * Copyright (c) 1995-2002 by The XFree86 Project, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name of the copyright holder(s)
 * and author(s) shall not be used in advertising or otherwise to promote
 * the sale, use or other dealings in this Software without prior written
 * authorization from the copyright holder(s) and author(s).
 */

/*
 * This file is used to build both the scanpci and pcidata modules.
 * The interfaces have changed compared with XFree86 4.2.0 and earlier.
 * The data is no longer exported directly.  Lookup functions are provided.
 * This means that the data format can change in the future without affecting
 * the exported interfaces.
 *
 * The namespaces for pcidata and scanpci clash, so both modules can't be
 * loaded at the same time.  The X server should only load the scanpci module
 * when run with the '-scanpci' flag.  The main difference between the
 * two modules is size.  pcidata only holds the subset of data that is
 * "interesting" to the X server.  "Interesting" is determined by the
 * PCI_VENDOR_* defines in ../common/xf86PciInfo.h.
 */


/* XXX This is including a lot of stuff that modules should not include! */

#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Pci.h"
#include "xf86_OSproc.h"

#ifndef IN_MODULE
#include <ctype.h>
#include <stdlib.h>
#else
#include <xf86_ansic.h>
#endif

#ifndef PCIDATA
#define VENDOR_INCLUDE_NONVIDEO
#endif
#define INIT_SUBSYS_INFO
#define INIT_VENDOR_SUBSYS_INFO

#include "xf86PciStr.h"
#include "xf86PciIds.h"
#include "xf86ScanPci.h"

/*
 * PCI classes that have messages printed always.  The others are only
 * have a message printed when the vendor/dev IDs are recognised.
 */
#define PCIALWAYSPRINTCLASSES(b,s)					      \
    (((b) == PCI_CLASS_PREHISTORIC && (s) == PCI_SUBCLASS_PREHISTORIC_VGA) || \
     ((b) == PCI_CLASS_DISPLAY) ||					      \
     ((b) == PCI_CLASS_MULTIMEDIA && (s) == PCI_SUBCLASS_MULTIMEDIA_VIDEO))


#ifdef XFree86LOADER

#include "xf86Module.h"

#ifdef PCIDATA

static XF86ModuleVersionInfo pciDataVersRec = {
	"pcidata",
	MODULEVENDORSTRING,
	MODINFOSTRING1,
	MODINFOSTRING2,
	XORG_VERSION_CURRENT,
	1, 0, 0,
	ABI_CLASS_VIDEODRV,
	ABI_VIDEODRV_VERSION,
	NULL,
	{0, 0, 0, 0}
};

XF86ModuleData pcidataModuleData = { &pciDataVersRec, NULL, NULL };

#else 

static XF86ModuleVersionInfo scanPciVersRec = {
	"scanpci",
	MODULEVENDORSTRING,
	MODINFOSTRING1,
	MODINFOSTRING2,
	XORG_VERSION_CURRENT,
	1, 0, 0,
	ABI_CLASS_VIDEODRV,
	ABI_VIDEODRV_VERSION,
	NULL,
	{0, 0, 0, 0}
};

XF86ModuleData scanpciModuleData = { &scanPciVersRec, NULL, NULL };

#endif /* PCIDATA */

#endif /* XFree86LOADER */

/* Initialisation/Close hooks, in case they're ever needed. */
Bool
ScanPciSetupPciIds(void)
{
    return TRUE;
}

void
ScanPciClosePciIds(void)
{
    return;
}

/*
 * The return value is the number of strings found, or -1 for an error.
 * Requested strings that aren't found are set to NULL.
 */

int
ScanPciFindPciNamesByDevice(unsigned short vendor, unsigned short device,
			 unsigned short svendor, unsigned short subsys,
			 const char **vname, const char **dname,
			 const char **svname, const char **sname)
{
    int i, j, k;
    const pciDeviceInfo **pDev;
    const pciSubsystemInfo **pSub;

    /* It's an error to not provide the Vendor */
    if (vendor == NOVENDOR)
	return -1;

    /* Initialise returns requested/provided to NULL */
    if (vname)
	*vname = NULL;
    if (device != NODEVICE && dname)
	*dname = NULL;
    if (svendor != NOVENDOR && svname)
	*svname = NULL;
    if (subsys != NOSUBSYS && sname)
	*sname = NULL;

    for (i = 0; pciVendorInfoList[i].VendorName; i++) {
	if (vendor == pciVendorInfoList[i].VendorID) {
	    if (vname) {
		*vname = pciVendorInfoList[i].VendorName;
	    }
	    if (device == NODEVICE) {
		return 1;
	    }
	    pDev = pciVendorInfoList[i].Device;
	    if (!pDev) {
		return 1;
	    }
	    for (j = 0; pDev[j]; j++) {
		if (device == pDev[j]->DeviceID) {
		    if (dname) {
			*dname = pDev[j]->DeviceName;
		    }
		    if (svendor == NOVENDOR) {
			return 2;
		    }
		    for (k = 0; pciVendorInfoList[k].VendorName; k++) {
			if (svendor &&
			    svendor == pciVendorInfoList[k].VendorID) {
			    if (svname) {
				*svname = pciVendorInfoList[k].VendorName;
			    }
			    if (subsys == NOSUBSYS) {
				return 3;
			    }
			    break;
			}
		    }
		    if (!pciVendorInfoList[k].VendorName) {
			return 2;
		    }
		    pSub = pDev[j]->Subsystem;
		    if (!pSub) {
			return 3;
		    }
		    for (k = 0; pSub[k]; k++) {
			if (svendor == pSub[k]->VendorID &&
			    subsys == pSub[k]->SubsystemID) {
			    if (sname)
				*sname = pSub[k]->SubsystemName;
			    return 4;
			}
		    }
		    /* No vendor/subsys match */
		    return 3;
		}
	    }
	    /* No device match */
	    return 1;
	}
    }
    /* No vendor match */
    return 0;
}

Bool
ScanPciFindPciNamesBySubsys(unsigned short svendor, unsigned short subsys,
			 const char **svname, const char **sname)
{
    int i, j;
    const pciSubsystemInfo **pSub;

    /* It's an error to not provide the Vendor */
    if (svendor == NOVENDOR)
	return -1;

    /* Initialise returns requested/provided to NULL */
    if (svname)
	*svname = NULL;
    if (subsys != NOSUBSYS && sname)
	*sname = NULL;

    for (i = 0; pciVendorSubsysInfoList[i].VendorName; i++) {
	if (svendor == pciVendorSubsysInfoList[i].VendorID) {
	    if (svname) {
		*svname = pciVendorSubsysInfoList[i].VendorName;
	    }
	    if (subsys == NOSUBSYS) {
		return 1;
	    }
	    pSub = pciVendorSubsysInfoList[i].Subsystem;
	    if (!pSub) {
		return 1;
	    }
	    for (j = 0; pSub[j]; j++) {
		if (subsys == pSub[j]->SubsystemID) {
		    if (sname) {
			*sname = pSub[j]->SubsystemName;
		    }
		}
	    }
	    /* No subsys match */
	    return 1;
	}
    }
    /* No vendor match */
    return 0;
}

CARD32
ScanPciFindPciClassBySubsys(unsigned short vendor, unsigned short subsys)
{
    int i, j;
    const pciSubsystemInfo **pSub;

    if (vendor == NOVENDOR || subsys == NOSUBSYS)
	return 0;

    for (i = 0; pciVendorSubsysInfoList[i].VendorName; i++) {
	if (vendor == pciVendorSubsysInfoList[i].VendorID) {
	    pSub = pciVendorSubsysInfoList[i].Subsystem;
	    if (!pSub) {
		return 0;
	    }
	    for (j = 0; pSub[j]; j++) {
		if (subsys == pSub[j]->SubsystemID) {
		    return pSub[j]->class;
		}
	    }
	    break;
	}
    }
    return 0;
}

CARD32
ScanPciFindPciClassByDevice(unsigned short vendor, unsigned short device)
{
    int i, j;
    const pciDeviceInfo **pDev;

    if (vendor == NOVENDOR || device == NODEVICE)
	return 0;

    for (i = 0; pciVendorInfoList[i].VendorName; i++) {
	if (vendor == pciVendorInfoList[i].VendorID) {
	    pDev = pciVendorInfoList[i].Device;
	    if (!pDev) {
		return 0;
	    }
	    for (j = 0; pDev[j]; j++) {
		if (device == pDev[j]->DeviceID) {
		    return pDev[j]->class;
		}
	    }
	    break;
	}
    }
    return 0;
}

#ifndef PCIDATA
void
ScanPciDisplayPCICardInfo(int verbosity)
{
    pciConfigPtr pcrp, *pcrpp;
    int i;

    xf86EnableIO();
    pcrpp = xf86scanpci(0);

    if (pcrpp == NULL) {
        xf86MsgVerb(X_NONE,0,"No PCI info available\n");
	return;
    }
    xf86MsgVerb(X_NONE,0,"Probing for PCI devices (Bus: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);

	/*
	 * Lookup as much as we can about the device.
	 */
	if (pcrp->pci_subsys_vendor || pcrp->pci_subsys_card) {
	    ScanPciFindPciNamesByDevice(pcrp->pci_vendor, pcrp->pci_device,
				     NOVENDOR, NOSUBSYS,
				     &vendorname, &devicename, NULL, NULL);
	} else {
	    ScanPciFindPciNamesByDevice(pcrp->pci_vendor, pcrp->pci_device,
				     pcrp->pci_subsys_vendor,
				     pcrp->pci_subsys_card,
				     &vendorname, &devicename,
				     &svendorname, &subsysname);
	}

	if (svendorname)
	    xf86MsgVerb(X_NONE, -verbosity, "%s ", svendorname);
	if (subsysname)
	    xf86MsgVerb(X_NONE, -verbosity, "%s ", subsysname);
	if (svendorname && !subsysname) {
	    if (pcrp->pci_subsys_card && pcrp->pci_subsys_card != NOSUBSYS) {
		xf86MsgVerb(X_NONE, -verbosity, "unknown card (0x%04x) ",
			    pcrp->pci_subsys_card);
	    } else {
		xf86MsgVerb(X_NONE, -verbosity, "card ");
	    }
	}
	if (!svendorname && !subsysname) {
	    /*
	     * We didn't find a text representation of the information 
	     * about the card.
	     */
	    if (pcrp->pci_subsys_vendor || pcrp->pci_subsys_card) {
		/*
		 * If there was information and we just couldn't interpret
		 * it, print it out as unknown, anyway.
		 */
		xf86MsgVerb(X_NONE, -verbosity,
			    "unknown card (0x%04x/0x%04x) ",
			    pcrp->pci_subsys_vendor, pcrp->pci_subsys_card);
	    } else
		noCard = TRUE;
	}
	if (!noCard) {
	    prefix1 = "using a ";
	    prefix2 = "using an ";
	}
	if (vendorname && devicename) {
	    xf86MsgVerb(X_NONE, -verbosity,"%s%s %s\n", prefix1, vendorname,
			devicename);
	} else if (vendorname) {
	    xf86MsgVerb(X_NONE, -verbosity,
			"%sunknown chip (DeviceId 0x%04x) from %s\n",
			prefix2, pcrp->pci_device, vendorname);
	} else {
	    xf86MsgVerb(X_NONE, -verbosity,
			"%sunknown chipset(0x%04x/0x%04x)\n",
			prefix2, pcrp->pci_vendor, pcrp->pci_device);
	}
    }
}
#endif


--- NEW FILE: xf86ScanPci.h ---
/* $XFree86: xc/programs/Xserver/hw/xfree86/scanpci/xf86ScanPci.h,v 1.3 2003/08/24 17:37:10 dawes Exp $ */
/*
 * Copyright (c) 2000-2002 by The XFree86 Project, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Except as contained in this notice, the name of the copyright holder(s)
 * and author(s) shall not be used in advertising or otherwise to promote
 * the sale, use or other dealings in this Software without prior written
 * authorization from the copyright holder(s) and author(s).
 */

#ifndef SCANPCI_H_
#define SCANPCI_H_

#include "xf86PciData.h"

typedef void (*ScanPciDisplayCardInfoProcPtr)(int verbosity);

/*
 * Whoever loads this module needs to define these and initialise them
 * after loading.
 */

extern ScanPciDisplayCardInfoProcPtr xf86DisplayPCICardInfo;

void ScanPciDisplayPCICardInfo(int verbosity);

#endif




More information about the xserver-commit mailing list