worlickwerx / pi-parport

retro parallel port for raspberry pi
GNU General Public License v2.0
64 stars 11 forks source link

does a PCIe parallel port card work with the CM4? #50

Open garlick opened 3 years ago

garlick commented 3 years ago

@herrkuhn mentioned in #31 that he had tried a parallel port PCIe card with the Pi CM4 (I assume with the CM4 IO module which brings the single PCIe lane out to a x4 slot).

Let's capture any data from that experiment here for people who might be looking at other ways to get a parallel port to work with the Pi.

herrkuhn commented 3 years ago

Here's what I get with a Raspberry Pi 4/CM4 and a Delock PCI Express Card to 1 x Parallel IEEE1284 (https://www.delock.de/produkt/90412/pdf.html?sprache=en) in the PCIe port:

pi@raspberrypi:~ $ sudo lspci -vvv
00:00.0 PCI bridge: Broadcom Limited Device 2711 (rev 20) (prog-if 00 [Normal decode])
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 0, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 55
    Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
    I/O behind bridge: 00000000-00000fff
    Memory behind bridge: f8000000-f80fffff
    Prefetchable memory behind bridge: 00000000fff00000-00000000000fffff
    Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
    BridgeCtl: Parity+ SERR+ NoISA- VGA- MAbort- >Reset- FastB2B-
        PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
    Capabilities: [48] Power Management version 3
        Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold-)
        Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=1 PME-
    Capabilities: [ac] Express (v2) Root Port (Slot-), MSI 00
        DevCap: MaxPayload 512 bytes, PhantFunc 0
            ExtTag- RBE+
        DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported+
            RlxdOrd+ ExtTag- PhantFunc- AuxPwr+ NoSnoop+
            MaxPayload 128 bytes, MaxReadReq 512 bytes
        DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
        LnkCap: Port #0, Speed 5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <2us, L1 <4us
            ClockPM+ Surprise- LLActRep- BwNot+ ASPMOptComp+
        LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk-
            ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
        LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        RootCtl: ErrCorrectable- ErrNon-Fatal- ErrFatal- PMEIntEna+ CRSVisible+
        RootCap: CRSVisible+
        RootSta: PME ReqID 0000, PMEStatus- PMEPending-
        DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Via WAKE# ARIFwd-
        DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled ARIFwd-
        LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
             Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
             Compliance De-emphasis: -6dB
        LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
             EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
    Capabilities: [100 v1] Advanced Error Reporting
        UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
        UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
        UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
        CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
        CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
        AERCap: First Error Pointer: 00, GenCap- CGenEn- ChkCap- ChkEn-
    Capabilities: [180 v1] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
    Capabilities: [240 v1] L1 PM Substates
        L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
              PortCommonModeRestoreTime=8us PortTPowerOnTime=10us
        L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
               T_CommonMode=1us LTR1.2_Threshold=0ns
        L1SubCtl2: T_PwrOn=10us
    Kernel driver in use: pcieport

01:00.0 Serial controller: Device 1c00:3050 (rev 10) (prog-if 05 [16850])
    Subsystem: Device 1c00:3050
    Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Interrupt: pin A routed to IRQ 55
    Region 0: I/O ports at <unassigned> [disabled]
    Region 1: Memory at 600000000 (32-bit, prefetchable) [size=32K]
    Region 2: I/O ports at <unassigned> [disabled]
    [virtual] Expansion ROM at 600008000 [disabled] [size=32K]
    Capabilities: [60] Power Management version 3
        Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
        Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
    Capabilities: [68] MSI: Enable- Count=1/32 Maskable+ 64bit+
        Address: 0000000000000000  Data: 0000
        Masking: 00000000  Pending: 00000000
    Capabilities: [80] Express (v2) Legacy Endpoint, MSI 00
        DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <2us, L1 <32us
            ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
        DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
            RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
            MaxPayload 128 bytes, MaxReadReq 512 bytes
        DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
        LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
            ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
        LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk-
            ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
        LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR-, OBFF Not Supported
        DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
        LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
             Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
             Compliance De-emphasis: -6dB
        LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
             EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
    Capabilities: [100 v1] Advanced Error Reporting
        UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
        UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
        UESvrt: DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
        CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
        CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
        AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-

Here's the segfault message I get with parport_pc:

