mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 16:53:58 -05:00
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>
This commit is contained in:
parent
4fd7e2ffe3
commit
74c6317df0
4 changed files with 5 additions and 1 deletions
|
@ -529,11 +529,12 @@ static enum fw_upload_err m10bmc_sec_prepare(struct fw_upload *fwl,
|
||||||
const u8 *data, u32 size)
|
const u8 *data, u32 size)
|
||||||
{
|
{
|
||||||
struct m10bmc_sec *sec = fwl->dd_handle;
|
struct m10bmc_sec *sec = fwl->dd_handle;
|
||||||
|
const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map;
|
||||||
u32 ret;
|
u32 ret;
|
||||||
|
|
||||||
sec->cancel_request = false;
|
sec->cancel_request = false;
|
||||||
|
|
||||||
if (!size || size > M10BMC_STAGING_SIZE)
|
if (!size || size > csr_map->staging_size)
|
||||||
return FW_UPLOAD_ERR_INVALID_SIZE;
|
return FW_UPLOAD_ERR_INVALID_SIZE;
|
||||||
|
|
||||||
if (sec->m10bmc->flash_bulk_ops)
|
if (sec->m10bmc->flash_bulk_ops)
|
||||||
|
|
|
@ -370,6 +370,7 @@ static const struct m10bmc_csr_map m10bmc_n6000_csr_map = {
|
||||||
.pr_reh_addr = M10BMC_N6000_PR_REH_ADDR,
|
.pr_reh_addr = M10BMC_N6000_PR_REH_ADDR,
|
||||||
.pr_magic = M10BMC_N6000_PR_PROG_MAGIC,
|
.pr_magic = M10BMC_N6000_PR_PROG_MAGIC,
|
||||||
.rsu_update_counter = M10BMC_N6000_STAGING_FLASH_COUNT,
|
.rsu_update_counter = M10BMC_N6000_STAGING_FLASH_COUNT,
|
||||||
|
.staging_size = M10BMC_STAGING_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct intel_m10bmc_platform_info m10bmc_pmci_n6000 = {
|
static const struct intel_m10bmc_platform_info m10bmc_pmci_n6000 = {
|
||||||
|
|
|
@ -109,6 +109,7 @@ static const struct m10bmc_csr_map m10bmc_n3000_csr_map = {
|
||||||
.pr_reh_addr = M10BMC_N3000_PR_REH_ADDR,
|
.pr_reh_addr = M10BMC_N3000_PR_REH_ADDR,
|
||||||
.pr_magic = M10BMC_N3000_PR_PROG_MAGIC,
|
.pr_magic = M10BMC_N3000_PR_PROG_MAGIC,
|
||||||
.rsu_update_counter = M10BMC_N3000_STAGING_FLASH_COUNT,
|
.rsu_update_counter = M10BMC_N3000_STAGING_FLASH_COUNT,
|
||||||
|
.staging_size = M10BMC_STAGING_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mfd_cell m10bmc_d5005_subdevs[] = {
|
static struct mfd_cell m10bmc_d5005_subdevs[] = {
|
||||||
|
|
|
@ -205,6 +205,7 @@ struct m10bmc_csr_map {
|
||||||
unsigned int pr_reh_addr;
|
unsigned int pr_reh_addr;
|
||||||
unsigned int pr_magic;
|
unsigned int pr_magic;
|
||||||
unsigned int rsu_update_counter;
|
unsigned int rsu_update_counter;
|
||||||
|
unsigned int staging_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue