diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -134,6 +134,14 @@ 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 --- a/sys/arm/include/machdep.h +++ b/sys/arm/include/machdep.h @@ -51,6 +51,13 @@ 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 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -138,6 +138,15 @@ 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.