summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_path.c
diff options
context:
space:
mode:
authorMichael Brown2020-10-22 15:01:27 +0200
committerMichael Brown2020-10-22 15:16:55 +0200
commitbf051a76eef07bb4bd04ad4ff2b8b5e23ef26740 (patch)
tree0b479c39ade7f5f34e9be868a0c229a788dc48b0 /src/interface/efi/efi_path.c
parent[iscsi] Allow iSCSI device to be described using an EFI device path (diff)
downloadipxe-bf051a76eef07bb4bd04ad4ff2b8b5e23ef26740.tar.gz
ipxe-bf051a76eef07bb4bd04ad4ff2b8b5e23ef26740.tar.xz
ipxe-bf051a76eef07bb4bd04ad4ff2b8b5e23ef26740.zip
[fcp] Allow Fibre Channel device to be described using an EFI device path
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.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/interface/efi/efi_path.c b/src/interface/efi/efi_path.c
index 3c14a2ee..76b1e4da 100644
--- a/src/interface/efi/efi_path.c
+++ b/src/interface/efi/efi_path.c
@@ -27,6 +27,7 @@
#include <ipxe/uri.h>
#include <ipxe/iscsi.h>
#include <ipxe/aoe.h>
+#include <ipxe/fcp.h>
#include <ipxe/usb.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
@@ -338,6 +339,36 @@ EFI_DEVICE_PATH_PROTOCOL * efi_aoe_path ( struct aoe_device *aoedev ) {
}
/**
+ * Construct EFI device path for Fibre Channel device
+ *
+ * @v desc FCP device description
+ * @ret path EFI device path, or NULL on error
+ */
+EFI_DEVICE_PATH_PROTOCOL * efi_fcp_path ( struct fcp_description *desc ) {
+ struct {
+ FIBRECHANNELEX_DEVICE_PATH fc;
+ EFI_DEVICE_PATH_PROTOCOL end;
+ } __attribute__ (( packed )) *path;
+
+ /* Allocate device path */
+ path = zalloc ( sizeof ( *path ) );
+ if ( ! path )
+ return NULL;
+
+ /* Construct device path */
+ path->fc.Header.Type = MESSAGING_DEVICE_PATH;
+ path->fc.Header.SubType = MSG_FIBRECHANNELEX_DP;
+ path->fc.Header.Length[0] = sizeof ( path->fc );
+ memcpy ( path->fc.WWN, &desc->wwn, sizeof ( path->fc.WWN ) );
+ memcpy ( path->fc.Lun, &desc->lun, sizeof ( path->fc.Lun ) );
+ path->end.Type = END_DEVICE_PATH_TYPE;
+ path->end.SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
+ path->end.Length[0] = sizeof ( path->end );
+
+ return &path->fc.Header;
+}
+
+/**
* Construct EFI device path for USB function
*
* @v func USB function