免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3701 | 回复: 1
打印 上一主题 下一主题

请教关于pci probe的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-11-21 11:37 |只看该作者 |倒序浏览
小弟在probe里面第一行先调用pci_enable_device,结果总是报
PCI: Device 0000:05:00.0 not available because of resource collisions
probe of 0000:05:00.0 failed with error -22
第一行是pcibios_enable_resources 打印的,第二行是驱动里面自己打印的。
分析了一下pcibios_enable_resources的代码发现resource的start地址为0. 测试机器是intel的,内核版本2.6.9,而相同的驱动代码、相同的内核版本在另一台AMD的机器上是可以运行的,另外如果把intel的机器装成2.6.18也是没问题的。请问resource结构的start成员变量是什么赋值的? 多谢!

static inline int
pcibios_enable_resources (struct pci_dev *dev, int mask)
{
u16 cmd, old_cmd;
int idx;
struct resource *r;
unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM;
if (!dev)
  return -EINVAL;
pci_read_config_word(dev, PCI_COMMAND, &cmd);
old_cmd = cmd;
for (idx=0; idx<PCI_NUM_RESOURCES; idx++) {
  /* Only set up the desired resources.  */
  if (!(mask & (1 << idx)))
   continue;
  r = &dev->resource[idx];
  if (!(r->flags & type_mask))
   continue;
  if ((idx == PCI_ROM_RESOURCE) &&
    (!(r->flags & IORESOURCE_ROM_ENABLE)))
   continue;
  if (!r->start && r->end) {
   printk(KERN_ERR
          "PCI: Device %s not available because of resource collisions\n",
          pci_name(dev));
   return -EINVAL;
  }
  if (r->flags & IORESOURCE_IO)
   cmd |= PCI_COMMAND_IO;
  if (r->flags & IORESOURCE_MEM)
   cmd |= PCI_COMMAND_MEMORY;
}
if (cmd != old_cmd) {
  printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
  pci_write_config_word(dev, PCI_COMMAND, cmd);
}
return 0;

论坛徽章:
0
2 [报告]
发表于 2009-11-21 15:40 |只看该作者

回复 #1 superfisha 的帖子

跟踪发现系统启动时打印
Nov 21 14:45:05 turbo kernel: PCI: Cannot allocate resource region 0 of device 0000:03:00.0
Nov 21 14:45:05 turbo kernel: PCI: Cannot allocate resource region 2 of device 0000:03:00.0
Nov 21 14:45:05 turbo kernel: PCI: Cannot allocate resource region 4 of device 0000:03:00.0
Nov 21 14:45:05 turbo kernel: PCI-DMA: Disabling IOMMU.
Nov 21 14:45:05 turbo kernel: PCI: Failed to allocate mem resource #0:0@0 for 0000:03:00.0
Nov 21 14:45:05 turbo kernel: PCI: Failed to allocate mem resource #2:0@0 for 0000:03:00.0
Nov 21 14:45:05 turbo kernel: PCI: Failed to allocate mem resource #4:0@0 for 0000:03:00.0

lspci -v输出:
[root@turbo ~]# lspci -v
pcilib: Resource 0 in /sys/bus/pci/devices/0000:03:00.0/resource has a 64-bit address, ignoring
pcilib: Resource 2 in /sys/bus/pci/devices/0000:03:00.0/resource has a 64-bit address, ignoring
pcilib: Resource 4 in /sys/bus/pci/devices/0000:03:00.0/resource has a 64-bit address, ignoring


03:00.0 Class aa00: Unknown device abcd (rev 00)
        Flags: bus master, fast devsel, latency 0, IRQ 132
        Memory at <ignored> (64-bit, prefetchable)
        Memory at <ignored> (64-bit, prefetchable)
        Memory at <ignored> (64-bit, prefetchable)
        Capabilities: [40] Power Management version 3
        Capabilities: [50] Message Signalled Interrupts: 64bit+ Queue=0/0 Enable-
        Capabilities: [70] Express Endpoint IRQ 0
        Capabilities: [100] Advanced Error Reporting
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP