summaryrefslogtreecommitdiffstats
path: root/sys/sun4v
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2006-11-03 07:29:09 +0000
committerkmacy <kmacy@FreeBSD.org>2006-11-03 07:29:09 +0000
commit0f567528e719846e72c70ad2a163dcff553803b5 (patch)
treec15471ef2c06e8a3dcc84edb9e55864c7eb3baec /sys/sun4v
parent5e83cb856a7b3ed0dba5d9af105b7759a5b08264 (diff)
downloadFreeBSD-src-0f567528e719846e72c70ad2a163dcff553803b5.zip
FreeBSD-src-0f567528e719846e72c70ad2a163dcff553803b5.tar.gz
Fix initialization sequence for console
Fix commenting convention slightly Approved by: rwatson (mentor) Reviewed by: jb
Diffstat (limited to 'sys/sun4v')
-rw-r--r--sys/sun4v/sun4v/machdep.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/sys/sun4v/sun4v/machdep.c b/sys/sun4v/sun4v/machdep.c
index e9fa99f..d93691b 100644
--- a/sys/sun4v/sun4v/machdep.c
+++ b/sys/sun4v/sun4v/machdep.c
@@ -302,6 +302,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
* Initialize Open Firmware (needed for console).
*/
OF_init(vec);
+
/*
* Parse metadata if present and fetch parameters. Must be before the
* console is inited so cninit gets the right value of boothowto.
@@ -333,7 +334,38 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
/*
* Initialize the console before printing anything.
+ * console uses the pcpu area for serialization
+ */
+ pc = (struct pcpu *)(pcpu0 + (PCPU_PAGES * PAGE_SIZE)) - 1;
+ cpu_setregs(pc);
+
+ /*
+ * Initialize proc0 stuff (p_contested needs to be done early).
*/
+
+#ifdef KSE
+ proc_linkup(&proc0, &ksegrp0, &thread0);
+#else
+ proc_linkup(&proc0, &thread0);
+#endif
+ proc0.p_md.md_sigtramp = NULL;
+ proc0.p_md.md_utrap = NULL;
+ frame0.tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_PRIV;
+ thread0.td_frame = &frame0;
+ if ((u_long)thread0.td_frame & 0x3f) {
+ panic("unaligned frame0");
+ }
+
+ /*
+ * Prime our per-cpu data page for use. Note, we are using it for our
+ * stack, so don't pass the real size (PAGE_SIZE) to pcpu_init or
+ * it'll zero it out from under us.
+ */
+ pc = (struct pcpu *)(pcpu0 + (PCPU_PAGES * PAGE_SIZE)) - 1;
+ pcpu_init(pc, 0, sizeof(struct pcpu));
+ pc->pc_curthread = &thread0;
+ pc->pc_addr = (vm_offset_t)pcpu0;
+
cninit();
tick_init(clock);
@@ -372,35 +404,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
freeenv(env);
}
- /*
- * Initialize proc0 stuff (p_contested needs to be done early).
- */
-#ifdef KSE
- proc_linkup(&proc0, &ksegrp0, &thread0);
-#else
- proc_linkup(&proc0, &thread0);
-#endif
- proc0.p_md.md_sigtramp = NULL;
- proc0.p_md.md_utrap = NULL;
- frame0.tf_tstate = TSTATE_IE | TSTATE_PEF | TSTATE_PRIV;
- thread0.td_frame = &frame0;
- if ((u_long)thread0.td_frame & 0x3f) {
- panic("unaligned frame0");
- }
- /*
- * Prime our per-cpu data page for use. Note, we are using it for our
- * stack, so don't pass the real size (PAGE_SIZE) to pcpu_init or
- * it'll zero it out from under us.
- */
- pc = (struct pcpu *)(pcpu0 + (PCPU_PAGES * PAGE_SIZE)) - 1;
- pcpu_init(pc, 0, sizeof(struct pcpu));
- pc->pc_curthread = &thread0;
-#ifdef notyet
- /* SUN4V_FIXME what is pc_mid? */
- pc->pc_mid = UPA_CR_GET_MID(ldxa(0, ASI_UPA_CONFIG_REG));
-#endif
- pc->pc_addr = (vm_offset_t)pcpu0;
/*
* Initialize global registers.
OpenPOWER on IntegriCloud