xref: /illumos-gate/usr/src/uts/sun4u/sunfire/ml/sysctrl_asm.S (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
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#include <sys/param.h>
28#include <sys/errno.h>
29#include <sys/asm_linkage.h>
30#include <sys/vtrace.h>
31#include <sys/machthread.h>
32#include <sys/clock.h>
33#include <sys/asi.h>
34#include <sys/fsr.h>
35#include <sys/privregs.h>
36#include <sys/pte.h>
37#include <sys/mmu.h>
38#include <sys/spitregs.h>
39
40#include "assym.h"
41
42#define	TT_HSM	0x99
43
44/*
45 * This routine quiets a cpu and has it spin on a barrier.
46 * It is used during memory sparing so that no memory operation
47 * occurs during the memory copy.
48 *
49 *	Entry:
50 *		%g1    - gate array base address
51 *		%g2    - barrier base address
52 *		%g3    - arg2
53 *		%g4    - arg3
54 *
55 * 	Register Usage:
56 *		%g3    - saved pstate
57 *		%g4    - temporary
58 *		%g5    - check for panicstr
59 */
60	ENTRY_NP(sysctrl_freeze)
61	CPU_INDEX(%g4, %g5)
62	sll	%g4, 2, %g4
63	add	%g4, %g1, %g4			! compute address of gate id
64
65	st	%g4, [%g4]			! indicate we are ready
66	membar	#Sync
671:
68	sethi	%hi(panicstr), %g5
69	ldn	[%g5 + %lo(panicstr)], %g5
70	brnz	%g5, 2f				! exit if in panic
71	 nop
72	ld	[%g2], %g4
73	brz,pt	%g4, 1b				! spin until barrier true
74	 nop
75
762:
77	retry
78	membar	#Sync
79	SET_SIZE(sysctrl_freeze)
80
81