sun4v: New function prom_startcpu_by_cpuid() necessary for starting cpus on sun4v

This commit is contained in:
palle 2014-09-06 20:56:39 +00:00
parent be450a374b
commit 176790cb54
2 changed files with 36 additions and 4 deletions

View File

@ -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_ */

View File

@ -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)
@ -560,6 +560,37 @@ prom_startcpu(u_int cpu, void *func, u_long arg)
openfirmware(&args);
}
/*
* 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.
*/