|
|
发表于 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。
' W5 N2 ~: x( [5 ^! R; f2 Q9 `- f8 \0 l4 z3 W k( V2 Y
对一个想管理某种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).0 F+ j% b. @5 u0 Q+ l/ h. U
' r# Q- r! Y% q1 \: N/ q. E) LUEFI 规范中connect all controller的示例程序片断:' j9 i& Y% o5 N% J; O
Status = gBS->LocateHandleBuffer (/ F+ K% F% g, J4 W* h5 O
AllHandles,
2 e/ c/ n4 v. E NULL,& U! C0 z4 s* b: l% m( M
NULL,
& a h6 L$ {( U+ U! L &HandleCount,
; m% ? j4 [" K- l8 U &HandleBuffer, X! u! z: X& x4 j8 W: @9 z
);
3 y$ y7 \: O; Y1 o" z. [ if (EFI_ERROR (Status)) {
/ s' |) Z" a% h' h! ^, j* D( K return Status;! S& ~- t1 F1 [. C: m# s& k
}
1 E$ d% q: j; t! h, Q2 Z3 D" b" L6 Y/ C+ o3 c" f8 E
for (Index = 0; Index < HandleCount; Index++) {7 ]" S- i$ y: d$ n: T; L5 a
Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
5 b, d! s2 b+ V' m. h- ] } |
|