- 论坛徽章:
- 0
|
开发一个LINUX下的PCI驱动,在
static int __init PCI9030_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
printk("<1>entre myprobe\n";
/* 启动PCI设备*/
if(pci_enable_device(dev));
return -EIO;
if((card=kmalloc(sizeof(struct PCI9030_card),GFP_KERNEL))==NULL)
{
printk(KERN_ERR"CI9030ut of memory\n";
return -ENOMEM;
}
memset(card,0,sizeof(struct PCI9030_card));
card->iobase1=pci_resource_start(dev,1);
card->iobase2=pci_resource_start(dev,2);
card->CI_dev=*dev;
card->pci_deviceID=id->device;
card->iobase1len=pci_resource_len(dev,1);
card->iobase2len=pci_resource_len(dev,2);
card->iobase1flag=pci_resource_flags(dev,1);
card->iobase2flag=pci_resource_flags(dev,2);
card->next=NULL;
unsigned long testReadConfig;
printk("<1>card iobase1flag,iobase2flag:%lx , %lx \n",card->iobase1flag,card->iobase2flag);
return 0;
}
打印出来的FLAG值居然是f8a3dd10,显然是个错误代码,
现在的驱动能访问到PCI配置空间,但是访问不了IO和IO内存空间,是没给IO空间分配资源么????
在/sys/bus/puc/*/下看到我的硬件对应的resource文件里的内容为
0x00000000febffc00 0x00000000febffc7f 0x0000000000000200
0x00000000000ec00 0x000000000000ec7f 0x000000000000101
0x000000000000e880 0x000000000000e8bf 0x00000000000101
0x00000000000000 0x0000000000000000 0x0000000000000000
(数是64位的)
但是该目录下另外三个文件resource0,resource1,resource2里的都没有值
是没分配资源么????急急急 |
|