|
|
发表于 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。
) T5 P& l3 ~0 G- \+ @4 B: J4 v# e; Y: f! B8 i+ j
对一个想管理某种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).
! P3 v( s' t% E" C3 I/ R4 m3 s. _
1 ]* S4 I/ T! o0 _. h) iUEFI 规范中connect all controller的示例程序片断:; l @$ i/ D* q- f7 l+ y+ k5 _/ l
Status = gBS->LocateHandleBuffer (
) U, g# N7 B7 b+ V AllHandles,3 X8 a% c. d5 z; @5 N) U; s# M( b
NULL,8 P6 ~3 S8 |3 i s
NULL,
, u& ]$ F: r {4 ~" a6 Y! I &HandleCount,
+ B8 b( H) g2 {9 K &HandleBuffer# Y" s1 e( }- Q3 r
);
0 d% }% L- H8 H- _( s0 \ if (EFI_ERROR (Status)) {
6 R. F2 ?. a, c return Status;
6 {- {2 u; {/ W6 B5 J& p7 w& @ }
& }! a7 l9 Y7 x0 c* @# q! h# Y
9 a- r( {" F2 k' `2 Y E1 a" ` for (Index = 0; Index < HandleCount; Index++) {
+ M# ]8 t4 b9 o" p Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);2 K# n, @$ b: ^! r
} |
|