iPXE
Data Structures | Defines | Enumerations | Functions | Variables
ib_srp.c File Reference

SCSI RDMA Protocol over Infiniband. More...

#include <stdlib.h>
#include <errno.h>
#include <ipxe/interface.h>
#include <ipxe/uri.h>
#include <ipxe/open.h>
#include <ipxe/base16.h>
#include <ipxe/acpi.h>
#include <ipxe/srp.h>
#include <ipxe/infiniband.h>
#include <ipxe/ib_cmrc.h>
#include <ipxe/ib_srp.h>

Go to the source code of this file.

Data Structures

struct  ipxe_ib_sbft
 An IB SRP sBFT created by iPXE. More...
struct  ib_srp_device
 An Infiniband SRP device. More...
struct  ib_srp_root_path
 IB SRP root path parameters. More...
struct  ib_srp_root_path_parser
 IB SRP root path component parser. More...

Defines

#define EINVAL_BYTE_STRING_LEN   __einfo_error ( EINFO_EINVAL_BYTE_STRING_LEN )
#define EINFO_EINVAL_BYTE_STRING_LEN
#define EINVAL_INTEGER   __einfo_error ( EINFO_EINVAL_INTEGER )
#define EINFO_EINVAL_INTEGER
#define EINVAL_RP_TOO_SHORT   __einfo_error ( EINFO_EINVAL_RP_TOO_SHORT )
#define EINFO_EINVAL_RP_TOO_SHORT
#define IB_SRP_NUM_RP_COMPONENTS   ( sizeof ( ib_srp_rp_parser ) / sizeof ( ib_srp_rp_parser[0] ) )
 Number of IB SRP root path components.

Enumerations

enum  ib_srp_parse_flags { IB_SRP_PARSE_REQUIRED = 0x0000, IB_SRP_PARSE_OPTIONAL = 0x8000, IB_SRP_PARSE_FLAG_MASK = 0xf000 }
 IB SRP parse flags. More...

Functions

 FILE_LICENCE (BSD2)
static void ib_srp_free (struct refcnt *refcnt)
 Free IB SRP device.
static void ib_srp_close (struct ib_srp_device *ib_srp, int rc)
 Close IB SRP device.
static struct acpi_descriptorib_srp_describe (struct ib_srp_device *ib_srp)
 Get IB SRP ACPI descriptor.
static int ib_srp_open (struct interface *block, struct ib_device *ibdev, union ib_gid *dgid, union ib_guid *service_id, union srp_port_id *initiator, union srp_port_id *target, struct scsi_lun *lun)
 Open IB SRP device.
static int ib_srp_parse_byte_string (const char *rp_comp, uint8_t *bytes, unsigned int size_flags)
 Parse IB SRP root path byte-string value.
static int ib_srp_parse_integer (const char *rp_comp, int default_value)
 Parse IB SRP root path integer value.
