git: 639a626b4050 - main - arm: Clean up socdev_va
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Feb 2024 11:51:47 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=639a626b40503f81a184ccd93fb9bc023f86a3fd
commit 639a626b40503f81a184ccd93fb9bc023f86a3fd
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-01-08 14:43:32 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-02-13 11:48:52 +0000
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
---
sys/arm/arm/machdep.c | 8 ++++++++
sys/arm/include/machdep.h | 7 +++++++
sys/arm64/arm64/machdep.c | 9 +++++++++
3 files changed, 24 insertions(+)
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.