[ 6402.591532] parport: loading out-of-tree module taints kernel.
[ 6411.128400] PCI parallel port detected: 1c00:3050, I/O at 0x0(0x0), IRQ 55
[ 6411.128514] 8<--- cut here ---
[ 6411.128541] Unable to handle kernel paging request at virtual address fee00001
[ 6411.128569] pgd = 41a7b1e2
[ 6411.128586] [fee00001] *pgd=80000000007003, *pmd=00000000
[ 6411.128617] Internal error: Oops: 206 [#1] SMP ARM
[ 6411.128637] Modules linked in: parport_pc(O+) parport(O) sha256_generic libsha256 cfg80211 rfkill 8021q garp stp llc vc4 v3d cec gpu_sched drm_kms_helper bcm2835_codec(C) bcm2835_isp(C) raspberrypi_hwmon drm bcm2835_v4l2(C) drm_panel_orientation_quirks v4l2_mem2mem bcm2835_mmal_vchiq(C) snd_soc_core videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 snd_compress videobuf2_common snd_bcm2835(C) snd_pcm_dmaengine snd_pcm videodev mc snd_timer snd vc_sm_cma(C) syscopyarea sysfillrect sysimgblt fb_sys_fops rpivid_mem uio_pdrv_genirq uio ip_tables x_tables ipv6
[ 6411.128842] CPU: 2 PID: 1015 Comm: insmod Tainted: G         C O      5.4.79-v7l+ #1373
[ 6411.128867] Hardware name: BCM2711
[ 6411.128906] PC is at clear_epp_timeout+0x24/0xc4 [parport_pc]
[ 6411.128940] LR is at parport_pc_probe_port+0x164/0xb08 [parport_pc]
[ 6411.128962] pc : [<bf223548>]    lr : [<bf223810>]    psr: 60000013
[ 6411.128983] sp : d82a3ad0  ip : d82a3ae0  fp : d82a3adc
[ 6411.129004] r10: 00000000  r9 : d843d700  r8 : d843d5a8
[ 6411.129024] r7 : ef855878  r6 : d843d580  r5 : c1204fc8  r4 : d8658800
[ 6411.129046] r3 : fee00001  r2 : d4157734  r1 : d843d700  r0 : d8658800
[ 6411.129071] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[ 6411.129095] Control: 30c5383d  Table: 189f5040  DAC: 55555555
[ 6411.129117] Process insmod (pid: 1015, stack limit = 0x5a30c62e)
[ 6411.129139] Stack: (0xd82a3ad0 to 0xd82a4000)
[ 6411.129161] 3ac0:                                     d82a3b74 d82a3ae0 bf223810 bf223530
[ 6411.129190] 3ae0: 00000005 00000000 d843d5c0 00000000 d82a3b14 d843d5a8 00000000 00000000
[ 6411.129219] 3b00: ef979c80 00000000 d82a3b44 d82a3b18 c0283dc4 c0282c7c c0a8fea0 c0295a14
[ 6411.129248] 3b20: 00000cc0 c03f3f6c c1204fc8 00000000 ef855800 00000000 d82a3b64 d82a3b48
[ 6411.129276] 3b40: c0283550 d4157734 d82a3b6c bf225b94 00000000 ef855800 00000000 bf2256a0
[ 6411.129305] 3b60: 00000037 00000000 d82a3bcc d82a3b78 bf22435c bf2236b8 ef855878 00000080
[ 6411.129334] 3b80: bf2270a4 00000000 bf225ec4 bf225f00 ef855878 d843d540 bf225618 00000000
[ 6411.129363] 3ba0: d82a3bcc ef855878 ef855800 bf22706c 00000000 bf2270a4 bf225b94 00000000
[ 6411.129391] 3bc0: d82a3bf4 d82a3bd0 c06f3b94 bf2241c0 c13616b0 ef855878 c13616b4 00000000
[ 6411.129420] 3be0: bf2270a4 00000018 d82a3c24 d82a3bf8 c07944d0 c06f3af0 00000000 ef855878
[ 6411.129448] 3c00: bf2270a4 bf2270a4 c0794b48 00000000 ffffffff bf2273f4 d82a3c64 d82a3c28
[ 6411.129477] 3c20: c079482c c07942ec d82a3c4c d82a3c38 c0a92768 c0a8fe78 ef855878 bf2270a4
[ 6411.129505] 3c40: ef855878 00000000 bf2270a4 c0794b48 00000000 ffffffff d82a3c84 d82a3c68
[ 6411.129534] 3c60: c0794b40 c07947c8 00000000 bf2270a4 ef855878 c0794b48 d82a3ca4 d82a3c88
[ 6411.129562] 3c80: c0794bb0 c0794ae4 ef03ebb4 c1204fc8 bf2270a4 c0794b48 d82a3cd4 d82a3ca8
[ 6411.129591] 3ca0: c07924c8 c0794b54 d82a3ce0 ef9fed58 ef03ebb4 d4157734 bf2270a4 c1268a40
[ 6411.129620] 3cc0: ef979b80 00000000 d82a3ce4 d82a3cd8 c0793d18 c0792450 d82a3d0c d82a3ce8
[ 6411.129648] 3ce0: c0793730 c0793cf8 bf225cf0 d82a3cf8 bf2270a4 bf225cf0 bf2256c4 ffffffff
[ 6411.129677] 3d00: d82a3d24 d82a3d10 c079526c c0793574 00000000 bf225cf0 d82a3d3c d82a3d28
[ 6411.129705] 3d20: c06f2e3c c07951f4 00000000 bf22506c d82a3d8c d82a3d40 bf22b410 c06f2df0
[ 6411.129735] 3d40: 8040003f c10a8b10 c03dc64c c1204fc8 bf22c084 bf22c044 ffffffff d4157734
[ 6411.129764] 3d60: d82a3d94 c1204fc8 bf22b100 d843d240 00000000 bf227140 d82a3f30 c1204fc8
[ 6411.129793] 3d80: d82a3e04 d82a3d90 c02030c4 bf22b10c d82a3dcc c0a8fea0 00000000 00000002
[ 6411.129822] 3da0: d82a3dc4 d82a3db0 c0a8fea0 c0295a14 00000cc0 c03f3f6c d82a3e04 d82a3dc8
[ 6411.129850] 3dc0: c03f3f6c c03b73f4 c03d6db0 c03f5d6c d82a3e04 d843d380 f085e000 d4157734
[ 6411.129879] 3de0: 00000002 bf227140 d843d340 d843d240 d843d280 bf227140 d82a3e2c d82a3e08
[ 6411.129909] 3e00: c02c26ac c0203080 d82a3e2c d82a3e18 c03d6f20 00000002 00000002 d843d240
[ 6411.129951] 3e20: d82a3f0c d82a3e30 c02c4d04 c02c2648 bf22714c 00007fff bf227140 c02c101c
[ 6411.129981] 3e40: c1204fc8 c0dce850 c0dce880 c0dce828 bf22f54b c0c03e0c bf227334 bf227254
[ 6411.130010] 3e60: c0dce8d0 d865a018 d843d248 bf227188 c1204fc8 bf226419 d82a0001 00000000
[ 6411.130059] 3e80: c0e8b810 c0e75724 bf22503c 00000002 00000000 00000000 00000000 00000000
[ 6411.130093] 3ea0: 6e72656b 00006c65 00000000 00000000 00000000 00000000 00000000 00000000
[ 6411.130122] 3ec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 d4157734
[ 6411.130165] 3ee0: 7fffffff c1204fc8 00000000 0029f150 00000003 c02011c4 d82a2000 0000017b
[ 6411.130200] 3f00: d82a3fa4 d82a3f10 c02c526c c02c29a8 7fffffff 00000000 00000003 d80c53c0
[ 6411.130231] 3f20: 00000000 f085e000 0000917c 00000000 f0861902 f0863200 f085e000 0000917c
[ 6411.130280] 3f40: f0866b14 f08669a8 f08648f0 00005000 00005a20 00004448 000060d4 00000000
[ 6411.130312] 3f60: 00000000 00000000 00004438 00000026 00000027 0000001e 0000001a 00000013
[ 6411.130358] 3f80: 00000000 d4157734 4c3a3e00 0002abf4 0003fce8 0000017b 00000000 d82a3fa8
[ 6411.130402] 3fa0: c0201000 c02c51a4 4c3a3e00 0002abf4 00000003 0029f150 00000000 0000000a
[ 6411.130452] 3fc0: 4c3a3e00 0002abf4 0003fce8 0000017b 002a07f0 0029f150 00000003 0029f150
[ 6411.130502] 3fe0: be9815b8 be9815a8 00022cb8 b6c54af0 60000010 00000003 00000000 00000000
[ 6411.130532] Backtrace: 
[ 6411.130599] [<bf223524>] (clear_epp_timeout [parport_pc]) from [<bf223810>] (parport_pc_probe_port+0x164/0xb08 [parport_pc])
[ 6411.130669] [<bf2236ac>] (parport_pc_probe_port [parport_pc]) from [<bf22435c>] (parport_pc_pci_probe+0x1a8/0x22c [parport_pc])
[ 6411.130718]  r10:00000000 r9:00000037 r8:bf2256a0 r7:00000000 r6:ef855800 r5:00000000
[ 6411.130744]  r4:bf225b94
[ 6411.130803] [<bf2241b4>] (parport_pc_pci_probe [parport_pc]) from [<c06f3b94>] (pci_device_probe+0xb0/0x138)
[ 6411.130859]  r10:00000000 r9:bf225b94 r8:bf2270a4 r7:00000000 r6:bf22706c r5:ef855800
[ 6411.130897]  r4:ef855878
[ 6411.130935] [<c06f3ae4>] (pci_device_probe) from [<c07944d0>] (really_probe+0x1f0/0x354)
[ 6411.130978]  r9:00000018 r8:bf2270a4 r7:00000000 r6:c13616b4 r5:ef855878 r4:c13616b0
[ 6411.131023] [<c07942e0>] (really_probe) from [<c079482c>] (driver_probe_device+0x70/0x194)
[ 6411.131054]  r10:bf2273f4 r9:ffffffff r8:00000000 r7:c0794b48 r6:bf2270a4 r5:bf2270a4
[ 6411.131080]  r4:ef855878 r3:00000000
[ 6411.131107] [<c07947bc>] (driver_probe_device) from [<c0794b40>] (device_driver_attach+0x68/0x70)
[ 6411.131149]  r9:ffffffff r8:00000000 r7:c0794b48 r6:bf2270a4 r5:00000000 r4:ef855878
[ 6411.131183] [<c0794ad8>] (device_driver_attach) from [<c0794bb0>] (__driver_attach+0x68/0xdc)
[ 6411.131211]  r7:c0794b48 r6:ef855878 r5:bf2270a4 r4:00000000
[ 6411.131244] [<c0794b48>] (__driver_attach) from [<c07924c8>] (bus_for_each_dev+0x84/0xc4)
[ 6411.131274]  r7:c0794b48 r6:bf2270a4 r5:c1204fc8 r4:ef03ebb4
[ 6411.131312] [<c0792444>] (bus_for_each_dev) from [<c0793d18>] (driver_attach+0x2c/0x30)
[ 6411.131341]  r7:00000000 r6:ef979b80 r5:c1268a40 r4:bf2270a4
[ 6411.131368] [<c0793cec>] (driver_attach) from [<c0793730>] (bus_add_driver+0x1c8/0x1e8)
[ 6411.131401] [<c0793568>] (bus_add_driver) from [<c079526c>] (driver_register+0x84/0x118)
[ 6411.131429]  r7:ffffffff r6:bf2256c4 r5:bf225cf0 r4:bf2270a4
[ 6411.131457] [<c07951e8>] (driver_register) from [<c06f2e3c>] (__pci_register_driver+0x58/0x5c)
[ 6411.131484]  r5:bf225cf0 r4:00000000
[ 6411.131527] [<c06f2de4>] (__pci_register_driver) from [<bf22b410>] (parport_pc_init+0x310/0xf00 [parport_pc])
[ 6411.131563]  r5:bf22506c r4:00000000
[ 6411.131604] [<bf22b100>] (parport_pc_init [parport_pc]) from [<c02030c4>] (do_one_initcall+0x50/0x25c)
[ 6411.131652]  r10:c1204fc8 r9:d82a3f30 r8:bf227140 r7:00000000 r6:d843d240 r5:bf22b100
[ 6411.131680]  r4:c1204fc8
[ 6411.131707] [<c0203074>] (do_one_initcall) from [<c02c26ac>] (do_init_module+0x70/0x264)
[ 6411.131736]  r8:bf227140 r7:d843d280 r6:d843d240 r5:d843d340 r4:bf227140
[ 6411.131764] [<c02c263c>] (do_init_module) from [<c02c4d04>] (load_module+0x2368/0x266c)
[ 6411.131790]  r6:d843d240 r5:00000002 r4:00000002
[ 6411.131816] [<c02c299c>] (load_module) from [<c02c526c>] (sys_finit_module+0xd4/0xec)
[ 6411.131845]  r10:0000017b r9:d82a2000 r8:c02011c4 r7:00000003 r6:0029f150 r5:00000000
[ 6411.131870]  r4:c1204fc8
[ 6411.131893] [<c02c5198>] (sys_finit_module) from [<c0201000>] (ret_fast_syscall+0x0/0x28)
[ 6411.131919] Exception stack(0xd82a3fa8 to 0xd82a3ff0)
[ 6411.131942] 3fa0:                   4c3a3e00 0002abf4 00000003 0029f150 00000000 0000000a
[ 6411.131972] 3fc0: 4c3a3e00 0002abf4 0003fce8 0000017b 002a07f0 0029f150 00000003 0029f150
[ 6411.131999] 3fe0: be9815b8 be9815a8 00022cb8 b6c54af0
[ 6411.132021]  r7:0000017b r6:0003fce8 r5:0002abf4 r4:4c3a3e00
[ 6411.132046] Code: e5903000 e2833001 e7f33053 e2433612 (e5d33000) 
[ 6411.132075] ---[ end trace 07eba9e3068abd4c ]---

Kernel source acquired with rpi-source from https://github.com/RPi-Distro/rpi-source, -> "make menuconfig" - selected parallel port drivers -> "make prepare" -> "make -C . M=drivers/parport" -> "sudo insmod drivers/parport/parport.ko" -> "sudo insmod drivers/parport/parport_pc.ko irq=none" (reference: https://www.kernel.org/doc/html/latest/admin-guide/parport.html)

herrkuhn commented 3 years ago

Research so far indicates that the problem is the BAR allocation from incompatible adresses:

pi@raspberrypi:~/linux $ dmesg|grep BAR
[    0.965113] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff]
[    0.965152] pci 0000:01:00.0: BAR 1: assigned [mem 0x600000000-0x600007fff pref]
[    0.965197] pci 0000:01:00.0: BAR 6: assigned [mem 0x600008000-0x60000ffff pref]
[    0.965233] pci 0000:01:00.0: BAR 0: no space for [io  size 0x0100]
[    0.965263] pci 0000:01:00.0: BAR 0: failed to assign [io  size 0x0100]
[    0.965293] pci 0000:01:00.0: BAR 2: no space for [io  size 0x0004]
[    0.965322] pci 0000:01:00.0: BAR 2: failed to assign [io  size 0x0004]
garlick commented 3 years ago

