Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/include define CPU_INFO iterators so that t...



details:   https://anonhg.NetBSD.org/src/rev/1587e74dba4d
branches:  trunk
changeset: 534485:1587e74dba4d
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Jul 28 07:02:29 2002 +0000

description:
define CPU_INFO iterators so that the CPU-states sysctl works for MP.

diffstat:

 sys/arch/powerpc/include/cpu.h |  28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diffs (65 lines):

diff -r 0d1a27e2b75b -r 1587e74dba4d sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Sun Jul 28 07:00:58 2002 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Sun Jul 28 07:02:29 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.17 2002/07/16 23:04:20 matt Exp $    */
+/*     $NetBSD: cpu.h,v 1.18 2002/07/28 07:02:29 chs Exp $     */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -139,6 +139,10 @@
 #define astpending             curcpu()->ci_astpending
 #define        intr_depth              curcpu()->ci_intrdepth
 
+#define CPU_INFO_ITERATOR              int
+#define CPU_INFO_FOREACH(cii, ci)                                      \
+       cii = 0, ci = &cpu_info[0]; cii < CPU_MAXNUM; cii++, ci++
+
 #else
 extern struct cpu_info cpu_info_store;
 extern volatile int want_resched;
@@ -148,8 +152,28 @@
 #define curcpu()               (&cpu_info_store)
 #define cpu_number()           0
 
+#define CPU_INFO_ITERATOR              int
+#define CPU_INFO_FOREACH(cii, ci)                                      \
+       cii = 0, ci = curcpu(); ci != NULL; ci = NULL
+
 #endif /* MULTIPROCESSOR */
 
+static __inline int
+mfmsr(void)
+{
+       int msr;
+
+       asm volatile ("mfmsr %0" : "=r"(msr));
+       return msr;
+}
+
+static __inline void
+mtmsr(int msr)
+{
+
+       asm volatile ("mtmsr %0" : : "r"(msr));
+}
+
 #define        CLKF_USERMODE(frame)    (((frame)->srr1 & PSL_PR) != 0)
 #define        CLKF_BASEPRI(frame)     ((frame)->pri == 0)
 #define        CLKF_PC(frame)          ((frame)->srr0)
@@ -166,6 +190,7 @@
 extern char cpu_model[];
 
 struct cpu_info *cpu_attach_common(struct device *, int);
+void cpu_setup(struct device *, struct cpu_info *);
 void cpu_identify(char *, size_t);
 void delay (unsigned int);
 void cpu_probe_cache(void);
@@ -203,7 +228,6 @@
 
 void __syncicache(void *, size_t);
 
-
 /*
  * CTL_MACHDEP definitions.
  */



Home | Main Index | Thread Index | Old Index