init: add a setup_arch() callback

This now mimics the 3 different C level init
entry points that a kernel feature might use.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
diff --git a/init.c b/init.c
index 502894c..6a7152b 100644
--- a/init.c
+++ b/init.c
@@ -58,3 +58,15 @@
 
 	return 0;
 }
+
+void setup_arch_init(void)
+{
+	struct init_fn *init_fn;
+
+	for_each_table_entry(init_fn, INIT_FNS) {
+		if ((init_fn->flags & INIT_DETECTED) && init_fn->setup_arch) {
+			printf("Running setup_arch for %s ...\n", init_fn->name);
+			init_fn->setup_arch();
+		}
+	}
+}
diff --git a/init.h b/init.h
index 3e6564f..dc35aa9 100644
--- a/init.h
+++ b/init.h
@@ -12,6 +12,7 @@
 	int (*depend)(void);
 	int (*early_init)(void); /* No memory allocate available. */
 	int (*late_init)(void); /* Yes, can allocate memory. */
+	void (*setup_arch)(void);
 	bool critical;
 	const char *name;
 #define INIT_FINISH_IF_DETECTED (1<<0)
@@ -32,6 +33,8 @@
 
 int early_init(void);
 int late_init(void);
+void setup_arch_init(void);
+
 void sort_table(struct init_fn *start,
 		      struct init_fn *finish);
 void check_table_entries(struct init_fn *start,
diff --git a/start_kernel.c b/start_kernel.c
index 3d57ad4..266f5c5 100644
--- a/start_kernel.c
+++ b/start_kernel.c
@@ -1,9 +1,12 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include "init.h"
+#include "x86.h"
 
 int start_kernel(void)
 {
+	setup_arch();
+
 	return late_init();
 }
 
diff --git a/x86.c b/x86.c
index 3b5b792..42c35bb 100644
--- a/x86.c
+++ b/x86.c
@@ -33,9 +33,13 @@
 	return x86_64_start_reservations();
 }
 
-/* x86 specific */
 int startup_64(void)
 {
 	printf("Initializing x86 bare metal world\n");
 	return x86_64_start_kernel();
 }
+
+void setup_arch(void)
+{
+	setup_arch_init();
+}
diff --git a/x86.h b/x86.h
index 9ab48f7..974ea97 100644
--- a/x86.h
+++ b/x86.h
@@ -1,2 +1,3 @@
-int x86_64_start_reservations(void);
 int startup_64(void);
+int x86_64_start_reservations(void);
+void setup_arch(void);