Module Name: src
Committed By: palle
Date: Sat Sep 6 20:56:39 UTC 2014
Modified Files:
src/sys/arch/sparc64/include: sparc64.h
src/sys/arch/sparc64/sparc64: ofw_machdep.c
Log Message:
sun4v: New function prom_startcpu_by_cpuid() necessary for starting cpus on
sun4v
To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/include/sparc64.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sparc64/sparc64/ofw_machdep.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/sparc64/include/sparc64.h
diff -u src/sys/arch/sparc64/include/sparc64.h:1.12 src/sys/arch/sparc64/include/sparc64.h:1.13
--- src/sys/arch/sparc64/include/sparc64.h:1.12 Tue Jan 7 20:11:35 2014
+++ src/sys/arch/sparc64/include/sparc64.h Sat Sep 6 20:56:39 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: sparc64.h,v 1.12 2014/01/07 20:11:35 palle Exp $ */
+/* $NetBSD: sparc64.h,v 1.13 2014/09/06 20:56:39 palle Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -58,5 +58,6 @@ bool prom_has_stopself(void);
int prom_stop_other(u_int);
bool prom_has_stop_other(void);
void prom_startcpu(u_int, void *, u_long);
+int prom_startcpu_by_cpuid(u_int, void *, u_long arg);
#endif /* _MACHINE_SPARC64_H_ */
Index: src/sys/arch/sparc64/sparc64/ofw_machdep.c
diff -u src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.42 src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.43
--- src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.42 Sun May 4 09:05:39 2014
+++ src/sys/arch/sparc64/sparc64/ofw_machdep.c Sat Sep 6 20:56:39 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_machdep.c,v 1.42 2014/05/04 09:05:39 martin Exp $ */
+/* $NetBSD: ofw_machdep.c,v 1.43 2014/09/06 20:56:39 palle Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.42 2014/05/04 09:05:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.43 2014/09/06 20:56:39 palle Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -536,7 +536,7 @@ prom_get_msgbuf(int len, int align)
#ifdef MULTIPROCESSOR
/*
- * Start secondary cpu, arrange 'func' as the entry.
+ * Start secondary cpu identified by node, arrange 'func' as the entry.
*/
void
prom_startcpu(u_int cpu, void *func, u_long arg)
@@ -561,6 +561,37 @@ prom_startcpu(u_int cpu, void *func, u_l
}
/*
+ * Start secondary cpu identified by cpuid, arrange 'func' as the entry.
+ * Returns -1 in case the openfirmware method is not available.
+ * Otherwise the result value from the openfirmware call is returned.
+ */
+int
+prom_startcpu_by_cpuid(u_int cpu, void *func, u_long arg)
+{
+ static struct {
+ cell_t name;
+ cell_t nargs;
+ cell_t nreturns;
+ cell_t cpu;
+ cell_t func;
+ cell_t arg;
+ cell_t status;
+ } args;
+
+ if (OF_test("SUNW,start-cpu-by-cpuid") != 0)
+ return -1;
+
+ args.name = ADR2CELL("SUNW,start-cpu-by-cpuid");
+ args.nargs = 3;
+ args.nreturns = 1;
+ args.cpu = cpu;
+ args.func = ADR2CELL(func);
+ args.arg = arg;
+
+ return openfirmware(&args);
+}
+
+/*
* Stop the calling cpu.
*/
void