aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD Scott Phillips <scottph@FreeBSD.org>2020-08-26 02:12:15 +0000
committerD Scott Phillips <scottph@FreeBSD.org>2020-08-26 02:12:15 +0000
commitdd6fd1d4307247432272a10521ea19a70bb157bb (patch)
tree35da9246cf1bf1a441ffcdb5204b6e89fb1b885a
parentf8782001804f674dc3aff53053af5ebc3c199f02 (diff)
downloadsrc-dd6fd1d4307247432272a10521ea19a70bb157bb.tar.gz
src-dd6fd1d4307247432272a10521ea19a70bb157bb.zip
arm64/acpi: Give the real PA limit to ACPI
Read PA bits from ID_AA64MMFR0_EL1.PARange. Reviewed by: andrew, markj Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26133
Notes
Notes: svn path=/head/; revision=364797
-rw-r--r--sys/arm64/acpica/acpi_machdep.c37
-rw-r--r--sys/arm64/arm64/identcpu.c7
2 files changed, 43 insertions, 1 deletions
diff --git a/sys/arm64/acpica/acpi_machdep.c b/sys/arm64/acpica/acpi_machdep.c
index 4e85c174b040..05ec00ccbe61 100644
--- a/sys/arm64/acpica/acpi_machdep.c
+++ b/sys/arm64/acpica/acpi_machdep.c
@@ -232,12 +232,47 @@ acpi_map_addr(struct acpi_generic_address *addr, bus_space_tag_t *tag,
static void
parse_pxm_tables(void *dummy)
{
+ uint64_t mmfr0, parange;
/* Only parse ACPI tables when booting via ACPI */
if (arm64_bus_method != ARM64_BUS_ACPI)
return;
- acpi_pxm_init(MAXCPU, (vm_paddr_t)1 << 40);
+ if (!get_kernel_reg(ID_AA64MMFR0_EL1, &mmfr0)) {
+ /* chosen arbitrarily */
+ mmfr0 = ID_AA64MMFR0_PARange_1T;
+ }
+
+ switch (ID_AA64MMFR0_PARange_VAL(mmfr0)) {
+ case ID_AA64MMFR0_PARange_4G:
+ parange = (vm_paddr_t)4 << 30 /* GiB */;
+ break;
+ case ID_AA64MMFR0_PARange_64G:
+ parange = (vm_paddr_t)64 << 30 /* GiB */;
+ break;
+ case ID_AA64MMFR0_PARange_1T:
+ parange = (vm_paddr_t)1 << 40 /* TiB */;
+ break;
+ case ID_AA64MMFR0_PARange_4T:
+ parange = (vm_paddr_t)4 << 40 /* TiB */;
+ break;
+ case ID_AA64MMFR0_PARange_16T:
+ parange = (vm_paddr_t)16 << 40 /* TiB */;
+ break;
+ case ID_AA64MMFR0_PARange_256T:
+ parange = (vm_paddr_t)256 << 40 /* TiB */;
+ break;
+ case ID_AA64MMFR0_PARange_4P:
+ parange = (vm_paddr_t)4 << 50 /* PiB */;
+ break;
+ default:
+ /* chosen arbitrarily */
+ parange = (vm_paddr_t)1 << 40 /* TiB */;
+ printf("Unknown value for PARange in mmfr0 (%#lx)\n", mmfr0);
+ break;
+ }
+
+ acpi_pxm_init(MAXCPU, parange);
acpi_pxm_parse_tables();
acpi_pxm_set_mem_locality();
}
diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c
index 6a197c245bc5..1c944ef09596 100644
--- a/sys/arm64/arm64/identcpu.c
+++ b/sys/arm64/arm64/identcpu.c
@@ -916,6 +916,13 @@ static struct mrs_user_reg user_regs[] = {
.offset = __offsetof(struct cpu_desc, id_aa64dfr0),
.fields = id_aa64dfr0_fields,
},
+ { /* id_aa64mmfr0_el1 */
+ .reg = ID_AA64MMFR0_EL1,
+ .CRm = 7,
+ .Op2 = 0,
+ .offset = __offsetof(struct cpu_desc, id_aa64mmfr0),
+ .fields = id_aa64mmfr0_fields,
+ },
};
#define CPU_DESC_FIELD(desc, idx) \