git: 17c67ba24df0 - main - sys: Move Marvell specific fdt code to sys/arm/mv
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 08 Apr 2025 10:49:19 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=17c67ba24df03c5c04f5149265aa514786dc220b
commit 17c67ba24df03c5c04f5149265aa514786dc220b
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-04-08 10:46:51 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-04-08 10:48:28 +0000
sys: Move Marvell specific fdt code to sys/arm/mv
fdt_immr_* are only used by the armv7 Marvell code. Move setting the
variables there as no new code should need to set them.
Reviewed by: cognet
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D49535
---
sys/arm/mv/armadaxp/armadaxp_mp.c | 1 +
sys/arm/mv/mv_armv7_machdep.c | 36 +++++++++++++++++++++++++++++++++---
sys/arm/mv/mvvar.h | 3 +++
sys/dev/fdt/fdt_common.c | 36 ------------------------------------
sys/dev/fdt/fdt_common.h | 4 ----
5 files changed, 37 insertions(+), 43 deletions(-)
diff --git a/sys/arm/mv/armadaxp/armadaxp_mp.c b/sys/arm/mv/armadaxp/armadaxp_mp.c
index 75a119e0cec9..34cdc611a21f 100644
--- a/sys/arm/mv/armadaxp/armadaxp_mp.c
+++ b/sys/arm/mv/armadaxp/armadaxp_mp.c
@@ -46,6 +46,7 @@
#include <machine/armreg.h>
#include <arm/mv/mvwin.h>
+#include <arm/mv/mvvar.h>
#include <machine/platformvar.h>
diff --git a/sys/arm/mv/mv_armv7_machdep.c b/sys/arm/mv/mv_armv7_machdep.c
index 4fe59d2fe7df..c4c3280e4078 100644
--- a/sys/arm/mv/mv_armv7_machdep.c
+++ b/sys/arm/mv/mv_armv7_machdep.c
@@ -103,6 +103,10 @@ void mv_axp_platform_mp_setmaxid(platform_t plate);
void mv_axp_platform_mp_start_ap(platform_t plate);
#endif
+vm_paddr_t fdt_immr_pa;
+vm_offset_t fdt_immr_va;
+static vm_offset_t fdt_immr_size;
+
#define MPP_PIN_MAX 68
#define MPP_PIN_CELLS 2
#define MPP_PINS_PER_REG 8
@@ -270,9 +274,35 @@ static int
mv_platform_probe_and_attach(platform_t plate)
{
- if (fdt_immr_addr(MV_BASE) != 0)
- while (1);
- return (0);
+ phandle_t node;
+ u_long base, size;
+ int r;
+
+ /*
+ * Try to access the SOC node directly i.e. through /aliases/.
+ */
+ if ((node = OF_finddevice("soc")) != -1)
+ if (ofw_bus_node_is_compatible(node, "simple-bus"))
+ goto moveon;
+ /*
+ * Find the node the long way.
+ */
+ if ((node = OF_finddevice("/")) == -1)
+ goto errout;
+
+ if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0)
+ goto errout;
+
+moveon:
+ if ((r = fdt_get_range(node, 0, &base, &size)) == 0) {
+ fdt_immr_pa = base;
+ fdt_immr_va = MV_BASE;
+ fdt_immr_size = size;
+ return (0);
+ }
+
+errout:
+ while (1);
}
static void
diff --git a/sys/arm/mv/mvvar.h b/sys/arm/mv/mvvar.h
index 733cde06667e..990eeb444345 100644
--- a/sys/arm/mv/mvvar.h
+++ b/sys/arm/mv/mvvar.h
@@ -80,6 +80,9 @@ extern const struct decode_win *xor_wins;
extern int idma_wins_no;
extern int xor_wins_no;
+extern vm_paddr_t fdt_immr_pa;
+extern vm_offset_t fdt_immr_va;
+
int soc_decode_win(void);
void soc_id(uint32_t *dev, uint32_t *rev);
void soc_dump_decode_win(void);
diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c
index 40b1b3c5fc4f..53d47c26b53d 100644
--- a/sys/dev/fdt/fdt_common.c
+++ b/sys/dev/fdt/fdt_common.c
@@ -62,10 +62,6 @@
SYSCTL_NODE(_hw, OID_AUTO, fdt, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
"Flattened Device Tree");
-vm_paddr_t fdt_immr_pa;
-vm_offset_t fdt_immr_va;
-vm_offset_t fdt_immr_size;
-
struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head);
static int
@@ -199,38 +195,6 @@ fdt_get_range(phandle_t node, int range_id, u_long *base, u_long *size)
return (0);
}
-int
-fdt_immr_addr(vm_offset_t immr_va)
-{
- phandle_t node;
- u_long base, size;
- int r;
-
- /*
- * Try to access the SOC node directly i.e. through /aliases/.
- */
- if ((node = OF_finddevice("soc")) != -1)
- if (ofw_bus_node_is_compatible(node, "simple-bus"))
- goto moveon;
- /*
- * Find the node the long way.
- */
- if ((node = OF_finddevice("/")) == -1)
- return (ENXIO);
-
- if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0)
- return (ENXIO);
-
-moveon:
- if ((r = fdt_get_range(node, 0, &base, &size)) == 0) {
- fdt_immr_pa = base;
- fdt_immr_va = immr_va;
- fdt_immr_size = size;
- }
-
- return (r);
-}
-
int
fdt_is_compatible_strict(phandle_t node, const char *compatible)
{
diff --git a/sys/dev/fdt/fdt_common.h b/sys/dev/fdt/fdt_common.h
index e49049051209..ece54290a6ad 100644
--- a/sys/dev/fdt/fdt_common.h
+++ b/sys/dev/fdt/fdt_common.h
@@ -66,10 +66,6 @@ struct fdt_ic {
device_t dev;
};
-extern vm_paddr_t fdt_immr_pa;
-extern vm_offset_t fdt_immr_va;
-extern vm_offset_t fdt_immr_size;
-
#if defined(FDT_DTB_STATIC)
extern u_char fdt_static_dtb;
#endif