我对 linux/kernels/drivers 相当陌生。我正在为嵌入式 linux (3.2.17) 上的 pci 卡编写驱动程序。
我遇到的问题是在我的探测功能中,result = pci_enable_device(dev)
失败并出现以下错误
0000:02:00.0: device not available (can't reserve [mem 0x00000000-0x00001ff)
我不确定这是为什么或如何调试它。
请让我知道我应该发布哪些其他信息。
编辑:
lspci -v
退回了这个
02:00.0 Class 0000: Unknown device 11aa:1770 (rev 52)
Subsystem: Unknown device feed:beef
Flags: slow devsel, IRQ 16
Memory at <ignored> (32-bit, non-prefetchable)
Capabilities: [44] Vendor Specific Information
在 dmesg 中找到了这个
PCI: Probing PCI hardware
pci_bus 0000:00: scanning bus
pci 0000:00:00.0: [1957:0070] type 1 class 0x000b20
pci 0000:00:00.0: calling quirk_mmio_always_on+0x0/0x24
pci 0000:00:00.0: ignoring class b20 (doesn't match header type 01)
pci 0000:00:00.0: calling fixup_hide_host_resource_fsl+0x0/0x54
pci 0000:00:00.0: calling pcibios_fixup_resources+0x0/0x110
pci 0000:00:00.0: calling quirk_fsl_pcie_header+0x0/0x74
pci 0000:00:00.0: calling quirk_resource_alignment+0x0/0x19c
pci 0000:00:00.0: supports D1 D2
pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
pci 0000:00:00.0: PME# disabled
pci_bus 0000:00: fixups for bus
pci 0000:00:00.0: scanning [bus 01-02] behind bridge, pass 0
pci 0000:00:00.0: scanning [bus 00-00] behind bridge, pass 1
pci_bus 0000:01: scanning bus
pci 0000:01:00.0: [12d8:e110] type 1 class 0x000604
pci 0000:01:00.0: calling quirk_mmio_always_on+0x0/0x24
pci 0000:01:00.0: calling pcibios_fixup_resources+0x0/0x110
pci 0000:01:00.0: calling quirk_resource_alignment+0x0/0x19c
pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
pci 0000:01:00.0: PME# disabled
pci_bus 0000:01: fixups for bus
pci 0000:00:00.0: PCI bridge to [bus 01-ff]
pci 0000:00:00.0: bridge window [mem 0xc0000000-0xc00fffff]
pci 0000:01:00.0: scanning [bus 02-02] behind bridge, pass 0
pci 0000:01:00.0: scanning [bus 00-00] behind bridge, pass 1
pci_bus 0000:02: scanning bus
pci 0000:02:00.0: [11aa:1770] type 0 class 0x000000
pci 0000:02:00.0: calling quirk_mmio_always_on+0x0/0x24
pci 0000:02:00.0: reg 10: [mem 0xc0000000-0xc0001fff]
pci 0000:02:00.0: calling pcibios_fixup_resources+0x0/0x110
pci 0000:02:00.0: calling quirk_resource_alignment+0x0/0x19c
pci_bus 0000:02: fixups for bus
pci 0000:01:00.0: PCI bridge to [bus 02-ff]
pci 0000:01:00.0: bridge window [mem 0xc0000000-0xc00fffff]
pci_bus 0000:02: bus scan returning with max=02
pci_bus 0000:01: bus scan returning with max=02
pci_bus 0000:00: bus scan returning with max=02
PCI: Cannot allocate resource region 1 of PCI bridge 2, will remap
PCI: Cannot allocate resource region 0 of device 0000:02:00.0, will remap
PCI 0000:00 Cannot reserve Legacy IO [io 0xff7ec000-0xff7ecfff]
PCI: max bus depth: 2 pci_try_num: 3
pci 0000:01:00.0: BAR 8: assigned [mem 0xc0000000-0xc00fffff]
pci 0000:01:00.0: PCI bridge to [bus 02-02]
pci 0000:01:00.0: bridge window [mem 0xc0000000-0xc00fffff]
pci 0000:00:00.0: PCI bridge to [bus 01-02]
pci 0000:00:00.0: bridge window [io 0xff7ec000-0xff7fbfff]
pci 0000:00:00.0: bridge window [mem 0xc0000000-0xdfffffff]
pci 0000:00:00.0: enabling device (0106 -> 0107)
pci_bus 0000:00: resource 0 [io 0xff7ec000-0xff7fbfff]
pci_bus 0000:00: resource 1 [mem 0xc0000000-0xdfffffff]
pci_bus 0000:01: resource 0 [io 0xff7ec000-0xff7fbfff]
pci_bus 0000:01: resource 1 [mem 0xc0000000-0xdfffffff]
pci_bus 0000:02: resource 1 [mem 0xc0000000-0xc00fffff]
有问题的设备是 0000:02