Tuesday, February 28, 2017

Analyze EFI_DRIVER_BINDING_PROTOCOL

In EfiPy_r0.1.3, new EfiPy module bFinder.py including bFinder and bOutClass is added.
Its purpose is to watch which EFI_DRIVER_BINDING_PROTOCOL.Supported() function in binding driver returns EFI_SUCCESS while application/driver calling gBS.ConnectController().

Disk\EFI\StdLib\lib\python.27\EfiPy\Analyzer\bFinder.py includes bFinder module and
Disk\EFI\Samples\ConnectScan.py is the python sample code for calling gBS.ConnectController(). It is referenced from EDKII ShellPkg\Library\UefiShellDriver1CommandsLib\Connect.c.

bFinder.finding() function in bFinder.py, it create pAnalyzer object and for filtering EFI_DRIVER_BINDING_PROTOCOL.Supported and EFI_DRIVER_BINDING_PROTOCOL.Start.

The filter function _filter_func() is used as

pAnalyzer.install("Supported", None, _filter_func)

That is, _filter_func() will be raised after EFI_DRIVER_BINDING_PROTOCOL.Supported is returned.  And no entry filter for EFI_DRIVER_BINDING_PROTOCOL.Supported() function.
In _filter_func(), output message outputs the result to bOutClass object when EFI_DRIVER_BINDING_PROTOCOL.Supported returns EFI_SUCCESS.
_filter_func() opens gEfiLoadedImageProtocolGuid to find device path of binding driver, which maybe the GUID in BIOS image or maybe the file path name in storage media.

Output Class bOutClass (inherit from dOutClass) override member function append().
bOutClass.Append() keeps dummy due to lots of EFI_DRIVER_BINDING_PROTOCOL are called when gBS.ConnectController()is called, these message can be ignored.
Instead,  bFinder uses ExtraOut() as flat output, because  bFinder needs to know which EFI_DRIVER_BINDING_PROTOCOL.Supported return EFI_SUCCESS, only.

No comments:

Post a Comment