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