#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>
return NULL;
}
+/**
+ * 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
*
#include <ipxe/scsi.h>
#include <ipxe/device.h>
#include <ipxe/edd.h>
+#include <ipxe/efi/efi_path.h>
#include <ipxe/fc.h>
#include <ipxe/fcels.h>
#include <ipxe/fcp.h>
/** List of active commands */
struct list_head fcpcmds;
- /** Fibre Channel WWN (for boot firmware table) */
- struct fc_name wwn;
- /** SCSI LUN (for boot firmware table) */
- struct scsi_lun lun;
+ /** Device description (for boot firmware table) */
+ struct fcp_description desc;
};
/** An FCP command */
} lun;
type->type = cpu_to_le64 ( EDD_INTF_TYPE_FIBRE );
- memcpy ( &wwn.fc, &fcpdev->wwn, sizeof ( wwn.fc ) );
+ memcpy ( &wwn.fc, &fcpdev->desc.wwn, sizeof ( wwn.fc ) );
path->fibre.wwn = be64_to_cpu ( wwn.u64 );
- memcpy ( &lun.scsi, &fcpdev->lun, sizeof ( lun.scsi ) );
+ memcpy ( &lun.scsi, &fcpdev->desc.lun, sizeof ( lun.scsi ) );
path->fibre.lun = be64_to_cpu ( lun.u64 );
return 0;
}
return identify_device ( &fcpdev->user.ulp->peer->port->transport );
}
+/**
+ * Describe as an EFI device path
+ *
+ * @v fcp FCP device
+ * @ret path EFI device path, or NULL on error
+ */
+static EFI_DEVICE_PATH_PROTOCOL *
+fcpdev_efi_describe ( struct fcp_device *fcpdev ) {
+
+ return efi_fcp_path ( &fcpdev->desc );
+}
+
/** FCP device SCSI interface operations */
static struct interface_operation fcpdev_scsi_op[] = {
INTF_OP ( scsi_command, struct fcp_device *, fcpdev_scsi_command ),
INTF_OP ( edd_describe, struct fcp_device *, fcpdev_edd_describe ),
INTF_OP ( identify_device, struct fcp_device *,
fcpdev_identify_device ),
+ EFI_INTF_OP ( efi_describe, struct fcp_device *, fcpdev_efi_describe ),
};
/** FCP device SCSI interface descriptor */
fc_ulp_attach ( ulp, &fcpdev->user );
/* Preserve parameters required for boot firmware table */
- memcpy ( &fcpdev->wwn, wwn, sizeof ( fcpdev->wwn ) );
- memcpy ( &fcpdev->lun, lun, sizeof ( fcpdev->lun ) );
+ memcpy ( &fcpdev->desc.wwn, wwn, sizeof ( fcpdev->desc.wwn ) );
+ memcpy ( &fcpdev->desc.lun, lun, sizeof ( fcpdev->desc.lun ) );
/* Attach SCSI device to parent interface */
if ( ( rc = scsi_open ( parent, &fcpdev->scsi, lun ) ) != 0 ) {