Skip to content

SPI device: major regression with non-flash mode #266

@rivos-eblot

Description

@rivos-eblot

TPM support has introduced a major regression, as SPI device enters TPM mode while TPM is not enabled, breaking support for flash and passthrough modes.

It seems that several functions are using the wrong register bank, namely spi_regs to index TPM registers, whereas the proper bank is likely tpm_regs.

What is more surprising is that the CI did not catch it?

static bool ot_spi_device_is_tpm_enabled(const OtSPIDeviceState *s)
{
    return (bool)FIELD_EX32(s->spi_regs[R_TPM_CFG], TPM_CFG, EN);
}

static bool ot_spi_device_is_tpm_mode_crb(const OtSPIDeviceState *s)
{
    return (bool)FIELD_EX32(s->spi_regs[R_TPM_CFG], TPM_CFG, TPM_MODE);
}

static bool ot_spi_device_tpm_disable_hw_regs(const OtSPIDeviceState *s)
{
    return (bool)FIELD_EX32(s->spi_regs[R_TPM_CFG], TPM_CFG, HW_REG_DIS);
}

There may be other locations where the wrong register bank is used, I have not dug further.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions