soc/amd/common/psp/psp_smi_flash: implement generation 1 support
Implement the request buffer access functions for the PSP generation 1 case. In this case, only the SMI_TARGET_NVRAM is supported, so always return this target NV ID and always return true in the validity checks which in the PSP generation 2 case check if the target NV ID is valid. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I7e141f846e930bab6972a281745c0180ac52c291 Reviewed-on: https://review.coreboot.org/c/coreboot/+/84064 Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
This commit is contained in:
parent
ef8fdd9d3e
commit
a28b518ba9
2 changed files with 54 additions and 0 deletions
|
|
@ -17,7 +17,9 @@ ifeq ($(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1),y)
|
|||
|
||||
romstage-y += psp_gen1.c
|
||||
ramstage-y += psp_gen1.c
|
||||
|
||||
smm-y += psp_gen1.c
|
||||
smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_PSP_SMI) += psp_smi_flash_gen1.c
|
||||
|
||||
endif # CONFIG_SOC_AMD_COMMON_BLOCK_PSP_GEN1
|
||||
|
||||
|
|
|
|||
52
src/soc/amd/common/block/psp/psp_smi_flash_gen1.c
Normal file
52
src/soc/amd/common/block/psp/psp_smi_flash_gen1.c
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <device/mmio.h>
|
||||
#include <types.h>
|
||||
#include "psp_def.h"
|
||||
#include "psp_smi_flash.h"
|
||||
|
||||
bool is_valid_psp_spi_info(struct mbox_psp_cmd_spi_info *cmd_buf)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_valid_psp_spi_read_write(struct mbox_psp_cmd_spi_read_write *cmd_buf)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool is_valid_psp_spi_erase(struct mbox_psp_cmd_spi_erase *cmd_buf)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
u64 get_psp_spi_info_id(struct mbox_psp_cmd_spi_info *cmd_buf)
|
||||
{
|
||||
return SMI_TARGET_NVRAM;
|
||||
}
|
||||
|
||||
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);
|
||||
write64(&cmd_buf->req.block_size, block_size);
|
||||
write64(&cmd_buf->req.num_blocks, num_blocks);
|
||||
}
|
||||
|
||||
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 = SMI_TARGET_NVRAM;
|
||||
*lba = read64(&cmd_buf->req.lba);
|
||||
*offset = read64(&cmd_buf->req.offset);
|
||||
*num_bytes = read64(&cmd_buf->req.num_bytes);
|
||||
*data = cmd_buf->req.buffer;
|
||||
}
|
||||
|
||||
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 = SMI_TARGET_NVRAM;
|
||||
*lba = read64(&cmd_buf->req.lba);
|
||||
*num_blocks = read64(&cmd_buf->req.num_blocks);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue