All,
Our company has recently designed a couple of products that use PCI-to-PCI
bridges. If we put one card in a system, everything usually works fine.
Two cards and one Via-based board screws up. Four in a system, all Intel
boards screw up.
It appears that there is a bug in motherboard BIOS during PCI enumeration
and depending on which board maker (probably original BIOS version), it
either fails to initialize some of our devices behind the bridge, the
bridge, or one of the devices on the primary bus. Interestingly, all these
failures occur on an AMI (American Megatrends, Inc.) BIOS.
I should also point out that we’re dealing with two separate bridges. One
board uses a DEC/Intel bridge; the other uses a DEC/Intel bridge with a HINT
bridge behind it.
I’ve implemented a workaround for our NT4 driver that seems to work – it
re-enumerates the devices on its own, based on the assignments it found
during an initial scan of the buses – at least when only the devices behind
the bridge are improperly initialized. Unfortunately the fix doesn’t work
under W2K. I use HalSetBusData() to reprogram the device and that works
fine; but HalAssignSlotResources() appears to use a cached copy of the
config space and simply writes the wrong data back to the device.
At this point, I wonder if the cached copy used by HalAssignSlotResources()
isn’t simply part of the data written to the RESOURCEMAP key. But since we
have the additional problem of some versions of the BIOS not properly
assigning the bridge resources – this only occurs on the card that has a
bridge behind another bridge – I’m wondering if I shouldn’t just create a
separate driver that re-enumerates the PCI buses ahead of the HAL/PCI.SYS,
or if I should create some kind of filter driver for PCI.SYS.
Do any of you know if anything like this has already been done? I find it
hard to believe that we’re the first one to encounter this problem. My
questions boil down to:
- On NT4, how do I get a driver to load before the HAL?
- On W2K, how do I get a driver to load ahead of PCI.SYS?
- On W2K, can I create a filter driver for PCI.SYS and if so, is that
even a reasonable approach to the problem? - On W2K, is do you know of some way around the problem with
HalAssignSlotResources() caching config data? - On W98, you can fail the resource assignments and force PCI.VXD to
stop all the other devices on your bus and force a re-enumeration. Is there
any way to do the same in W2K?
Any source you could point me to that would get me started would be helpful.
And yes, I have the DDKs, MSDN subscriptions and NuMega’s DriverWorks if
refering to any of that would be helpful.
BTW: I’ve found that W2K/HalAssignSlotResources() does attempt to allocate
BARs when it finds they’re NULL. However, I’ve also found that if all the
devices on the bus are not initialize, it will erroneously assign the first
device an illegal BAR that starts just beyond the parent bridge’s limit for
that space type. This is a most annoying bug. But since
HalAssignSlotResources doesn’t bother to assign an IRQ pin, a Latency Timer
value, nor turn on any address spaces in the Command register, this problem
is kind of trivial in comparison. It also leads me to believe that even if
this feature is available, PCI.SYS can’t be trusted to handle device
reassignment/re-enumeration and I’m going to have to do it myself.
And before you tell me to tell our customers to get a BIOS fix, let me point
out that these BIOSes are very common (Intel uses them) and there isn’t
currently a fix for the problem. Also, one of these boards is a redesign of
an older product, so telling our customers to throw out their inventory of
motherboards won’t be very well received. Since the problem is so
wide-spread, I don’t see how we can avoid addressing the problem ourselves
at the driver level.
Thanks in advance,
- Joel Corley