diff options
author | Michael Brown <mcb30@ipxe.org> | 2011-02-17 00:27:51 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2011-02-17 02:56:55 +0000 |
commit | d7736fbb7bbf2116e95742affcaf45c2a7ee5476 (patch) | |
tree | aad56a264b42dcba5e5e491e3eab8a04766a0647 /src/include/ipxe/efi | |
parent | e2b5a588691c6b0bdb99ca4b27cb8c5ea0ac712b (diff) | |
download | ipxe-d7736fbb7bbf2116e95742affcaf45c2a7ee5476.zip ipxe-d7736fbb7bbf2116e95742affcaf45c2a7ee5476.tar.gz ipxe-d7736fbb7bbf2116e95742affcaf45c2a7ee5476.tar.bz2 |
[efi] Allow EFI to control PCI bus enumeration
EFI performs its own PCI bus enumeration. Respect this, and start
controlling devices only when instructed to do so by EFI.
As a side benefit, we should now correctly create multiple SNP
instances for multi-port devices.
This should also fix the problem of failing to enumerate devices
because the PCI bridges have not yet been enabled at the time the iPXE
driver is loaded.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/efi')
-rw-r--r-- | src/include/ipxe/efi/efi.h | 1 | ||||
-rw-r--r-- | src/include/ipxe/efi/efi_driver.h | 49 | ||||
-rw-r--r-- | src/include/ipxe/efi/efi_pci.h | 40 |
3 files changed, 89 insertions, 1 deletions
diff --git a/src/include/ipxe/efi/efi.h b/src/include/ipxe/efi/efi.h index 6dca132..8a216b5 100644 --- a/src/include/ipxe/efi/efi.h +++ b/src/include/ipxe/efi/efi.h @@ -142,6 +142,5 @@ extern EFI_SYSTEM_TABLE *efi_systab; extern const char * efi_strerror ( EFI_STATUS efirc ); extern EFI_STATUS efi_init ( EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab ); -extern int efi_snp_install ( void ); #endif /* _IPXE_EFI_H */ diff --git a/src/include/ipxe/efi/efi_driver.h b/src/include/ipxe/efi/efi_driver.h new file mode 100644 index 0000000..0633164 --- /dev/null +++ b/src/include/ipxe/efi/efi_driver.h @@ -0,0 +1,49 @@ +#ifndef _IPXE_EFI_DRIVER_H +#define _IPXE_EFI_DRIVER_H + +/** @file + * + * EFI driver interface + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <ipxe/efi/efi.h> +#include <ipxe/efi/Protocol/DriverBinding.h> +#include <ipxe/efi/Protocol/ComponentName2.h> +#include <ipxe/efi/Protocol/DevicePath.h> + +/** An EFI driver */ +struct efi_driver { + /** Name */ + const char *name; + /** EFI name */ + CHAR16 *wname; + /** EFI driver binding protocol */ + EFI_DRIVER_BINDING_PROTOCOL driver; + /** EFI component name protocol */ + EFI_COMPONENT_NAME2_PROTOCOL wtf; +}; + +/** Initialise an EFI driver + * + * @v name Driver name + * @v supported Device supported method + * @v start Device start method + * @v stop Device stop method + */ +#define EFI_DRIVER_INIT( _name, _supported, _start, _stop ) { \ + .name = _name, \ + .driver = { \ + .Supported = _supported, \ + .Start = _start, \ + .Stop = _stop, \ + .Version = 0x10, \ + } } + +extern EFI_DEVICE_PATH_PROTOCOL * +efi_devpath_end ( EFI_DEVICE_PATH_PROTOCOL *path ); + +extern EFI_STATUS efi_driver_install ( struct efi_driver *efidrv ); + +#endif /* _IPXE_EFI_DRIVER_H */ diff --git a/src/include/ipxe/efi/efi_pci.h b/src/include/ipxe/efi/efi_pci.h new file mode 100644 index 0000000..e226a56 --- /dev/null +++ b/src/include/ipxe/efi/efi_pci.h @@ -0,0 +1,40 @@ +#ifndef _IPXE_EFI_PCI_H +#define _IPXE_EFI_PCI_H + +/** @file + * + * EFI driver interface + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include <ipxe/efi/efi.h> +#include <ipxe/efi/Protocol/PciIo.h> +#include <ipxe/efi/Protocol/DevicePath.h> + +struct efi_driver; +struct device; + +/** An EFI PCI device */ +struct efi_pci_device { + /** List of EFI PCI devices */ + struct list_head list; + /** iPXE PCI device */ + struct pci_device pci; + /** Underlying EFI device */ + EFI_HANDLE device; + /** PCI I/O protocol */ + EFI_PCI_IO_PROTOCOL *pci_io; + /** Device path */ + EFI_DEVICE_PATH_PROTOCOL *path; +}; + +extern struct efi_pci_device * efipci_create ( struct efi_driver *efidrv, + EFI_HANDLE device ); +extern EFI_STATUS efipci_enable ( struct efi_pci_device *efipci ); +extern struct efi_pci_device * efipci_find_efi ( EFI_HANDLE device ); +extern struct efi_pci_device * efipci_find ( struct device *dev ); +extern void efipci_destroy ( struct efi_driver *efidrv, + struct efi_pci_device *efipci ); + +#endif /* _IPXE_EFI_PCI_H */ |