|
|
发表于 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。% g* I6 B% I1 F; ~
k7 L7 C, z K9 e$ L对一个想管理某种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).
9 r# n3 Y E4 K, j P6 H2 ~5 j s0 p7 {' H4 ? {/ H% d
UEFI 规范中connect all controller的示例程序片断:
# e2 r% W3 W0 n6 R Status = gBS->LocateHandleBuffer (3 e" c/ @% c0 D, {' Y
AllHandles,
5 e* [$ X6 i9 R! q1 S NULL,4 p* e$ j t& l9 q
NULL,
# d. I5 b/ h h |( _% | &HandleCount,8 F$ n% P* _0 a: r9 f( b
&HandleBuffer+ n" v' q5 _" h; V6 u" h0 C
);
, [& _* g; U* v3 `: d! w$ ^( N" O if (EFI_ERROR (Status)) {
8 `4 }& U4 u0 A8 P8 t' c* k$ _3 Q return Status;9 P1 e( Q8 Z z2 g
}3 D7 I$ M9 e. g7 b
: g, }1 Y% h7 L" i7 c( A5 N5 g1 J
for (Index = 0; Index < HandleCount; Index++) {6 g( ]9 u" d! y' Z* W7 a) t X {
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);8 J& _ s2 K) Q& e8 y5 A0 w
} |
|