From 9c366417dfca97cb3aacfaf684ceafc18d6419e6 Mon Sep 17 00:00:00 2001 From: Felix Held Date: Tue, 30 Jul 2024 15:08:48 +0200 Subject: soc/amd/common/psp_smm: add/improve comments to buffers and flags Since it's not exactly obvious what 'c2p_buffer', 'p2c_buffer' and 'smm_flag' are used for, add comments to those. Signed-off-by: Felix Held Change-Id: I4ec092a92fe9f0686ffb7103e441802fc05381f4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/83698 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/amd/common/block/psp/psp_smm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/soc/amd/common') diff --git a/src/soc/amd/common/block/psp/psp_smm.c b/src/soc/amd/common/block/psp/psp_smm.c index 2112e868f6..114cf12add 100644 --- a/src/soc/amd/common/block/psp/psp_smm.c +++ b/src/soc/amd/common/block/psp/psp_smm.c @@ -14,15 +14,28 @@ #define C2P_BUFFER_MAXSIZE 0xc00 /* Core-to-PSP buffer */ #define P2C_BUFFER_MAXSIZE 0xc00 /* PSP-to-core buffer */ +/* + * When sending PSP mailbox commands to the PSP from the SMI handler after the boot done + * command was sent, the corresponding data buffer needs to be placed in this core to PSP (C2P) + * buffer. + */ struct { u8 buffer[C2P_BUFFER_MAXSIZE]; } __aligned(32) c2p_buffer; +/* + * When the PSP sends mailbox commands to the host, it will update the PSP to core (P2C) buffer + * and then send an SMI to the host to process the request. + */ struct { u8 buffer[P2C_BUFFER_MAXSIZE]; } __aligned(32) p2c_buffer; -static uint32_t smm_flag; /* Non-zero for SMM, clear when not */ +/* + * When sending PSP mailbox commands to the PSP from the SMI handler, the SMM flag needs to be + * set for the PSP to accept it. Otherwise it should be cleared. + */ +static uint32_t smm_flag; static void set_smm_flag(void) { -- cgit v1.2.3