/* MFA2 FILE * +----------------------------------+ * | MFA2 finger print | * +----------------------------------+ * | package descriptor multi_tlv | * | +------------------------------+ | +-----------------+ * | | package descriptor tlv +-----> |num_devices=n | * | +------------------------------+ | |num_components=m | * +----------------------------------+ |CB offset | * | device descriptor multi_tlv | |... | * | +------------------------------+ | | | * | | PSID tlv | | +-----------------+ * | +------------------------------+ | * | | component index tlv | | * | +------------------------------+ | * +----------------------------------+ * | component descriptor multi_tlv | * | +------------------------------+ | +-----------------+ * | | component descriptor tlv +-----> |Among others: | * | +------------------------------+ | |CB offset=o | * +----------------------------------+ |comp index=i | * | | |... | * | | | | * | | +-----------------+ * | COMPONENT BLOCK (CB) | * | | * | | * | | * +----------------------------------+ * * On the top level, an MFA2 file contains: * - Fingerprint * - Several multi_tlvs (TLVs of type MLXFW_MFA2_TLV_MULTI, as defined in * mlxfw_mfa2_format.h) * - Compresses content block * * The first multi_tlv * ------------------- * The first multi TLV is treated as package descriptor, and expected to have a * first TLV child of type MLXFW_MFA2_TLV_PACKAGE_DESCRIPTOR which contains all * the global information needed to parse the file. Among others, it contains * the number of device descriptors and component descriptor following this * multi TLV. * * The device descriptor multi_tlv * ------------------------------- * The multi TLVs following the package descriptor are treated as device * descriptor, and are expected to have the following children: * - PSID TLV child of type MLXFW_MFA2_TLV_PSID containing that device PSID. * - Component index of type MLXFW_MFA2_TLV_COMPONENT_PTR that contains that * device component index. * * The component descriptor multi_tlv * ---------------------------------- * The multi TLVs following the device descriptor multi TLVs are treated as * component descriptor, and are expected to have a first child of type * MLXFW_MFA2_TLV_COMPONENT_DESCRIPTOR that contains mostly the component index, * needed for the flash process and the offset to the binary within the * component block.
*/
/* Check that all children are valid */
mlxfw_mfa2_tlv_multi_foreach(mfa2_file, tlv, idx, multi) { if (!tlv) {
pr_err("Multi has invalid child"); returnfalse;
}
} returntrue;
}
multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, dev_tlv); if (!multi) {
pr_err("Device %d is not a valid TLV error\n", dev_idx); returnfalse;
}
if (!mlxfw_mfa2_tlv_multi_validate(mfa2_file, multi)) returnfalse;
/* Validate the device has PSID tlv */
tlv = mlxfw_mfa2_tlv_multi_child_find(mfa2_file, multi,
MLXFW_MFA2_TLV_PSID, 0); if (!tlv) {
pr_err("Device %d does not have PSID\n", dev_idx); returnfalse;
}
psid = mlxfw_mfa2_tlv_psid_get(mfa2_file, tlv); if (!psid) {
pr_err("Device %d PSID TLV is not valid\n", dev_idx); returnfalse;
}
multi = mlxfw_mfa2_tlv_multi_get(mfa2_file, comp_tlv); if (!multi) {
pr_err("Component %d is not a valid TLV error\n", comp_idx); returnfalse;
}
if (!mlxfw_mfa2_tlv_multi_validate(mfa2_file, multi)) returnfalse;
/* Check that component have COMPONENT_DESCRIPTOR as first child */
tlv = mlxfw_mfa2_tlv_multi_child(mfa2_file, multi); if (!tlv) {
pr_err("Component descriptor %d multi TLV error\n", comp_idx); returnfalse;
}
cdesc = mlxfw_mfa2_tlv_component_descriptor_get(mfa2_file, tlv); if (!cdesc) {
pr_err("Component %d does not have a valid descriptor\n",
comp_idx); returnfalse;
}
pr_debug(" -- Component type %d\n", be16_to_cpu(cdesc->identifier));
pr_debug(" -- Offset 0x%llx and size %d\n",
((u64) be32_to_cpu(cdesc->cb_offset_h) << 32)
| be32_to_cpu(cdesc->cb_offset_l), be32_to_cpu(cdesc->size));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.