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 apply the same change for powerpc a...



details:   https://anonhg.NetBSD.org/src/rev/0a5af30c1af9
branches:  trunk
changeset: 358209:0a5af30c1af9
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Dec 17 17:18:34 2017 +0000

description:
apply the same change for powerpc as mrg did for arm and mips:

CPU_INFO_FOREACH() must always iterate at least the boot cpu.
document this in sys/cpu.h and fix the arm and mips versions
to check ncpu is non zero before using it as an iterator max.

this should fix the new assert in init_main.c.

diffstat:

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

diffs (35 lines):

diff -r e8acd9a4b44a -r 0a5af30c1af9 sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Sun Dec 17 15:43:27 2017 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Sun Dec 17 17:18:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.102 2016/10/19 00:08:42 nonaka Exp $ */
+/*     $NetBSD: cpu.h,v 1.103 2017/12/17 17:18:34 chs Exp $    */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -32,6 +32,7 @@
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifndef        _POWERPC_CPU_H_
 #define        _POWERPC_CPU_H_
 
@@ -54,6 +55,8 @@
 #include <sys/intr.h>
 #include <sys/device_if.h>
 #include <sys/evcnt.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
 #endif
 
 #include <sys/cpu_data.h>
@@ -191,7 +194,7 @@
 #define CPU_IS_PRIMARY(ci)     ((ci)->ci_cpuid == 0)
 #define CPU_INFO_ITERATOR      int
 #define CPU_INFO_FOREACH(cii, ci)                              \
-       cii = 0, ci = &cpu_info[0]; cii < ncpu; cii++, ci++
+       cii = 0, ci = &cpu_info[0]; cii < (ncpu ? ncpu : 1); cii++, ci++
 
 #else
 #define cpu_number()           0



Home | Main Index | Thread Index | Old Index