freebsd-dev/sys/dev/pci
Bill Paul 85155d23de Add a 1 microsecond delay in pci_add_children(), right before the read
of the PCIR_HDRTYPE register. It's the value returned from this
read access that determines whether or not we decide a device is
present at the current slot index. For some reason that I can't
adequately explain, this read fails on my machine when probing the
USB controller on my machine (which happens a multifunction device
at slot index 3 hung off the PCI-PCI bridge on the AMD8111 (bus
index 1)). The read will return 0xFF even though it should return
0x80 to indicate the presence of a multifunction device.

As near as I can tell, there's some timing issue involved with reading
the 'dead' slot indexes 0 through 2 that causes the read of the actual
device at slot 3 to fail. I tried a couple of different tricks to
correct the problem (the patch to amd64/pci/pci_cfgreg.c fixes it
for the amd64 arch), but adding this delay is the only thing that
always allows the USB controllers to be correctly probed 100% of the
time. Whatever the problem is, it's likely confined to the AMD8111
chipset. However, a simple 1us delay is fairly harmless and should
have no side effects for other hardware. I consider this to be
voodoo, but it's fairly benign voodoo and it makes my USB keyboard
and mouse work again.

Note that this is the second time that I've had to resort to a
1us delay to fix a PCI-related problem with this AMD8111/Opteron
system (the first being a fix I made a while back to the NDISulator).
It's possible the delay really belongs in the cfgreg code itself,
or that pci_cfgreg needs some custom hackery for an errata in the
8111. (I checked but couldn't find any documented errata on AMD's
site that could account for these problems.)
2005-10-25 06:53:45 +00:00
..
eisa_pci.c Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
fixup_pci.c Add some missing <sys/module.h> includes which are masked by the 2004-05-30 17:57:46 +00:00
ignore_pci.c Add some missing <sys/module.h> includes which are masked by the 2004-05-30 17:57:46 +00:00
isa_pci.c Don't save and restore the ELCR register across suspend and resume for 2005-09-29 15:00:09 +00:00
pci_if.m Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
pci_pci.c fix CardBus issue for Compaq R3000 series laptop 2005-08-26 23:39:44 +00:00
pci_private.h Expose pci_cfg_safe/restore for subclasses of pci to use. 2005-02-28 01:14:15 +00:00
pci_user.c For FreeBSD 4 binaries, when trying to read from a device that does 2005-08-26 01:00:19 +00:00
pci.c Add a 1 microsecond delay in pci_add_children(), right before the read 2005-10-25 06:53:45 +00:00
pcib_if.m Fix compile error :-(. 2005-04-13 19:10:27 +00:00
pcib_private.h Add support for subtractive decoding bridges. These bridges pass all 2004-01-11 06:52:31 +00:00
pcireg.h As threatened by BURN_BRIDGES, restire PCIR_MAPS and PCIR_HEADERTYPE 2005-06-05 23:08:59 +00:00
pcivar.h Allow one to access the cached values for CMDREG, CACHELNSZ, MINGNT, 2005-09-11 03:22:03 +00:00