summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/psp
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-02-09 20:04:33 +0100
committerMartin Roth <martinroth@google.com>2021-02-10 21:10:11 +0000
commit583d531bd68366fb0eadc9799584318bf415a602 (patch)
treecca37d2b40eef7c099272b4b9521c61ba4fb71a4 /src/soc/amd/common/block/psp
parent517453a6cc770cf69515bb0d5768495ffead7f08 (diff)
soc/amd/common/block/psp: factor out soc_get_psp_base_address
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ib73ac92e69f1be5852a1406ba714acb6a8a04989 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50447 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src/soc/amd/common/block/psp')
-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);
}