1*29949e86Sstevel/* 2*29949e86Sstevel * CDDL HEADER START 3*29949e86Sstevel * 4*29949e86Sstevel * The contents of this file are subject to the terms of the 5*29949e86Sstevel * Common Development and Distribution License (the "License"). 6*29949e86Sstevel * You may not use this file except in compliance with the License. 7*29949e86Sstevel * 8*29949e86Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*29949e86Sstevel * or http://www.opensolaris.org/os/licensing. 10*29949e86Sstevel * See the License for the specific language governing permissions 11*29949e86Sstevel * and limitations under the License. 12*29949e86Sstevel * 13*29949e86Sstevel * When distributing Covered Code, include this CDDL HEADER in each 14*29949e86Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*29949e86Sstevel * If applicable, add the following below this CDDL HEADER, with the 16*29949e86Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 17*29949e86Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 18*29949e86Sstevel * 19*29949e86Sstevel * CDDL HEADER END 20*29949e86Sstevel */ 21*29949e86Sstevel 22*29949e86Sstevel/* 23*29949e86Sstevel * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*29949e86Sstevel * Use is subject to license terms. 25*29949e86Sstevel */ 26*29949e86Sstevel 27*29949e86Sstevel#pragma ident "%Z%%M% %I% %E% SMI" 28*29949e86Sstevel 29*29949e86Sstevel#include <sys/param.h> 30*29949e86Sstevel#include <sys/errno.h> 31*29949e86Sstevel#include <sys/asm_linkage.h> 32*29949e86Sstevel#include <sys/machthread.h> 33*29949e86Sstevel#include <sys/asi.h> 34*29949e86Sstevel#include <sys/privregs.h> 35*29949e86Sstevel#include <sys/spitregs.h> 36*29949e86Sstevel 37*29949e86Sstevel#if defined(lint) 38*29949e86Sstevel 39*29949e86Sstevel#else /* lint */ 40*29949e86Sstevel#include "assym.h" 41*29949e86Sstevel#endif /* lint */ 42*29949e86Sstevel 43*29949e86Sstevel/* 44*29949e86Sstevel * fhc_shutdown_asm(u_longlong_t base, int size) 45*29949e86Sstevel * 46*29949e86Sstevel * Flush cpu E$ then shutdown. 47*29949e86Sstevel * This function is special in that it really sets the D-tags to 48*29949e86Sstevel * a known state. And this is the behavior we're looking for. 49*29949e86Sstevel * 50*29949e86Sstevel * The flush address is known to be a cpu-unique non-existent 51*29949e86Sstevel * cacheable address. We write to non-existent memory, using 52*29949e86Sstevel * the side effect of d-tag invalidation. 53*29949e86Sstevel * 54*29949e86Sstevel * Also, note that this function is never run from main memory. 55*29949e86Sstevel * Rather it is copied to non-cacheable SRAM (hence the ..._end 56*29949e86Sstevel * label at the bottom of the function). This implies that the 57*29949e86Sstevel * function must be position independent code that doesn't reference 58*29949e86Sstevel * cacheable real memory. 59*29949e86Sstevel */ 60*29949e86Sstevel#if defined(lint) 61*29949e86Sstevel 62*29949e86Sstevel/*ARGSUSED*/ 63*29949e86Sstevelvoid 64*29949e86Sstevelfhc_shutdown_asm(u_longlong_t base, int size) 65*29949e86Sstevel{} 66*29949e86Sstevel 67*29949e86Sstevel#else /* lint */ 68*29949e86Sstevel 69*29949e86Sstevel ENTRY(fhc_shutdown_asm) 70*29949e86Sstevel ! turn off errors (we'll be writing to non-existent memory) 71*29949e86Sstevel stxa %g0, [%g0]ASI_ESTATE_ERR 72*29949e86Sstevel membar #Sync ! SYNC 73*29949e86Sstevel 74*29949e86Sstevel rdpr %pstate, %o4 75*29949e86Sstevel andn %o4, PSTATE_IE | PSTATE_AM, %o3 76*29949e86Sstevel wrpr %o3, %g0, %pstate 77*29949e86Sstevel1: 78*29949e86Sstevel brlez,pn %o1, 2f ! if (len <= 0) exit loop 79*29949e86Sstevel dec 64, %o1 ! size -= 64 80*29949e86Sstevel sta %g0, [%o0]ASI_MEM ! store (unpopulated) word 81*29949e86Sstevel ba 1b 82*29949e86Sstevel inc 64, %o0 ! addr += 64 83*29949e86Sstevel2: 84*29949e86Sstevel membar #Sync ! SYNC 85*29949e86Sstevel shutdown ! SHUTDOWN 86*29949e86Sstevel /*NOTREACHED*/ 87*29949e86Sstevel 88*29949e86Sstevel ! if, for some reason, this cpu doesn't shutdown, just sit here 89*29949e86Sstevel3: 90*29949e86Sstevel ba 3b 91*29949e86Sstevel nop ! eventually the master will notice 92*29949e86Sstevel SET_SIZE(fhc_shutdown_asm) 93*29949e86Sstevel 94*29949e86Sstevel .global fhc_shutdown_asm_end 95*29949e86Sstevelfhc_shutdown_asm_end: 96*29949e86Sstevel 97*29949e86Sstevel#endif /* lint */ 98