|
|
发表于 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。
% F* v1 d& u- r3 Y0 l! }8 F! T
! T/ a) O7 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).
" ~# X) @' N9 g# p3 b2 P f2 m6 t2 Z' m; k: Z, E1 @& |- P
UEFI 规范中connect all controller的示例程序片断:3 Q Y# W: ?/ k6 D6 x9 i% O
Status = gBS->LocateHandleBuffer (* X) \, O* k. J$ T8 f
AllHandles," j' q8 b! d( e0 ], {1 a) T/ z4 @
NULL,; ]0 o# @! z( [; \- G0 r' [5 ?1 w
NULL,
1 t2 `+ M) S q &HandleCount,
1 I2 z+ J: d9 g+ f' m/ C: z &HandleBuffer/ u* l. Y* E" F+ ]# d8 {
);0 l# Q4 r$ l. K
if (EFI_ERROR (Status)) {
! H5 {7 K2 c# M1 b. j return Status;$ B7 t& D f$ |; @) |
}
7 i+ ]+ X; o# C9 l x
7 T& B% o& G9 n& y, n) l for (Index = 0; Index < HandleCount; Index++) {
5 M9 M3 o# K1 W9 U4 U9 I g7 B Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
( W: B# v- C* f x6 ` } |
|