1*7c478bd9Sstevel@tonic-gate/* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate/* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate/* 30*7c478bd9Sstevel@tonic-gate * This file is through cpp before being used as 31*7c478bd9Sstevel@tonic-gate * an inline. It contains support routines used 32*7c478bd9Sstevel@tonic-gate * only by DR for the copy-rename sequence. 33*7c478bd9Sstevel@tonic-gate */ 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate#if defined(lint) 36*7c478bd9Sstevel@tonic-gate#include <sys/types.h> 37*7c478bd9Sstevel@tonic-gate#else 38*7c478bd9Sstevel@tonic-gate#include "assym.h" 39*7c478bd9Sstevel@tonic-gate#endif /* lint */ 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate#include <sys/asm_linkage.h> 42*7c478bd9Sstevel@tonic-gate#include <sys/param.h> 43*7c478bd9Sstevel@tonic-gate#include <sys/privregs.h> 44*7c478bd9Sstevel@tonic-gate#include <sys/machasi.h> 45*7c478bd9Sstevel@tonic-gate#include <sys/spitregs.h> 46*7c478bd9Sstevel@tonic-gate#include <sys/mmu.h> 47*7c478bd9Sstevel@tonic-gate#include <sys/machthread.h> 48*7c478bd9Sstevel@tonic-gate#include <sys/pte.h> 49*7c478bd9Sstevel@tonic-gate#include <sys/stack.h> 50*7c478bd9Sstevel@tonic-gate#include <sys/vis.h> 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate#ifndef lint 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate/* 55*7c478bd9Sstevel@tonic-gate * arg1 = icache_size 56*7c478bd9Sstevel@tonic-gate * arg2 = icache_linesize 57*7c478bd9Sstevel@tonic-gate */ 58*7c478bd9Sstevel@tonic-gate#define ICACHE_FLUSHALL(lbl, arg1, arg2, tmp1) \ 59*7c478bd9Sstevel@tonic-gate ldxa [%g0]ASI_LSU, tmp1 ;\ 60*7c478bd9Sstevel@tonic-gate btst LSU_IC, tmp1 ;\ 61*7c478bd9Sstevel@tonic-gate bz,pn %icc, lbl/**/1 ;\ 62*7c478bd9Sstevel@tonic-gate sub arg1, arg2, tmp1 ;\ 63*7c478bd9Sstevel@tonic-gatelbl/**/0: ;\ 64*7c478bd9Sstevel@tonic-gate stxa %g0, [tmp1]ASI_IC_TAG ;\ 65*7c478bd9Sstevel@tonic-gate membar #Sync ;\ 66*7c478bd9Sstevel@tonic-gate cmp %g0, tmp1 ;\ 67*7c478bd9Sstevel@tonic-gate bne,pt %icc, lbl/**/0 ;\ 68*7c478bd9Sstevel@tonic-gate sub tmp1, arg2, tmp1 ;\ 69*7c478bd9Sstevel@tonic-gatelbl/**/1: 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate/* 72*7c478bd9Sstevel@tonic-gate * arg1 = dcache_size 73*7c478bd9Sstevel@tonic-gate * arg2 = dcache_linesize 74*7c478bd9Sstevel@tonic-gate */ 75*7c478bd9Sstevel@tonic-gate#define DCACHE_FLUSHALL(lbl, arg1, arg2, tmp1) \ 76*7c478bd9Sstevel@tonic-gate ldxa [%g0]ASI_LSU, tmp1 ;\ 77*7c478bd9Sstevel@tonic-gate btst LSU_DC, tmp1 ;\ 78*7c478bd9Sstevel@tonic-gate bz,pn %icc, lbl/**/1 ;\ 79*7c478bd9Sstevel@tonic-gate sub arg1, arg2, tmp1 ;\ 80*7c478bd9Sstevel@tonic-gatelbl/**/0: ;\ 81*7c478bd9Sstevel@tonic-gate stxa %g0, [tmp1]ASI_DC_TAG ;\ 82*7c478bd9Sstevel@tonic-gate membar #Sync ;\ 83*7c478bd9Sstevel@tonic-gate cmp %g0, tmp1 ;\ 84*7c478bd9Sstevel@tonic-gate bne,pt %icc, lbl/**/0 ;\ 85*7c478bd9Sstevel@tonic-gate sub tmp1, arg2, tmp1 ;\ 86*7c478bd9Sstevel@tonic-gatelbl/**/1: 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate/* 89*7c478bd9Sstevel@tonic-gate * arg1 = ecache flush physaddr 90*7c478bd9Sstevel@tonic-gate * arg2 = size 91*7c478bd9Sstevel@tonic-gate * arg3 = ecache_linesize 92*7c478bd9Sstevel@tonic-gate */ 93*7c478bd9Sstevel@tonic-gate#define ECACHE_FLUSHALL(lbl, arg1, arg2, arg3, tmp1, tmp2) \ 94*7c478bd9Sstevel@tonic-gate rdpr %pstate, tmp1 ;\ 95*7c478bd9Sstevel@tonic-gate andn tmp1, PSTATE_IE | PSTATE_AM, tmp2 ;\ 96*7c478bd9Sstevel@tonic-gate wrpr %g0, tmp2, %pstate ;\ 97*7c478bd9Sstevel@tonic-gate b lbl/**/1 ;\ 98*7c478bd9Sstevel@tonic-gatelbl/**/0: ;\ 99*7c478bd9Sstevel@tonic-gate sub arg2, arg3, arg2 ;\ 100*7c478bd9Sstevel@tonic-gatelbl/**/1: ;\ 101*7c478bd9Sstevel@tonic-gate brgez,a arg2, lbl/**/0 ;\ 102*7c478bd9Sstevel@tonic-gate ldxa [arg1 + arg2]ASI_MEM, %g0 ;\ 103*7c478bd9Sstevel@tonic-gate wrpr %g0, tmp1, %pstate 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate#ifdef SF_ERRATA_32 106*7c478bd9Sstevel@tonic-gate#define SF_WORKAROUND(tmp1, tmp2) \ 107*7c478bd9Sstevel@tonic-gate sethi %hi(FLUSH_ADDR), tmp2 ;\ 108*7c478bd9Sstevel@tonic-gate set MMU_PCONTEXT, tmp1 ;\ 109*7c478bd9Sstevel@tonic-gate stxa %g0, [tmp1]ASI_DMMU ;\ 110*7c478bd9Sstevel@tonic-gate flush tmp2 ; 111*7c478bd9Sstevel@tonic-gate#else 112*7c478bd9Sstevel@tonic-gate#define SF_WORKAROUND(tmp1, tmp2) 113*7c478bd9Sstevel@tonic-gate#endif /* SF_ERRATA_32 */ 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate/* 116*7c478bd9Sstevel@tonic-gate * arg1 = vaddr 117*7c478bd9Sstevel@tonic-gate * arg2 = ctxnum 118*7c478bd9Sstevel@tonic-gate * - disable interrupts and clear address mask 119*7c478bd9Sstevel@tonic-gate * to access 64 bit physaddr 120*7c478bd9Sstevel@tonic-gate * - Blow out the TLB. 121*7c478bd9Sstevel@tonic-gate * . If it's kernel context, then use primary context. 122*7c478bd9Sstevel@tonic-gate * . Otherwise, use secondary. 123*7c478bd9Sstevel@tonic-gate */ 124*7c478bd9Sstevel@tonic-gate#define VTAG_FLUSHPAGE(lbl, arg1, arg2, tmp1, tmp2, tmp3, tmp4) \ 125*7c478bd9Sstevel@tonic-gate rdpr %pstate, tmp1 ;\ 126*7c478bd9Sstevel@tonic-gate andn tmp1, PSTATE_IE | PSTATE_AM, tmp2 ;\ 127*7c478bd9Sstevel@tonic-gate wrpr tmp2, 0, %pstate ;\ 128*7c478bd9Sstevel@tonic-gate brnz,pt arg2, lbl/**/1 ;\ 129*7c478bd9Sstevel@tonic-gate sethi %hi(FLUSH_ADDR), tmp2 ;\ 130*7c478bd9Sstevel@tonic-gate stxa %g0, [arg1]ASI_DTLB_DEMAP ;\ 131*7c478bd9Sstevel@tonic-gate stxa %g0, [arg1]ASI_ITLB_DEMAP ;\ 132*7c478bd9Sstevel@tonic-gate b lbl/**/5 ;\ 133*7c478bd9Sstevel@tonic-gate flush tmp2 ;\ 134*7c478bd9Sstevel@tonic-gatelbl/**/1: ;\ 135*7c478bd9Sstevel@tonic-gate set MMU_SCONTEXT, tmp3 ;\ 136*7c478bd9Sstevel@tonic-gate ldxa [tmp3]ASI_DMMU, tmp4 ;\ 137*7c478bd9Sstevel@tonic-gate or DEMAP_SECOND | DEMAP_PAGE_TYPE, arg1, arg1 ;\ 138*7c478bd9Sstevel@tonic-gate cmp tmp4, arg2 ;\ 139*7c478bd9Sstevel@tonic-gate be,a,pt %icc, lbl/**/4 ;\ 140*7c478bd9Sstevel@tonic-gate nop ;\ 141*7c478bd9Sstevel@tonic-gate stxa arg2, [tmp3]ASI_DMMU ;\ 142*7c478bd9Sstevel@tonic-gatelbl/**/4: ;\ 143*7c478bd9Sstevel@tonic-gate stxa %g0, [arg1]ASI_DTLB_DEMAP ;\ 144*7c478bd9Sstevel@tonic-gate stxa %g0, [arg1]ASI_ITLB_DEMAP ;\ 145*7c478bd9Sstevel@tonic-gate flush tmp2 ;\ 146*7c478bd9Sstevel@tonic-gate be,a,pt %icc, lbl/**/5 ;\ 147*7c478bd9Sstevel@tonic-gate nop ;\ 148*7c478bd9Sstevel@tonic-gate stxa tmp4, [tmp3]ASI_DMMU ;\ 149*7c478bd9Sstevel@tonic-gate flush tmp2 ;\ 150*7c478bd9Sstevel@tonic-gatelbl/**/5: ;\ 151*7c478bd9Sstevel@tonic-gate wrpr %g0, tmp1, %pstate 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate/* 154*7c478bd9Sstevel@tonic-gate * arg1 = dtlb entry 155*7c478bd9Sstevel@tonic-gate * - Before first compare: 156*7c478bd9Sstevel@tonic-gate * tmp4 = tte 157*7c478bd9Sstevel@tonic-gate * tmp5 = vaddr 158*7c478bd9Sstevel@tonic-gate * tmp6 = cntxnum 159*7c478bd9Sstevel@tonic-gate */ 160*7c478bd9Sstevel@tonic-gate#define DTLB_FLUSH_UNLOCKED(lbl, arg1, tmp1, tmp2, tmp3, \ 161*7c478bd9Sstevel@tonic-gate tmp4, tmp5, tmp6) \ 162*7c478bd9Sstevel@tonic-gatelbl/**/0: ;\ 163*7c478bd9Sstevel@tonic-gate sllx arg1, 3, tmp3 ;\ 164*7c478bd9Sstevel@tonic-gate SF_WORKAROUND(tmp1, tmp2) ;\ 165*7c478bd9Sstevel@tonic-gate ldxa [tmp3]ASI_DTLB_ACCESS, tmp4 ;\ 166*7c478bd9Sstevel@tonic-gate srlx tmp4, 6, tmp4 ;\ 167*7c478bd9Sstevel@tonic-gate andcc tmp4, 1, %g0 ;\ 168*7c478bd9Sstevel@tonic-gate bnz,pn %xcc, lbl/**/1 ;\ 169*7c478bd9Sstevel@tonic-gate srlx tmp4, 57, tmp4 ;\ 170*7c478bd9Sstevel@tonic-gate andcc tmp4, 1, %g0 ;\ 171*7c478bd9Sstevel@tonic-gate beq,pn %xcc, lbl/**/1 ;\ 172*7c478bd9Sstevel@tonic-gate nop ;\ 173*7c478bd9Sstevel@tonic-gate set TAGREAD_CTX_MASK, tmp1 ;\ 174*7c478bd9Sstevel@tonic-gate ldxa [tmp3]ASI_DTLB_TAGREAD, tmp2 ;\ 175*7c478bd9Sstevel@tonic-gate and tmp2, tmp1, tmp6 ;\ 176*7c478bd9Sstevel@tonic-gate andn tmp2, tmp1, tmp5 ;\ 177*7c478bd9Sstevel@tonic-gate VTAG_FLUSHPAGE(VD, tmp5, tmp6, tmp1, tmp2, tmp3, tmp4) ;\ 178*7c478bd9Sstevel@tonic-gatelbl/**/1: ;\ 179*7c478bd9Sstevel@tonic-gate brgz,pt arg1, lbl/**/0 ;\ 180*7c478bd9Sstevel@tonic-gate sub arg1, 1, arg1 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate/* 183*7c478bd9Sstevel@tonic-gate * arg1 = itlb entry 184*7c478bd9Sstevel@tonic-gate * - Before first compare: 185*7c478bd9Sstevel@tonic-gate * tmp4 = tte 186*7c478bd9Sstevel@tonic-gate * tmp5 = vaddr 187*7c478bd9Sstevel@tonic-gate * tmp6 = cntxnum 188*7c478bd9Sstevel@tonic-gate */ 189*7c478bd9Sstevel@tonic-gate#define ITLB_FLUSH_UNLOCKED(lbl, arg1, tmp1, tmp2, tmp3, \ 190*7c478bd9Sstevel@tonic-gate tmp4, tmp5, tmp6) \ 191*7c478bd9Sstevel@tonic-gatelbl/**/0: ;\ 192*7c478bd9Sstevel@tonic-gate sllx arg1, 3, tmp3 ;\ 193*7c478bd9Sstevel@tonic-gate SF_WORKAROUND(tmp1, tmp2) ;\ 194*7c478bd9Sstevel@tonic-gate ldxa [tmp3]ASI_ITLB_ACCESS, tmp4 ;\ 195*7c478bd9Sstevel@tonic-gate srlx tmp4, 6, tmp4 ;\ 196*7c478bd9Sstevel@tonic-gate andcc tmp4, 1, %g0 ;\ 197*7c478bd9Sstevel@tonic-gate bnz,pn %xcc, lbl/**/1 ;\ 198*7c478bd9Sstevel@tonic-gate srlx tmp4, 57, tmp4 ;\ 199*7c478bd9Sstevel@tonic-gate andcc tmp4, 1, %g0 ;\ 200*7c478bd9Sstevel@tonic-gate beq,pn %xcc, lbl/**/1 ;\ 201*7c478bd9Sstevel@tonic-gate nop ;\ 202*7c478bd9Sstevel@tonic-gate set TAGREAD_CTX_MASK, tmp1 ;\ 203*7c478bd9Sstevel@tonic-gate ldxa [tmp3]ASI_ITLB_TAGREAD, tmp2 ;\ 204*7c478bd9Sstevel@tonic-gate and tmp2, tmp1, tmp6 ;\ 205*7c478bd9Sstevel@tonic-gate andn tmp2, tmp1, tmp5 ;\ 206*7c478bd9Sstevel@tonic-gate VTAG_FLUSHPAGE(VI, tmp5, tmp6, tmp1, tmp2, tmp3, tmp4) ;\ 207*7c478bd9Sstevel@tonic-gatelbl/**/1: ;\ 208*7c478bd9Sstevel@tonic-gate brgz,pt arg1, lbl/**/0 ;\ 209*7c478bd9Sstevel@tonic-gate sub arg1, 1, arg1 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate#define CLEARTL(lvl) \ 212*7c478bd9Sstevel@tonic-gate wrpr %g0, lvl, %tl ;\ 213*7c478bd9Sstevel@tonic-gate wrpr %g0, %g0, %tpc ;\ 214*7c478bd9Sstevel@tonic-gate wrpr %g0, %g0, %tnpc ;\ 215*7c478bd9Sstevel@tonic-gate wrpr %g0, %g0, %tt 216*7c478bd9Sstevel@tonic-gate 217*7c478bd9Sstevel@tonic-gate#define SWITCH_STACK(estk) \ 218*7c478bd9Sstevel@tonic-gate flushw ;\ 219*7c478bd9Sstevel@tonic-gate sub estk, SA(KFPUSIZE+GSR_SIZE), estk ;\ 220*7c478bd9Sstevel@tonic-gate andn estk, 0x3f, estk ;\ 221*7c478bd9Sstevel@tonic-gate sub estk, SA(MINFRAME) + STACK_BIAS, %sp ;\ 222*7c478bd9Sstevel@tonic-gate mov estk, %fp 223*7c478bd9Sstevel@tonic-gate 224*7c478bd9Sstevel@tonic-gate#endif /* !lint */ 225*7c478bd9Sstevel@tonic-gate 226*7c478bd9Sstevel@tonic-gate#if defined(lint) 227*7c478bd9Sstevel@tonic-gate 228*7c478bd9Sstevel@tonic-gate/*ARGSUSED*/ 229*7c478bd9Sstevel@tonic-gatevoid 230*7c478bd9Sstevel@tonic-gatedrmach_shutdown_asm(uint64_t mbox_addr) 231*7c478bd9Sstevel@tonic-gate{} 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gate#else /* lint */ 234*7c478bd9Sstevel@tonic-gate 235*7c478bd9Sstevel@tonic-gate ENTRY_NP(drmach_shutdown_asm) 236*7c478bd9Sstevel@tonic-gate mov %o0, %o5 237*7c478bd9Sstevel@tonic-gate 238*7c478bd9Sstevel@tonic-gate ldxa [%o5]ASI_MEM, %o0 ! get 8-byte estack in o0 239*7c478bd9Sstevel@tonic-gate add %o5, 8, %o5 240*7c478bd9Sstevel@tonic-gate ldxa [%o5]ASI_MEM, %o1 ! get 8-byte flushaddr in o1 241*7c478bd9Sstevel@tonic-gate add %o5, 8, %o5 242*7c478bd9Sstevel@tonic-gate lda [%o5]ASI_MEM, %o2 ! get 4-byte size in o2 243*7c478bd9Sstevel@tonic-gate srl %o2, 0, %o2 244*7c478bd9Sstevel@tonic-gate add %o5, 4, %o5 245*7c478bd9Sstevel@tonic-gate lda [%o5]ASI_MEM, %o3 ! get 4-byte linesize in o3 246*7c478bd9Sstevel@tonic-gate srl %o3, 0, %o3 247*7c478bd9Sstevel@tonic-gate add %o5, 4, %o5 248*7c478bd9Sstevel@tonic-gate ldxa [%o5]ASI_MEM, %o4 ! get 8-byte physaddr in o4 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate ! %o0 = base (va mapping this code in bbsram) 252*7c478bd9Sstevel@tonic-gate ! %o1 = flushaddr for ecache 253*7c478bd9Sstevel@tonic-gate ! %o2 = size to use for ecache flush 254*7c478bd9Sstevel@tonic-gate ! %o3 = ecache linesize 255*7c478bd9Sstevel@tonic-gate ! %o4 = phys addr of byte to clear when finished 256*7c478bd9Sstevel@tonic-gate ! 257*7c478bd9Sstevel@tonic-gate ! output: Stores a zero at [%o4]ASI_MEM 258*7c478bd9Sstevel@tonic-gate 259*7c478bd9Sstevel@tonic-gate membar #LoadStore 260*7c478bd9Sstevel@tonic-gate 261*7c478bd9Sstevel@tonic-gate ! 262*7c478bd9Sstevel@tonic-gate ! Switch stack pointer to bbsram 263*7c478bd9Sstevel@tonic-gate ! 264*7c478bd9Sstevel@tonic-gate SWITCH_STACK(%o0) 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate ! 267*7c478bd9Sstevel@tonic-gate ! Get some globals 268*7c478bd9Sstevel@tonic-gate ! 269*7c478bd9Sstevel@tonic-gate mov %o3, %g1 ! ecache_linesize 270*7c478bd9Sstevel@tonic-gate mov %o4, %o0 ! physaddr byte to clear 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate sethi %hi(dcache_linesize), %g2 273*7c478bd9Sstevel@tonic-gate ld [%g2 + %lo(dcache_linesize)], %g2 274*7c478bd9Sstevel@tonic-gate 275*7c478bd9Sstevel@tonic-gate sethi %hi(dcache_size), %g3 276*7c478bd9Sstevel@tonic-gate ld [%g3 + %lo(dcache_size)], %g3 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate sethi %hi(icache_linesize), %g4 279*7c478bd9Sstevel@tonic-gate ld [%g4 + %lo(icache_linesize)], %g4 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate sethi %hi(icache_size), %g5 282*7c478bd9Sstevel@tonic-gate ld [%g5 + %lo(icache_size)], %g5 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate sethi %hi(dtlb_entries), %o5 285*7c478bd9Sstevel@tonic-gate ld [%o5 + %lo(dtlb_entries)], %o5 286*7c478bd9Sstevel@tonic-gate sllx %o5, 32, %o5 287*7c478bd9Sstevel@tonic-gate srlx %o5, 32, %o5 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate sethi %hi(itlb_entries), %o3 290*7c478bd9Sstevel@tonic-gate ld [%o3 + %lo(itlb_entries)], %o3 291*7c478bd9Sstevel@tonic-gate ! 292*7c478bd9Sstevel@tonic-gate ! cram Xtlb_entries into a single register (%o5) 293*7c478bd9Sstevel@tonic-gate ! %o5 upper 32 = itlb_entries 294*7c478bd9Sstevel@tonic-gate ! lower 32 = dtlb_entries 295*7c478bd9Sstevel@tonic-gate ! 296*7c478bd9Sstevel@tonic-gate sllx %o3, 32, %o3 297*7c478bd9Sstevel@tonic-gate or %o5, %o3, %o5 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate ! 300*7c478bd9Sstevel@tonic-gate ! Flush E$ 301*7c478bd9Sstevel@tonic-gate ! 302*7c478bd9Sstevel@tonic-gate ECACHE_FLUSHALL(EC, %o1, %o2, %g1, %o3, %o4) 303*7c478bd9Sstevel@tonic-gate ! 304*7c478bd9Sstevel@tonic-gate ! %o1 & %o2 now available 305*7c478bd9Sstevel@tonic-gate ! 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate membar #Sync 308*7c478bd9Sstevel@tonic-gate 309*7c478bd9Sstevel@tonic-gate ! 310*7c478bd9Sstevel@tonic-gate ! Flush D$ 311*7c478bd9Sstevel@tonic-gate ! 312*7c478bd9Sstevel@tonic-gate DCACHE_FLUSHALL(DC, %g3, %g2, %o3) 313*7c478bd9Sstevel@tonic-gate 314*7c478bd9Sstevel@tonic-gate ! 315*7c478bd9Sstevel@tonic-gate ! Flush I$ 316*7c478bd9Sstevel@tonic-gate ! 317*7c478bd9Sstevel@tonic-gate ICACHE_FLUSHALL(IC, %g5, %g4, %o3) 318*7c478bd9Sstevel@tonic-gate 319*7c478bd9Sstevel@tonic-gate membar #Sync 320*7c478bd9Sstevel@tonic-gate 321*7c478bd9Sstevel@tonic-gate ! 322*7c478bd9Sstevel@tonic-gate ! Flush dtlb's 323*7c478bd9Sstevel@tonic-gate ! 324*7c478bd9Sstevel@tonic-gate srlx %o5, 32, %g5 ! %g5 = itlb_entries 325*7c478bd9Sstevel@tonic-gate sllx %o5, 32, %o5 326*7c478bd9Sstevel@tonic-gate srlx %o5, 32, %g1 327*7c478bd9Sstevel@tonic-gate sub %g1, 1, %g1 ! %g1 = dtlb_entries - 1 328*7c478bd9Sstevel@tonic-gate 329*7c478bd9Sstevel@tonic-gate DTLB_FLUSH_UNLOCKED(D, %g1, %g3, %g4, %o2, %o3, %o4, %o5) 330*7c478bd9Sstevel@tonic-gate 331*7c478bd9Sstevel@tonic-gate ! 332*7c478bd9Sstevel@tonic-gate ! Flush itlb's 333*7c478bd9Sstevel@tonic-gate ! 334*7c478bd9Sstevel@tonic-gate sub %g5, 1, %g1 ! %g1 = itlb_entries - 1 335*7c478bd9Sstevel@tonic-gate 336*7c478bd9Sstevel@tonic-gate ITLB_FLUSH_UNLOCKED(I, %g1, %g3, %g4, %o2, %o3, %o4, %o5) 337*7c478bd9Sstevel@tonic-gate 338*7c478bd9Sstevel@tonic-gate membar #Sync 339*7c478bd9Sstevel@tonic-gate 340*7c478bd9Sstevel@tonic-gate ! 341*7c478bd9Sstevel@tonic-gate ! Clear byte to signal finished. 342*7c478bd9Sstevel@tonic-gate ! 343*7c478bd9Sstevel@tonic-gate stba %g0, [%o0]ASI_MEM 344*7c478bd9Sstevel@tonic-gate membar #Sync 345*7c478bd9Sstevel@tonic-gate 346*7c478bd9Sstevel@tonic-gate ! 347*7c478bd9Sstevel@tonic-gate ! read ensures that last write completed (has left queue in the PC chip) 348*7c478bd9Sstevel@tonic-gate ! 349*7c478bd9Sstevel@tonic-gate lduba [%o0]ASI_MEM, %g0 350*7c478bd9Sstevel@tonic-gate5: 351*7c478bd9Sstevel@tonic-gate ba 5b 352*7c478bd9Sstevel@tonic-gate nop 353*7c478bd9Sstevel@tonic-gate SET_SIZE(drmach_shutdown_asm) 354*7c478bd9Sstevel@tonic-gate 355*7c478bd9Sstevel@tonic-gate .global drmach_shutdown_asm_end 356*7c478bd9Sstevel@tonic-gate 357*7c478bd9Sstevel@tonic-gate .skip 2048 358*7c478bd9Sstevel@tonic-gate 359*7c478bd9Sstevel@tonic-gatedrmach_shutdown_asm_end: 360*7c478bd9Sstevel@tonic-gate 361*7c478bd9Sstevel@tonic-gate#endif /* lint */ 362