Hmm, I hope we're not running up against this "IO BAR" issue, but I suspect that might be it:

https://www.raspberrypi.org/forums/viewtopic.php?t=288902

Specifically, see this interchange:

PhilE wrote: Thu Oct 22, 2020 3:23 pm I'm looking into the BAR 5 problem - it's possibly down to it being an IO BAR rather than a memory BAR.

Does it even support IO BARs? It'd need to do it via MMIO as I/O ports are a weird legacy thing from x86. VGA had some I/O ports so it is probably for that.

Short answer - no. From the datasheet: "Supports accessing external PCIe configuration space and memory space (no support for I/O space)."

garlick commented 3 years ago

To get another data point, I'm setting up a test with

https://media.startech.com/cms/pdfs/pex1p_datasheet.pdf

And latest (5.10) kernel from

https://github.com/raspberrypi/linux/

Kernel building now...

garlick commented 3 years ago

OK, I'm getting the same oops as you. Here's the lspci -vvv for my card:

      Subsystem: Oxford Semiconductor Ltd Device c110
        Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin A routed to IRQ 64
        Region 0: I/O ports at <unassigned> [disabled]
        Region 1: I/O ports at <unassigned> [disabled]
        Capabilities: [40] Power Management version 3
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=55mA PME(D0-,D1+,D2+,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [70] Express (v1) Legacy Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <128ns, L1 <2us
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <512ns, L1 <64us
                        ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk-
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        Capabilities: [100 v1] Device Serial Number 00-30-e0-11-11-00-01-10
        Capabilities: [110 v1] Power Budgeting <?>
        Kernel driver in use: parport_pc
        Kernel modules: parport_pc

and the oops (just ran modprobe parport_pc with no module options):

[  213.224068] PCI parallel port detected: 1415:c110, I/O at 0x0(0x0), IRQ 64
[  213.224259] 8<--- cut here ---
[  213.226858] Unable to handle kernel paging request at virtual address fee00001
[  213.229433] pgd = a425deda
[  213.231830] [fee00001] *pgd=80000000007003, *pmd=00000000
[  213.234439] Internal error: Oops: 206 [#1] SMP ARM
[  213.236830] Modules linked in: parport_pc(+) parport binfmt_misc sha256_generic cfg80211 rfkill 8021q garp stp llc v3d gpu_sched raspberrypi_hwmon dwc2 roles vc4 cec bcm2835_codec(C) drm_kms_helper bcm2835_v4l2(C) bcm2835_isp(C) v4l2_mem2mem bcm2835_mmal_vchiq(C) videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common vc_sm_cma(C) drm snd_bcm2835(C) drm_panel_orientation_quirks videodev mc snd_soc_core snd_compress snd_pcm_dmaengine snd_pcm rpivid_mem snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops backlight uio_pdrv_genirq uio ip_tables x_tables ipv6
[  213.245275] CPU: 0 PID: 516 Comm: modprobe Tainted: G         C        5.10.4-v7l-parport+ #5
[  213.248072] Hardware name: BCM2711
[  213.250894] PC is at clear_epp_timeout+0x24/0xc4 [parport_pc]
[  213.253726] LR is at parport_EPP_supported+0x1c/0x78 [parport_pc]
[  213.256543] pc : [<bf2b9b2c>]    lr : [<bf2b9ff8>]    psr: a0000013
[  213.259373] sp : c3e5bae0  ip : c3e5baf0  fp : c3e5baec
[  213.262199] r10: c22e9700  r9 : 00000000  r8 : c2fdd428
[  213.265022] r7 : c1816070  r6 : c2fdd400  r5 : c1205048  r4 : c3195c00
[  213.267868] r3 : fee00001  r2 : 5b9855aa  r1 : c22e9700  r0 : c3195c00
[  213.270717] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  213.273602] Control: 30c5383d  Table: 032ac700  DAC: fffffffd
[  213.276490] Process modprobe (pid: 516, stack limit = 0x30cf4815)
[  213.279385] Stack: (0xc3e5bae0 to 0xc3e5c000)
[  213.282285] bae0: c3e5bb04 c3e5baf0 bf2b9ff8 bf2b9b14 c3195c00 c1205048 c3e5bba4 c3e5bb08
[  213.285245] bb00: bf2ba780 bf2b9fe8 00000005 00000000 c35eb800 00000000 00000040 00000000
[  213.288238] bb20: c2fdd428 00000000 00000000 00000000 c35a9a80 00000000 c3e5bb74 c3e5bb48
[  213.291242] bb40: c028513c c02842cc c1801e40 c041f9bc c3e5bba4 c3e5bb60 c1205048 00000000
[  213.294262] bb60: c1816000 00000000 c3e5bb94 c3e5bb78 c0b59ca8 5b9855aa c3e5bb9c bf2bda44
[  213.297292] bb80: 00000000 c1816000 00000000 bf2bd510 00000040 00000000 c3e5bbfc c3e5bba8
[  213.300337] bba0: bf2bb858 bf2ba410 c1816070 00000080 bf2bf0a0 00000000 bf2be178 bf2be1b4
[  213.303402] bbc0: c1816070 c2fddc80 bf2bd468 00000000 c3e5bbfc c1816070 c1816000 bf2bf070
[  213.306502] bbe0: 00000000 bf2bf0a0 bf2bda44 00000000 c3e5bc24 c3e5bc00 c07a33cc bf2bb6bc
[  213.309603] bc00: c1816070 c13fd62c c13fd634 00000000 bf2bf0a0 00000023 c3e5bc54 c3e5bc28
[  213.312702] bc20: c08405f4 c07a3328 00000000 c1816070 bf2bf0a0 bf2bf0a0 c0840c08 00000000
[  213.315806] bc40: fffffffd bf2bf3f8 c3e5bc6c c3e5bc58 c08409b8 c0840410 c1816070 00000000
[  213.318922] bc60: c3e5bc8c c3e5bc70 c0840c00 c0840958 00000000 bf2bf0a0 c1816070 c0840c08
[  213.322051] bc80: c3e5bcac c3e5bc90 c0840c70 c0840ba4 c20779b4 c1205048 bf2bf0a0 c0840c08
[  213.325168] bca0: c3e5bcdc c3e5bcb0 c083e56c c0840c14 c3e5bce8 c1a29658 c20779b4 5b9855aa
[  213.328279] bcc0: bf2bf0a0 c12e7c64 c35a9b80 00000000 c3e5bcec c3e5bce0 c083fe80 c083e4f4
[  213.331407] bce0: c3e5bd14 c3e5bcf0 c083f7d0 c083fe60 bf2bde0c c3e5bd00 bf2bf0a0 bf2bde0c
[  213.334553] bd00: bf2bd718 ffffffff c3e5bd2c c3e5bd18 c084133c c083f614 00000000 bf2bde0c
[  213.337706] bd20: c3e5bd44 c3e5bd30 c07a264c c08412c4 00000000 bf2bd0a0 c3e5bd94 c3e5bd48
[  213.340890] bd40: bf29f410 c07a2600 c0405a20 eff72700 8040003e c1205048 bf2a0084 bf2a0044
[  213.344102] bd60: c03d09ac 5b9855aa 000035eb c1205048 bf29f100 00000002 00000000 c2fddb40
[  213.347320] bd80: bf2bf140 c1205048 c3e5be0c c3e5bd98 c0202270 bf29f10c 00000000 00000cc0
[  213.350525] bda0: c3e5bdc4 c3e5bdb0 c0b63194 c0299fc4 c1801e40 c041f9bc c3e5be0c c3e5bdc8
[  213.353753] bdc0: c041f9bc c03dcbcc c3e5be04 c3e5bdd8 c04015c8 00000008 c3e5be0c c2fddb40
[  213.357008] bde0: f0891000 5b9855aa 00000002 bf2bf140 c2fdd980 00000002 c2fddb00 c2fddb40
[  213.360274] be00: c3e5be34 c3e5be10 c02ca210 c020222c c3e5be34 c3e5be20 c0401730 c3e5bf30
[  213.363565] be20: 00000002 00000002 c3e5bf14 c3e5be38 c02cc9d4 c02ca1ac bf2bf14c 00007fff
[  213.366861] be40: bf2bf140 c02c8bf4 c1205048 c0e24f98 c0e24f40 c0e24f68 bf2a3d3f c0c03b28
[  213.370160] be60: bf2bf14c bf2bf34c c0e24fe8 c3195418 bf2bf188 c2fddb08 bf2bd073 c3e50001
[  213.373483] be80: 00000000 c0ede1dc c0ec6d7c 00000000 bf2bd03c 00000002 00000000 00000000
[  213.376808] bea0: 00000000 00000000 6e72656b 00006c65 00000000 00000000 00000000 00000000
[  213.380117] bec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  213.383397] bee0: 00000000 5b9855aa c3e5bf2c c1205048 00000000 0002d064 00000004 c0200204
[  213.386688] bf00: c3e5a000 0000017b c3e5bfa4 c3e5bf18 c02ccf84 c02ca590 c3e5bf2c 7fffffff
[  213.389993] bf20: 00000000 00000002 c3e5bf24 f0891000 f0896839 f0898780 f0891000 0000c474
[  213.393318] bf40: f089ce0c f089cca0 f089a250 00007000 00007d30 00004c08 000086a0 00000000
[  213.396664] bf60: 00000000 00000000 00004bf8 00000026 00000027 0000001e 0000001a 00000014
[  213.400014] bf80: 00000000 5b9855aa 664b8b00 00000000 00000000 0000017b 00000000 c3e5bfa8
[  213.403365] bfa0: c0200040 c02ccec8 664b8b00 00000000 00000004 0002d064 00000000 0002ec3c
[  213.406726] bfc0: 664b8b00 00000000 00000000 0000017b 006ebe50 00000000 006ebda8 00000000
[  213.410109] bfe0: bead82b8 bead82a8 00022cb8 b6c25af0 60000010 00000004 00000000 00000000
[  213.413510] Backtrace: 
[  213.416933] [<bf2b9b08>] (clear_epp_timeout [parport_pc]) from [<bf2b9ff8>] (parport_EPP_supported+0x1c/0x78 [parport_pc])
[  213.420462] [<bf2b9fdc>] (parport_EPP_supported [parport_pc]) from [<bf2ba780>] (parport_pc_probe_port+0x37c/0x12ac [parport_pc])
[  213.424022]  r5:c1205048 r4:c3195c00
[  213.427595] [<bf2ba404>] (parport_pc_probe_port [parport_pc]) from [<bf2bb858>] (parport_pc_pci_probe+0x1a8/0x22c [parport_pc])
[  213.431268]  r10:00000000 r9:00000040 r8:bf2bd510 r7:00000000 r6:c1816000 r5:00000000
[  213.434936]  r4:bf2bda44
[  213.438587] [<bf2bb6b0>] (parport_pc_pci_probe [parport_pc]) from [<c07a33cc>] (pci_device_probe+0xb0/0x138)
[  213.442306]  r10:00000000 r9:bf2bda44 r8:bf2bf0a0 r7:00000000 r6:bf2bf070 r5:c1816000
[  213.446035]  r4:c1816070
[  213.449641] [<c07a331c>] (pci_device_probe) from [<c08405f4>] (really_probe+0x1f0/0x3c8)
[  213.453185]  r9:00000023 r8:bf2bf0a0 r7:00000000 r6:c13fd634 r5:c13fd62c r4:c1816070
[  213.456633] [<c0840404>] (really_probe) from [<c08409b8>] (driver_probe_device+0x6c/0xc4)
[  213.460050]  r10:bf2bf3f8 r9:fffffffd r8:00000000 r7:c0840c08 r6:bf2bf0a0 r5:bf2bf0a0
[  213.463470]  r4:c1816070 r3:00000000
[  213.466873] [<c084094c>] (driver_probe_device) from [<c0840c00>] (device_driver_attach+0x68/0x70)
[  213.470343]  r5:00000000 r4:c1816070
[  213.473785] [<c0840b98>] (device_driver_attach) from [<c0840c70>] (__driver_attach+0x68/0xdc)
[  213.477285]  r7:c0840c08 r6:c1816070 r5:bf2bf0a0 r4:00000000
[  213.480795] [<c0840c08>] (__driver_attach) from [<c083e56c>] (bus_for_each_dev+0x84/0xc4)
[  213.484343]  r7:c0840c08 r6:bf2bf0a0 r5:c1205048 r4:c20779b4
[  213.487905] [<c083e4e8>] (bus_for_each_dev) from [<c083fe80>] (driver_attach+0x2c/0x30)
[  213.491483]  r7:00000000 r6:c35a9b80 r5:c12e7c64 r4:bf2bf0a0
[  213.495054] [<c083fe54>] (driver_attach) from [<c083f7d0>] (bus_add_driver+0x1c8/0x1e8)
[  213.498660] [<c083f608>] (bus_add_driver) from [<c084133c>] (driver_register+0x84/0x118)
[  213.502269]  r7:ffffffff r6:bf2bd718 r5:bf2bde0c r4:bf2bf0a0
[  213.505858] [<c08412b8>] (driver_register) from [<c07a264c>] (__pci_register_driver+0x58/0x5c)
[  213.509472]  r5:bf2bde0c r4:00000000
[  213.513087] [<c07a25f4>] (__pci_register_driver) from [<bf29f410>] (parport_pc_init+0x310/0xf00 [parport_pc])
[  213.516753]  r5:bf2bd0a0 r4:00000000
[  213.520404] [<bf29f100>] (parport_pc_init [parport_pc]) from [<c0202270>] (do_one_initcall+0x50/0x264)
[  213.524114]  r10:c1205048 r9:bf2bf140 r8:c2fddb40 r7:00000000 r6:00000002 r5:bf29f100
[  213.527817]  r4:c1205048
[  213.531504] [<c0202220>] (do_one_initcall) from [<c02ca210>] (do_init_module+0x70/0x264)
[  213.535243]  r8:c2fddb40 r7:c2fddb00 r6:00000002 r5:c2fdd980 r4:bf2bf140
[  213.538987] [<c02ca1a0>] (do_init_module) from [<c02cc9d4>] (load_module+0x2450/0x2778)
[  213.542742]  r6:00000002 r5:00000002 r4:c3e5bf30
[  213.546481] [<c02ca584>] (load_module) from [<c02ccf84>] (sys_finit_module+0xc8/0xfc)
[  213.550251]  r10:0000017b r9:c3e5a000 r8:c0200204 r7:00000004 r6:0002d064 r5:00000000
[  213.554039]  r4:c1205048
[  213.557801] [<c02ccebc>] (sys_finit_module) from [<c0200040>] (ret_fast_syscall+0x0/0x28)
[  213.561613] Exception stack(0xc3e5bfa8 to 0xc3e5bff0)
[  213.565403] bfa0:                   664b8b00 00000000 00000004 0002d064 00000000 0002ec3c
[  213.569238] bfc0: 664b8b00 00000000 00000000 0000017b 006ebe50 00000000 006ebda8 00000000
[  213.573062] bfe0: bead82b8 bead82a8 00022cb8 b6c25af0
[  213.576865]  r7:0000017b r6:00000000 r5:00000000 r4:664b8b00
[  213.580655] Code: e5903000 e2833001 e7f33053 e2433612 (e5d33000) 
[  213.584444] ---[ end trace 792fd8b17530f5f3 ]---
garlick commented 3 years ago

