On Feb 26, 2013, at 9:40 AM, Andrew Fish <[email protected]> wrote:

>> Hi All,
>> 
>> what I learnt?
>> PCI Bus driver enums PCI bus for PCI devices, checks Oprom is there, check 
>> Oprom header, checks UEFI driver and if yes loads it into RAM.  StartImage 
>> calls Drivers entry point & it exits successfully with driver in RAM.
>> 
>> 
>> I have one query related to supporting multiple controllers in my driver. 
>> 

I missed this side of the question in my previous answer. 

Your driver gets connected (Driver Binding Start() function is called) to a 
handle that contains a PCI IO protocol instance that represents a PCI device. 
Your driver should only connect to that device. Your Start() function will get 
called for every PCI device you need to manage. So as long as you don't do 
something like use a single instance global variable your driver should not 
have any problems supporting multiple PCI devices. 

If you want to know which driver will get connected, the algorithm is defined 
in the UEFI spec, under the ConnectController() Boot Service: 

This functions uses five precedence rules when deciding the order that drivers 
are tested against controllers. These five rules from highest precedence to 
lowest precedence are as follows:
1. Context Override : DriverImageHandle is an ordered list of handles that 
support the EFI_DRIVER_BINDING_PROTOCOL. The highest priority image handle is 
the first element of the list, and the lowest priority image handle is the last 
element of the list. The list is terminated with a NULL image handle.
2. Platform Driver Override : If an EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL 
instance is present in the system, then the GetDriver() service of this 
protocol is used to retrieve an ordered list of image handles for 
ControllerHandle. From this list, the image handles found in rule (1) above are 
removed. The first image handle returned from GetDriver() has the highest 
precedence, and the last image handle returned from GetDriver() has the lowest 
precedence. The ordered list is terminated when GetDriver() returns 
EFI_NOT_FOUND. It is legal for no image handles to be returned by GetDriver(). 
There can be at most a single instance in the system of the 
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL. If there is more than one, then the 
system behavior is not deterministic.
3. Driver Family Override Search : The list of available driver image handles 
can be found by using the boot service LocateHandle()with a SearchType of 
ByProtocol for the GUID of the EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL. From this 
list, the image handles found in rules (1), and (2) above are removed. The 
remaining image handles are sorted from highest to lowest based on the value 
returned from the GetVersion() function of the 
EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL associated with each image handle.
4. Bus Specific Driver Override : If there is an instance of the 
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL attached to ControllerHandle, then 
the GetDriver() service of this protocol is used to retrieve an ordered list of 
image handle for ControllerHandle. From this list, the image handles found in 
rules (1), (2), and (3) above are removed. The first image handle returned from 
GetDriver() has the highest precedence, and the last image handle returned from 
GetDriver() has the lowest precedence. The ordered list is terminated when 
GetDriver() returns EFI_NOT_FOUND. It is legal for no image handles to be 
returned by GetDriver().
5. Driver Binding Search : The list of available driver image handles can be 
found by using the boot service LocateHandle() with a SearchType of ByProtocol 
for the GUID of the EFI_DRIVER_BINDING_PROTOCOL. From this list, the image 
handles found in rules (1), (2), (3), and (4) above are removed. The remaining 
image handles are sorted from highest to lowest based on the Version field of 
the EFI_DRIVER_BINDING_PROTOCOL instance associated with each image handle.


>> Query?
>> Is same thing applicable for all HBA the in the system or UEFI drivers for 
>> devices only in boot path will be executed and it is decided in BDS phase?
>> 
> 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to