summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block/acpi/tables.c
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-04-20 13:22:34 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-04-21 15:14:00 +0000
commit09906111aaaa2a74e67b2483ee9dd7e0fbbddf2b (patch)
tree590f4419af0650b948fa3982682d475b23f8b118 /src/soc/amd/common/block/acpi/tables.c
parent88c94fead3c2b16801e27ea8102d13917bf62547 (diff)
soc/amd/common/block/acpi/tables: use get_top_of_mem_[below,above]_4gb
Use get_top_of_mem_below_4gb and get_top_of_mem_above_4g instead of open-coding the functionality. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I35895340f6e747e2f5e1669d40f40b201d8c1845 Reviewed-on: https://review.coreboot.org/c/coreboot/+/74612 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'src/soc/amd/common/block/acpi/tables.c')
-rw-r--r--src/soc/amd/common/block/acpi/tables.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/soc/amd/common/block/acpi/tables.c b/src/soc/amd/common/block/acpi/tables.c
index b7c942c27a..17db421831 100644
--- a/src/soc/amd/common/block/acpi/tables.c
+++ b/src/soc/amd/common/block/acpi/tables.c
@@ -40,7 +40,6 @@ unsigned long acpi_fill_madt_irqoverride(unsigned long current)
/* Used by \_SB.PCI0._CRS */
void acpi_fill_root_complex_tom(const struct device *device)
{
- msr_t msr;
const char *scope;
assert(device);
@@ -49,9 +48,8 @@ void acpi_fill_root_complex_tom(const struct device *device)
assert(scope);
acpigen_write_scope(scope);
- msr = rdmsr(TOP_MEM);
- acpigen_write_name_dword("TOM1", msr.lo);
- msr = rdmsr(TOP_MEM2);
+ acpigen_write_name_dword("TOM1", get_top_of_mem_below_4gb());
+
/*
* Since XP only implements parts of ACPI 2.0, we can't use a qword
* here.
@@ -60,6 +58,6 @@ void acpi_fill_root_complex_tom(const struct device *device)
* Shift value right by 20 bit to make it fit into 32bit,
* giving us 1MB granularity and a limit of almost 4Exabyte of memory.
*/
- acpigen_write_name_dword("TOM2", (msr.hi << 12) | msr.lo >> 20);
+ acpigen_write_name_dword("TOM2", get_top_of_mem_above_4g() >> 20);
acpigen_pop_len();
}