cleanup
To: None <port-mips@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: port-mips
Date: 08/31/2001 18:27:57
The following patch attempts to clean up <machine/cpu.h> a little.
Since 'struct cpu_info' and related stuff is the same on all ports,
it makes sense to centralise it. Most of these files are reduced
to:
#include <mips/cpu.h>
#include <mips/cpuregs.h>
Should it be necessary for some port to differ in the future, we could
do something in a <machine/cpu.h> like:
#define MACHINE_CPUINFO_EXTRAS int cpunum;
#include <mips/cpu.h>
and 'struct cpu_info' (in <mips/cpu.h>) could contain
struct cpu_info {
...
#ifdef MACHINE_CPUINFO_EXTRAS
MACHINE_CPUINFO_EXTRAS
#endif
...
}
Anyone see any problems with this? If not, I'll commit these diffs
in the next week or so.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD CDs, Support and Service: http://www.wasabisystems.com/
Index: algor/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/algor/include/cpu.h,v
retrieving revision 1.2
diff -d -p -u -r1.2 cpu.h
--- algor/include/cpu.h 2001/05/30 12:28:37 1.2
+++ algor/include/cpu.h 2001/08/31 07:52:26
@@ -1,31 +1,4 @@
/* $NetBSD: cpu.h,v 1.2 2001/05/30 12:28:37 mrg Exp $ */
-#ifndef _ALGOR_CPU_H_
-#define _ALGOR_CPU_H_
-
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define curcpu() (&cpu_info_store)
-#define cpu_number() (0)
-#endif
-#endif /* !_LOCORE */
-
-#endif /* !_ALGOR_CPU_H_ */
Index: arc/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arc/include/cpu.h,v
retrieving revision 1.16
diff -d -p -u -r1.16 cpu.h
--- arc/include/cpu.h 2001/05/30 12:28:39 1.16
+++ arc/include/cpu.h 2001/08/31 07:52:26
@@ -12,28 +12,6 @@
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define curcpu() (&cpu_info_store)
-#define cpu_number() (0)
-#endif
-#endif /* !_LOCORE */
-
/*
* definitions of cpu-dependent requirements
* referenced in generic code
Index: cobalt/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/cobalt/include/cpu.h,v
retrieving revision 1.8
diff -d -p -u -r1.8 cpu.h
--- cobalt/include/cpu.h 2001/05/30 12:28:41 1.8
+++ cobalt/include/cpu.h 2001/08/31 07:52:26
@@ -1,31 +1,4 @@
/* $NetBSD: cpu.h,v 1.8 2001/05/30 12:28:41 mrg Exp $ */
-#ifndef _COBALT_CPU_H
-#define _COBALT_CPU_H
-
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define cpu_number() (0)
-#define curcpu() (&cpu_info_store)
-#endif
-#endif /* !_LOCORE */
-
-#endif /* !_COBALT_CPU_H_ */
Index: hpcmips/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/hpcmips/include/cpu.h,v
retrieving revision 1.9
diff -d -p -u -r1.9 cpu.h
--- hpcmips/include/cpu.h 2001/08/31 04:18:52 1.9
+++ hpcmips/include/cpu.h 2001/08/31 07:52:26
@@ -1,31 +1,4 @@
/* $NetBSD: cpu.h,v 1.9 2001/08/31 04:18:52 simonb Exp $ */
-#ifndef __HPCMIPS_CPU_H
-#define __HPCMIPS_CPU_H
-
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define cpu_number() (0)
-#define curcpu() (&cpu_info_store)
-#endif
-#endif /* !_LOCORE */
-
-#endif /* __HPCMIPS_CPU_H */
Index: mipsco/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mipsco/include/cpu.h,v
retrieving revision 1.5
diff -d -p -u -r1.5 cpu.h
--- mipsco/include/cpu.h 2001/05/30 12:28:46 1.5
+++ mipsco/include/cpu.h 2001/08/31 07:52:26
@@ -1,32 +1,4 @@
/* $NetBSD: cpu.h,v 1.5 2001/05/30 12:28:46 mrg Exp $ */
-#ifndef _MIPSCO_CPU_H_
-#define _MIPSCO_CPU_H_
-
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define curcpu() (&cpu_info_store)
-#define cpu_number() 0
-
-#endif /* _KERNEL */
-#endif /* !_LOCORE */
-
-#endif /* !_MIPSCO_CPU_H_ */
Index: newsmips/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/newsmips/include/cpu.h,v
retrieving revision 1.10
diff -d -p -u -r1.10 cpu.h
--- newsmips/include/cpu.h 2001/05/30 12:28:48 1.10
+++ newsmips/include/cpu.h 2001/08/31 07:52:26
@@ -1,36 +1,14 @@
/* $NetBSD: cpu.h,v 1.10 2001/05/30 12:28:48 mrg Exp $ */
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
+#ifndef _NEWSMIPS_CPU_H_
+#define _NEWSMIPS_CPU_H_
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
extern int systype;
#define NEWS3400 1
#define NEWS5000 2
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-#define curcpu() (&cpu_info_store)
-#define cpu_number() 0
-#endif /* _KERNEL */
-
-#endif /* _LOCORE */
-#endif /* _MACHINE_CPU_H_ */
+#endif /* _NEWSMIPS_CPU_H_ */
Index: pmax/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/pmax/include/cpu.h,v
retrieving revision 1.25
diff -d -p -u -r1.25 cpu.h
--- pmax/include/cpu.h 2001/05/30 12:28:49 1.25
+++ pmax/include/cpu.h 2001/08/31 07:52:26
@@ -1,31 +1,4 @@
/* $NetBSD: cpu.h,v 1.25 2001/05/30 12:28:49 mrg Exp $ */
-#ifndef _PMAX_CPU_H_
-#define _PMAX_CPU_H_
-
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define curcpu() (&cpu_info_store)
-#define cpu_number() (0)
-#endif
-#endif /* !_LOCORE */
-
-#endif /* !_PMAX_CPU_H_ */
Index: sgimips/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sgimips/include/cpu.h,v
retrieving revision 1.2
diff -d -p -u -r1.2 cpu.h
--- sgimips/include/cpu.h 2001/05/30 12:28:50 1.2
+++ sgimips/include/cpu.h 2001/08/31 07:52:26
@@ -1,31 +1,4 @@
/* $NetBSD: cpu.h,v 1.2 2001/05/30 12:28:50 mrg Exp $ */
-#ifndef _SGIMIPS_CPU_H
-#define _SGIMIPS_CPU_H
-
#include <mips/cpu.h>
#include <mips/cpuregs.h>
-
-#ifndef _LOCORE
-#if defined(_KERNEL_OPT)
-#include "opt_lockdebug.h"
-#endif
-
-#include <sys/sched.h>
-struct cpu_info {
- struct schedstate_percpu ci_schedstate; /* scheduler state */
-#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
- u_long ci_spin_locks; /* # of spin locks held */
- u_long ci_simple_locks; /* # of simple locks held */
-#endif
-};
-
-#ifdef _KERNEL
-extern struct cpu_info cpu_info_store;
-
-#define cpu_number() (0)
-#define curcpu() (&cpu_info_store)
-#endif
-#endif /* !_LOCORE */
-
-#endif /* !_SGIMIPS_CPU_H_ */
Index: mips/include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/mips/include/cpu.h,v
retrieving revision 1.52
diff -d -p -u -r1.52 cpu.h
--- mips/include/cpu.h 2001/06/14 22:56:57 1.52
+++ mips/include/cpu.h 2001/08/31 07:52:26
@@ -41,10 +41,26 @@
#ifndef _CPU_H_
#define _CPU_H_
+#include <sys/sched.h>
+
/*
* Exported definitions unique to NetBSD/mips cpu support.
*/
+#ifndef _LOCORE
+#if defined(_KERNEL_OPT)
+#include "opt_lockdebug.h"
+#endif
+
+struct cpu_info {
+ struct schedstate_percpu ci_schedstate; /* scheduler state */
+#if defined(DIAGNOSTIC) || defined(LOCKDEBUG)
+ u_long ci_spin_locks; /* # of spin locks held */
+ u_long ci_simple_locks; /* # of simple locks held */
+#endif
+};
+#endif /* !defined(_LOCORE) */
+
/*
* CTL_MACHDEP definitions.
*/
@@ -69,6 +85,10 @@
#ifdef _KERNEL
#ifndef _LOCORE
+extern struct cpu_info cpu_info_store;
+
+#define curcpu() (&cpu_info_store)
+#define cpu_number() (0)
/*
* Macros to find the CPU architecture we're on at run-time,