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>
This commit is contained in:
Felix Held 2021-02-09 20:04:33 +01:00 committed by Martin Roth
parent 517453a6cc
commit 583d531bd6
1 changed files with 10 additions and 7 deletions

View File

@ -10,16 +10,19 @@
#define PSP_MAILBOX_OFFSET 0x10570 #define PSP_MAILBOX_OFFSET 0x10570
static uintptr_t soc_get_psp_base_address(void)
{
uintptr_t psp_mmio = rdmsr(MSR_PSP_ADDR).lo;
if (!psp_mmio)
printk(BIOS_WARNING, "PSP: MSR_PSP_ADDR uninitialized\n");
return psp_mmio;
}
void *soc_get_mbox_address(void) void *soc_get_mbox_address(void)
{ {
uintptr_t psp_mmio; uintptr_t psp_mmio = soc_get_psp_base_address();
if (!psp_mmio)
psp_mmio = rdmsr(MSR_PSP_ADDR).lo;
if (!psp_mmio) {
printk(BIOS_WARNING, "PSP: MSR_PSP_ADDR uninitialized\n");
return 0; return 0;
}
return (void *)(psp_mmio + PSP_MAILBOX_OFFSET); return (void *)(psp_mmio + PSP_MAILBOX_OFFSET);
} }