Re: /proc/pcibus patch

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Mon, 15 Sep 1997 08:42:03 +0200 (MET DST)


Stephen Williams wrote:
> + Each file contains exactly 256 bytes. This is the official size of the
> + PCI configuration space for a device/function. Reading the bytes gets
> + the contents of the cnfiguration space directly from the
> + hardware. (Writing is currently not supported.) The layout of the
> + configuration space is defined by the ``PCI Local Bus Specification.''

Oh please, Oh please.....

I have had a time when I wanted to write to PCI device registers:
To test those extra configuration registers of my host bridge.

> diff -Ncr -X ../exclude ./Makefile /usr/src/linux-2.1.55/Makefile
> *** ./Makefile Mon Sep 8 21:57:58 1997
> --- /usr/src/linux-2.1.55/Makefile Thu Sep 11 16:56:47 1997
> ***************
> *** 11,17 ****
> #
> # NOTE! SMP is experimental. See the file Documentation/SMP.txt
> #
> ! SMP = 1
> #
> # SMP profiling options
> # SMP_PROF = 1

Please review your patches (by hand!) to delete this type of configuration
stuff. You can either keep a "clean tree with this patch", add this
file to your exclude list, or simply edit it out by hand....

> + tcnt = cnt;
> + if (tpos & 3) {
> + tcnt += tpos & 3;
> + tpos &= ~3;
> + }
> +
> + tcnt = (tcnt + 3) & ~3;

Suppose I have to muck with a few configuration registers of a device
that I'm writing a userlevel device driver for. Now the manual
says that I have this register at offset 30 (dec!).
short bla;

pcibus = open ("/dev/pcibus", "r");
seek (pcibus, 30, SEEK_SET);
read (pcibus, &bla, 2);

Now what? I dont get the bytes I want. Sure I can go along with you
that you might want to use only 32bit accesses, but then GIVE ME
the right bytes anyway....

Roger.

-- 
** R.E.Wolff@BitWizard.nl ** +31-15-2137555 ** http://www.BitWizard.nl/ **
Florida -- A 39 year old construction worker woke up this morning when a
109-car freigt train drove over him. According to the police the man was 
drunk. The man himself claims he slipped while walking the dog. 080897