|
发表于 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。3 C/ n/ I2 r/ k8 v5 E
8 ]6 w6 Z; J4 x3 m; M) t' v
对一个想管理某种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).# a" g3 [ M$ x
8 N) v% z* S9 ~- [2 H- cUEFI 规范中connect all controller的示例程序片断:
' ^, V W, f5 f& s* [' y! ?8 u Status = gBS->LocateHandleBuffer (
# s- t3 p5 |. s( u R1 H+ X AllHandles,
, j: z! T6 q7 N) }: z NULL,
. @, d6 p" X( I' a8 o NULL,
" ?; q2 U8 o; y5 k &HandleCount,
8 a* x; p1 a3 E; u1 O" k% t6 J &HandleBuffer
! N I% C2 K/ l0 P' g( L );
& o7 c5 M# M: a e% j" I3 _; A if (EFI_ERROR (Status)) {* P }6 a5 H& f) y
return Status;7 p! X- Y& `( x& u) b x6 W
}. q: s* v9 h/ n0 y {
/ c5 ^# E+ X* F; W( F2 e
for (Index = 0; Index < HandleCount; Index++) {% C$ S: P* A! c% `7 {; f- b) M4 F
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);. G$ f. K% ^4 t) a3 _6 k. F
} |
|