summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/soc/amd/common/block/psp/psp_gen2.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/soc/amd/common/block/psp/psp_gen2.c b/src/soc/amd/common/block/psp/psp_gen2.c
index ef71d5b42a..0972131fb3 100644
--- a/src/soc/amd/common/block/psp/psp_gen2.c
+++ b/src/soc/amd/common/block/psp/psp_gen2.c
@@ -10,16 +10,19 @@
#define PSP_MAILBOX_OFFSET 0x10570
-void *soc_get_mbox_address(void)
+static uintptr_t soc_get_psp_base_address(void)
{
- uintptr_t psp_mmio;
-
- psp_mmio = rdmsr(MSR_PSP_ADDR).lo;
- if (!psp_mmio) {
+ uintptr_t psp_mmio = rdmsr(MSR_PSP_ADDR).lo;
+ if (!psp_mmio)
printk(BIOS_WARNING, "PSP: MSR_PSP_ADDR uninitialized\n");
- return 0;
- }
+ return psp_mmio;
+}
+void *soc_get_mbox_address(void)
+{
+ uintptr_t psp_mmio = soc_get_psp_base_address();
+ if (!psp_mmio)
+ return 0;
return (void *)(psp_mmio + PSP_MAILBOX_OFFSET);
}