diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/amd/common/block/psp/psp_smi_flash.c | 22 | ||||
-rw-r--r-- | src/soc/amd/common/block/psp/psp_smi_flash.h | 38 | ||||
-rw-r--r-- | src/soc/amd/common/block/psp/psp_smi_flash_gen2.c | 14 |
3 files changed, 40 insertions, 34 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 8a622961c5..e9b906b0be 100644 --- a/src/soc/amd/common/block/psp/psp_smi_flash.c +++ b/src/soc/amd/common/block/psp/psp_smi_flash.c @@ -11,13 +11,13 @@ #include "psp_def.h" #include "psp_smi_flash.h" -static bool is_valid_rw_byte_count(struct mbox_pspv2_cmd_spi_read_write *cmd_buf, +static bool is_valid_rw_byte_count(struct mbox_psp_cmd_spi_read_write *cmd_buf, u64 num_bytes) { const u32 cmd_buf_size = read32(&cmd_buf->header.size); const size_t payload_buffer_offset = - offsetof(struct mbox_pspv2_cmd_spi_read_write, req) + - offsetof(struct pspv2_spi_read_write_request, buffer); + offsetof(struct mbox_psp_cmd_spi_read_write, req) + + offsetof(struct psp_spi_read_write_request, buffer); return num_bytes <= cmd_buf_size - payload_buffer_offset; } @@ -91,8 +91,8 @@ static bool spi_controller_available(void) enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer) { - struct mbox_pspv2_cmd_spi_info *const cmd_buf = - (struct mbox_pspv2_cmd_spi_info *)buffer; + struct mbox_psp_cmd_spi_info *const cmd_buf = + (struct mbox_psp_cmd_spi_info *)buffer; const struct spi_flash *flash; struct region_device store; u64 target_nv_id; @@ -131,8 +131,8 @@ enum mbox_p2c_status psp_smi_spi_get_info(struct mbox_default_buffer *buffer) enum mbox_p2c_status psp_smi_spi_read(struct mbox_default_buffer *buffer) { - struct mbox_pspv2_cmd_spi_read_write *const cmd_buf = - (struct mbox_pspv2_cmd_spi_read_write *)buffer; + struct mbox_psp_cmd_spi_read_write *const cmd_buf = + (struct mbox_psp_cmd_spi_read_write *)buffer; enum mbox_p2c_status ret; u64 target_nv_id; u64 lba; @@ -180,8 +180,8 @@ enum mbox_p2c_status psp_smi_spi_read(struct mbox_default_buffer *buffer) enum mbox_p2c_status psp_smi_spi_write(struct mbox_default_buffer *buffer) { - struct mbox_pspv2_cmd_spi_read_write *const cmd_buf = - (struct mbox_pspv2_cmd_spi_read_write *)buffer; + struct mbox_psp_cmd_spi_read_write *const cmd_buf = + (struct mbox_psp_cmd_spi_read_write *)buffer; enum mbox_p2c_status ret; u64 target_nv_id; u64 lba; @@ -229,8 +229,8 @@ enum mbox_p2c_status psp_smi_spi_write(struct mbox_default_buffer *buffer) enum mbox_p2c_status psp_smi_spi_erase(struct mbox_default_buffer *buffer) { - struct mbox_pspv2_cmd_spi_erase *const cmd_buf = - (struct mbox_pspv2_cmd_spi_erase *)buffer; + struct mbox_psp_cmd_spi_erase *const cmd_buf = + (struct mbox_psp_cmd_spi_erase *)buffer; enum mbox_p2c_status ret; u64 target_nv_id; u64 lba; diff --git a/src/soc/amd/common/block/psp/psp_smi_flash.h b/src/soc/amd/common/block/psp/psp_smi_flash.h index 077cc3b72c..52144f8c95 100644 --- a/src/soc/amd/common/block/psp/psp_smi_flash.h +++ b/src/soc/amd/common/block/psp/psp_smi_flash.h @@ -8,49 +8,55 @@ enum psp_spi_id_type { SMI_TARGET_RPMC_NVRAM = 5, }; -struct pspv2_spi_info_request { +struct psp_spi_info_request { +#if CONFIG(SOC_AMD_COMMON_BLOCK_PSP_GEN2) u64 target_nv_id; +#endif u64 lba; u64 block_size; u64 num_blocks; } __packed; -struct mbox_pspv2_cmd_spi_info { +struct mbox_psp_cmd_spi_info { struct mbox_buffer_header header; - struct pspv2_spi_info_request req; + struct psp_spi_info_request req; } __packed; -struct pspv2_spi_read_write_request { +struct psp_spi_read_write_request { +#if CONFIG(SOC_AMD_COMMON_BLOCK_PSP_GEN2) u64 target_nv_id; +#endif u64 lba; u64 offset; u64 num_bytes; u8 buffer[]; } __packed; -struct mbox_pspv2_cmd_spi_read_write { +struct mbox_psp_cmd_spi_read_write { struct mbox_buffer_header header; - struct pspv2_spi_read_write_request req; + struct psp_spi_read_write_request req; } __packed; -struct pspv2_spi_erase_request { +struct psp_spi_erase_request { +#if CONFIG(SOC_AMD_COMMON_BLOCK_PSP_GEN2) u64 target_nv_id; +#endif u64 lba; u64 num_blocks; } __packed; -struct mbox_pspv2_cmd_spi_erase { +struct mbox_psp_cmd_spi_erase { struct mbox_buffer_header header; - struct pspv2_spi_erase_request req; + struct psp_spi_erase_request req; } __packed; -bool is_valid_psp_spi_info(struct mbox_pspv2_cmd_spi_info *cmd_buf); -bool is_valid_psp_spi_read_write(struct mbox_pspv2_cmd_spi_read_write *cmd_buf); -bool is_valid_psp_spi_erase(struct mbox_pspv2_cmd_spi_erase *cmd_buf); -u64 get_psp_spi_info_id(struct mbox_pspv2_cmd_spi_info *cmd_buf); -void set_psp_spi_info(struct mbox_pspv2_cmd_spi_info *cmd_buf, u64 lba, u64 block_size, +bool is_valid_psp_spi_info(struct mbox_psp_cmd_spi_info *cmd_buf); +bool is_valid_psp_spi_read_write(struct mbox_psp_cmd_spi_read_write *cmd_buf); +bool is_valid_psp_spi_erase(struct mbox_psp_cmd_spi_erase *cmd_buf); +u64 get_psp_spi_info_id(struct mbox_psp_cmd_spi_info *cmd_buf); +void set_psp_spi_info(struct mbox_psp_cmd_spi_info *cmd_buf, u64 lba, u64 block_size, u64 num_blocks); -void get_psp_spi_read_write(struct mbox_pspv2_cmd_spi_read_write *cmd_buf, u64 *target_nv_id, +void get_psp_spi_read_write(struct mbox_psp_cmd_spi_read_write *cmd_buf, u64 *target_nv_id, u64 *lba, u64 *offset, u64 *num_bytes, u8 **data); -void get_psp_spi_erase(struct mbox_pspv2_cmd_spi_erase *cmd_buf, u64 *target_nv_id, u64 *lba, +void get_psp_spi_erase(struct mbox_psp_cmd_spi_erase *cmd_buf, u64 *target_nv_id, u64 *lba, u64 *num_blocks); diff --git a/src/soc/amd/common/block/psp/psp_smi_flash_gen2.c b/src/soc/amd/common/block/psp/psp_smi_flash_gen2.c index 99ea0303d5..f62cdd23a4 100644 --- a/src/soc/amd/common/block/psp/psp_smi_flash_gen2.c +++ b/src/soc/amd/common/block/psp/psp_smi_flash_gen2.c @@ -11,27 +11,27 @@ static bool is_valid_psp_spi_id(u64 target_nv_id) target_nv_id == SMI_TARGET_RPMC_NVRAM; } -bool is_valid_psp_spi_info(struct mbox_pspv2_cmd_spi_info *cmd_buf) +bool is_valid_psp_spi_info(struct mbox_psp_cmd_spi_info *cmd_buf) { return is_valid_psp_spi_id(read64(&cmd_buf->req.target_nv_id)); } -bool is_valid_psp_spi_read_write(struct mbox_pspv2_cmd_spi_read_write *cmd_buf) +bool is_valid_psp_spi_read_write(struct mbox_psp_cmd_spi_read_write *cmd_buf) { return is_valid_psp_spi_id(read64(&cmd_buf->req.target_nv_id)); } -bool is_valid_psp_spi_erase(struct mbox_pspv2_cmd_spi_erase *cmd_buf) +bool is_valid_psp_spi_erase(struct mbox_psp_cmd_spi_erase *cmd_buf) { return is_valid_psp_spi_id(read64(&cmd_buf->req.target_nv_id)); } -u64 get_psp_spi_info_id(struct mbox_pspv2_cmd_spi_info *cmd_buf) +u64 get_psp_spi_info_id(struct mbox_psp_cmd_spi_info *cmd_buf) { return read64(&cmd_buf->req.target_nv_id); } -void set_psp_spi_info(struct mbox_pspv2_cmd_spi_info *cmd_buf, u64 lba, u64 block_size, +void set_psp_spi_info(struct mbox_psp_cmd_spi_info *cmd_buf, u64 lba, u64 block_size, u64 num_blocks) { write64(&cmd_buf->req.lba, lba); @@ -39,7 +39,7 @@ void set_psp_spi_info(struct mbox_pspv2_cmd_spi_info *cmd_buf, u64 lba, u64 bloc write64(&cmd_buf->req.num_blocks, num_blocks); } -void get_psp_spi_read_write(struct mbox_pspv2_cmd_spi_read_write *cmd_buf, u64 *target_nv_id, +void get_psp_spi_read_write(struct mbox_psp_cmd_spi_read_write *cmd_buf, u64 *target_nv_id, u64 *lba, u64 *offset, u64 *num_bytes, u8 **data) { *target_nv_id = read64(&cmd_buf->req.target_nv_id); @@ -49,7 +49,7 @@ void get_psp_spi_read_write(struct mbox_pspv2_cmd_spi_read_write *cmd_buf, u64 * *data = cmd_buf->req.buffer; } -void get_psp_spi_erase(struct mbox_pspv2_cmd_spi_erase *cmd_buf, u64 *target_nv_id, u64 *lba, +void get_psp_spi_erase(struct mbox_psp_cmd_spi_erase *cmd_buf, u64 *target_nv_id, u64 *lba, u64 *num_blocks) { *target_nv_id = read64(&cmd_buf->req.target_nv_id); |