|
|
发表于 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 o0 b( A1 l$ j) s9 k' N. f% v$ S4 N7 n/ ^
对一个想管理某种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).
0 x( _' J; j1 Z, F3 g# J6 L, C9 D- t" `% d$ B2 |2 B
UEFI 规范中connect all controller的示例程序片断:$ L6 d) X* o* y1 r
Status = gBS->LocateHandleBuffer ( t/ `8 ], P+ g$ ^
AllHandles,4 A$ ^) F! G% L* E5 V9 [
NULL,; E; n0 }: e$ g T
NULL,6 Q$ \# _" V' [" r- E" q4 n
&HandleCount,- M4 t. c- G% _3 a8 z; B+ T* W; @ V
&HandleBuffer
I. d6 F- c7 g4 h/ y );( @( R6 P/ h8 j
if (EFI_ERROR (Status)) {
8 I2 T. G( I' [; r7 G+ } return Status;6 g; m5 C0 a- a$ d& v, G
}
" W' h% U8 U( L, D F
$ v' F& Y: ~7 z2 i$ N& d. K! D for (Index = 0; Index < HandleCount; Index++) {
2 X/ V, e1 R* i Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
) J8 u# `0 D" @. h0 T) w } |
|