|
|
发表于 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 e0 ~% J2 m# D+ h+ u: U! T9 E8 a5 M" P) r6 H
对一个想管理某种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)., T. l2 W5 Z! N) z+ m
3 ~, ?7 y6 @, c: z5 [
UEFI 规范中connect all controller的示例程序片断:5 _; Y# g6 }7 W
Status = gBS->LocateHandleBuffer (
" @4 t. C* B9 ] AllHandles,
; i- s' T% k `8 W* E. O/ R0 @ NULL,0 n) }6 F6 R" Q# Z i
NULL,
, @/ g$ r' V7 \ _6 v &HandleCount,+ Z* X) E* ~) _1 d3 }
&HandleBuffer9 ^8 h2 g5 F* n$ }* c
);& `2 P8 r' [; n: w5 H
if (EFI_ERROR (Status)) {
, c# I2 _, H+ t' h& P return Status;4 k7 h$ g/ V4 f
}
: t- T' }7 h( n2 j" Y/ E$ V
% R( ~0 X! X% J1 m' N4 r for (Index = 0; Index < HandleCount; Index++) {0 ?( P( [4 {; V! Y
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);2 S- |9 ^% n, N, P$ {- c
} |
|