/* * For some Intel FPGA devices, the BMC firmware is not available to service * handshake registers during a secure update.
*/ staticbool m10bmc_reg_always_available(struct intel_m10bmc *m10bmc, unsignedint offset)
{ if (!m10bmc->info->handshake_sys_reg_nranges) returntrue;
/* * m10bmc_handshake_reg_unavailable - Checks if reg access collides with secure update state * @m10bmc: M10 BMC structure * * For some Intel FPGA devices, the BMC firmware is not available to service * handshake registers during a secure update erase and write phases. * * Context: @m10bmc->bmcfw_lock must be held.
*/ staticbool m10bmc_handshake_reg_unavailable(struct intel_m10bmc *m10bmc)
{ return m10bmc->bmcfw_state == M10BMC_FW_STATE_SEC_UPDATE_PREPARE ||
m10bmc->bmcfw_state == M10BMC_FW_STATE_SEC_UPDATE_WRITE;
}
/* * This function helps to simplify the accessing of the system registers. * * The base of the system registers is configured through the struct * csr_map.
*/ int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsignedint offset, unsignedint *val)
{ conststruct m10bmc_csr_map *csr_map = m10bmc->info->csr_map; int ret;
if (m10bmc_reg_always_available(m10bmc, offset)) return m10bmc_raw_read(m10bmc, csr_map->base + offset, val);
down_read(&m10bmc->bmcfw_lock); if (m10bmc_handshake_reg_unavailable(m10bmc))
ret = -EBUSY; /* Reg not available during secure update */ else
ret = m10bmc_raw_read(m10bmc, csr_map->base + offset, val);
up_read(&m10bmc->bmcfw_lock);
int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsignedint offset, unsignedint msk, unsignedint val)
{ conststruct m10bmc_csr_map *csr_map = m10bmc->info->csr_map; int ret;
if (m10bmc_reg_always_available(m10bmc, offset)) return regmap_update_bits(m10bmc->regmap, csr_map->base + offset, msk, val);
down_read(&m10bmc->bmcfw_lock); if (m10bmc_handshake_reg_unavailable(m10bmc))
ret = -EBUSY; /* Reg not available during secure update */ else
ret = regmap_update_bits(m10bmc->regmap, csr_map->base + offset, msk, val);
up_read(&m10bmc->bmcfw_lock);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.