summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_path.c
diff options
context:
space:
mode:
authorMichael Brown2020-10-19 15:42:11 +0200
committerMichael Brown2020-10-19 15:45:49 +0200
commit04cb17de505317db56623b8b4d07b242dec35256 (patch)
treef5dbde17ed38df51f3c47c173c2466a42c0dd9a4 /src/interface/efi/efi_path.c
parent[efi] Provide utility function to concatenate device paths (diff)
downloadipxe-04cb17de505317db56623b8b4d07b242dec35256.tar.gz
ipxe-04cb17de505317db56623b8b4d07b242dec35256.tar.xz
ipxe-04cb17de505317db56623b8b4d07b242dec35256.zip
[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/efi/efi_path.c')
-rw-r--r--src/interface/efi/efi_path.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/interface/efi/efi_path.c b/src/interface/efi/efi_path.c
index 3c8a3be5..8636c965 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