/* The following data structures define the layout of a firmware binary * following the "PLDM For Firmware Update Specification", DMTF standard * #DSP0267. * * pldmfw.c uses these structures to implement a simple engine that will parse * a fw binary file in this format and perform a firmware update for a given * device. * * Due to the variable sized data layout, alignment of fields within these * structures is not guaranteed when reading. For this reason, all multi-byte * field accesses should be done using the unaligned access macros. * Additionally, the standard specifies that multi-byte fields are in * LittleEndian format. * * The structure definitions are not made public, in order to keep direct * accesses within code that is prepared to deal with the limitation of * unaligned access.
*/
/* * DSP0267 also includes the following variable length fields at the * end of this structure: * * PackageVersionString, length is version_len. * * The total size of this section is * sizeof(pldm_header) + version_len;
*/
u8 version_string[]; /* PackageVersionString */
} __packed __aligned(1);
/* * DSP0267 also includes the following variable length fields at the * end of this structure: * * ApplicableComponents, length is component_bitmap_len from header * ComponentImageSetVersionString, length is version_len * RecordDescriptors, a series of TLVs with 16bit type and length * FirmwareDevicePackageData, length is package_data_len * * The total size of each record is * sizeof(pldmfw_record_info) + * component_bitmap_len (converted to bytes!) + * version_len + * <length of RecordDescriptors> + * package_data_len
*/
u8 variable_record_data[];
} __packed __aligned(1);
/* Firmware Device Identification Area */ struct __pldmfw_record_area {
u8 record_count; /* DeviceIDRecordCount */ /* This is not a struct type because the size of each record varies */
u8 records[];
} __aligned(1);
/* * DSP0267 also includes the following variable length fields at the * end of this structure: * * ComponentVersionString, length is version_len * * The total size of this section is * sizeof(pldmfw_component_info) + version_len;
*/
u8 version_string[]; /* ComponentVersionString */
} __packed __aligned(1);
/* Component Image Information Area */ struct __pldmfw_component_area {
__le16 component_image_count; /* This is not a struct type because the component size varies */
u8 components[];
} __aligned(1);
/** * pldm_first_desc_tlv * @start: byte offset of the start of the descriptor TLVs * * Converts the starting offset of the descriptor TLVs into a pointer to the * first descriptor.
*/ #define pldm_first_desc_tlv(start) \
((conststruct __pldmfw_desc_tlv *)(start))
/** * pldm_next_desc_tlv * @desc: pointer to a descriptor TLV * * Finds the pointer to the next descriptor following a given descriptor
*/ #define pldm_next_desc_tlv(desc) \
((conststruct __pldmfw_desc_tlv *)((desc)->data + \
get_unaligned_le16(&(desc)->size)))
/** * pldm_for_each_desc_tlv * @i: variable to store descriptor index * @desc: variable to store descriptor pointer * @start: byte offset of the start of the descriptors * @count: the number of descriptors * * for loop macro to iterate over all of the descriptors of a given PLDM * record.
*/ #define pldm_for_each_desc_tlv(i, desc, start, count) \ for ((i) = 0, (desc) = pldm_first_desc_tlv(start); \
(i) < (count); \
(i)++, (desc) = pldm_next_desc_tlv(desc))
/** * pldm_first_record * @start: byte offset of the start of the PLDM records * * Converts a starting offset of the PLDM records into a pointer to the first * record.
*/ #define pldm_first_record(start) \
((conststruct __pldmfw_record_info *)(start))
/** * pldm_next_record * @record: pointer to a PLDM record * * Finds a pointer to the next record following a given record
*/ #define pldm_next_record(record) \
((conststruct __pldmfw_record_info *) \
((const u8 *)(record) + get_unaligned_le16(&(record)->record_len)))
/** * pldm_for_each_record * @i: variable to store record index * @record: variable to store record pointer * @start: byte offset of the start of the records * @count: the number of records * * for loop macro to iterate over all of the records of a PLDM file.
*/ #define pldm_for_each_record(i, record, start, count) \ for ((i) = 0, (record) = pldm_first_record(start); \
(i) < (count); \
(i)++, (record) = pldm_next_record(record))
/** * pldm_first_component * @start: byte offset of the start of the PLDM components * * Convert a starting offset of the PLDM components into a pointer to the * first component
*/ #define pldm_first_component(start) \
((conststruct __pldmfw_component_info *)(start))
/** * pldm_next_component * @component: pointer to a PLDM component * * Finds a pointer to the next component following a given component
*/ #define pldm_next_component(component) \
((conststruct __pldmfw_component_info *)((component)->version_string + \
(component)->version_len))
/** * pldm_for_each_component * @i: variable to store component index * @component: variable to store component pointer * @start: byte offset to the start of the first component * @count: the number of components * * for loop macro to iterate over all of the components of a PLDM file.
*/ #define pldm_for_each_component(i, component, start, count) \ for ((i) = 0, (component) = pldm_first_component(start); \
(i) < (count); \
(i)++, (component) = pldm_next_component(component))
#endif
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
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.