Skip to content

Commit d4679b7

Browse files
konradknitteranguy11
authored andcommitted
pldmfw: enable selected component update
This patch enables to update a selected component from PLDM image containing multiple components. Example usage: struct pldmfw; data.mode = PLDMFW_UPDATE_MODE_SINGLE_COMPONENT; data.compontent_identifier = DRIVER_FW_MGMT_COMPONENT_ID; Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Marcin Szycik <marcin.szycik@linux.intel.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Signed-off-by: Konrad Knitter <konrad.knitter@intel.com> Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
1 parent b44e27b commit d4679b7

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/linux/pldmfw.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,17 @@ struct pldmfw_ops;
125125
* a pointer to their own data, used to implement the device specific
126126
* operations.
127127
*/
128+
129+
enum pldmfw_update_mode {
130+
PLDMFW_UPDATE_MODE_FULL,
131+
PLDMFW_UPDATE_MODE_SINGLE_COMPONENT,
132+
};
133+
128134
struct pldmfw {
129135
const struct pldmfw_ops *ops;
130136
struct device *dev;
137+
u16 component_identifier;
138+
enum pldmfw_update_mode mode;
131139
};
132140

133141
bool pldmfw_op_pci_match_record(struct pldmfw *context, struct pldmfw_record *record);

lib/pldmfw/pldmfw.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,17 @@ static int pldm_parse_components(struct pldmfw_priv *data)
481481
component->component_data = data->fw->data + offset;
482482
component->component_size = size;
483483

484+
if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT &&
485+
data->context->component_identifier != component->identifier)
486+
continue;
487+
484488
list_add_tail(&component->entry, &data->components);
485489
}
486490

491+
if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT &&
492+
list_empty(&data->components))
493+
return -ENOENT;
494+
487495
header_crc_ptr = data->fw->data + data->offset;
488496

489497
err = pldm_move_fw_offset(data, sizeof(data->header_crc));

0 commit comments

Comments
 (0)