Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pci_resource_start 是如何得到设备的起始地址的?

297 views
Skip to first unread message

@UBOOT@

unread,
Mar 22, 2007, 5:25:14 AM3/22/07
to
看某网卡的源码:

在pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
中:
..
err = pci_enable_device(pdev);
if (err < 0) {
if (pcnet32_debug & NETIF_MSG_PROBE)
printk(KERN_ERR PFX "failed to enable device -- err=%d\n", err);
return err;
}
pci_set_master(pdev);

ioaddr = pci_resource_start (pdev, 0);

其中:
#define pci_resource_start(dev,bar) ((dev)->resource[(bar)].start)
那么是谁把这些地址填进去的?linux的pci core会初始化好这个pci_dev?

不解

--
巴黎购物一日[2004]
http://www.newsmth.net/pc/pccon.php?id=2625&nid=61748&order=&tid=6343
Walking Paris图片版[2004]
http://www.newsmth.net/pc/pccon.php?id=2625&nid=66081&order=&tid=6343
怀念巴黎[2004]
http://www.newsmth.net/pc/pccon.php?id=2625&nid=72161&order=&tid=6343


[m [33m※ 来源:·水木社区 http://newsmth.net·[FROM: 210.12.42.*] [m

cad

unread,
Mar 22, 2007, 7:57:44 AM3/22/07
to
是的.这个不需要驱动瞎操心.
【 在 netwind (@UBOOT@) 的大作中提到: 】
: 看某网卡的源码:

: 在pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
: 中:
: ...................

--

[m [1;35m※ 来源:·水木社区 newsmth.net·[FROM: 143.127.3.*] [m

casky

unread,
Mar 22, 2007, 8:08:24 AM3/22/07
to
bios一般已经往pci device的IO/memory bar空间初始化好了
如果这些值设置没错的话,linux一般是不会改的
windows有可能改,可能Windows 的hotplug做得比较好吧

【 在 netwind (@UBOOT@) 的大作中提到: 】
: 看某网卡的源码:
: 在pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent)
: 中:
: ...................

--

[m [1;31m※ 来源:·水木社区 newsmth.net·[FROM: 221.222.168.*] [m

@UBOOT@

unread,
Mar 22, 2007, 9:49:01 PM3/22/07
to
照你的意思是bios负责把这些值从设备弄出来?
然后kernel负责和bios交互把这些数据load进来?

【 在 casky (casky) 的大作中提到: 】
: bios一般已经往pci device的IO/memory bar空间初始化好了


: 如果这些值设置没错的话,linux一般是不会改的
: windows有可能改,可能Windows 的hotplug做得比较好吧

--
声色场所.南京.1[2005]
http://www.newsmth.net/pc/pccon.php?id=2625&nid=170133&order=&tid=17857
声色场所.南京.2[2005]
http://www.newsmth.net/pc/pccon.php?id=2625&nid=259455&order=&tid=17857
小资产阶级南京指南[2005]
http://www.newsmth.net/pc/pccon.php?id=2625&nid=170057&order=&tid=17857


[m [34m※ 来源:·水木社区 http://newsmth.net·[FROM: 210.12.42.*] [m

boer

unread,
Mar 22, 2007, 10:17:21 PM3/22/07
to
你找下Linux Device Driver书看看,在PCI这章。对于PCI设备,在其PCI配置空间有IO/MEM地址区,共6个BAR.这些值是在系统启动时,由BOIS来初始化每个PCI设备的dev设备结构
【 在 netwind (@UBOOT@) 的大作中提到: 】
: 照你的意思是bios负责把这些值从设备弄出来?
: 然后kernel负责和bios交互把这些数据load进来?


--
最近计划:1)帮三姐公司弄了个网页www.shcc-logistics.com,发现自己确实没有艺术天赋!2)刚快投入毕业论文中吧,没时间了,老板要发飙!3)神啦,求工作别抛弃我。
-----------------------------------------------------------------------------
http://www.shcc-logistics.com


[m [1;34m※ 来源:·水木社区 newsmth.net·[FROM: 58.31.12.*] [m

@UBOOT@

unread,
Mar 22, 2007, 11:20:31 PM3/22/07
to
我也看了这章,就是讲讲过程,并没有说是怎么做的...hehe
【 在 boer001217 (boer) 的大作中提到: 】
: 你找下Linux Device Driver书看看,在PCI这章。对于PCI设备,在其PCI配置空间有IO/MEM地址区,共6个BAR.这些值是在系统启动时,由BOIS来初始化每个PCI设备的dev设备结构
0 new messages