* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: tso_n2_prod_cons_intr5.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_HV_ALSO
#define BUFFERSIZE 64 /*in bytes*/
#define bufferSizeReg %g1
#define ASI_SWVR_UDB_INTR_W 0x73
#define ASI_SWVR_UDB_INTR_R 0x74
#define NO_OF_STRANDS 0x7
#define H_HT0_Interrupt_0x60
#define My_HT0_Interrupt_0x60 \
call My_interrupt_0x60_handler; \
ta T_CHANGE_HPRIV ! change to hyper mode
setx boundedBufferSize, %g5, %g6
setx prodCntBase, %g5, %g6
setx consCntBase, %g5, %g6
setx consumedDataBase, %g5, %g6
setx producedDataBase, %g5, %g6
mov BUFFERSIZE, %g1 !Bounded Buffer Size
mov ITERATIONS, prodCntReg !no of iterations to produce
mov ITERATIONS, consCntReg !no of iterations to produce
! Some of the threads are producers, some are consumers
! A pair of producer and consumer has the same ID.
!=====================================================
add %g0, 0x1, myIdReg ! this is my ID address
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
add %g0, 0x0, phyCoreIdReg
!==============================================================
!==============================================================
setx prodCntBase , %l0, %l2
call produceData !will produce one set of data
stxa %g7, [%g0]ASI_SWVR_UDB_INTR_W ! no membar sync needed after this reg
setx consumedDataBase, %l0, %l2
setx dataBufferBase, %l0, %l1
setx boundedBufferSize , %l0, %l2
lduw [%l2] , %l0 !has buffer size
!pair id available in global myIdReg
add %l3, %l1, %l1 !has the base addr for this pair
mov %i0, %l5 !after save o0 becomes i0
!==============================================================
!==============================================================
setx producedDataBase, %l0, %l2
setx consCntBase , %l0, %l2
!dispacth interrrupt to producer
or %g7,0x001, %g7 ! send to thread 0 vector number 1
stxa %g7, [%g0]ASI_SWVR_UDB_INTR_W ! no membar sync needed after this reg
sub thrdIdReg, 1, %g7 ! send to thread 0 vector number 1
stxa %g7, [%g0]ASI_SWVR_UDB_INTR_W ! no membar sync needed after this reg
setx dataBufferBase, %l0, %l1
setx boundedBufferSize , %l0, %l2
lduw [%l2] , %l0 !has buffer size
!pair id available in global myIdReg
add %l3, %l1, %l1 !has the base addr for this pair
!==============================================================
!==============================================================
.global My_interrupt_0x60_handler
My_interrupt_0x60_handler:
!First figure out wether the consumer interrupting producer
!or Producer interrupting Consumer
!if the vector is 1 then consumer interrupting producer
!if the vector is 2 then producer interrupting consumer
!In interrupts Interrupt Globals are used IG
!read the ASI_SWVR_UDB_INTR_R ASI=0x74 VA=0x0
setx consumedDataBase, %g6, %g2
setx producedDataBase, %g6, %g2
!===============================================================
SECTION .MY_DATA0 TEXT_VA=0xf0100000, DATA_VA=0xd0100000
PA= ra2pa(0x1d0100000,0),
part_0_ctx_nonzero_tsb_config_0,
TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0,
TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0,
TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1
PA= ra2pa(0x1f0100000,0),
part_0_ctx_nonzero_tsb_config_0,
TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0,
TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0,
TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1
.global boundedBufferSize
SECTION .MY_DATA1 TEXT_VA=0xf1110000, DATA_VA=0xd1110000
PA= ra2pa(0x1d1110000,0),
part_0_ctx_nonzero_tsb_config_0,
TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0,
TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0,
TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1
PA= ra2pa(0x1f1110000,0),
part_0_ctx_nonzero_tsb_config_0,
TTE_G=1, TTE_Context=0x44, TTE_V=1, TTE_Size=0, TTE_NFO=0,
TTE_IE=0, TTE_Soft2=0, TTE_Diag=0, TTE_Soft=0,
TTE_L=0, TTE_CP=1, TTE_CV=1, TTE_E=0, TTE_P=0, TTE_W=1