|
|
发表于 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。! _* R1 b+ K) z
6 Q& d5 m& L/ O4 s! X1 }( q
对一个想管理某种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). `4 E {' D1 @% H* n4 j4 l
7 n( T4 m" t0 Y) y
UEFI 规范中connect all controller的示例程序片断:
6 w9 N+ \5 E% y! F7 }4 g( a, Z Status = gBS->LocateHandleBuffer (
6 I+ y6 W5 ^$ @4 w5 V: O AllHandles,
) R; n: e# I- O- v" w) H5 e NULL,: A, o/ e7 ^& r
NULL,7 E. b( H7 ]4 ?5 @6 ]3 a$ b$ |
&HandleCount,
?9 ~+ R: `5 e &HandleBuffer
3 C- A( C% {3 U' X) ]% x; a );- ]# Z6 }) y7 W' R3 C9 j
if (EFI_ERROR (Status)) {4 R0 W# e- E# b# U8 V1 h# S5 U
return Status;) Y5 ^3 | k% f. l' [
}
; s/ k( I4 x$ F( g6 N p2 @4 p3 U5 f, j
for (Index = 0; Index < HandleCount; Index++) {
* u8 K9 e I& P( [0 i2 N2 w Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);# Z% E1 a& k' w5 r6 K
} |
|