Module Name: src Committed By: chs Date: Sun Dec 17 17:18:34 UTC 2017
Modified Files: src/sys/arch/powerpc/include: cpu.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/powerpc/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/powerpc/include/cpu.h diff -u src/sys/arch/powerpc/include/cpu.h:1.102 src/sys/arch/powerpc/include/cpu.h:1.103 --- src/sys/arch/powerpc/include/cpu.h:1.102 Wed Oct 19 00:08:42 2016 +++ src/sys/arch/powerpc/include/cpu.h Sun Dec 17 17:18:34 2017 @@ -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 @@ struct cache_info { #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 @@ extern struct cpuset_info cpuset_info; #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