|
|
发表于 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 s, J, T8 Q) n, X) b* z
# l) C! O; B) x
对一个想管理某种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).+ ~6 \& f8 u0 R0 Q! G2 j4 l$ {
9 e3 v4 u B) M' ]' Y& F
UEFI 规范中connect all controller的示例程序片断:
- t" L/ L$ e; ~2 T# Q Status = gBS->LocateHandleBuffer (
- y: N; j. p' V1 N4 V, F AllHandles,6 c3 b$ l5 Z+ R/ `; Y( { _
NULL,- C$ a( T! T+ Q, o& D! d) ]! V& a
NULL,7 |; r2 f. ~, @1 }
&HandleCount,
; J# T) r( v4 D5 E$ [1 C &HandleBuffer9 E4 E8 u) [5 M. n+ U; v: K/ C
);
; U* D# l" l* J$ W if (EFI_ERROR (Status)) {
) q) c2 V4 @3 y9 d2 |( K return Status;* Z. `" t U; c8 o; S9 u
}+ n8 m" O# L! D# l; P+ k
. x- `) K: f3 u4 ~7 _
for (Index = 0; Index < HandleCount; Index++) {. [5 y# ~, B6 o, E" K* }2 r$ \% W
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
8 I7 @" O# D3 y% G } |
|