|
发表于 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。# ]1 f- f$ N6 J6 |$ n9 h
. |: o. b2 I' N% r3 h
对一个想管理某种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)., I: E5 a- F: F# G, S9 ~8 S
% g8 J% A- n# Z, J( W
UEFI 规范中connect all controller的示例程序片断:
) G* S+ s I) P Status = gBS->LocateHandleBuffer (% T# W( e" O( c6 ?9 d6 Z
AllHandles,8 y! C, b9 h- m; U3 Z
NULL,
2 {* Y6 W. |9 E& N% t$ } NULL,
9 R* R$ W. H0 h! C &HandleCount,
" c9 \2 ~* K1 ^+ A: n- a &HandleBuffer
c7 N% O1 c& A4 b );! I9 ]' d) h* F
if (EFI_ERROR (Status)) {: S9 S3 ^8 W f9 _
return Status;$ \" S* M( h) _2 Q6 f% A6 G
}
0 q1 n# r, Z4 J; O2 l6 l
* |. |: p2 P! R" s for (Index = 0; Index < HandleCount; Index++) {
7 z5 A- t( T# ^ Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
7 w- o: O3 m1 C- J Q6 h } |
|