xref: /onnv-gate/usr/src/uts/sun4u/sunfire/ml/sysctrl_asm.s (revision 1341:6d7c4f090a72)
1*1341Sstevel/*
2*1341Sstevel * CDDL HEADER START
3*1341Sstevel *
4*1341Sstevel * The contents of this file are subject to the terms of the
5*1341Sstevel * Common Development and Distribution License (the "License").
6*1341Sstevel * You may not use this file except in compliance with the License.
7*1341Sstevel *
8*1341Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1341Sstevel * or http://www.opensolaris.org/os/licensing.
10*1341Sstevel * See the License for the specific language governing permissions
11*1341Sstevel * and limitations under the License.
12*1341Sstevel *
13*1341Sstevel * When distributing Covered Code, include this CDDL HEADER in each
14*1341Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1341Sstevel * If applicable, add the following below this CDDL HEADER, with the
16*1341Sstevel * fields enclosed by brackets "[]" replaced with your own identifying
17*1341Sstevel * information: Portions Copyright [yyyy] [name of copyright owner]
18*1341Sstevel *
19*1341Sstevel * CDDL HEADER END
20*1341Sstevel */
21*1341Sstevel
22*1341Sstevel/*
23*1341Sstevel * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
24*1341Sstevel * Use is subject to license terms.
25*1341Sstevel */
26*1341Sstevel
27*1341Sstevel#pragma	ident	"%Z%%M%	%I%	%E% SMI"
28*1341Sstevel
29*1341Sstevel#include <sys/param.h>
30*1341Sstevel#include <sys/errno.h>
31*1341Sstevel#include <sys/asm_linkage.h>
32*1341Sstevel#include <sys/vtrace.h>
33*1341Sstevel#include <sys/machthread.h>
34*1341Sstevel#include <sys/clock.h>
35*1341Sstevel#include <sys/asi.h>
36*1341Sstevel#include <sys/fsr.h>
37*1341Sstevel#include <sys/privregs.h>
38*1341Sstevel#include <sys/pte.h>
39*1341Sstevel#include <sys/mmu.h>
40*1341Sstevel#include <sys/spitregs.h>
41*1341Sstevel
42*1341Sstevel#if defined(lint)
43*1341Sstevel
44*1341Sstevel#else	/* lint */
45*1341Sstevel#include "assym.h"
46*1341Sstevel#endif	/* lint */
47*1341Sstevel
48*1341Sstevel#define	TT_HSM	0x99
49*1341Sstevel
50*1341Sstevel#if defined(lint)
51*1341Sstevelvoid
52*1341Sstevelsysctrl_freeze(void)
53*1341Sstevel{}
54*1341Sstevel#else /* lint */
55*1341Sstevel/*
56*1341Sstevel * This routine quiets a cpu and has it spin on a barrier.
57*1341Sstevel * It is used during memory sparing so that no memory operation
58*1341Sstevel * occurs during the memory copy.
59*1341Sstevel *
60*1341Sstevel *	Entry:
61*1341Sstevel *		%g1    - gate array base address
62*1341Sstevel *		%g2    - barrier base address
63*1341Sstevel *		%g3    - arg2
64*1341Sstevel *		%g4    - arg3
65*1341Sstevel *
66*1341Sstevel * 	Register Usage:
67*1341Sstevel *		%g3    - saved pstate
68*1341Sstevel *		%g4    - temporary
69*1341Sstevel *		%g5    - check for panicstr
70*1341Sstevel */
71*1341Sstevel	ENTRY_NP(sysctrl_freeze)
72*1341Sstevel	CPU_INDEX(%g4, %g5)
73*1341Sstevel	sll	%g4, 2, %g4
74*1341Sstevel	add	%g4, %g1, %g4			! compute address of gate id
75*1341Sstevel
76*1341Sstevel	st	%g4, [%g4]			! indicate we are ready
77*1341Sstevel	membar	#Sync
78*1341Sstevel1:
79*1341Sstevel	sethi	%hi(panicstr), %g5
80*1341Sstevel	ldn	[%g5 + %lo(panicstr)], %g5
81*1341Sstevel	brnz	%g5, 2f				! exit if in panic
82*1341Sstevel	 nop
83*1341Sstevel	ld	[%g2], %g4
84*1341Sstevel	brz,pt	%g4, 1b				! spin until barrier true
85*1341Sstevel	 nop
86*1341Sstevel
87*1341Sstevel2:
88*1341Sstevel	retry
89*1341Sstevel	membar	#Sync
90*1341Sstevel	SET_SIZE(sysctrl_freeze)
91*1341Sstevel
92*1341Sstevel#endif	/* lint */
93