diff options
Diffstat (limited to 'src/soc/amd/common/block/acpi/tables.c')
-rw-r--r-- | src/soc/amd/common/block/acpi/tables.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/acpi/tables.c b/src/soc/amd/common/block/acpi/tables.c index 88ff252b26..8bad755de1 100644 --- a/src/soc/amd/common/block/acpi/tables.c +++ b/src/soc/amd/common/block/acpi/tables.c @@ -1,8 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include <acpi/acpi.h> +#include <acpi/acpigen.h> #include <amdblocks/acpi.h> #include <amdblocks/chip.h> +#include <assert.h> +#include <cpu/amd/msr.h> +#include <cpu/amd/mtrr.h> #include <device/device.h> #include <types.h> @@ -45,3 +49,30 @@ unsigned long acpi_fill_madt_irqoverride(unsigned long current) return current; } + +/* Used by \_SB.PCI0._CRS */ +void acpi_fill_root_complex_tom(const struct device *device) +{ + msr_t msr; + const char *scope; + + assert(device); + + scope = acpi_device_scope(device); + assert(scope); + acpigen_write_scope(scope); + + msr = rdmsr(TOP_MEM); + acpigen_write_name_dword("TOM1", msr.lo); + msr = rdmsr(TOP_MEM2); + /* + * Since XP only implements parts of ACPI 2.0, we can't use a qword + * here. + * See http://www.acpi.info/presentations/S01USMOBS169_OS%2520new.ppt + * slide 22ff. + * 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_pop_len(); +} |