Module Name:    src
Committed By:   cliff
Date:           Tue Feb  8 06:03:36 UTC 2011

Modified Files:
        src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_cpucore.c

Log Message:
- cpucore_rmixl_attach() now examines 'userapp_cpu_map' bitmask obtained
from the firmware, and avoids attaching threads that are not enabled there.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixl_cpucore.c

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/mips/rmi/rmixl_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.8 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.9
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.1.2.8	Sat Feb  5 06:00:13 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Tue Feb  8 06:03:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.8 2011/02/05 06:00:13 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.1.2.9 2011/02/08 06:03:36 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.1.2.8 2011/02/05 06:00:13 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.1.2.9 2011/02/08 06:03:36 cliff Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -87,6 +87,7 @@
 	struct cpunode_attach_args *na = aux;
 	struct cpucore_attach_args ca;
 	u_int nthreads;
+	struct rmixl_config *rcp = &rmixl_configuration;
 
 	sc->sc_dev = self;
 	sc->sc_core = na->na_core;
@@ -132,10 +133,30 @@
 
 	/*
 	 * Attach CPU (RMI thread contexts) devices
+	 * according to userapp_cpu_map bitmask.
 	 */
-	for (int i=0; i < nthreads; i++) {
+	u_int thread_mask = (1 << nthreads) - 1;
+	u_int core_shft = sc->sc_core * nthreads;
+	u_int threads_enb =
+		(u_int)(rcp->rc_psb_info.userapp_cpu_map >> core_shft) & thread_mask;
+	u_int threads_dis = (~threads_enb) & thread_mask;
+
+	if (threads_dis != 0) {
+		aprint_normal_dev(self, "threads");
+		while (threads_dis != 0) {
+			u_int t = ffs(threads_dis) - 1;
+			threads_dis ^= (1 << t);
+			aprint_normal(" %d%s",
+				t, (threads_dis==0) ? "" : ",");
+		}
+		aprint_normal(" offline (disabled by firmware)\n");
+	}
+
+	while (threads_enb != 0) {
+		u_int t = ffs(threads_enb) - 1;
+		threads_enb ^= (1 << t);
 		ca.ca_name = "cpu";
-		ca.ca_thread = i;
+		ca.ca_thread = t;
 		ca.ca_core = sc->sc_core;
 		config_found(self, &ca, cpucore_rmixl_print);
 	}

Reply via email to