We've seen in many cases BIOS completely ignores CardBus bridges present in the system. It programs PCI2PCI bridges in the way that no I/O port and bus-range can be allocated from under this PCI2PCI bridge. When a CardBus bridge is the child of such a PCI2PCI bridge, it cannot allocate I/O port and bus-range resources for its children.
Specifically there're two problems:
1) SECBUS == SUBBUS on the PCI2PCI bridge. This leaves no room for a new bus number under the bridge.
2) IOBASE > IOLIM. This turns off IO window on the bridge so that it never forwards any I/O transaction to the secondary bus. But many PC Cards require I/O transaction.
Here's an example:
root@furong>uname -a
SunOS furong 5.11 snv_38 i86pc i386 i86pc
root@furong>/usr/X11/bin/scanpci -v
...
pci bus 0x0000 cardnum 0x1e function 0x00: vendor 0x8086 device 0x244e
Intel Corporation 82801 PCI Bridge
STATUS 0x0010 COMMAND 0x0047
CLASS 0x06 0x04 0x01 REVISION 0xd3
HEADER 0x81 LATENCY 0x00
PRIBUS 0x00 SECBUS 0x04 SUBBUS 0x04
^^^^ ^^^^ (SECBUS == SUBBUS)
SECLT 0x20 SECSTATUS 0x2280
IOBASE 0xf000 IOLIM 0x0fff
^^^^^^ ^^^^^^ (IOBASE > IOLIM)
NOPREFETCH_MEMBASE 0xdf900000 MEMLIM 0xdfafffff
PREFETCH_MEMBASE 0x00000000d0000000 MEMLIM 0x00000000d00fffff
NO_FAST_B2B NO_SEC_BUS_RST NO_M_ABRT NO_VGA_EN NO_ISA_EN SERR_EN PERR_EN
...
pci bus 0x0004 cardnum 0x02 function 0x00: vendor 0x1180 device 0x0475
Ricoh Co Ltd RL5c475
STATUS 0x0210 COMMAND 0x0007
CLASS 0x06 0x07 0x00 REVISION 0x81
^^^^^^^^^ (CardBus bridge)
BIST 0x00 HEADER 0x02 LATENCY 0x40 CACHE 0x00
BASE0 0xdf900000 addr 0xdf900000 MEM
BASE1 0x00000000020000dc addr 0x00000000020000d0 MEM PREFETCHABLE 64BIT
MAX_LAT 0x07 MIN_GNT 0x00 INT_PIN 0x01 INT_LINE 0x03
In this example, 4/2/0 is a CardBus bridge, its parent (0/1e/0) is a PCI2PCI bridge. The PCI2PCI bridge has both the problems: SECBUS==SUBBUS and IOBASE>IOLIM. The CardBus bridge can never work in this way.
Newboo (pci_boot.c) should reporgram the PCI2PCI bridge when BIOS doesn't get it right, so that the CardBus bridges like this can obtain the necessary resources.
Not only the bus-range and I/O port, memory may also be configurarted incorrectly or may not be configurated at all on a PCI[e]-PCI bridge by BIOS, so that the devices under this kind of bridge can not be accessed since the bridge doesn't forward the I/O or memory operation.
Here is an example:
On a Fujistu laptop, the 3945 wifi card is behind a pcie-pci bridge, while the bridge turns off the memory access due to the BIOS initialization. so all the wifi card can not work. The same thing happens on Toshiba P105, Sony, HP laptop.
#/usr/X11/bin/scanpci -v
pci bus 0x0000 cardnum 0x1c function 0x00: vendor 0x8086 device 0x27d0
Intel Corporation 82801G (ICH7 Family) PCI Express Port 1
STATUS 0x0010 COMMAND 0x0047
CLASS 0x06 0x04 0x00 REVISION 0x02
HEADER 0x81 LATENCY 0x00
PRIBUS 0x00 SECBUS 0x02 SUBBUS 0x02
SECLT 0x00 SECSTATUS 0x2000
IOBASE 0x2000 IOLIM 0x2fff
NOPREFETCH_MEMBASE 0xf0000000 MEMLIM 0xf00fffff
PREFETCH_MEMBASE 0x00000000fff00000 MEMLIM 0x00000000000fffff
NO_FAST_B2B NO_SEC_BUS_RST NO_M_ABRT NO_VGA_EN ISA_EN NO_SERR_EN PERR_EN
pci bus 0x0000 cardnum 0x1c function 0x01: vendor 0x8086 device 0x27d2
Intel Corporation 82801G (ICH7 Family) PCI Express Port 2
STATUS 0x0010 COMMAND 0x0004
CLASS 0x06 0x04 0x00 REVISION 0x02
HEADER 0x81 LATENCY 0x00
PRIBUS 0x00 SECBUS 0x03 SUBBUS 0x04
SECLT 0x00 SECSTATUS 0x2000
PREFETCH_MEMBASE 0x0000000000000000 MEMLIM 0x00000000000fffff
NO_FAST_B2B NO_SEC_BUS_RST NO_M_ABRT NO_VGA_EN ISA_EN NO_SERR_EN NO_PERR_EN
pci bus 0x0000 cardnum 0x1c function 0x02: vendor 0x8086 device 0x27d4
Intel Corporation 82801G (ICH7 Family) PCI Express Port 3
STATUS 0x0010 COMMAND 0x0044
^^^---Memory not enabled
CLASS 0x06 0x04 0x00 REVISION 0x02
HEADER 0x81 LATENCY 0x00
PRIBUS 0x00 SECBUS 0x05 SUBBUS 0x05
SECLT 0x00 SECSTATUS 0x2000
PREFETCH_MEMBASE 0x0000000000000000 MEMLIM 0x00000000000fffff
^^^^^^ ^^^^^^ memory range not configurated correctly.
NO_FAST_B2B NO_SEC_BUS_RST NO_M_ABRT NO_VGA_EN ISA_EN NO_SERR_EN PERR_EN
...
pci bus 0x0005 cardnum 0x00 function 0x00: vendor 0x8086 device 0x4222
Intel Corporation PRO/Wireless 3945ABG Network Connection
CardVendor 0x8086 card 0x1002 (Intel Corporation, Card unknown)
STATUS 0x0010 COMMAND 0x0006
CLASS 0x02 0x80 0x00 REVISION 0x02
BIST 0x00 HEADER 0x00 LATENCY 0x00 CACHE 0x10
BASE0 0xf0100000 addr 0xf0100000 MEM
^^^ though configurated, the memory operation can not be forward by the bridge.
MAX_LAT 0x00 MIN_GNT 0x00 INT_PIN 0x01 INT_LINE 0x0b
By manually modify the 'memory range' and 'command' register, the wifi card can work.
#pcitool /pci@0,0 -d bdf=0.1c.2,config -o 4 -s 1 -w 0x46
#pcitool /pci@0,0 -d bdf=0.1c.2,config -o 0x20 -s 4 -w 0xf010f010