summaryrefslogtreecommitdiff
path: root/lib/pldmfw/pldmfw.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pldmfw/pldmfw.c')
-rw-r--r--lib/pldmfw/pldmfw.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/pldmfw/pldmfw.c b/lib/pldmfw/pldmfw.c
index 54e1809a38fd..b45ceb725780 100644
--- a/lib/pldmfw/pldmfw.c
+++ b/lib/pldmfw/pldmfw.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2018-2019, Intel Corporation. */
-#include <asm/unaligned.h>
+#include <linux/unaligned.h>
#include <linux/crc32.h>
#include <linux/device.h>
#include <linux/firmware.h>
@@ -481,9 +481,17 @@ static int pldm_parse_components(struct pldmfw_priv *data)
component->component_data = data->fw->data + offset;
component->component_size = size;
+ if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT &&
+ data->context->component_identifier != component->identifier)
+ continue;
+
list_add_tail(&component->entry, &data->components);
}
+ if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT &&
+ list_empty(&data->components))
+ return -ENOENT;
+
header_crc_ptr = data->fw->data + data->offset;
err = pldm_move_fw_offset(data, sizeof(data->header_crc));
@@ -720,6 +728,9 @@ pldm_send_package_data(struct pldmfw_priv *data)
struct pldmfw_record *record = data->matching_record;
const struct pldmfw_ops *ops = data->context->ops;
+ if (!ops->send_package_data)
+ return 0;
+
return ops->send_package_data(data->context, record->package_data,
record->package_data_len);
}
@@ -747,6 +758,9 @@ pldm_send_component_tables(struct pldmfw_priv *data)
if (!test_bit(index, bitmap))
continue;
+ if (!data->context->ops->send_component_table)
+ continue;
+
/* determine whether this is the start, middle, end, or both
* the start and end of the component tables
*/