* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: memop_all_packet.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
#define MAIN_PAGE_NUCLEUS_ALSO
#define MAIN_PAGE_HV_ALSO
#define SPU_TIMEOUT 0x100
#define H_HT0_Interrupt_0x60
#define My_HT0_Interrupt_0x60 \
/************************************************************************
************************************************************************/
! PCX Load, CPX Load Return
setx user_data_start, %g1, %g2
setx 0x1111111111111111, %g1, %g7
! PCX Prefetch, CPX Prefetch Return
prefetch [%g2 + 0x10], 0x0
setx 0x22222222, %g1, %g3
! PCX Diagnostic Load, CPX Diagnostic Load Return
setx 0xaa00000000, %g1, %g7 ! L2$ Error Enable Reg.
! PCX Diagnostic Store, CPX Diagnostic Store Ack
stx %g6, [%g7] ! Store back to same reg.
! PCX Dcache Invalidate, CPX, Dcache Invalidate Ack
! Not enough infomation available to know how to generate
! PCX Instruction Fill, CPX IFill Return (1) & (2)
! These occur all the time as code is fetched.
! PCX Icache Invalidate, CPX Icache Invalidate Ack
! Not enough infomation available to know how to generate
! PCX Store, CPX Store Ack
setx 0xa5a5a5a5, %g1, %g3
! PCX CAS (1) & (2), CPX CAS Return & Ack
setx 0xffffffffffffffff, %g1, %l0
casa [%g2]ASI_PRIMARY, %g0, %l0
setx 0xffffffff, %g1, %g4
! PCX Swap/Ldstub, CPX Swap/Ldstub Return & Ack
setx 0xa5a5a5a5a5a5a5a5, %g1, %g5
setx 0xa5a5a5a5, %g1, %g7
! PCX MMU Load, CPX MMU Load Return
ldda [%g7]ASI_NUCLEUS_QUAD_LDD, %l0
setx 0x4444444444444444, %g1, %g4
setx 0x5555555555555555, %g1, %g3
! PCX Interrupt, CPX Interrupt Return
stxa %g0, [%g0]ASI_SWVR_INTR_RECEIVE ! enable interrupts
stxa %g1, [%g0]ASI_SWVR_INTR_W ! Send interrupt to myself
mov %g1, %g3 ! %g3, timeout count
setx my_trap_count, %g1, %g4
! PCX Flush, CPX Flush Return
! CPX Eviction Invalidation
ldx [%g2], %l1 ! Bring data into a D$ line.
call flush_l2_line ! Causing the corresponding L2$
! line to be replaced causes the
! Dcache line to be invalidated.
! Currently not able to induce an error on a load,
! such as an L2$ ECC error.
! PCX Stream Load, CPX Stream Load Return
! PCX Stream Store, CPX Stream Store Ack
! This code was modified from isa3_spu_cwq_tcp.s diag
wr %g0, 0x40, %asi ! setup ASI register to point to SPU
! Make sure CWQ is currently disabled, not busy,
! not terminated, no protocol error; else fail
ldxa [%g0 + ASI_SPU_CWQ_CSR] %asi, %l1
! Allocate control word queue
! (e.g., setup head/tail/first/last registers)
stxa %l6, [%g0 + ASI_SPU_CWQ_FIRST] %asi
ldxa [%g0 + ASI_SPU_CWQ_FIRST] %asi, %l1
setx 0x0000ffffffffffff, %l5, %l0 ! Mask off upper 16 bits
stxa %l6, [%g0 + ASI_SPU_CWQ_HEAD] %asi
ldxa [%g0 + ASI_SPU_CWQ_HEAD] %asi, %l1
stxa %l6, [%g0 + ASI_SPU_CWQ_TAIL] %asi
ldxa [%g0 + ASI_SPU_CWQ_TAIL] %asi, %l1
stxa %l5, [%g0 + ASI_SPU_CWQ_LAST] %asi
ldxa [%g0 + ASI_SPU_CWQ_LAST] %asi, %l1
and %l0, %l5, %l2 !# Mask off upper 16 bits
! Build the first control word, for the first RC4 vector.
! For RC4, set op = 65, Enc=1, SOB=EOB=1, SFAS=0, Int=CoreID=0,
! AuthType=8, EncType=00, status=0, Len=30
setx 0xc1E001080000001D, %l1, %l2
! Note: All CWQ entry addresses must be physical!
! Write source address to next CW field
setx cleartext_1, %g1, %l2
! Write 0's to the next 5 CW fields as they are not used
! Finally write destination address to last CW field
! Make sure all these stores get to memory before we start
! Now add 1 (actually 8*8B) to tail pointer
ldxa [%g0 + ASI_SPU_CWQ_TAIL] %asi, %l2
stxa %l2, [%g0 + ASI_SPU_CWQ_TAIL] %asi
ldxa [%g0 + ASI_SPU_CWQ_TAIL] %asi, %l1
! Kick off the CWQ operation by writing to the CWQ_CSR
! Set the enabled bit and reset the other bits
stxa %g1, [%g0 + ASI_SPU_CWQ_CSR] %asi
! set maximum wait loop count, setup mask for busy bit
! This timeout may need adjustment
setx SPU_TIMEOUT, %o3, %l3
or %g0, 0x4, %l2 ! mask out the busy bit
! loop on busy to fall through when done or loop count exceeded
ldxa [%g0 + ASI_SPU_CWQ_CSR] %asi, %l1
/**********************************************************************
*********************************************************************/
! Assumes that %o0 contains VA that maps to L2$ line to be flushed,
! and %o7 contains the return address. The flush is done by
! doing 16 loads from different addresses that alias to that line.
! Note that this will cause a writeback if the L2$ line is dirty.
! The registers %o1, %o2, %o3, %o4 and %o5 are used.
/**********************************************************************
**********************************************************************/
setx my_trap_count, %g6, %g7
ldxa [%g0]ASI_SWVR_INTR_R, %g3
/************************************************************************
************************************************************************/
.xword 0x0000000000000000
.xword 0x1111111111111111
.xword 0x2222222222222222
.xword 0x3333333333333333
.xword 0x4444444444444444
.xword 0x5555555555555555
.xword 0x6666666666666666
.xword 0x7777777777777777
.xword 0x8888888888888888
.xword 0x9999999999999999
.xword 0xaaaaaaaaaaaaaaaa
.xword 0xbbbbbbbbbbbbbbbb
.xword 0xcccccccccccccccc
.xword 0xdddddddddddddddd
.xword 0xeeeeeeeeeeeeeeee
.xword 0xffffffffffffffff
.xword 0xffffffffaaaaaaaa
.xword 0xffffffffaaaaaaaa
.xword 0xffffffffaaaaaaaa
.xword 0xffffffffaaaaaaaa
! Data used for steam (SPU) load/store testing
.xword 0xDEECA425C5AF7185
.xword 0xB128069258CF5271
.xword 0xF2D9FC0493661FF4
.xword 0x4C6DC5810067DEAD
.xword 0x2e2dBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
! CWQ data area, set aside 512 CW's worth
.align 0x40000 ! each 246kb, 0x40000, aliases to same L2$ line