Attention is currently required from: Fred Reitberger, Jason Glenesk, Matt DeVillier, ritul guru.
Hello ritul guru,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/83775?usp=email
to review the following change.
Change subject: soc/amd/common/psp_smi_flash: add spi_controller_available ......................................................................
soc/amd/common/psp_smi_flash: add spi_controller_available
Add the 'spi_controller_available' helper function to check SPI_SEMAPHORE_DRIVER_LOCKED in SPI_MISC_CNTRL to see if some software or driver outside of SMM is currently using the SPI flash controller to avoid interfering with that operation.
This patch is a slightly reworked version of parts of CB:65523.
Test=When selecting SOC_AMD_COMMON_BLOCK_PSP_SMI, Mandolin still builds
Signed-off-by: Felix Held felix-coreboot@felixheld.de Signed-off-by: Ritul Guru ritul.bits@gmail.com Change-Id: I49218e03a5dd555b2b2d34eaad86673e9fc908c3 --- M src/soc/amd/common/block/psp/psp_smi_flash.c 1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/83775/1
diff --git a/src/soc/amd/common/block/psp/psp_smi_flash.c b/src/soc/amd/common/block/psp/psp_smi_flash.c index 4c83fcd..367baef 100644 --- a/src/soc/amd/common/block/psp/psp_smi_flash.c +++ b/src/soc/amd/common/block/psp/psp_smi_flash.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <amdblocks/spi.h> #include <boot_device.h> #include <commonlib/region.h> #include <console/console.h> @@ -134,6 +135,11 @@ return MBOX_PSP_SUCCESS; }
+static inline bool spi_controller_available(void) +{ + return !(spi_read8(SPI_MISC_CNTRL) & SPI_SEMAPHORE_DRIVER_LOCKED); +} + enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer) { struct mbox_pspv2_cmd_spi_info *const cmd_buf =