- 论坛徽章:
- 0
|
最近在移植一个mv88se6121驱动到Powerpc平台,这个芯片是一个pcie to sata的芯片,我使用的CPU是freescale p1020,当我将pcie to sata这个芯片插入到CPU的pcie slot的时候,内核会打印出如下消息:- PCI: Cannot allocate resource region 4 of device 0000:01:00.0, will remap
- PCI: Cannot allocate resource region 5 of device 0000:01:00.0, will remap
复制代码 后来我根据打印出来的消息定位到内核代码中去发现,内核报这样的错误是由于这下面的这个函数中,- static inline void __devinit alloc_resource(struct pci_dev *dev, int idx)
复制代码 调用:返回的pr是空,为了验证,我在alloc_resource中加入了一些调用代码,发现打印出来的消息:- PCI: Probing PCI hardware
- pci 0000:00:00.0: ignoring class b20 (doesn't match header type 01)
- pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
- pci 0000:00:00.0: PME# disabled
- pci 0000:01:00.0: PME# supported from D0 D1 D3hot
- pci 0000:01:00.0: PME# disabled
- pci_dev->irq=16
- pci 0001:02:00.0: ignoring class b20 (doesn't match header type 01)
- pci 0001:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold
- pci 0001:02:00.0: PME# disabled
- PCI: Allocating 0000:01:00.0: Resource 0: 00000000ff7f4000..00000000ff7f4007 [20101]
- pci_find_parent_resource 00000000ff7ec000..00000000ff7fbfff //正常分配
- PCI: Allocating 0000:01:00.0: Resource 1: 00000000ff7f4040..00000000ff7f4043 [20101]
- pci_find_parent_resource 00000000ff7ec000..00000000ff7fbfff //正常分配
- PCI: Allocating 0000:01:00.0: Resource 2: 00000000ff7f4200..00000000ff7f4207 [20101]
- pci_find_parent_resource 00000000ff7ec000..00000000ff7fbfff //正常分配
- PCI: Allocating 0000:01:00.0: Resource 3: 00000000ff7f4800..00000000ff7f4803 [20101]
- pci_find_parent_resource 00000000ff7ec000..00000000ff7fbfff //正常分配
- PCI: Allocating 0000:01:00.0: Resource 4: 00000000000ec000..00000000000ec00f [20101]
- PCI: Cannot allocate resource region 4 of device 0000:01:00.0, will remap //调用pci_find_parent_resource失败,返回一个空指针
- PCI: Allocating 0000:01:00.0: Resource 5: 0000000000800000..00000000008003ff [20200]
- PCI: Cannot allocate resource region 5 of device 0000:01:00.0, will remap //调用pci_find_parent_resource失败,返回一个空指针
- pci 0000:00:00.0: PCI bridge, secondary bus 0000:01
- pci 0000:00:00.0: IO window: 0x00-0xffff
- pci 0000:00:00.0: MEM window: 0xa0000000-0xbfffffff
- pci 0000:00:00.0: PREFETCH window: disabled
- pci 0000:00:00.0: enabling device (0106 -> 0107)
- pci 0001:02:00.0: PCI bridge, secondary bus 0001:03
- pci 0001:02:00.0: IO window: 0x00-0xffff
- pci 0001:02:00.0: MEM window: 0xc0000000-0xdfffffff
- pci 0001:02:00.0: PREFETCH window: disabled
- pci 0001:02:00.0: enabling device (0106 -> 0107)
复制代码 下面是内核在初始化的时候打印出来的关于pcie的消息:- mpc85xx_rdb_setup_arch()
- Found FSL PCI host bridge at 0x00000000ffe09000. Firmware bus number: 0->255
- PCI host bridge /pcie@ffe09000 ranges:
- MEM 0x00000000a0000000..0x00000000bfffffff -> 0x00000000a0000000
- IO 0x00000000ffc30000..0x00000000ffc3ffff -> 0x0000000000000000
- /pcie@ffe09000: PCICSRBAR @ 0xfff00000
- Found FSL PCI host bridge at 0x00000000ffe0a000. Firmware bus number: 0->255
- PCI host bridge /pcie@ffe0a000 ranges:
- MEM 0x00000000c0000000..0x00000000dfffffff -> 0x00000000c0000000
- IO 0x00000000ffc20000..0x00000000ffc2ffff -> 0x0000000000000000
- /pcie@ffe0a000: PCICSRBAR @ 0xfff00000
- MPC85xx RDB board from Freescale Semiconductor
复制代码 后来我又将cat /proc/ioports的消息打印出来:- /home # cat /proc/ioports
- ff7d9000-ff7e8fff : /pcie@ffe0a000
- ff7d9000-ff7e8fff : PCI Bus 0001:03
- ff7ec000-ff7fbfff : /pcie@ffe09000
- ff7ec000-ff7fbfff : PCI Bus 0000:01
- ff7ec000-ff7ec00f : 0000:01:00.0
- ff7f4000-ff7f4007 : 0000:01:00.0
- ff7f4040-ff7f4043 : 0000:01:00.0
- ff7f4200-ff7f4207 : 0000:01:00.0
- ff7f4800-ff7f4803 : 0000:01:00.0
- /home #
复制代码 以及cat /proc/iomemd的消息也打印出来了:- a0000000-bfffffff : /pcie@ffe09000
- a0000000-bfffffff : PCI Bus 0000:01
- a0000000-a00003ff : 0000:01:00.0
- c0000000-dfffffff : /pcie@ffe0a000
- c0000000-dfffffff : PCI Bus 0001:03
- ec000000-efffffff : ec000000.nor
- ff87fff0-ff87ffff : rtc-cy14b108k.0
- ff87fff0-ff87ffff : rtc-cy14b108k
- ffe04500-ffe04507 : serial
- ffe04600-ffe04607 : serial
- ffe07000-ffe07fff : fsl-espi
- ffe22000-ffe22fff : usb
复制代码 根据我的理解,前面的分配的六个资源(resource)分别是为BAR0-BAR5分配的,从我后来驱动中打印出来的值(mv88se6121的驱动)更能验证这一点,目前我不明白的是:
为什么BAR4-BAR5的资源空间分配会失败,从我目前的系统状态来看,会是什么原因导致的,如果有遇到类似问题的,或者对这块比较了解的兄弟,还望多多指教
|
|