blob: ddefd22bd033ae76f15c0902eb325bb9899b1ffd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* 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 == 0xffffffff) {
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)
return;
trig->address = (uintptr_t)acpimmio_smi + SMI_REG_SMITRIG0;
trig->address_type = SMM_TRIGGER_MEM;
trig->value_width = SMM_TRIGGER_DWORD;
trig->value_and_mask = ~SMITRIG0_PSP;
trig->value_or_mask = SMITRIG0_PSP;
}
void soc_fill_smm_reg_info(struct smm_register_info *reg)
{
if (!reg)
return;
reg->smi_enb.address = (uintptr_t)acpimmio_smi + SMI_REG_SMITRIG0;
reg->smi_enb.address_type = SMM_TRIGGER_MEM;
reg->smi_enb.value_width = SMM_TRIGGER_DWORD;
reg->smi_enb.reg_bit_mask = SMITRG0_SMIENB;
reg->smi_enb.expect_value = 0;
reg->eos.address = (uintptr_t)acpimmio_smi + SMI_REG_SMITRIG0;
reg->eos.address_type = SMM_TRIGGER_MEM;
reg->eos.value_width = SMM_TRIGGER_DWORD;
reg->eos.reg_bit_mask = SMITRG0_EOS;
reg->eos.expect_value = SMITRG0_EOS;
reg->psp_smi_en.address = (uintptr_t)acpimmio_smi + SMI_REG_CONTROL0;
reg->psp_smi_en.address += sizeof(uint32_t) * SMITYPE_PSP / 16;
reg->psp_smi_en.address_type = SMM_TRIGGER_MEM;
reg->psp_smi_en.value_width = SMM_TRIGGER_DWORD;
reg->psp_smi_en.reg_bit_mask = SMI_MODE_MASK << (2 * SMITYPE_PSP % 16);
reg->psp_smi_en.expect_value = SMI_MODE_SMI << (2 * SMITYPE_PSP % 16);
}
|