|
|
发表于 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。# W5 F+ `( @) S- n
z- u- d1 \/ |; ~# J% |; n9 d
对一个想管理某种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).
3 S2 g+ A: m& x2 B6 \- t5 y7 a7 Q# d0 `6 T3 |
UEFI 规范中connect all controller的示例程序片断:* ?' d- ? a D% K& O+ n
Status = gBS->LocateHandleBuffer (5 }; X L/ g* M+ w; `
AllHandles,5 c4 x/ `) c2 k7 r6 z6 X& ~) H
NULL,
2 D1 p6 F' _' p NULL,
0 s% k5 C. c( s0 D# c &HandleCount,! z: D6 _0 K# f2 \3 D$ _* K
&HandleBuffer
8 Z+ a( r! o3 m! ?* v );2 b; e9 t. K! [& W
if (EFI_ERROR (Status)) {
, T# q$ L% J. x8 Z return Status;( J. J d, O3 @! |1 n" `
}
7 w1 J) a% B( j' ^! h2 O8 F6 W4 m: F; F3 g* A7 W, H/ t7 G
for (Index = 0; Index < HandleCount; Index++) {
4 g4 x, ^ C: n; p$ ]# f- t Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
1 w& L2 A7 q6 _) k6 e( v, b' u0 r } |
|