]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Allow for drivers to be located via child handles
authorMichael Brown <mcb30@ipxe.org>
Fri, 22 Mar 2024 16:50:13 +0000 (16:50 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 25 Mar 2024 17:58:33 +0000 (17:58 +0000)
commitda5188f3ea73900f1c6a4e44a8345b48320d396f
treed9adcce6a6b91145a2b34f91132d7bfe9d521d1b
parentca483a196c091c16ea0a426ce5f915b184a34412
[efi] Allow for drivers to be located via child handles

When using a service binding protocol, CreateChild() will create a new
protocol instance (and optionally a new handle).  The caller will then
typically open this new protocol instance with BY_DRIVER attributes,
since the service binding mechanism has no equivalent of the driver
binding protocol's Stop() method, and there is therefore no other way
for the caller to be informed if the protocol instance is about to
become invalid (e.g. because the service driver wants to remove the
child).

The caller cannot ask CreateChild() to install the new protocol
instance on the original handle (i.e. the service binding handle),
since the whole point of the service binding protocol is to allow for
the existence of multiple children, and UEFI does not permit multiple
instances of the same protocol to be installed on a handle.

Our current drivers all open the original handle (as passed to our
driver binding's Start() method) with BY_DRIVER attributes, and so the
same handle will be passed to our Stop() method.  This changes when
our driver must use a separate handle, as described above.

Add an optional "child handle" field to struct efi_device (on the
assumption that we will not have any drivers that need to create
multiple children), and generalise efidev_find() to match on either
the original handle or the child handle.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/efi/efi_driver.h
src/interface/efi/efi_driver.c