|
|
发表于 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。, ^. u( h$ f6 I6 Q$ _2 f
/ o& d. `* k, ^- d* D
对一个想管理某种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 `8 S8 c, a# W& G8 e
* f e$ @0 Q; ~+ @% Z5 _UEFI 规范中connect all controller的示例程序片断:
" ^4 z/ Y8 i$ K- L: D6 N& Y Status = gBS->LocateHandleBuffer (
0 [8 N, R% K4 t: `* Q1 K AllHandles,& C6 k7 |* L! m4 Y8 {" @
NULL,
: V$ R* v7 U s7 Y7 I/ H. x# | NULL,
P1 r, A! n) k: m9 B) b. ]9 F7 | &HandleCount,
+ q4 S* k0 ^, x8 s+ L' x, m( { &HandleBuffer. f. B( H/ E( L4 J
);
2 P4 V4 j' W! w! W if (EFI_ERROR (Status)) {. p9 X4 t4 ]$ O
return Status;
) s! Z d5 z$ s5 s; `" A( I" ?+ q* a }
% ]3 x% }- w0 u; C" ~# @/ S+ p2 j8 ~
for (Index = 0; Index < HandleCount; Index++) {
% K9 N# m6 |9 M- k/ x# K Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);, D! K9 q# g' v% s
} |
|