阅读:2431回复:11
关于读PCI配置寄存器。
在WRITE_PORT_ULONG(0xcf8,...)之前,有必要KeRaiseIrql吗?为什么?谢谢。
|
|
沙发#
发布于:2002-03-22 14:49
在这里没有这个必要,KeRaiseIrql只为提高优先级,以提供一段不原被打断的处理。WRITE_PORT_ULONG,本身不存在这种事情。另外,你写的0XCF8这个端口地址:如果你在驱动程序中,用它来访问配置空间,显得有些麻烦。配置空间映射后,可使用直接的地址访问,要简便一些。
|
|
板凳#
发布于:2002-03-22 20:09
用户被禁言,该主题自动屏蔽! |
|
地板#
发布于:2002-03-23 14:59
谢谢众位的的关注:但9054的Driver代码里有这样一段:
KeRaiseIrql( DISPATCH_LEVEL, &IrqlSave ); // Save the content of the command register RegisterSave = READ_PORT_ULONG( (ULONG*)0xcf8 ); // Scan the PCI bus to find our device // MAX_PCI_DEV = 32dev) for (SlotNumber = 0; SlotNumber < MAX_PCI_DEV; SlotNumber++) { // Issue PCI Config write command WRITE_PORT_ULONG( (ULONG*)0xcf8, (1 << 31) | (pdx->Device.BusNumber << 16) | (SlotNumber << 11) | 0x10 ); // Get the Result if (READ_PORT_ULONG((ULONG*)0xcfc) == RegisterToCompare) { pdx->Device.SlotNumber = SlotNumber; KdPrint((DBG_NAME \"Workaround successful, Slot number = %02Xh\\n\", SlotNumber)); break; } } // Restore saved command register WRITE_PORT_ULONG( (ULONG*)0xcf8, RegisterSave ); // Restore IRQL KeLowerIrql( IrqlSave ); 而且还注解说: Scanning the PCI bus involves using I/O addresses 0xcf8 and 0xcfc. These addresses must be used together and no other process must interrupt, so we must raise the IRQL. 由是为什么? |
|
地下室#
发布于:2002-03-23 15:51
用户被禁言,该主题自动屏蔽! |
|
5楼#
发布于:2002-03-24 18:07
两个成对使用的寄存器,一次读一次写,如果中间又中断那模你的原有配置不就完蛋了吗?相当于一个原语吧!
|
|
|
6楼#
发布于:2002-03-27 13:11
To Tom.cat:
Of course i know the functions of registers CFC and CF8, i have clearly put it in my first post message of the current thread. CF8 is my most confused spot here, not READ_PORT_ULONG. OK? But anyway i will give u some scores for ur frequent helping. Thx . |
|
7楼#
发布于:2002-03-27 13:14
To Tom.cat:
Of course i know the functions of registers CFC and CF8, i have clearly put it in my first post message of the current thread. CF8 is my most confused spot here, not READ_PORT_ULONG. OK? But anyway i will give u some scores for ur frequent helping. Thx . To jansen: 啥叫原语呀?回答完了就给分。 |
|
8楼#
发布于:2002-03-27 13:22
To Tom.cat: \"原语\"的意思就像是一个原子操作吧! |
|
|
9楼#
发布于:2002-03-27 13:24
To Tom.cat: \"原语\"的意思就像是一个原子操作吧! 补充:请参见操作系统:自旋锁(SPIN_LOCK)... |
|
|
10楼#
发布于:2002-03-27 19:50
对不起piig.我吧分加错了,加到tom.cat上去了,你再看见我发贴子,就过来废一句话,我再给你补上,真不好意思。
|
|
11楼#
发布于:2002-03-27 23:53
http://www.driverdevelop.com/read.php?t=A&id=113
I gave the detail reason in the attached article. |
|
|