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