summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/common/block/psp/psp_smi_flash.c21
1 files changed, 11 insertions, 10 deletions
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 ca595536c1..abddcdf19a 100644
--- a/src/soc/amd/common/block/psp/psp_smi_flash.c
+++ b/src/soc/amd/common/block/psp/psp_smi_flash.c
@@ -92,9 +92,14 @@ static enum mbox_p2c_status find_psp_spi_flash_device_region(uint64_t target_nv_
return MBOX_PSP_SUCCESS;
}
-static bool spi_controller_available(void)
+static bool spi_controller_busy(void)
{
- return !(spi_read8(SPI_MISC_CNTRL) & SPI_SEMAPHORE_DRIVER_LOCKED);
+ const bool busy = (spi_read8(SPI_MISC_CNTRL) & SPI_SEMAPHORE_DRIVER_LOCKED);
+
+ if (busy)
+ printk(BIOS_NOTICE, "PSP: SPI controller busy\n");
+
+ return busy;
}
enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer)
@@ -113,8 +118,7 @@ enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer)
if (!is_valid_psp_spi_info(cmd_buf))
return MBOX_PSP_COMMAND_PROCESS_ERROR;
- if (!spi_controller_available()) {
- printk(BIOS_NOTICE, "PSP: SPI controller busy\n");
+ if (spi_controller_busy()) {
return MBOX_PSP_SPI_BUSY;
}
@@ -156,8 +160,7 @@ enum mbox_p2c_status psp_smi_spi_read(struct mbox_default_buffer *buffer)
if (!is_valid_psp_spi_read_write(cmd_buf))
return MBOX_PSP_COMMAND_PROCESS_ERROR;
- if (!spi_controller_available()) {
- printk(BIOS_NOTICE, "PSP: SPI controller busy\n");
+ if (spi_controller_busy()) {
return MBOX_PSP_SPI_BUSY;
}
@@ -205,8 +208,7 @@ enum mbox_p2c_status psp_smi_spi_write(struct mbox_default_buffer *buffer)
if (!is_valid_psp_spi_read_write(cmd_buf))
return MBOX_PSP_COMMAND_PROCESS_ERROR;
- if (!spi_controller_available()) {
- printk(BIOS_NOTICE, "PSP: SPI controller busy\n");
+ if (spi_controller_busy()) {
return MBOX_PSP_SPI_BUSY;
}
@@ -253,8 +255,7 @@ enum mbox_p2c_status psp_smi_spi_erase(struct mbox_default_buffer *buffer)
if (!is_valid_psp_spi_erase(cmd_buf))
return MBOX_PSP_COMMAND_PROCESS_ERROR;
- if (!spi_controller_available()) {
- printk(BIOS_NOTICE, "PSP: SPI controller busy\n");
+ if (spi_controller_busy()) {
return MBOX_PSP_SPI_BUSY;
}