|
|
发表于 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 ]% J3 N, v/ g2 v
# m; y7 ]. x. N3 A- 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).
- b2 M8 j, d' |9 G/ ^1 ?! F8 D: ~: d m. _2 Z
UEFI 规范中connect all controller的示例程序片断:
' B* A2 K z2 _9 r; J3 c* I2 D" C Status = gBS->LocateHandleBuffer (( M/ ~( D4 A& X
AllHandles,
( D I9 x D+ J! `1 L1 A9 s* e NULL,
Z# }8 w/ R( t7 W* M% H NULL,: K6 x' d7 }6 L0 R( @' L+ P D" a5 m
&HandleCount,
( Y& R. I( } E+ Q' V( w; P$ d7 V &HandleBuffer. U4 L7 Z9 { p4 Z+ b7 A7 r
);
" h' g1 Y" |; q0 O. B: s if (EFI_ERROR (Status)) {/ C! ]& K; j$ g! T: _# \
return Status;
9 S1 T- a) t7 { }& C/ _/ N4 o4 l
& E, t1 Q! }8 U7 _0 r
for (Index = 0; Index < HandleCount; Index++) {/ p& E9 {) ]- r( `" s
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
7 E1 |# X7 u! d: S/ E9 e1 c } |
|