|
|
发表于 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 u: U' D* O
) o+ T" K9 n4 a k% t3 [; b
对一个想管理某种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).
! H2 y, W) i8 R: m( K% c" M5 t' A, V8 M% X
UEFI 规范中connect all controller的示例程序片断:
2 M4 u3 O, r' R6 A Status = gBS->LocateHandleBuffer (
, y# p$ t) @0 d; z# G/ A AllHandles,
, W$ G: D& q+ w1 K NULL,) H% W4 B3 ~# p K
NULL,% N& D; Z# @- ]: a) e
&HandleCount,
+ T6 V9 d J% g- ~" N &HandleBuffer
6 c6 G, Y- p/ J );
5 I* {% S4 a" O. G3 q' | if (EFI_ERROR (Status)) {
9 x; c' E% b/ r+ [* l' ^( t return Status;9 ~0 |& K7 t6 ? R; F
}5 |* [$ c/ @+ [ C+ s" G
% a+ h) f+ L) Q( `$ I for (Index = 0; Index < HandleCount; Index++) {- k+ z q* U* Q/ E
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
5 |. a9 j7 L; d; \ } |
|