Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Konrad Knitter and committed by
Tony Nguyen
d4679b79 b44e27b4

+16
+8
include/linux/pldmfw.h
··· 125 125 * a pointer to their own data, used to implement the device specific 126 126 * operations. 127 127 */ 128 + 129 + enum pldmfw_update_mode { 130 + PLDMFW_UPDATE_MODE_FULL, 131 + PLDMFW_UPDATE_MODE_SINGLE_COMPONENT, 132 + }; 133 + 128 134 struct pldmfw { 129 135 const struct pldmfw_ops *ops; 130 136 struct device *dev; 137 + u16 component_identifier; 138 + enum pldmfw_update_mode mode; 131 139 }; 132 140 133 141 bool pldmfw_op_pci_match_record(struct pldmfw *context, struct pldmfw_record *record);
+8
lib/pldmfw/pldmfw.c
··· 481 481 component->component_data = data->fw->data + offset; 482 482 component->component_size = size; 483 483 484 + if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT && 485 + data->context->component_identifier != component->identifier) 486 + continue; 487 + 484 488 list_add_tail(&component->entry, &data->components); 485 489 } 490 + 491 + if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT && 492 + list_empty(&data->components)) 493 + return -ENOENT; 486 494 487 495 header_crc_ptr = data->fw->data + data->offset; 488 496