cardbus memory allocation problem

From: Michael Butler <imb_at_protected-networks.net>
Date: Mon, 02 May 2011 22:29:56 -0400
I've stared at this for a (long) while but haven't come to any
reasonable conclusion as to why it does what it does or how to fix it :-(

Specifically, the BIOS in this machine doesn't set up a memory window
for the cardbus controller nor does it properly configure the PCI bridge
to route to the correct buses. BSD tries but allocates memory from the
wrong space.

My question is - how to get PCI-cardbus bridge to allocate memory inside
the window of the parent PCI-PCI bridge? .. the bus tree looks like ..

imb_at_toshi:/home/imb> sudo lspci -t
-[0000:00]-+-00.0
           +-02.0
           +-02.1
           +-1b.0
           +-1c.0-[02]--
           +-1c.1-[03-04]--
           +-1c.2-[05-06]----00.0
           +-1d.0
           +-1d.1
           +-1d.2
           +-1d.3
           +-1d.7
           +-1e.0-[07]--+-06.0
           |            +-06.1
           |            +-06.2
           |            +-06.3
           |            \-08.0
           +-1f.0
           +-1f.2
           \-1f.3

I've annotated the verbose dmesg below to highlight the issues ..

pcib4: <ACPI PCI-PCI bridge> at device 30.0 on pci0
pcib4:   domain            0
pcib4:   secondary bus     7
pcib4:   subordinate bus   7
 *** subordinate bus needs to be '9' so as to include both '8' & '9'
 *** for the PCI-cardbus bridge

pcib4:   I/O decode        0x4000-0x4fff
pcib4:   memory decode     0xf0900000-0xf09fffff
 *** this memory widow is what I expected all children to allocate from

pcib4:   no prefetched decode
pcib4:   Subtractively decoded bridge.
pci7: <ACPI PCI bus> on pcib4
pci7: domain=0, physical bus=7
found-> vendor=0x104c, dev=0x8039, revid=0x00
        domain=0, bus=7, slot=6, func=0
        class=06-07-00, hdrtype=0x02, mfdev=1
        cmdreg=0x0000, statreg=0x0210, cachelnsz=0 (dwords)
        lattimer=0x40 (1920 ns), mingnt=0x40 (16000 ns), maxlat=0x03
(750 ns)
        intpin=a, irq=255
        powerspec 2  supports D0 D1 D2 D3  current D0
        map[10]: type Memory, range 32, base 0, size 12, memory disabled
 *** silly uninitialized value here outside of the expected window

found-> vendor=0x104c, dev=0x803a, revid=0x00
        domain=0, bus=7, slot=6, func=1
        class=0c-00-10, hdrtype=0x00, mfdev=1
        cmdreg=0x0006, statreg=0x0210, cachelnsz=4 (dwords)
        lattimer=0x80 (3840 ns), mingnt=0x02 (500 ns), maxlat=0x04 (1000 ns)
        intpin=b, irq=11
        powerspec 2  supports D0 D1 D2 D3  current D0
        map[10]: type Memory, range 32, base 0xf0906000, size 11, enabled
 *** everything else under the pcib4 bridge is in the right window

pcib4: requested memory range 0xf0906000-0xf09067ff: good
        map[14]: type Memory, range 32, base 0xf0900000, size 14, enabled
pcib4: requested memory range 0xf0900000-0xf0903fff: good
pcib4: matched entry for 7.6.INTB
pcib4: slot 6 INTB hardwired to IRQ 17
found-> vendor=0x104c, dev=0x803b, revid=0x00
        domain=0, bus=7, slot=6, func=2
        class=01-80-00, hdrtype=0x00, mfdev=1
        cmdreg=0x0006, statreg=0x0210, cachelnsz=4 (dwords)
        lattimer=0x80 (3840 ns), mingnt=0x07 (1750 ns), maxlat=0x04
(1000 ns)
        intpin=a, irq=11
        powerspec 2  supports D0 D1 D2 D3  current D0
        map[10]: type Memory, range 32, base 0xf0904000, size 12, enabled
pcib4: requested memory range 0xf0904000-0xf0904fff: good
pcib4: matched entry for 7.6.INTA
pcib4: slot 6 INTA hardwired to IRQ 18
found-> vendor=0x104c, dev=0x803c, revid=0x00
        domain=0, bus=7, slot=6, func=3
        class=08-05-01, hdrtype=0x00, mfdev=1
        cmdreg=0x0006, statreg=0x0210, cachelnsz=4 (dwords)
        lattimer=0x80 (3840 ns), mingnt=0x07 (1750 ns), maxlat=0x04
(1000 ns)
        intpin=a, irq=11
        powerspec 2  supports D0 D1 D2 D3  current D0
        map[10]: type Memory, range 32, base 0xf0906800, size  8, enabled
pcib4: requested memory range 0xf0906800-0xf09068ff: good
pcib4: matched entry for 7.6.INTA
pcib4: slot 6 INTA hardwired to IRQ 18
found-> vendor=0x8086, dev=0x1092, revid=0x02
        domain=0, bus=7, slot=8, func=0
        class=02-00-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0017, statreg=0x0290, cachelnsz=16 (dwords)
        lattimer=0x42 (1980 ns), mingnt=0x08 (2000 ns), maxlat=0x38
(14000 ns)
        intpin=a, irq=10
        powerspec 2  supports D0 D1 D2 D3  current D0
        map[10]: type Memory, range 32, base 0xf0905000, size 12, enabled
pcib4: requested memory range 0xf0905000-0xf0905fff: good
        map[14]: type I/O Port, range 32, base 0x4000, size  6, enabled
pcib4: requested I/O range 0x4000-0x403f: in range
pcib4: matched entry for 7.8.INTA
pcib4: slot 8 INTA hardwired to IRQ 20
cbb0: <PCI-CardBus Bridge> at device 6.0 on pci7
pcib4: cbb0 requested memory range 0x0-0xffffffff: good
 *** what appears to be a "wildcard" alloc request

cbb0: Lazy allocation of 0x1000 bytes rid 0x10 type 3 at 0xbf670000
 *** but which isn't constrained to be within the parent bridge's space

cardbus0: <CardBus bus> on cbb0
pccard0: <16-bit PCCard bus> on cbb0
pcib4: matched entry for 7.6.INTA
pcib4: slot 6 INTA hardwired to IRQ 18
cbb0: PCI Configuration space:
  0x00: 0x8039104c 0x02100007 0x06070000 0x00824000
  0x10: 0xbf670000 0x020000a0 0x20090807 0xfffff000
        ^^^^^^^^^^                 ^ ^ ^
                                   | | + primary bus
                                   | + secondary bus
                                   + subordinate bus

  0x20: 0x00000000 0xfffff000 0x00000000 0xfffffffc
  0x30: 0x00000000 0xfffffffc 0x00000000 0x07400112
  0x40: 0xff101179 0x00000001 0x00000000 0x00000000
  0x50: 0x00000000 0x00000000 0x00000000 0x00000000
  0x60: 0x00000000 0x00000000 0x00000000 0x00000000
  0x70: 0x00000000 0x00000000 0x00000000 0x00000000
  0x80: 0x48409060 0x02830019 0x000f0000 0x01a01b22
  0x90: 0x606600c0 0x00000000 0x00000000 0x00000000
  0xa0: 0xfe120001 0x00c00000 0x00000000 0x00000000
  0xb0: 0x00000000 0x00000000 0x00000000 0x00000000
  0xc0: 0x00000000 0x00000000 0x00000000 0x00000000
  0xd0: 0x00000000 0x00000000 0x00000000 0x00000000
  0xe0: 0x00000000 0x00000000 0x00000000 0x00000000
  0xf0: 0x44072b31 0x8d019449 0x00000000 0x00000000

'lspci' reports the following nonsense configuration ..

07:06.0 CardBus bridge: Texas Instruments PCIxx12 Cardbus Controller
        Subsystem: Toshiba America Info Systems Device ff10
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 64
        Interrupt: pin A routed to IRQ 18
        Region 0: Memory at bf670000 (32-bit, non-prefetchable)
        Bus: primary=07, secondary=08, subordinate=09, sec-latency=32
        Memory window 0: fffff000-00000000 (prefetchable)
        Memory window 1: fffff000-00000000 (prefetchable)
        I/O window 0: 0000fffc-00000003
        I/O window 1: 0000fffc-00000003
        BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset+ 16bInt-
PostWrite+
        16-bit legacy interface ports at 0001

Any hints as to where to look to work around this would be appreciated,

	imb
Received on Tue May 03 2011 - 00:30:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC