Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/allwinner Extract # of cores from L2CTRL for MU...



details:   https://anonhg.NetBSD.org/src/rev/957f26e4f86d
branches:  trunk
changeset: 326979:957f26e4f86d
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Feb 24 16:50:49 2014 +0000

description:
Extract # of cores from L2CTRL for MULTIPROCESSOR kernels

diffstat:

 sys/arch/arm/allwinner/awin_board.c |  20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 891ad28a452e -r 957f26e4f86d sys/arch/arm/allwinner/awin_board.c
--- a/sys/arch/arm/allwinner/awin_board.c       Mon Feb 24 16:45:06 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_board.c       Mon Feb 24 16:50:49 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awin_board.c,v 1.7 2014/02/20 21:46:14 matt Exp $      */
+/*     $NetBSD: awin_board.c,v 1.8 2014/02/24 16:50:49 matt Exp $      */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: awin_board.c,v 1.7 2014/02/20 21:46:14 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_board.c,v 1.8 2014/02/24 16:50:49 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -46,6 +46,8 @@
 #include <net/if.h>
 #include <net/if_ether.h>
 
+#include <arm/locore.h>
+
 #include <arm/mainbus/mainbus.h>
 
 #include <arm/allwinner/awin_reg.h>
@@ -163,6 +165,20 @@
 #ifdef VERBOSE_INIT_ARM
        printf("\n");
 #endif
+
+#ifdef MULTIPROCESSOR
+#ifdef VERBOSE_INIT_ARM
+       uint32_t s0 = bus_space_read_4(&awin_bs_tag, awin_core_bsh,
+           AWIN_CPUCFG_OFFSET + AWIN_CPUCFG_CPU0_STATUS_REG);
+       uint32_t s1 = bus_space_read_4(&awin_bs_tag, awin_core_bsh,
+           AWIN_CPUCFG_OFFSET + AWIN_CPUCFG_CPU1_STATUS_REG);
+       printf("%s: cpu status: 0=%#x 1=%#x\n", __func__, s0, s1);
+#endif
+       arm_cpu_max = 1 + __SHIFTOUT(armreg_l2ctrl_read(), L2CTRL_NUMCPU);
+#ifdef VERBOSE_INIT_ARM
+       printf("%s: %d cpus present\n", __func__, arm_cpu_max);
+#endif
+#endif
 }
 
 #ifdef MULTIPROCESSOR



Home | Main Index | Thread Index | Old Index