xref: /onnv-gate/usr/src/uts/sun4v/os/mach_mp_startup.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate #include <sys/machsystm.h>
30*0Sstevel@tonic-gate #include <sys/cpu_module.h>
31*0Sstevel@tonic-gate #include <sys/dtrace.h>
32*0Sstevel@tonic-gate #include <sys/cpu_sgnblk_defs.h>
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate /*
35*0Sstevel@tonic-gate  * Useful for disabling MP bring-up for an MP capable kernel
36*0Sstevel@tonic-gate  * (a kernel that was built with MP defined)
37*0Sstevel@tonic-gate  */
38*0Sstevel@tonic-gate int use_mp = 1;			/* set to come up mp */
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate /*
41*0Sstevel@tonic-gate  * Init CPU info - get CPU type info for processor_info system call.
42*0Sstevel@tonic-gate  */
43*0Sstevel@tonic-gate void
44*0Sstevel@tonic-gate init_cpu_info(struct cpu *cp)
45*0Sstevel@tonic-gate {
46*0Sstevel@tonic-gate 	processor_info_t *pi = &cp->cpu_type_info;
47*0Sstevel@tonic-gate 	int cpuid = cp->cpu_id;
48*0Sstevel@tonic-gate 	struct cpu_node *cpunode = &cpunodes[cpuid];
49*0Sstevel@tonic-gate 	char buf[CPU_IDSTRLEN];
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate 	cp->cpu_fpowner = NULL;		/* not used for V9 */
52*0Sstevel@tonic-gate 
53*0Sstevel@tonic-gate 	/*
54*0Sstevel@tonic-gate 	 * Get clock-frequency property from cpunodes[] for the CPU.
55*0Sstevel@tonic-gate 	 */
56*0Sstevel@tonic-gate 	pi->pi_clock = (cpunode->clock_freq + 500000) / 1000000;
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate 	(void) strcpy(pi->pi_processor_type, "sparcv9");
59*0Sstevel@tonic-gate 	(void) strcpy(pi->pi_fputypes, "sparcv9");
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate 	(void) snprintf(buf, sizeof (buf),
62*0Sstevel@tonic-gate 	    "%s (cpuid %d clock %d MHz)",
63*0Sstevel@tonic-gate 	    cpunode->name, cpunode->cpuid, pi->pi_clock);
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate 	cp->cpu_idstr = kmem_alloc(strlen(buf) + 1, KM_SLEEP);
66*0Sstevel@tonic-gate 	(void) strcpy(cp->cpu_idstr, buf);
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate 	cmn_err(CE_CONT, "?cpu%d: %s\n", cpuid, cp->cpu_idstr);
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate 	cp->cpu_brandstr = kmem_alloc(strlen(cpunode->name) + 1, KM_SLEEP);
71*0Sstevel@tonic-gate 	(void) strcpy(cp->cpu_brandstr, cpunode->name);
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate 	/*
74*0Sstevel@tonic-gate 	 * StarFire requires the signature block stuff setup here
75*0Sstevel@tonic-gate 	 */
76*0Sstevel@tonic-gate 	CPU_SGN_MAPIN(cpuid);
77*0Sstevel@tonic-gate 	if (cpuid == cpu0.cpu_id) {
78*0Sstevel@tonic-gate 		/*
79*0Sstevel@tonic-gate 		 * cpu0 starts out running.  Other cpus are
80*0Sstevel@tonic-gate 		 * still in OBP land and we will leave them
81*0Sstevel@tonic-gate 		 * alone for now.
82*0Sstevel@tonic-gate 		 */
83*0Sstevel@tonic-gate 		CPU_SIGNATURE(OS_SIG, SIGST_RUN, SIGSUBST_NULL, cpuid);
84*0Sstevel@tonic-gate #ifdef	lint
85*0Sstevel@tonic-gate 		cpuid = cpuid;
86*0Sstevel@tonic-gate #endif	/* lint */
87*0Sstevel@tonic-gate 	}
88*0Sstevel@tonic-gate }
89*0Sstevel@tonic-gate 
90*0Sstevel@tonic-gate /* ARGSUSED */
91*0Sstevel@tonic-gate /*
92*0Sstevel@tonic-gate  * Routine used to cleanup a CPU that has been powered off.  This will
93*0Sstevel@tonic-gate  * destroy all per-cpu information related to this cpu.
94*0Sstevel@tonic-gate  */
95*0Sstevel@tonic-gate int
96*0Sstevel@tonic-gate mp_cpu_unconfigure(int cpuid)
97*0Sstevel@tonic-gate {
98*0Sstevel@tonic-gate 	return (0);
99*0Sstevel@tonic-gate }
100*0Sstevel@tonic-gate 
101*0Sstevel@tonic-gate /* ARGSUSED */
102*0Sstevel@tonic-gate int
103*0Sstevel@tonic-gate mp_find_cpu(dev_info_t *dip, void *arg)
104*0Sstevel@tonic-gate {
105*0Sstevel@tonic-gate 	return (0);
106*0Sstevel@tonic-gate }
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate /* ARGSUSED */
109*0Sstevel@tonic-gate /*
110*0Sstevel@tonic-gate  * Routine used to setup a newly inserted CPU in preparation for starting
111*0Sstevel@tonic-gate  * it running code.
112*0Sstevel@tonic-gate  */
113*0Sstevel@tonic-gate int
114*0Sstevel@tonic-gate mp_cpu_configure(int cpuid)
115*0Sstevel@tonic-gate {
116*0Sstevel@tonic-gate 	return (0);
117*0Sstevel@tonic-gate }
118