/** * Fill in all variable portions of sBFT * * @v srp SRP device * @ret rc Return status code */ int sbft_fill_data ( struct srp_device *srp ) { struct sbft_scsi_subtable *sbft_scsi = &sbftab.scsi; struct sbft_srp_subtable *sbft_srp = &sbftab.srp; struct sbft_ib_subtable *sbft_ib = &sbftab.ib; struct ib_srp_parameters *ib_params; struct segoff rm_sbftab = { .segment = rm_ds, .offset = __from_data16 ( &sbftab ), }; /* Fill in the SCSI subtable */ memcpy ( &sbft_scsi->lun, &srp->lun, sizeof ( sbft_scsi->lun ) ); /* Fill in the SRP subtable */ memcpy ( &sbft_srp->port_ids, &srp->port_ids, sizeof ( sbft_srp->port_ids ) ); /* Fill in the IB subtable */ assert ( srp->transport == &ib_srp_transport ); ib_params = ib_srp_params ( srp ); memcpy ( &sbft_ib->sgid, &ib_params->sgid, sizeof ( sbft_ib->sgid ) ); memcpy ( &sbft_ib->dgid, &ib_params->dgid, sizeof ( sbft_ib->dgid ) ); memcpy ( &sbft_ib->service_id, &ib_params->service_id, sizeof ( sbft_ib->service_id ) ); sbft_ib->pkey = ib_params->pkey; /* Update checksum */ acpi_fix_checksum ( &sbftab.table.acpi ); DBGC ( &sbftab, "SRP Boot Firmware Table at %04x:%04x:\n", rm_sbftab.segment, rm_sbftab.offset ); DBGC_HDA ( &sbftab, rm_sbftab, &sbftab, sizeof ( sbftab ) ); return 0; }
/** Duplicate an ACPI table. */ struct acpi_table *acpi_dup_table(struct acpi_table *rsdt, const char signature[4], memory_alloc_t alloc) { struct acpi_table **tab = acpi_get_table_ptr(rsdt, signature); struct acpi_table *newtab = alloc((*tab)->size, 0x1000); /* 4K aligned */ memcpy(newtab, *tab, (*tab)->size); *tab = newtab; acpi_fix_checksum(rsdt); return newtab; }
/** * Fill in all variable portions of iBFT * * @v netdev Network device * @v initiator_iqn Initiator IQN * @v st_target Target socket address * @v target_iqn Target IQN * @ret rc Return status code * */ int ibft_fill_data ( struct net_device *netdev, struct iscsi_session *iscsi ) { struct ibft_string_block strings = { .table = &ibftab.table, .offset = offsetof ( typeof ( ibftab ), strings ), }; int rc; /* Fill in NIC, Initiator and Target portions */ if ( ( rc = ibft_fill_nic ( &ibftab.nic, &strings, netdev ) ) != 0 ) return rc; if ( ( rc = ibft_fill_initiator ( &ibftab.initiator, &strings ) ) != 0 ) return rc; if ( ( rc = ibft_fill_target ( &ibftab.target, &strings, iscsi ) ) != 0 ) return rc; /* Update checksum */ acpi_fix_checksum ( &ibftab.table.acpi ); return 0; }