diff mbox series

[3/7] hwprobe: vas_init(), nx_init(), imc_init()

Message ID 20210125005807.3019715-5-stewart@flamingspork.com
State Under Review
Headers show
Series Modularize hardware probing | expand

Commit Message

Stewart Smith Jan. 25, 2021, 12:58 a.m. UTC
Signed-off-by: Stewart Smith <stewart@flamingspork.com>
---
 core/init.c | 9 ---------
 hw/imc.c    | 6 ++++++
 hw/nx.c     | 8 ++++++++
 hw/vas.c    | 6 ++++++
 4 files changed, 20 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/core/init.c b/core/init.c
index 92811aa4..8fa30e95 100644
--- a/core/init.c
+++ b/core/init.c
@@ -1316,15 +1316,6 @@  void __noreturn __nomcount main_cpu_entry(const void *fdt)
 	/* Catalog decompression routine */
 	imc_decompress_catalog();
 
-	/* Virtual Accelerator Switchboard */
-	vas_init();
-
-	/* NX init */
-	nx_init();
-
-	/* Init In-Memory Collection related stuff (load the IMC dtb into memory) */
-	imc_init();
-
 	/* Probe all hardware we have code linked for (PHBs, NPUs etc)*/
 	probe_hardware();
 
diff --git a/hw/imc.c b/hw/imc.c
index 63488b9b..e8d658e7 100644
--- a/hw/imc.c
+++ b/hw/imc.c
@@ -926,3 +926,9 @@  static int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir)
 	return OPAL_SUCCESS;
 }
 opal_call(OPAL_IMC_COUNTERS_STOP, opal_imc_counters_stop, 2);
+
+DECLARE_HWPROBE(imc) = {
+	.name = "imc",
+	.probe = imc_init,
+	.deps = NULL
+};
diff --git a/hw/nx.c b/hw/nx.c
index 12204808..4bfc2c53 100644
--- a/hw/nx.c
+++ b/hw/nx.c
@@ -121,3 +121,11 @@  void nx_init(void)
 	if (proc_gen == proc_gen_p9)
 		p9_darn_init();
 }
+
+static const char* nx_deps[] = { "vas", NULL };
+
+DECLARE_HWPROBE(nx) = {
+	.name = "nx",
+	.probe = nx_init,
+	.deps = nx_deps
+};
diff --git a/hw/vas.c b/hw/vas.c
index c70094b7..7bbd700e 100644
--- a/hw/vas.c
+++ b/hw/vas.c
@@ -519,3 +519,9 @@  out:
 	vas_err("Disabled (failed initialization)\n");
 	return;
 }
+
+DECLARE_HWPROBE(vas) = {
+	.name = "vas",
+	.probe = vas_init,
+	.deps = NULL
+};