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