static int ib_srp_parse_sgid (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path source GID.
static int ib_srp_parse_initiator_id_ext (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path initiator identifier extension.
static int ib_srp_parse_initiator_hca_guid (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path initiator HCA GUID.
static int ib_srp_parse_dgid (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path destination GID.
static int ib_srp_parse_pkey (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path partition key.
static int ib_srp_parse_service_id (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path service ID.
static int ib_srp_parse_lun (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path LUN.
static int ib_srp_parse_target_id_ext (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path target identifier extension.
static int ib_srp_parse_target_ioc_guid (const char *rp_comp, struct ib_srp_root_path *rp)
 Parse IB SRP root path target I/O controller GUID.
static int ib_srp_parse_root_path (const char *rp_string, struct ib_srp_root_path *rp)
 Parse IB SRP root path.
static int ib_srp_open_uri (struct interface *parent, struct uri *uri)
 Open IB SRP URI.
static int ib_sbft_complete (struct acpi_descriptor *desc __unused)
 Check if IB SRP boot firmware table descriptor is complete.
static int ib_sbft_install (int(*install)(struct acpi_header *acpi))
 Install IB SRP boot firmware table(s)

Variables

struct acpi_model ib_sbft_model __acpi_model
 IB sBFT model.
static struct interface_operation ib_srp_cmrc_op []
 IB SRP CMRC interface operations.
static struct interface_descriptor ib_srp_cmrc_desc
 IB SRP CMRC interface descriptor.
static struct interface_operation ib_srp_srp_op []
 IB SRP SRP interface operations.
static struct interface_descriptor ib_srp_srp_desc
 IB SRP SRP interface descriptor.
static struct
ib_srp_root_path_parser 
ib_srp_rp_parser []
 IB SRP root path components.
struct uri_opener ib_srp_uri_opener __uri_opener
 IB SRP URI opener.

Detailed Description

SCSI RDMA Protocol over Infiniband.

Definition in file ib_srp.c.


Define Documentation

Definition at line 53 of file ib_srp.c.

Referenced by ib_srp_parse_byte_string().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x01, "Invalid byte string length" )

Definition at line 54 of file ib_srp.c.

Definition at line 56 of file ib_srp.c.

Referenced by ib_srp_parse_integer().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x03, "Invalid integer" )

Definition at line 57 of file ib_srp.c.

Definition at line 59 of file ib_srp.c.

Referenced by ib_srp_parse_root_path().

Value:
__einfo_uniqify \
        ( EINFO_EINVAL, 0x04, "Root path too short" )

Definition at line 60 of file ib_srp.c.

#define IB_SRP_NUM_RP_COMPONENTS   ( sizeof ( ib_srp_rp_parser ) / sizeof ( ib_srp_rp_parser[0] ) )

Number of IB SRP root path components.

Definition at line 488 of file ib_srp.c.

Referenced by ib_srp_parse_root_path().


Enumeration Type Documentation

IB SRP parse flags.

Enumerator:
IB_SRP_PARSE_REQUIRED 
IB_SRP_PARSE_OPTIONAL 
IB_SRP_PARSE_FLAG_MASK 

Definition at line 242 of file ib_srp.c.


Function Documentation

FILE_LICENCE ( BSD2  )
static void ib_srp_free ( struct refcnt refcnt) [static]

Free IB SRP device.

Parameters:
refcntReference count

Definition at line 110 of file ib_srp.c.

References container_of, free, ib_srp_device::ibdev, and ibdev_put().

Referenced by ib_srp_open().

                                                  {
        struct ib_srp_device *ib_srp =
                container_of ( refcnt, struct ib_srp_device, refcnt );

        ibdev_put ( ib_srp->ibdev );
        free ( ib_srp );
}
static void ib_srp_close ( struct ib_srp_device ib_srp,
int  rc 
) [static]

Close IB SRP device.

Parameters:
ib_srpIB SRP device
rcReason for close

Definition at line 124 of file ib_srp.c.

References ib_srp_device::cmrc, intf_shutdown(), and ib_srp_device::srp.

Referenced by ib_srp_open().

                                                                  {

        /* Shut down interfaces */
        intf_shutdown ( &ib_srp->cmrc, rc );
        intf_shutdown ( &ib_srp->srp, rc );
}
static struct acpi_descriptor* ib_srp_describe ( struct ib_srp_device ib_srp) [static, read]

Get IB SRP ACPI descriptor.

Parameters:
ib_srpIB SRP device
Return values:
descACPI descriptor

Definition at line 138 of file ib_srp.c.

References ib_srp_device::desc.

                                                 {

        return &ib_srp->desc;
}
static int ib_srp_open ( struct interface block,
struct ib_device ibdev,
union ib_gid dgid,
union ib_guid service_id,
union srp_port_id initiator,
union srp_port_id target,
struct scsi_lun lun 
) [static]

Open IB SRP device.

Parameters:
blockBlock control interface
ibdevInfiniband device
dgidDestination GID
service_idService ID
initiatorInitiator port ID
targetTarget port ID
lunSCSI LUN
Return values:
rcReturn status code

Definition at line 174 of file ib_srp.c.

References acpi_init(), ib_srp_device::cmrc, DBGC, ib_srp_device::desc, sbft_ib_subtable::dgid, ENOMEM, ipxe_ib_sbft::ib, ib_cmrc_open(), IB_GID_ARGS, IB_GID_FMT, IB_GUID_ARGS, IB_GUID_FMT, ib_srp_close(), ib_srp_free(), ib_srp_device::ibdev, ibdev_get(), sbft_srp_subtable::initiator, intf_init(), sbft_scsi_subtable::lun, memcpy(), rc, ib_device::rdma_key, ref_init, ref_put, ib_srp_device::refcnt, ib_srp_device::sbft, ipxe_ib_sbft::scsi, sbft_ib_subtable::service_id, ipxe_ib_sbft::srp, ib_srp_device::srp, srp_open(), strerror(), sbft_srp_subtable::target, and zalloc().

Referenced by ib_srp_open_uri().

                                                                           {
        struct ib_srp_device *ib_srp;
        struct ipxe_ib_sbft *sbft;
        int rc;

        /* Allocate and initialise structure */
        ib_srp = zalloc ( sizeof ( *ib_srp ) );
        if ( ! ib_srp ) {
                rc = -ENOMEM;
                goto err_zalloc;
        }
        ref_init ( &ib_srp->refcnt, ib_srp_free );
        intf_init ( &ib_srp->srp, &ib_srp_srp_desc, &ib_srp->refcnt );
        intf_init ( &ib_srp->cmrc, &ib_srp_cmrc_desc, &ib_srp->refcnt );
        ib_srp->ibdev = ibdev_get ( ibdev );
        acpi_init ( &ib_srp->desc, &ib_sbft_model, &ib_srp->refcnt );
        DBGC ( ib_srp, "IBSRP %p for " IB_GID_FMT " " IB_GUID_FMT "\n",
               ib_srp, IB_GID_ARGS ( dgid ), IB_GUID_ARGS ( service_id ) );

        /* Preserve parameters required for boot firmware table */
        sbft = &ib_srp->sbft;
        memcpy ( &sbft->scsi.lun, lun, sizeof ( sbft->scsi.lun ) );
        memcpy ( &sbft->srp.initiator, initiator,
                 sizeof ( sbft->srp.initiator ) );
        memcpy ( &sbft->srp.target, target, sizeof ( sbft->srp.target ) );
        memcpy ( &sbft->ib.dgid, dgid, sizeof ( sbft->ib.dgid ) );
        memcpy ( &sbft->ib.service_id, service_id,
                 sizeof ( sbft->ib.service_id ) );

        /* Open CMRC socket */
        if ( ( rc = ib_cmrc_open ( &ib_srp->cmrc, ibdev, dgid,
                                   service_id, "SRP" ) ) != 0 ) {
                DBGC ( ib_srp, "IBSRP %p could not open CMRC socket: %s\n",
                       ib_srp, strerror ( rc ) );
                goto err_cmrc_open;
        }

        /* Attach SRP device to parent interface */
        if ( ( rc = srp_open ( block, &ib_srp->srp, initiator, target,
                               ibdev->rdma_key, lun ) ) != 0 ) {
                DBGC ( ib_srp, "IBSRP %p could not create SRP device: %s\n",
                       ib_srp, strerror ( rc ) );
                goto err_srp_open;
        }

        /* Mortalise self and return */
        ref_put ( &ib_srp->refcnt );
        return 0;

 err_srp_open:
 err_cmrc_open:
        ib_srp_close ( ib_srp, rc );
        ref_put ( &ib_srp->refcnt );
 err_zalloc:
        return rc;
}
static int ib_srp_parse_byte_string ( const char *  rp_comp,
uint8_t bytes,
unsigned int  size_flags 
) [static]

Parse IB SRP root path byte-string value.

Parameters:
rp_compRoot path component string
default_valueDefault value to use if component string is empty
Return values:
valueValue

Definition at line 273 of file ib_srp.c.

References EINVAL_BYTE_STRING_LEN, IB_SRP_PARSE_FLAG_MASK, IB_SRP_PARSE_OPTIONAL, size, and strlen().

Referenced by ib_srp_parse_dgid(), ib_srp_parse_initiator_hca_guid(), ib_srp_parse_initiator_id_ext(), ib_srp_parse_service_id(), ib_srp_parse_sgid(), ib_srp_parse_target_id_ext(), and ib_srp_parse_target_ioc_guid().

                                                                {
        size_t size = ( size_flags & ~IB_SRP_PARSE_FLAG_MASK );
        size_t rp_comp_len = strlen ( rp_comp );
        int decoded_size;

        /* Allow optional components to be empty */
        if ( ( rp_comp_len == 0 ) &&
             ( size_flags & IB_SRP_PARSE_OPTIONAL ) )
                return 0;

        /* Check string length */
        if ( rp_comp_len != ( 2 * size ) )
                return -EINVAL_BYTE_STRING_LEN;

        /* Parse byte string */
        decoded_size = base16_decode ( rp_comp, bytes, size );
        if ( decoded_size < 0 )
                return decoded_size;

        return 0;
}
static int ib_srp_parse_integer ( const char *  rp_comp,
int  default_value 
) [static]

Parse IB SRP root path integer value.

Parameters:
rp_compRoot path component string
default_valueDefault value to use if component string is empty
Return values:
valueValue

Definition at line 303 of file ib_srp.c.

References EINVAL_INTEGER, end, strtoul(), and value.

Referenced by ib_srp_parse_pkey().

                                                                           {
        int value;
        char *end;

        value = strtoul ( rp_comp, &end, 16 );
        if ( *end )
                return -EINVAL_INTEGER;

        if ( end == rp_comp )
                return default_value;

        return value;
}
static int ib_srp_parse_sgid ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path source GID.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 324 of file ib_srp.c.

References ib_gid::bytes, ib_device::gid, ib_srp_parse_byte_string(), IB_SRP_PARSE_OPTIONAL, last_opened_ibdev(), memcpy(), NULL, and ib_srp_root_path::sgid.

                                                             {
        struct ib_device *ibdev;

        /* Default to the GID of the last opened Infiniband device */
        if ( ( ibdev = last_opened_ibdev() ) != NULL )
                memcpy ( &rp->sgid, &ibdev->gid, sizeof ( rp->sgid ) );

        return ib_srp_parse_byte_string ( rp_comp, rp->sgid.bytes,
                                          ( sizeof ( rp->sgid ) |
                                            IB_SRP_PARSE_OPTIONAL ) );
}
static int ib_srp_parse_initiator_id_ext ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path initiator identifier extension.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 344 of file ib_srp.c.

References ib_guid::bytes, ib_srp_initiator_port_id::ib, ib_srp_parse_byte_string(), IB_SRP_PARSE_OPTIONAL, ib_srp_initiator_port_id::id_ext, and ib_srp_root_path::initiator.

                                                                         {
        union ib_srp_initiator_port_id *port_id = &rp->initiator;

        return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.bytes,
                                          ( sizeof ( port_id->ib.id_ext ) |
                                            IB_SRP_PARSE_OPTIONAL ) );
}
static int ib_srp_parse_initiator_hca_guid ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path initiator HCA GUID.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 360 of file ib_srp.c.

References ib_guid::bytes, ib_gid::guid, ib_srp_initiator_port_id::hca_guid, ib_srp_initiator_port_id::ib, ib_srp_parse_byte_string(), IB_SRP_PARSE_OPTIONAL, ib_srp_root_path::initiator, memcpy(), ib_gid::s, and ib_srp_root_path::sgid.

                                                                           {
        union ib_srp_initiator_port_id *port_id = &rp->initiator;

        /* Default to the GUID portion of the source GID */
        memcpy ( &port_id->ib.hca_guid, &rp->sgid.s.guid,
                 sizeof ( port_id->ib.hca_guid ) );

        return ib_srp_parse_byte_string ( rp_comp, port_id->ib.hca_guid.bytes,
                                          ( sizeof ( port_id->ib.hca_guid ) |
                                            IB_SRP_PARSE_OPTIONAL ) );
}
static int ib_srp_parse_dgid ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path destination GID.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 380 of file ib_srp.c.

References ib_gid::bytes, ib_srp_root_path::dgid, ib_srp_parse_byte_string(), and IB_SRP_PARSE_REQUIRED.

                                                             {
        return ib_srp_parse_byte_string ( rp_comp, rp->dgid.bytes,
                                          ( sizeof ( rp->dgid ) |
                                            IB_SRP_PARSE_REQUIRED ) );
}
static int ib_srp_parse_pkey ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path partition key.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 394 of file ib_srp.c.

References IB_PKEY_DEFAULT, ib_srp_parse_integer(), pkey, and ib_srp_root_path::pkey.

                                                             {
        int pkey;

        if ( ( pkey = ib_srp_parse_integer ( rp_comp, IB_PKEY_DEFAULT ) ) < 0 )
                return pkey;
        rp->pkey = pkey;
        return 0;
}
static int ib_srp_parse_service_id ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path service ID.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 411 of file ib_srp.c.

References ib_guid::bytes, ib_srp_parse_byte_string(), IB_SRP_PARSE_REQUIRED, and ib_srp_root_path::service_id.

                                                                   {
        return ib_srp_parse_byte_string ( rp_comp, rp->service_id.bytes,
                                          ( sizeof ( rp->service_id ) |
                                            IB_SRP_PARSE_REQUIRED ) );
}
static int ib_srp_parse_lun ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path LUN.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 425 of file ib_srp.c.

References ib_srp_root_path::lun, and scsi_parse_lun().

                                                            {
        return scsi_parse_lun ( rp_comp, &rp->lun );
}
static int ib_srp_parse_target_id_ext ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path target identifier extension.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 437 of file ib_srp.c.

References ib_guid::bytes, ib_srp_target_port_id::ib, ib_srp_parse_byte_string(), IB_SRP_PARSE_REQUIRED, ib_srp_target_port_id::id_ext, and ib_srp_root_path::target.

                                                                      {
        union ib_srp_target_port_id *port_id = &rp->target;

        return ib_srp_parse_byte_string ( rp_comp, port_id->ib.id_ext.bytes,
                                          ( sizeof ( port_id->ib.id_ext ) |
                                            IB_SRP_PARSE_REQUIRED ) );
}
static int ib_srp_parse_target_ioc_guid ( const char *  rp_comp,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path target I/O controller GUID.

Parameters:
rp_compRoot path component string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 453 of file ib_srp.c.

References ib_guid::bytes, ib_srp_target_port_id::ib, ib_srp_parse_byte_string(), IB_SRP_PARSE_REQUIRED, ib_srp_target_port_id::ioc_guid, and ib_srp_root_path::target.

                                                                        {
        union ib_srp_target_port_id *port_id = &rp->target;

        return ib_srp_parse_byte_string ( rp_comp, port_id->ib.ioc_guid.bytes,
                                          ( sizeof ( port_id->ib.ioc_guid ) |
                                            IB_SRP_PARSE_REQUIRED ) );
}
static int ib_srp_parse_root_path ( const char *  rp_string,
struct ib_srp_root_path rp 
) [static]

Parse IB SRP root path.

Parameters:
rp_stringRoot path string
rpIB SRP root path
Return values:
rcReturn status code

Definition at line 498 of file ib_srp.c.

References DBG, EINVAL_RP_TOO_SHORT, IB_SRP_NUM_RP_COMPONENTS, ib_srp_root_path_parser::parse, rc, strcpy(), strerror(), and strlen().

Referenced by ib_srp_open_uri().

                                                                  {
        struct ib_srp_root_path_parser *parser;
        char rp_string_copy[ strlen ( rp_string ) + 1 ];
        char *rp_comp[IB_SRP_NUM_RP_COMPONENTS];
        char *rp_string_tmp = rp_string_copy;
        unsigned int i = 0;
        int rc;

        /* Split root path into component parts */
        strcpy ( rp_string_copy, rp_string );
        while ( 1 ) {
                rp_comp[i++] = rp_string_tmp;
                if ( i == IB_SRP_NUM_RP_COMPONENTS )
                        break;
                for ( ; *rp_string_tmp != ':' ; rp_string_tmp++ ) {
                        if ( ! *rp_string_tmp ) {
                                DBG ( "IBSRP root path \"%s\" too short\n",
                                      rp_string );
                                return -EINVAL_RP_TOO_SHORT;
                        }
                }
                *(rp_string_tmp++) = '\0';
        }

        /* Parse root path components */
        for ( i = 0 ; i < IB_SRP_NUM_RP_COMPONENTS ; i++ ) {
                parser = &ib_srp_rp_parser[i];
                if ( ( rc = parser->parse ( rp_comp[i], rp ) ) != 0 ) {
                        DBG ( "IBSRP could not parse \"%s\" in root path "
                              "\"%s\": %s\n", rp_comp[i], rp_string,
                              strerror ( rc ) );
                        return rc;
                }
        }

        return 0;
}
static int ib_srp_open_uri ( struct interface parent,
struct uri uri 
) [static]

Open IB SRP URI.

Parameters:
parentParent interface
uriURI
Return values:
rcReturn status code

Definition at line 544 of file ib_srp.c.

References DBG, ib_srp_root_path::dgid, EINVAL, ENODEV, find_ibdev(), ib_srp_open(), ib_srp_parse_root_path(), ib_srp_root_path::initiator, ib_srp_root_path::lun, memset(), uri::opaque, rc, ib_srp_root_path::service_id, ib_srp_root_path::sgid, ib_srp_initiator_port_id::srp, ib_srp_target_port_id::srp, and ib_srp_root_path::target.

                                                                         {
        struct ib_srp_root_path rp;
        struct ib_device *ibdev;
        int rc;

        /* Parse URI */
        if ( ! uri->opaque )
                return -EINVAL;
        memset ( &rp, 0, sizeof ( rp ) );
        if ( ( rc = ib_srp_parse_root_path ( uri->opaque, &rp ) ) != 0 )
                return rc;

        /* Identify Infiniband device */
        ibdev = find_ibdev ( &rp.sgid );
        if ( ! ibdev ) {
                DBG ( "IBSRP could not identify Infiniband device\n" );
                return -ENODEV;
        }

        /* Open IB SRP device */
        if ( ( rc = ib_srp_open ( parent, ibdev, &rp.dgid, &rp.service_id,
                                  &rp.initiator.srp, &rp.target.srp,
                                  &rp.lun ) ) != 0 )
                return rc;

        return 0;
}
static int ib_sbft_complete ( struct acpi_descriptor *desc  __unused) [static]

Check if IB SRP boot firmware table descriptor is complete.

Parameters:
descACPI descriptor
Return values:
rcReturn status code

Definition at line 591 of file ib_srp.c.

                                                                      {
        return 0;
}
static int ib_sbft_install ( int(*)(struct acpi_header *acpi install) [static]

Install IB SRP boot firmware table(s)

Parameters:
installInstallation method
Return values:
rcReturn status code

Definition at line 601 of file ib_srp.c.

References sbft_table::acpi, cpu_to_le16, cpu_to_le32, DBGC, ib_device::gid, ipxe_ib_sbft::ib, sbft_table::ib_offset, ib_srp_device::ibdev, acpi_header::length, list_for_each_entry, memcpy(), offsetof, sbft_ib_subtable::pkey, ib_device::pkey, rc, acpi_header::revision, ib_srp_device::sbft, SBFT_SIG, sbft_table::scsi_offset, sbft_ib_subtable::sgid, acpi_header::signature, sbft_table::srp_offset, strerror(), and ipxe_ib_sbft::table.

                                                                              {
        struct ib_srp_device *ib_srp;
        struct ipxe_ib_sbft *sbft;
        struct ib_device *ibdev;
        int rc;

        list_for_each_entry ( ib_srp, &ib_sbft_model.descs, desc.list ) {

                /* Complete table */
                sbft = &ib_srp->sbft;
                ibdev = ib_srp->ibdev;
                sbft->table.acpi.signature = cpu_to_le32 ( SBFT_SIG );
                sbft->table.acpi.length = cpu_to_le32 ( sizeof ( *sbft ) );
                sbft->table.acpi.revision = 1;
                sbft->table.scsi_offset =
                        cpu_to_le16 ( offsetof ( typeof ( *sbft ), scsi ) );
                sbft->table.srp_offset =
                        cpu_to_le16 ( offsetof ( typeof ( *sbft ), srp ) );
                sbft->table.ib_offset =
                        cpu_to_le16 ( offsetof ( typeof ( *sbft ), ib ) );
                memcpy ( &sbft->ib.sgid, &ibdev->gid, sizeof ( sbft->ib.sgid ));
                sbft->ib.pkey = cpu_to_le16 ( ibdev->pkey );

                /* Install table */
                if ( ( rc = install ( &sbft->table.acpi ) ) != 0 ) {
                        DBGC ( ib_srp, "IBSRP %p could not install sBFT: %s\n",
                               ib_srp, strerror ( rc ) );
                        return rc;
                }
        }

        return 0;
}

Variable Documentation

struct acpi_model ib_sbft_model __acpi_model
Initial value:
 {
        .descs = LIST_HEAD_INIT ( ib_sbft_model.descs ),
        .complete = ib_sbft_complete,
        .install = ib_sbft_install,
}

IB sBFT model.

aBFT model

Definition at line 63 of file ib_srp.c.

Initial value:

IB SRP CMRC interface operations.

Definition at line 144 of file ib_srp.c.

Initial value:

IB SRP CMRC interface descriptor.

Definition at line 149 of file ib_srp.c.

Initial value:

IB SRP SRP interface operations.

Definition at line 153 of file ib_srp.c.

Initial value:

IB SRP SRP interface descriptor.

Definition at line 159 of file ib_srp.c.

struct uri_opener ib_srp_uri_opener __uri_opener
Initial value:
 {
        .scheme = "ib_srp",
        .open = ib_srp_open_uri,
}

IB SRP URI opener.

Definition at line 573 of file ib_srp.c.