|
|
发表于 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。, V! A* i( Y7 L
( p. r5 ~$ |& Y, p2 G9 \对一个想管理某种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).
0 y& }5 R [4 @$ T0 T0 c" @# x3 e) ^; }" d. U* W/ z. m
UEFI 规范中connect all controller的示例程序片断:$ l5 L8 u1 T9 c( U1 H" H
Status = gBS->LocateHandleBuffer (
7 f1 o" R, v1 q2 f' S6 P3 g8 o AllHandles,
' s7 a' v) Y3 T/ {# ?, t NULL,2 _2 F1 Z* r Z9 s% \
NULL," Y. R3 i( `" D6 C
&HandleCount,
: X1 C5 f* b3 p9 }# m7 u5 e, G &HandleBuffer
' ?9 l& a; S( U4 [, a7 s2 { );, B* ?& x2 I" q q5 s
if (EFI_ERROR (Status)) {% q4 ?6 ~% ^# A' b
return Status;) s* C5 g$ y- K0 s$ L
}8 j. }0 z7 L) @$ G6 H2 X
* t4 a2 K& {1 l/ b2 ]) p3 w for (Index = 0; Index < HandleCount; Index++) {
+ [0 {& R; }8 m# h% |, [4 ~& y Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);- e! f5 B+ c% Y4 @
} |
|