[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

@@ -17,9 +17,17 @@ static inline EFIAPI uint64_t LShiftU64 ( UINT64 value, UINTN shift ) {
return ( value << shift );
}
/** An EFI PCI device */
struct efi_pci_device {
/** PCI device */
struct pci_device pci;
/** PCI I/O protocol */
EFI_PCI_IO_PROTOCOL *io;
};
extern int efipci_open ( EFI_HANDLE device, UINT32 attributes,
struct pci_device *pci );
struct efi_pci_device *efipci );
extern void efipci_close ( EFI_HANDLE device );
extern int efipci_info ( EFI_HANDLE device, struct pci_device *pci );
extern int efipci_info ( EFI_HANDLE device, struct efi_pci_device *efipci );
#endif /* _IPXE_EFI_PCI_H */