|
发表于 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。
0 c r5 k) N" R6 c3 i$ h3 q2 R5 o; U4 t# Z) ?1 q/ B
对一个想管理某种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).
) D7 B( x( S# j( z* r& R
( ]; X& Q( I8 K& \ lUEFI 规范中connect all controller的示例程序片断:% W0 f* T2 ?# F7 h& [
Status = gBS->LocateHandleBuffer (
' F! j7 O: J# V7 m AllHandles,. |8 @9 M" t: U' Q+ Z
NULL,
! t/ I) Z L* M& z5 A: ` NULL,
1 s# N; x% B$ ] k9 U! i &HandleCount,7 t. w7 \' g# A5 W
&HandleBuffer# K5 a; F) @* F* P& G1 G% Q( U |
);/ o) r5 E8 H( V3 P
if (EFI_ERROR (Status)) {
, P9 w% _8 k* m! {7 D return Status;
/ b2 B1 R+ f8 h' [; [; R }; u ^, F( k5 U, E
+ F$ o" n& q8 i
for (Index = 0; Index < HandleCount; Index++) {
& Q; y4 q" b- ~6 e- P% E4 ^ t; A# H( a Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);, A/ l9 i: m) S! c- b
} |
|