54 #define EINVAL_BYTE_STRING_LEN __einfo_error ( EINFO_EINVAL_BYTE_STRING_LEN ) 55 #define EINFO_EINVAL_BYTE_STRING_LEN __einfo_uniqify \ 56 ( EINFO_EINVAL, 0x01, "Invalid byte string length" ) 57 #define EINVAL_INTEGER __einfo_error ( EINFO_EINVAL_INTEGER ) 58 #define EINFO_EINVAL_INTEGER __einfo_uniqify \ 59 ( EINFO_EINVAL, 0x03, "Invalid integer" ) 60 #define EINVAL_RP_TOO_SHORT __einfo_error ( EINFO_EINVAL_RP_TOO_SHORT ) 61 #define EINFO_EINVAL_RP_TOO_SHORT __einfo_uniqify \ 62 ( EINFO_EINVAL, 0x04, "Root path too short" ) 108 return &ib_srp->
desc;
152 ib_srp =
zalloc (
sizeof ( *ib_srp ) );
166 sbft = &ib_srp->
sbft;
178 DBGC ( ib_srp,
"IBSRP %p could not open CMRC socket: %s\n",
186 DBGC ( ib_srp,
"IBSRP %p could not create SRP device: %s\n",
243 unsigned int size_flags ) {
245 size_t rp_comp_len =
strlen ( rp_comp );
249 if ( ( rp_comp_len == 0 ) &&
254 if ( rp_comp_len != ( 2 *
size ) )
258 decoded_size = base16_decode ( rp_comp,
bytes,
size );
259 if ( decoded_size < 0 )
280 if (
end == rp_comp )
281 return default_value;
302 ( sizeof ( rp->
sgid ) |
352 ( sizeof ( rp->
dgid ) |
457 #define IB_SRP_NUM_RP_COMPONENTS \ 458 ( sizeof ( ib_srp_rp_parser ) / sizeof ( ib_srp_rp_parser[0] ) ) 471 char *rp_string_copy;
477 rp_string_copy =
strdup ( rp_string );
478 if ( ! rp_string_copy ) {
482 rp_string_tmp = rp_string_copy;
486 rp_comp[i++] = rp_string_tmp;
489 for ( ; *rp_string_tmp !=
':' ; rp_string_tmp++ ) {
490 if ( ! *rp_string_tmp ) {
491 DBG (
"IBSRP root path \"%s\" too short\n",
497 *(rp_string_tmp++) =
'\0';
503 if ( (
rc = parser->
parse ( rp_comp[i], rp ) ) != 0 ) {
504 DBG (
"IBSRP could not parse \"%s\" in root path " 505 "\"%s\": %s\n", rp_comp[i], rp_string,
513 free ( rp_string_copy );
533 memset ( &rp, 0,
sizeof ( rp ) );
540 DBG (
"IBSRP could not identify Infiniband device\n" );
591 sbft = &ib_srp->
sbft;
592 ibdev = ib_srp->
ibdev;
606 if ( (
rc = install ( &sbft->
table.
acpi ) ) != 0 ) {
607 DBGC ( ib_srp,
"IBSRP %p could not install sBFT: %s\n",
static int ib_srp_open_uri(struct interface *parent, struct uri *uri)
Open IB SRP URI.
#define EINVAL
Invalid argument.
An object interface operation.
static int ib_srp_parse_dgid(const char *rp_comp, struct ib_srp_root_path *rp)
Parse IB SRP root path destination GID.
struct arbelprm_rc_send_wqe rc
void intf_close(struct interface *intf, int rc)
Close an object interface.
union srp_port_id srp
SRP version of port identifier.
int ib_cmrc_open(struct interface *xfer, struct ib_device *ibdev, union ib_gid *dgid, union ib_guid *service_id, const char *name)
Open CMRC connection.
static struct ib_srp_root_path_parser ib_srp_rp_parser[]
IB SRP root path components.
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
union ib_guid service_id
Service ID.
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.
int(* parse)(const char *rp_comp, struct ib_srp_root_path *rp)
Parse IB SRP root path component.
int srp_open(struct interface *block, struct interface *socket, union srp_port_id *initiator, union srp_port_id *target, uint32_t memory_handle, struct scsi_lun *lun)
Open SRP device.
union ib_gid gid
Port GID (comprising GID prefix and port GUID)
struct ipxe_ib_sbft sbft
Boot firmware table parameters.
unsigned long strtoul(const char *string, char **endp, int base)
Convert string to numeric value.
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.
struct ib_device * last_opened_ibdev(void)
Get most recently opened Infiniband device.
union ib_srp_initiator_port_id initiator
Initiator port ID.
union srp_port_id initiator
Initiator port identifier.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct list_head descs
List of descriptors.
struct interface cmrc
CMRC interface.
SRP target port identifier for Infiniband.
struct interface srp
SRP transport interface.
uint8_t size
Entry size (in 32-bit words)
uint64_t desc
Microcode descriptor list physical address.
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_service_id(const char *rp_comp, struct ib_srp_root_path *rp)
Parse IB SRP root path service ID.
#define IB_GUID_ARGS(guid)
Infiniband Globally Unique Identifier debug message arguments.
union srp_port_id target
Target port identifier.
IB SRP root path component parser.
#define IB_PKEY_DEFAULT
Default Infiniband partition key.
union ib_gid dgid
Destination GID.
#define offsetof(type, field)
Get offset of a field within a structure.
Uniform Resource Identifiers.
static struct interface_descriptor ib_srp_srp_desc
IB SRP SRP interface descriptor.
union srp_port_id srp
SRP version of port identifier.
static __always_inline struct ib_device * ibdev_get(struct ib_device *ibdev)
Get reference to Infiniband device.
An Infiniband Global Identifier.
#define SBFT_SIG
SRP Boot Firmware Table signature.
static struct interface_operation ib_srp_srp_op[]
IB SRP SRP interface operations.
#define ENOMEM
Not enough space.
struct refcnt refcnt
Reference count.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define IB_GUID_FMT
Infiniband Globally Unique Identifier debug message format.
struct acpi_header acpi
ACPI header.
static struct acpi_descriptor * ib_srp_describe(struct ib_srp_device *ib_srp)
Get IB SRP ACPI descriptor.
struct ib_srp_initiator_port_id::@618 ib
Infiniband version of port identifier.
SRP initiator port identifier for Infiniband.
#define container_of(ptr, type, field)
Get containing structure.
struct sbft_table table
The table header.
int scsi_parse_lun(const char *lun_string, struct scsi_lun *lun)
Parse SCSI LUN.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
pseudo_bit_t value[0x00020]
#define __unused
Declare a variable or data structure as unused.
static EFI_ACPI_TABLE_PROTOCOL * acpi
ACPI table protocol protocol.
struct sbft_srp_subtable srp
The SRP subtable.
const char * scheme
URI protocol name.
static int ib_sbft_complete(struct acpi_descriptor *desc __unused)
Check if IB SRP boot firmware table descriptor is complete.
static int ib_srp_parse_root_path(const char *rp_string, struct ib_srp_root_path *rp)
Parse IB SRP root path.
An Infiniband SRP sBFT created by iPXE.
union ib_gid sgid
Source GID.
uint8_t lun
Logical Unit Number.
union ib_guid service_id
Service ID.
#define cpu_to_le32(value)
IB SRP root path parameters.
#define IB_GID_ARGS(gid)
Infiniband Global Identifier debug message arguments.
EFI_DEVICE_PATH_PROTOCOL * efi_ib_srp_path(struct ib_srp_device *ib_srp)
Construct EFI device path for Infiniband SRP device.
uint32_t rdma_key
RDMA key.
#define EINVAL_RP_TOO_SHORT
#define EINVAL_BYTE_STRING_LEN
An object interface descriptor.
struct scsi_lun lun
SCSI LUN.
static __always_inline void ibdev_put(struct ib_device *ibdev)
Drop reference to Infiniband device.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
#define IB_SRP_NUM_RP_COMPONENTS
Number of IB SRP root path components.
void * zalloc(size_t size)
Allocate cleared memory.
struct ib_device * find_ibdev(union ib_gid *gid)
Find Infiniband device by GID.
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
An Infiniband Globally Unique Identifier.
char * strdup(const char *src)
Duplicate string.
#define ENODEV
No such device.
size_t strlen(const char *src)
Get length of string.
struct sbft_scsi_subtable scsi
The SCSI subtable.
Data transfer interface opening.
ib_srp_parse_flags
IB SRP parse flags.
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.
An Infiniband SRP device.
struct acpi_descriptor * acpi_describe(struct interface *intf)
Get object's ACPI descriptor.
sbft_off_t ib_offset
Offset to IB subtable, if present.
static void ib_srp_close(struct ib_srp_device *ib_srp, int rc)
Close IB SRP device.
union ib_guid ioc_guid
I/O controller GUID.
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.
union ib_gid dgid
Destination GID.
An ACPI descriptor (used to construct ACPI tables)
sbft_off_t scsi_offset
Offset to SCSI subtable.
EFI_DEVICE_PATH_PROTOCOL * efi_describe(struct interface *intf)
Describe object as an EFI device path.
union ib_guid hca_guid
IB channel adapter GUID.
Infiniband Communication-managed Reliable Connections.
struct acpi_model ib_sbft_model __acpi_model
IB sBFT model.
uint16_t pkey
Partition key.
SCSI RDMA Protocol over Infiniband.
const char * opaque
Opaque part.
uint8_t block[3][8]
DES-encrypted blocks.
struct ib_device * ibdev
Infiniband device.
union ib_gid sgid
Source GID.
static void ib_srp_free(struct refcnt *refcnt)
Free IB SRP device.
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.
#define IB_GID_FMT
Infiniband Global Identifier debug message format.
#define cpu_to_le16(value)
uint16_t pkey[32]
Partition key.
static int ib_srp_parse_integer(const char *rp_comp, int default_value)
Parse IB SRP root path integer value.
uint32_t end
Ending offset.
struct sbft_ib_subtable ib
The Infiniband subtable.
static struct interface_descriptor ib_srp_cmrc_desc
IB SRP CMRC interface descriptor.
uint16_t pkey
Partition key.
A Uniform Resource Identifier.
#define INTF_DESC_PASSTHRU(object_type, intf, operations, passthru)
Define an object interface descriptor with pass-through interface.
static struct interface_operation ib_srp_cmrc_op[]
IB SRP CMRC interface operations.
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.
typeof(acpi_finder=acpi_find)
ACPI table finder.
struct uri_opener ib_srp_uri_opener __uri_opener
IB SRP URI opener.
union ib_guid service_id
Service ID.
#define DBG(...)
Print a debugging message.
static int ib_sbft_install(int(*install)(struct acpi_header *acpi))
Install IB SRP boot firmware table(s)
#define LIST_HEAD_INIT(list)
Initialise a static list head.
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
static int ib_srp_parse_lun(const char *rp_comp, struct ib_srp_root_path *rp)
Parse IB SRP root path LUN.
uint16_t pkey
Partition key.
union ib_srp_target_port_id target
Target port ID.
union ib_guid id_ext
Identifier extension.
#define NULL
NULL pointer (VOID *)
sbft_off_t srp_offset
Offset to SRP subtable.
union ib_guid id_ext
Identifier extension.
static int ib_srp_parse_pkey(const char *rp_comp, struct ib_srp_root_path *rp)
Parse IB SRP root path partition key.
#define ref_put(refcnt)
Drop reference to object.
static void acpi_init(struct acpi_descriptor *desc, struct acpi_model *model, struct refcnt *refcnt)
Initialise ACPI descriptor.
struct ib_srp_target_port_id::@619 ib
Infiniband version of port identifier.
void * memset(void *dest, int character, size_t len) __nonnull
struct acpi_descriptor desc
ACPI descriptor.