aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Turner <andrew@FreeBSD.org>2024-01-08 14:43:32 +0000
committerAndrew Turner <andrew@FreeBSD.org>2024-02-13 11:48:52 +0000
commit639a626b40503f81a184ccd93fb9bc023f86a3fd (patch)
tree59443bbcece5f08ec29489a62b14983912f27da1
parent90405e1d63ff919705422745f19a8b56a37f5ac0 (diff)
downloadsrc-639a626b40503f81a184ccd93fb9bc023f86a3fd.tar.gz
src-639a626b40503f81a184ccd93fb9bc023f86a3fd.zip
arm: Clean up socdev_va
Support socdev_va on arm and ensure the variable is available on arm64. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43359
-rw-r--r--sys/arm/arm/machdep.c8
-rw-r--r--sys/arm/include/machdep.h7
-rw-r--r--sys/arm64/arm64/machdep.c9
3 files changed, 24 insertions, 0 deletions
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index 999e47fd381a..c36953c513be 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -134,6 +134,14 @@ static delay_func *delay_impl;
static void *delay_arg;
#endif
+#if defined(SOCDEV_PA)
+#if !defined(SOCDEV_VA)
+#error SOCDEV_PA defined, but not SOCDEV_VA
+#endif
+uintptr_t socdev_va = SOCDEV_VA;
+#endif
+
+
struct kva_md_info kmi;
/*
* arm32_vector_init:
diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h
index f999cce12b47..45e44a65368b 100644
--- a/sys/arm/include/machdep.h
+++ b/sys/arm/include/machdep.h
@@ -51,6 +51,13 @@ void arm_add_efi_map_entries(struct efi_map_header *efihdr,
struct mem_region *mr, int *mrcnt);
#endif
+#ifdef SOCDEV_PA
+/*
+ * The virtual address SOCDEV_PA is mapped at.
+ */
+extern uintptr_t socdev_va;
+#endif
+
/*
* Symbols created by ldscript.arm which are accessible in the kernel as global
* symbols. They have uint8 type because they mark the byte location where the
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 92f9e5692be4..9ce1c40b674c 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -138,6 +138,15 @@ struct kva_md_info kmi;
int64_t dczva_line_size; /* The size of cache line the dc zva zeroes */
int has_pan;
+#if defined(SOCDEV_PA)
+/*
+ * This is the virtual address used to access SOCDEV_PA. As it's set before
+ * .bss is cleared we need to ensure it's preserved. To do this use
+ * __read_mostly as it's only ever set once but read in the putc functions.
+ */
+uintptr_t socdev_va __read_mostly;
+#endif
+
/*
* Physical address of the EFI System Table. Stashed from the metadata hints
* passed into the kernel and used by the EFI code to call runtime services.