|
发表于 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。
$ M# J, d# {& S* c) i0 i% o3 ] C, h8 N& ~1 [" F9 k9 F$ g I
对一个想管理某种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).
, h. o* `1 e: l! d2 ~) a9 ?
( ]% C0 o' [; Z7 MUEFI 规范中connect all controller的示例程序片断:+ V0 q ?/ l9 m
Status = gBS->LocateHandleBuffer (
3 H2 I0 e$ x5 W, c2 A2 w AllHandles,
! `2 L; z2 Y8 s/ U NULL,
' Z/ n% V8 `7 @+ F) C NULL,
. N# J/ m: N, D/ G E/ m &HandleCount,7 n1 ^( `: V2 X- d: g
&HandleBuffer
# u) c5 F" {- G# d2 c9 H );
2 m7 x6 H9 g. ]& Y! ? if (EFI_ERROR (Status)) {) y+ s$ ?# T0 ?
return Status;& I; m$ o# _4 j! |) w
}
/ z( b2 W' e4 U2 X8 P+ \. U1 ]) [& ]+ x3 I. T
for (Index = 0; Index < HandleCount; Index++) {, G! S4 ~3 m8 X$ Y8 ]& M4 h
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);: r- E! L5 \- u3 S( P
} |
|