|
|
发表于 2009-3-17 14:57:51
|
显示全部楼层
Driver Binding Protcol.support()用来支持将driver和要管理的device动态匹配起来,driver不能对传入的handle有任何假定,传入的handle有可能是device handle或者是和硬件无关的image handle和service handle。driver在support()函数中判断传入的handle是不是自己要管理的device的handle。3 L9 O1 M) \6 b6 H( G
* m& ?* E( C2 j- O' I8 u' _) R
对一个想管理某种PCI device的driver来说传入的handle没有PCI IO Protocl是正常的。没有PCI IO Protcol说明这个handle不是PCI device handle,甚至根本就不是device handle。(PCI bus driver在enumeration的时候会有发现的每个PCI device创建一个device handle,并在此handle上安装PCI IO Protocol).& j" j4 O/ c7 J# b1 s3 p
6 k8 O) w! G' P3 l% Q
UEFI 规范中connect all controller的示例程序片断:9 c& y. b6 c3 q+ P
Status = gBS->LocateHandleBuffer (! q4 b3 Q* B' a2 F7 B
AllHandles,
, t8 ^, n( a; X7 X NULL,( P6 `' l7 ]7 a
NULL,
8 K9 C5 D0 c5 f5 V g" g# k8 j &HandleCount,
. O$ z8 @* [2 J$ J3 n &HandleBuffer) b( ~, N& h' |! z8 W
);2 |/ W/ Y% z5 j5 R
if (EFI_ERROR (Status)) {) H+ v# V( k) o5 ], Z) B
return Status;
* A% }# k* | v8 {" x, a1 l7 k }
4 K7 ^! Y: T4 X1 R( E4 I1 D* P G& e% I
for (Index = 0; Index < HandleCount; Index++) {* l( f, m3 ?1 Q0 C
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
) [- C! W% |3 K4 N/ v } |
|