[efi] Retain a long-lived reference to the EFI_PCI_IO_PROTOCOL instance

Provide opened EFI PCI devices with access to the underlying
EFI_PCI_IO_PROTOCOL instance, in order to facilitate the future use of
the DMA mapping methods within the fast data path.

Do not require the use of this stored EFI_PCI_IO_PROTOCOL instance for
memory-mapped I/O (since the entire point of memory-mapped I/O as a
concept is to avoid this kind of unnecessary complexity) or for
slow-path PCI configuration space accesses (since these may be
required for access to PCI bus:dev.fn addresses that do not correspond
to a device bound via our driver binding protocol instance).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2020-11-04 15:08:48 +00:00
parent f560e7b70b
commit 36dde9b0bf
4 changed files with 60 additions and 49 deletions

View File

@@ -145,7 +145,7 @@ void efi_child_del ( EFI_HANDLE parent, EFI_HANDLE child ) {
static int efi_pci_info ( EFI_HANDLE device, const char *prefix,
struct device *dev ) {
EFI_HANDLE pci_device;
struct pci_device pci;
struct efi_pci_device efipci;
int rc;
/* Find parent PCI device */
@@ -157,16 +157,16 @@ static int efi_pci_info ( EFI_HANDLE device, const char *prefix,
}
/* Get PCI device information */
if ( ( rc = efipci_info ( pci_device, &pci ) ) != 0 ) {
if ( ( rc = efipci_info ( pci_device, &efipci ) ) != 0 ) {
DBGC ( device, "EFIDEV %s could not get PCI information: %s\n",
efi_handle_name ( device ), strerror ( rc ) );
return rc;
}
/* Populate device information */
memcpy ( &dev->desc, &pci.dev.desc, sizeof ( dev->desc ) );
memcpy ( &dev->desc, &efipci.pci.dev.desc, sizeof ( dev->desc ) );
snprintf ( dev->name, sizeof ( dev->name ), "%s-%s",
prefix, pci.dev.name );
prefix, efipci.pci.dev.name );
return 0;
}