Skip to content

Commit 74c6317

Browse files
ij-intellag-linaro
authored andcommitted
mfd: intel-m10-bmc: Change staging size to a variable
The secure update driver does a sanity-check of the image size in comparison to the size of the staging area in FLASH. Instead of hard-wiring M10BMC_STAGING_SIZE, move the staging size to the m10bmc_csr_map structure to make the size assignment more flexible. Co-developed-by: Russ Weight <[email protected]> Signed-off-by: Russ Weight <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Peter Colberg <[email protected]> Reviewed-by: Xu Yilun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 4fd7e2f commit 74c6317

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

drivers/fpga/intel-m10-bmc-sec-update.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,12 @@ static enum fw_upload_err m10bmc_sec_prepare(struct fw_upload *fwl,
529529
const u8 *data, u32 size)
530530
{
531531
struct m10bmc_sec *sec = fwl->dd_handle;
532+
const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map;
532533
u32 ret;
533534

534535
sec->cancel_request = false;
535536

536-
if (!size || size > M10BMC_STAGING_SIZE)
537+
if (!size || size > csr_map->staging_size)
537538
return FW_UPLOAD_ERR_INVALID_SIZE;
538539

539540
if (sec->m10bmc->flash_bulk_ops)

drivers/mfd/intel-m10-bmc-pmci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ static const struct m10bmc_csr_map m10bmc_n6000_csr_map = {
370370
.pr_reh_addr = M10BMC_N6000_PR_REH_ADDR,
371371
.pr_magic = M10BMC_N6000_PR_PROG_MAGIC,
372372
.rsu_update_counter = M10BMC_N6000_STAGING_FLASH_COUNT,
373+
.staging_size = M10BMC_STAGING_SIZE,
373374
};
374375

375376
static const struct intel_m10bmc_platform_info m10bmc_pmci_n6000 = {

drivers/mfd/intel-m10-bmc-spi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static const struct m10bmc_csr_map m10bmc_n3000_csr_map = {
109109
.pr_reh_addr = M10BMC_N3000_PR_REH_ADDR,
110110
.pr_magic = M10BMC_N3000_PR_PROG_MAGIC,
111111
.rsu_update_counter = M10BMC_N3000_STAGING_FLASH_COUNT,
112+
.staging_size = M10BMC_STAGING_SIZE,
112113
};
113114

114115
static struct mfd_cell m10bmc_d5005_subdevs[] = {

include/linux/mfd/intel-m10-bmc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ struct m10bmc_csr_map {
205205
unsigned int pr_reh_addr;
206206
unsigned int pr_magic;
207207
unsigned int rsu_update_counter;
208+
unsigned int staging_size;
208209
};
209210

210211
/**

0 commit comments

Comments
 (0)