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 2003 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/machthread.h> 33*1341Sstevel#include <sys/asi.h> 34*1341Sstevel#include <sys/privregs.h> 35*1341Sstevel#include <sys/spitregs.h> 36*1341Sstevel 37*1341Sstevel#if defined(lint) 38*1341Sstevel 39*1341Sstevel#else /* lint */ 40*1341Sstevel#include "assym.h" 41*1341Sstevel#endif /* lint */ 42*1341Sstevel 43*1341Sstevel/* 44*1341Sstevel * fhc_shutdown_asm(u_longlong_t base, int size) 45*1341Sstevel * 46*1341Sstevel * Flush cpu E$ then shutdown. 47*1341Sstevel * This function is special in that it really sets the D-tags to 48*1341Sstevel * a known state. And this is the behavior we're looking for. 49*1341Sstevel * 50*1341Sstevel * The flush address is known to be a cpu-unique non-existent 51*1341Sstevel * cacheable address. We write to non-existent memory, using 52*1341Sstevel * the side effect of d-tag invalidation. 53*1341Sstevel * 54*1341Sstevel * Also, note that this function is never run from main memory. 55*1341Sstevel * Rather it is copied to non-cacheable SRAM (hence the ..._end 56*1341Sstevel * label at the bottom of the function). This implies that the 57*1341Sstevel * function must be position independent code that doesn't reference 58*1341Sstevel * cacheable real memory. 59*1341Sstevel */ 60*1341Sstevel#if defined(lint) 61*1341Sstevel 62*1341Sstevel/*ARGSUSED*/ 63*1341Sstevelvoid 64*1341Sstevelfhc_shutdown_asm(u_longlong_t base, int size) 65*1341Sstevel{} 66*1341Sstevel 67*1341Sstevel#else /* lint */ 68*1341Sstevel 69*1341Sstevel ENTRY(fhc_shutdown_asm) 70*1341Sstevel ! turn off errors (we'll be writing to non-existent memory) 71*1341Sstevel stxa %g0, [%g0]ASI_ESTATE_ERR 72*1341Sstevel membar #Sync ! SYNC 73*1341Sstevel 74*1341Sstevel rdpr %pstate, %o4 75*1341Sstevel andn %o4, PSTATE_IE | PSTATE_AM, %o3 76*1341Sstevel wrpr %o3, %g0, %pstate 77*1341Sstevel1: 78*1341Sstevel brlez,pn %o1, 2f ! if (len <= 0) exit loop 79*1341Sstevel dec 64, %o1 ! size -= 64 80*1341Sstevel sta %g0, [%o0]ASI_MEM ! store (unpopulated) word 81*1341Sstevel ba 1b 82*1341Sstevel inc 64, %o0 ! addr += 64 83*1341Sstevel2: 84*1341Sstevel membar #Sync ! SYNC 85*1341Sstevel shutdown ! SHUTDOWN 86*1341Sstevel /*NOTREACHED*/ 87*1341Sstevel 88*1341Sstevel ! if, for some reason, this cpu doesn't shutdown, just sit here 89*1341Sstevel3: 90*1341Sstevel ba 3b 91*1341Sstevel nop ! eventually the master will notice 92*1341Sstevel SET_SIZE(fhc_shutdown_asm) 93*1341Sstevel 94*1341Sstevel .global fhc_shutdown_asm_end 95*1341Sstevelfhc_shutdown_asm_end: 96*1341Sstevel 97*1341Sstevel#endif /* lint */ 98