summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-01-29 22:59:42 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-01-31 01:12:37 +0000
commit84439c26d8afd0079ce9cbaddf11c911974c3b1b (patch)
tree2259bb822406823972f3650e4730174ffa1e2f4a /src/soc
parent31fdefe5842b7b6f77f341b65cb7851c72fc8516 (diff)
downloadcoreboot-84439c26d8afd0079ce9cbaddf11c911974c3b1b.tar.xz
soc/amd/picasso/psp: move soc_get_mbox_address to common PSP gen2 code
The function to get the PSP mailbox address is the same on Picasso and Cezanne, so move it to the common PSP generation 2 code. The function is only used in the same compilation unit, but it can't be marked as static due to the function prototype in amdblocks/psp.h that is still needed for Stoneyridge. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ieea91ef76523d303f948d29ef48e3b2e56293f26 Reviewed-on: https://review.coreboot.org/c/coreboot/+/50151 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/amd/common/block/psp/psp_gen2.c17
-rw-r--r--src/soc/amd/picasso/psp.c17
2 files changed, 17 insertions, 17 deletions
diff --git a/src/soc/amd/common/block/psp/psp_gen2.c b/src/soc/amd/common/block/psp/psp_gen2.c
index 59e62551c1..ef71d5b42a 100644
--- a/src/soc/amd/common/block/psp/psp_gen2.c
+++ b/src/soc/amd/common/block/psp/psp_gen2.c
@@ -1,11 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <console/console.h>
+#include <cpu/x86/msr.h>
#include <device/mmio.h>
#include <timer.h>
#include <amdblocks/psp.h>
#include <soc/iomap.h>
#include "psp_def.h"
+#define PSP_MAILBOX_OFFSET 0x10570
+
+void *soc_get_mbox_address(void)
+{
+ uintptr_t psp_mmio;
+
+ psp_mmio = rdmsr(MSR_PSP_ADDR).lo;
+ if (!psp_mmio) {
+ printk(BIOS_WARNING, "PSP: MSR_PSP_ADDR uninitialized\n");
+ return 0;
+ }
+
+ return (void *)(psp_mmio + PSP_MAILBOX_OFFSET);
+}
+
static u16 rd_mbox_sts(struct pspv2_mbox *mbox)
{
union {
diff --git a/src/soc/amd/picasso/psp.c b/src/soc/amd/picasso/psp.c
index 6acb5888ce..f02723ad1f 100644
--- a/src/soc/amd/picasso/psp.c
+++ b/src/soc/amd/picasso/psp.c
@@ -1,27 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#include <console/console.h>
-#include <cpu/x86/msr.h>
#include <soc/smi.h>
#include <amdblocks/acpimmio.h>
#include <amdblocks/psp.h>
#include <amdblocks/smi.h>
-#define PSP_MAILBOX_OFFSET 0x10570
-
-void *soc_get_mbox_address(void)
-{
- uintptr_t psp_mmio;
-
- psp_mmio = rdmsr(MSR_PSP_ADDR).lo;
- if (!psp_mmio) {
- printk(BIOS_WARNING, "PSP: MSR_PSP_ADDR uninitialized\n");
- return 0;
- }
-
- return (void *)(psp_mmio + PSP_MAILBOX_OFFSET);
-}
-
void soc_fill_smm_trig_info(struct smm_trigger_info *trig)
{
if (!trig)