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

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 <russell.h.weight@intel.com>
Signed-off-by: Russ Weight <russell.h.weight@intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Peter Colberg <peter.colberg@intel.com>
Reviewed-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20240402184925.1065932-1-peter.colberg@intel.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Ilpo Järvinen and committed by
Lee Jones
74c6317d 4fd7e2ff

+5 -1
+2 -1
drivers/fpga/intel-m10-bmc-sec-update.c
··· 529 529 const u8 *data, u32 size) 530 530 { 531 531 struct m10bmc_sec *sec = fwl->dd_handle; 532 + const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; 532 533 u32 ret; 533 534 534 535 sec->cancel_request = false; 535 536 536 - if (!size || size > M10BMC_STAGING_SIZE) 537 + if (!size || size > csr_map->staging_size) 537 538 return FW_UPLOAD_ERR_INVALID_SIZE; 538 539 539 540 if (sec->m10bmc->flash_bulk_ops)
+1
drivers/mfd/intel-m10-bmc-pmci.c
··· 370 370 .pr_reh_addr = M10BMC_N6000_PR_REH_ADDR, 371 371 .pr_magic = M10BMC_N6000_PR_PROG_MAGIC, 372 372 .rsu_update_counter = M10BMC_N6000_STAGING_FLASH_COUNT, 373 + .staging_size = M10BMC_STAGING_SIZE, 373 374 }; 374 375 375 376 static const struct intel_m10bmc_platform_info m10bmc_pmci_n6000 = {
+1
drivers/mfd/intel-m10-bmc-spi.c
··· 109 109 .pr_reh_addr = M10BMC_N3000_PR_REH_ADDR, 110 110 .pr_magic = M10BMC_N3000_PR_PROG_MAGIC, 111 111 .rsu_update_counter = M10BMC_N3000_STAGING_FLASH_COUNT, 112 + .staging_size = M10BMC_STAGING_SIZE, 112 113 }; 113 114 114 115 static struct mfd_cell m10bmc_d5005_subdevs[] = {
+1
include/linux/mfd/intel-m10-bmc.h
··· 205 205 unsigned int pr_reh_addr; 206 206 unsigned int pr_magic; 207 207 unsigned int rsu_update_counter; 208 + unsigned int staging_size; 208 209 }; 209 210 210 211 /**