|
|
发表于 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。
! O+ G& V8 ^& P4 w5 S. A; u& H- e% f- o0 l: x; |: R4 T6 s
对一个想管理某种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).2 o* _$ L" P3 d3 M
; C3 ?- {. W7 {0 g. s" ^UEFI 规范中connect all controller的示例程序片断:
3 G B/ N. r( _ Q$ j n6 u: } Status = gBS->LocateHandleBuffer (9 j/ O' |1 m9 ]9 |$ P* S+ z
AllHandles,
9 N4 T2 D4 i: B& A, \. @ NULL,
$ g$ b: M3 a F6 B$ {! H ~0 V NULL,# ]* r2 ^, K/ l( ]+ w8 u
&HandleCount,; n5 X( K* a# L7 S- b, X5 ]
&HandleBuffer( W7 K+ R* I) g
);
3 I4 a8 Q& Y- J if (EFI_ERROR (Status)) {& O- g8 l9 W6 f* C0 ]; r( y! Q* g
return Status;
" v4 \0 C5 S; {9 s' Z: _/ z; z5 [ }% W4 H2 A i" M
7 X( |, K0 S+ T0 f* Z& |- B8 p
for (Index = 0; Index < HandleCount; Index++) {
' o1 m# u% g( e6 y. y/ C, V Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);" r0 y9 d' D x* [* E- |
} |
|