|
|
发表于 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。
5 x% f' a5 Q8 \2 \8 P+ e
' L) _1 L2 q* }0 t, u对一个想管理某种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)./ |/ f8 k) O% m# B$ w( ]
' h( X& ^6 o# uUEFI 规范中connect all controller的示例程序片断:. z5 D5 M( f& G$ {% ^ Z
Status = gBS->LocateHandleBuffer (; w- b8 V# p F9 h* \
AllHandles,1 }/ f$ {: I: V9 X4 A: K
NULL,
5 U5 [, V- t+ {5 I( C, H# y3 G, X NULL,; Q. w6 i, H q& c u
&HandleCount,
, d' u& O/ p' D1 D &HandleBuffer, K& s+ w! J/ s- ~, K( S: W! m3 Q
);
# R$ i0 z6 g! ?' x5 Y. _2 a if (EFI_ERROR (Status)) {
% G* G5 T" h+ B% ` return Status;
% A4 H' U, o% p$ u; Q }' W$ v% U- e7 K6 A7 g
- r0 X+ g S9 V4 c2 a for (Index = 0; Index < HandleCount; Index++) {0 ~& j3 k/ G$ ]2 f
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);* F5 d" s( c" z$ \
} |
|