
PCICONF 1.2
/*
 * Copyright (c) 1996,1997 Picture Elements, Inc.
 *    Stephen Williams (steve@picturel.com)
 *
 *    c/o Picture Elements, Inc.
 *    777 Panoramic Way
 *    Berkeley, CA, 94704
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */

The pciconf driver allows programs to read/write the CONFIGURATION
space of PCI devices. Although reading such things may be of value to
anyone, the ability to write configuration space registers is
especially useful to device driver writers, board developers,
etc. That in fact was my original motivation for writing such a thing.

The package includes source for a misc device module that allows
read/write access, and a TCL extension that allows one to manipulate
configuration space from within Tcl/Tk.

See pci_init.c for details on the Tcl extension.

PCICONF.DLL or LIBPCICONF.SO

The Tcl extension to support the device driver is compiled into shared
objects on Linux or a DLL on NT. This means that a program that uses
the extension must first load the objects with the Tcl load command.

SHOWPCI

The showpci program is a wish script that uses the PCICONF extensions
to display the configuration header for a single device. The window
displays editable fields for the vendor id, the device id and the
instance number. The program uses these numbers to gather
configuration information and display it in the rest of the window.

LINUX INSTALL

The ``make install'' installs the commands in /usr/local/bin (unless
you configure with --prefix to something else) and installs the pciconf.h
header file in /usr/local/include.

The driver module, pciconf.o, currently needs to be installed by hand.
You will need to know the major number of misc device driver (normally 10)
and will need to choose a minor number. The number 143 was assigned by the
controlling authority for these numbers.

	# mknod /dev/pciconf c 10 143
	# cp pciconf.o /lib/modules/misc
	# depmod -a
	# insmod pciconf

If the kerneld is working on your system, add the following lines to
your /etc/modules.conf file:

	alias char-major-10-143 pciconf

If kerneld is not working on your system, you will need to arrange for
the module to be loaded at boot time. ``insmod pciconf'' in your rc.local
should be sufficient.

WINDOWS NT INSTALL

The first step (and the most expensive part) is to compile the device
driver and the DLL. This is most expensive because the compiler
(MSVC++) typically costs $500, and the DDK comes with the MSDN
Professional subscription which costs another $500 a year. (If someone
tells me how to build these things with GNU tools, I'll switch.)

The device driver is compiled in the usual way by changing to the
winnt directory and typing ``build'' to build the pciconfd.sys file.
Once the driver is compiled (either yourself or with the help of a
friend) copy the pciconfd.sys file into the directory
\WINNT\SYSTEM32\DRIVERS and install the driver with the command
``regini pciconf.ini''. This last step tells NT where the driver and
its resources are, and that the module is to be loaded
automatically. A reboot will be required to finish the driver install.

Edit the makefile.vc file to suit your configuration, then build the
.DLL with nmake in the source directory:

      % nmake -f makefile.vc

The makefile.vc file is a makefile for MSVC++ and causes the
pciconf.dll file to be built. Copy the pciconf.dll and showpci.bat
files to a directory in your path, and copy the showpci.tcl script to
some convenient place. I use the following directory structure:

     picturel\
	bin\
	   showpci.bat
	   pciconf.dll
	lib\
	   showpci.tcl

Edit the showpci.bat file to reflect the name of your wish program and
the location of the showpci.tcl script.

Edit the showpci.tcl script, replacing the @libpciconf.so@ with
pciconf.dll (this will be found in the path so do not enter the
directory) and change "/dev/pciconf" to "\\\\.\\PCICONF"

Whew!

If you haven't yet rebooted, do so now.
