Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2008 00:48:51 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 133376 for review
Message-ID:  <200801160048.m0G0mpqX043603@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=133376

Change 133376 by imp@imp_lighthouse on 2008/01/16 00:48:25

	Create a mips_proc0_init() (name stole from Juniper code) to
	encapsulate the 8 lines of code that were being cut and paste.
	
	We may be able to have a routine that's from init_param2() through
	the kdb_init too that would save another 8 lines of code from
	all the init functions, but one step at a time.

Affected files ...

.. //depot/projects/mips2/src/sys/mips/include/md_var.h#5 edit
.. //depot/projects/mips2/src/sys/mips/mips/machdep.c#35 edit
.. //depot/projects/mips2/src/sys/mips/mips32/adm5120/adm5120_machdep.c#5 edit
.. //depot/projects/mips2/src/sys/mips/mips32/idt/idt_machdep.c#7 edit
.. //depot/projects/mips2/src/sys/mips/mips32/malta/malta_machdep.c#8 edit
.. //depot/projects/mips2/src/sys/mips/mips32/sentry5/s5_machdep.c#6 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/include/md_var.h#5 (text+ko) ====

@@ -41,6 +41,7 @@
 
 void	cpu_identify(void);
 void	mips_cpu_init(void);
+void	mips_proc0_init(void);
 
 /* Platform call-downs. */
 void	platform_identify(void);

==== //depot/projects/mips2/src/sys/mips/mips/machdep.c#35 (text+ko) ====

@@ -468,4 +468,18 @@
 
 }
 
-
+void
+mips_proc0_init(void)
+{
+	proc_linkup(&proc0, &thread0);
+	thread0.td_kstack = kstack0;
+	/* Initialize pcpu info of cpu-zero */
+#ifdef SMP
+	pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu));
+#else
+	pcpu_init(pcpup, 0, sizeof(struct pcpu));
+#endif
+	pcpup->pc_curthread = &thread0;
+	cpu_thread_alloc(curthread);
+	pcpup->pc_curpcb = curthread->td_pcb;
+}

==== //depot/projects/mips2/src/sys/mips/mips32/adm5120/adm5120_machdep.c#5 (text+ko) ====

@@ -94,19 +94,10 @@
 
 	init_param1();
 	init_param2(physmem);
-
 	mips_cpu_init();
 	pmap_bootstrap();
-
-	proc_linkup(&proc0, &thread0);
-	thread0.td_kstack = kstack0;
-	pcpu_init(pcpup, 0, sizeof(struct pcpu));
-	pcpup->pc_curthread = &thread0;
-	cpu_thread_alloc(curthread);
-	pcpup->pc_curpcb = curthread->td_pcb;
-
+	mips_proc0_init();
 	mutex_init();
-
 #ifdef DDB
 	kdb_init();
 #endif

==== //depot/projects/mips2/src/sys/mips/mips32/idt/idt_machdep.c#7 (text+ko) ====

@@ -145,19 +145,10 @@
 	cninit();
 
 	init_param2(physmem);
-
 	mips_cpu_init();
 	pmap_bootstrap();
-
-	proc_linkup(&proc0, &thread0);
-	thread0.td_kstack = kstack0;
-	pcpu_init(pcpup, 0, sizeof(struct pcpu));
-	pcpup->pc_curthread = &thread0;
-	cpu_thread_alloc(curthread);
-	pcpup->pc_curpcb = curthread->td_pcb;
-
+	mips_proc0_init();
 	mutex_init();
-
 #ifdef DDB
 	kdb_init();
 #endif

==== //depot/projects/mips2/src/sys/mips/mips32/malta/malta_machdep.c#8 (text+ko) ====

@@ -181,16 +181,8 @@
 
 	mips_cpu_init();
 	pmap_bootstrap();
-
-	proc_linkup(&proc0, &thread0);
-	thread0.td_kstack = kstack0;
-	pcpu_init(pcpup, 0, sizeof(struct pcpu));
-	pcpup->pc_curthread = &thread0;
-	cpu_thread_alloc(curthread);
-	pcpup->pc_curpcb = curthread->td_pcb;
-
+	mips_proc0_init();
 	mutex_init();
-
 #ifdef DDB
 	kdb_init();
 #endif

==== //depot/projects/mips2/src/sys/mips/mips32/sentry5/s5_machdep.c#6 (text+ko) ====

@@ -132,19 +132,10 @@
 
 	init_param1();
 	init_param2(physmem);
-
 	mips_cpu_init();
 	pmap_bootstrap();
-
-	proc_linkup(&proc0, &thread0);
-	thread0.td_kstack = kstack0;
-	pcpu_init(pcpup, 0, sizeof(struct pcpu));
-	pcpup->pc_curthread = &thread0;
-	cpu_thread_alloc(curthread);
-	pcpup->pc_curpcb = curthread->td_pcb;
-
+	mips_proc0_init();
 	mutex_init();
-
 #ifdef DDB
 	kdb_init();
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801160048.m0G0mpqX043603>