[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do we write a single byte in the config. registers?



On Nov 19, pierce@scruznet.com (John R Pierce) wrote:
> Actually, its not that hard to test for config mech 1 and 2...  I thought I had
> a code fragment that did this, but I can't seem to locate it... Anyways, if I
> recall correctly, you test for method 2 first, then method 1.   Either method,
> to write a single byte, you'd set the index register accordingly, then do a
> byte output to the data port.  The more complex task is locating your device in
> configuration space, essentially you need to read the vendor and device ID at
> every possible bus / dev / func location until you locate the vendor and device
> ID you are looking for.

This does not work on all systems :(

There are systems that use config mechanism 1, yet have a byte 
writable index register, and others that use mechanism 2, but
fail to treat bits 24..30 as hard-wired to '0'.

And then you have to be aware, that the PCI probe may crash some
EISA systems (with no PCI bus at all). Those systems happen to
have critical registers at the address of the PCI config index
and data register addresses ...

If there is a PCI bus probe code (that probes for the existance
of a PCI bus and determines the configuration mechanism) without
resorting to a scan for the BIOS, I'd like to hear about it.

My probe code can be found in the FreeBSD PCI code, see:

ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/sys/i386/isa/pcibus.c

I expect the current version to

- not falsely detect a PCI bus on some EISA (-only) systems

- not crash any non-PCI (ie. EISA) system during PCI probe

- correctly determine config mech. 1/2 on PCI systems, even
  if they violate the PCI 2.0/2.1 specs on the definition of
  the configuration address and data registers

These three requirements don't go together well, actually, so
I'm looking for an implementation that is better than mine :)

Regards, STefan,̺