2016-05-27 20:51 GMT+03:00, Andrew Fish <[email protected]>: > >> On May 27, 2016, at 7:23 AM, valerij zaporogeci <[email protected]> >> wrote: >> >> >> Hi, there. Sorry for my english. > > I'm a native English speaker but I'm a little dyslexic so I've been known to > mangle English too. > >> I was asking questions on >> Fw_Os_Forum, but was redirected here, as it turned my questions might >> be more relevant here than there. Hope so. >> My question is about ConnectController semantics. >> The specification says: >> "If Recursive is FALSE, then this function returns after all drivers >> have been connected to ControllerHandle. If Recursive is TRUE, then >> ConnectController() is called recursively on all of the child >> controllers of ControllerHandle. The child controllers can be >> identified by searching the handle database for all the controllers >> that have opened ControllerHandle with an attribute of >> EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER" >> >> So when I were seeking child controllers I should look for those who >> have open with BY_CHILD_CONTROLLER on ControllerHandle. But which >> protocol? All installed on ControllerHandle? >> EFI_DRIVER_BINDING_PROTOCOL? >> > > 1st what are you trying to do, the answer may be different. >
You only don't laugh at me, what I'm trying to do is to implement ConnectController() as part of my UEFI implementation. And I was asking from the perspective of ConnectController() function. > The relationship is tracked by meta data associated with the handle. You can > use the EFI Boot Service OpenProtocolInformation() to get more info. You can > use LocateHandleBuffer(), ProtocolsPerHandle(), and > OpenProtocolInformation() to dump out the entire Handle/Protocol database. > The edk2 Shell has some useful commands for showing this relationship so you > might start there if you want to see the code, or you can use the shell > commands to show you the relationship. There is a spec for the UEFI Shell is > located here: http://www.uefi.org/specifications > I meant this: what protocol interface (installed on the ControllerHandle handle) ConnectController() function should check out to find its (ControllerHandle's) children (when doing recursive connection on it)? Because BY_CHILD_CONTROLLER is an attribute of a protocol interface opening on a handle. What the handle is, is clear, not so for the protocol involved. I'm sure it's easy, but only for a skilled Uefi specification guru. >> Next, I hope I understood right, but I'm not sure. Suppose >> ConnectController finds a driver in the highest precedence group, let >> it be the first - Context Override, it calls Supported() on that >> driver (handle) and it returns SUCCESS, and then it calls Start() and >> that returns SUCCESS. Should ConnectController stop trying all the >> rest candidates for ControllerHandle after that? > > I'm not sure what you are asking? From a driver point of view it should not > matter you just produce the Driver Binding Supported()/Start()/Stop(). The > UEFI spec defines the precedence rules and that is the behavior you can > depend on. When exactly Supported() gets called could be implementation > dependent. The driver that gets the Start() call is deterministic. The best > thing to do is assume Supported() gets call a lot and to be as efficient as > possible. I should write what I'm trying to do from the beginning, now you know. I was asking exactly about the behaviour of ConnectController() after Start() success. Despite it looks obvious, the specification is somewhat not clear about it, namely, when ConnectController() gets the first EFI_SUCCESS from the Start() routine of the highest possible (in the precedence order) Driver Binding protocol instance on a candidate driver handle, should ConnectController() stop trying the next driver or not? Logically it should stop, but honestly, (re)reading the specification doesn't give confidence about this. > This is the edk2 implementation of ConnectController(): > https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Hand/DriverSupport.c#L50 > Thank you, I'm sure I'd get a lot of understanding by browsing the code of an implementation. To be honest untill now I was trying to avoid doing so, trying to look only into the specification. > I'd also point out that doing a "connect all", calling ConnectController() > on all the handles in the system. Would cause a drivers Supported() routine > to get called a lot in a short period of time. > > Thanks, > > Andrew Fish > Thank you for the asnwers and the links. _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