should have noted this too:

$ dmesg|grep BAR
[    1.282152] pci 0000:01:00.0: BAR 0: no space for [io  size 0x0008]
[    1.284620] pci 0000:01:00.0: BAR 0: failed to assign [io  size 0x0008]
[    1.287138] pci 0000:01:00.0: BAR 1: no space for [io  size 0x0004]
[    1.289612] pci 0000:01:00.0: BAR 1: failed to assign [io  size 0x0004]
herrkuhn commented 3 years ago

[ 1.287138] pci 0000:01:00.0: BAR 1: no space for [io size 0x0004] [ 1.289612] pci 0000:01:00.0: BAR 1: failed to assign [io size 0x0004]

Same as mine, the io size of 0x0004 leads me to speculate that's the address for 0x378, since that would be enough for data/status/control registers.

garlick commented 3 years ago

Same model card in a PC:

[    6.742514] parport0: PC-style at 0xdc00 (0xd880), irq 16, using FIFO [PCSPP,TRISTATE,COMPAT,EPP,ECP]

And lspci -vvv

03:00.0 Parallel controller: Oxford Semiconductor Ltd Device c110 (prog-if 02 [ECP])
        Subsystem: Oxford Semiconductor Ltd Device c110
        Physical Slot: 0
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 32 bytes
        Interrupt: pin A routed to IRQ 16
        Region 0: I/O ports at dc00 [size=8]
        Region 1: I/O ports at d880 [size=4]
        Capabilities: [40] Power Management version 3
                Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=55mA PME(D0-,D1+,D2+,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
        Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [70] Express (v1) Legacy Endpoint, MSI 00
                DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <128ns, L1 <2us
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
                        MaxPayload 128 bytes, MaxReadReq 512 bytes
                DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 unlimited
                        ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
                LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
        Capabilities: [100 v1] Device Serial Number 00-30-e0-11-11-00-01-10
        Capabilities: [110 v1] Power Budgeting <?>
        Kernel driver in use: parport_pc
        Kernel modules: parport_pc

According to comment at the top of parport_pc.c, the two segments are 1) the data/status/control registers, and 2) the optional EPP/ECP registers. The datasheet for the chip in my card describes just the two I/O mapped BARs for the parallel port:

https://www.semiconductorstore.com/pdf/newsite/oxford/OXPCIe952_ds.pdf

If the Broadcom 2711's PCI bridge doesn't support mapping I/O addresses, and the cards don't offer a memory mapped alternative, I think we may be at a dead end.