* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: pmu_ccx_sel5_0x02_thAll.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 MAX_THREAD_TIMEOUT 0x1fff
#define MAIN_PAGE_HV_ALSO
#define H_HT0_Control_Word_Queue_Interrupt_0x3c
#define My_HT0_Control_Word_Queue_Interrupt_0x3c \
ldxa [%g0 + ASI_SPU_CWQ_CSR]%asi, %i5; \
stxa %i5, [%g0 + ASI_SPU_CWQ_CSR]%asi; \
setx 0x0000deadbeefbad0, %l5, %l4
!# Check to make sure pic is zero
wr %g0, %g0, %pic !zero out pic
set 0x0000000038094088, %g2
wr %g0, %g0, %pic !zero out pic
!all other threads execute the same code
!# 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)
!# write base addr to first, head, and tail ptr
stxa %l6, [%g0 + ASI_SPU_CWQ_FIRST] %asi
ldxa [%g0 + ASI_SPU_CWQ_FIRST] %asi, %l1
!# Mask off upper 16 bits
setx 0x0000ffffffffffff, %l5, %l0
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
!# then end of CWQ region to LAST
stxa %l5, [%g0 + ASI_SPU_CWQ_LAST] %asi
ldxa [%g0 + ASI_SPU_CWQ_LAST] %asi, %l1
!# Mask off upper 16 bits
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
!# Make sure all these stores get to memory before we start
!# Try CWQ_SYNC operation...
ldxa [%g0 + 0x30] %asi, %l1
brnz %l1, fail !# test for unexpected protocal error
ldxa [%g0 + ASI_SPU_CWQ_HEAD] %asi, %l1
ldxa [%g0 + ASI_SPU_CWQ_TAIL] %asi, %l1
setx fas_result, %g1, %l5
!disable SPU before next operation
stxa %g0, [%g0 + ASI_SPU_CWQ_CSR] %asi
!wait for interrupt and then exit
! first 8 addresses are for counters, last is for done bit
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0000000000000000
.xword 0x0030fdc05d599221
.xword 0x10f3279537ce239f
.xword 0x350192ee57e49864
.xword 0xe6b13af6031ce21d
.xword 0xc04ca56d80506fa8
.xword 0xb3c6d051fbad26e0
.xword 0xb260907945f0428a
.xword 0xa59182341647b4c2
.xword 0xab9b60838da8f032
.xword 0x97149144f33acd56
.xword 0x95f1a4e75e3d7de9
.xword 0x54d350ef97fc6332
.xword 0x8bf6a691fb59ffa6
.xword 0xd0a8142e351cffdc
.xword 0xa110d949b459ff24
.xword 0x40e7b7e36e436a93
.xword 0x8afbb3c3013d7e7a
.xword 0x1980dd67b1386a71
.xword 0x4cb849ad9f511439
.xword 0x5af08a49a51e2b9d
.xword 0x879b4a63cc59cd74
.xword 0xb847c25ebf5b1795
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
.xword 0xDEADBEEFDEADBEEF
!# CWQ data area, set aside 512 CW's worth
.xword 0xC1610B02000A0000
.xword 0xC1610B22000A0040
.xword 0xC1610B42000A0035
.xword 0xC1610B62000A0005
.xword 0xC1610B82000A0035
.xword 0xC1610BA2000A0025
.xword 0xC1610BC2000A0015
.xword 0xC1610BE2000A0005
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
.xword 0xAAAAAAAAAAAAAAAA
setx 0xffffffff00000000, %l5, %l0
!increment interrupt counter