diff options
author | Michael Brown <mcb30@ipxe.org> | 2020-10-19 14:42:11 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2020-10-19 14:45:49 +0100 |
commit | 04cb17de505317db56623b8b4d07b242dec35256 (patch) | |
tree | f5dbde17ed38df51f3c47c173c2466a42c0dd9a4 /src/interface | |
parent | 2d49ce6f08002d9e92c2ba819c65a8b093e975f4 (diff) | |
download | ipxe-04cb17de505317db56623b8b4d07b242dec35256.zip ipxe-04cb17de505317db56623b8b4d07b242dec35256.tar.gz ipxe-04cb17de505317db56623b8b4d07b242dec35256.tar.bz2 |
[aoe] Allow AoE device to be described using an EFI device path
There is no standard defined for AoE device paths in the UEFI
specification, and it seems unlikely that any standard will be adopted
in future.
Choose to construct an AoE device path using a concatenation of the
network device path and a SATA device path, treating the AoE major and
minor numbers as the HBA port number and port multiplier port number
respectively.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r-- | src/interface/efi/efi_path.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/interface/efi/efi_path.c b/src/interface/efi/efi_path.c index 3c8a3be..8636c96 100644 --- a/src/interface/efi/efi_path.c +++ b/src/interface/efi/efi_path.c @@ -24,6 +24,7 @@ #include <ipxe/netdevice.h> #include <ipxe/vlan.h> #include <ipxe/uri.h> +#include <ipxe/aoe.h> #include <ipxe/usb.h> #include <ipxe/efi/efi.h> #include <ipxe/efi/efi_driver.h> @@ -221,6 +222,52 @@ EFI_DEVICE_PATH_PROTOCOL * efi_uri_path ( struct uri *uri ) { } /** + * Construct EFI device path for AoE device + * + * @v aoedev AoE device + * @ret path EFI device path, or NULL on error + */ +EFI_DEVICE_PATH_PROTOCOL * efi_aoe_path ( struct aoe_device *aoedev ) { + struct { + SATA_DEVICE_PATH sata; + EFI_DEVICE_PATH_PROTOCOL end; + } satapath; + EFI_DEVICE_PATH_PROTOCOL *netpath; + EFI_DEVICE_PATH_PROTOCOL *path; + + /* Get network device path */ + netpath = efi_netdev_path ( aoedev->netdev ); + if ( ! netpath ) + goto err_netdev; + + /* Construct SATA path */ + memset ( &satapath, 0, sizeof ( satapath ) ); + satapath.sata.Header.Type = MESSAGING_DEVICE_PATH; + satapath.sata.Header.SubType = MSG_SATA_DP; + satapath.sata.Header.Length[0] = sizeof ( satapath.sata ); + satapath.sata.HBAPortNumber = aoedev->major; + satapath.sata.PortMultiplierPortNumber = aoedev->minor; + satapath.end.Type = END_DEVICE_PATH_TYPE; + satapath.end.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; + satapath.end.Length[0] = sizeof ( satapath.end ); + + /* Construct overall device path */ + path = efi_paths ( netpath, &satapath, NULL ); + if ( ! path ) + goto err_paths; + + /* Free temporary paths */ + free ( netpath ); + + return path; + + err_paths: + free ( netpath ); + err_netdev: + return NULL; +} + +/** * Construct EFI device path for USB function * * @v func USB function |