* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: isa3_mondo_121503.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
! Enable main section to run in PRIV mode
#define MAIN_PAGE_NUCLEUS_ALSO
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!Override trap handler definitions
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Trap should set %l6=TT which is verified in main program
#define H_T0_Cpu_Mondo_Trap_0x7c
#define My_T0_Cpu_Mondo_Trap_0x7c \
ldxa [ASI_CPU_MONDO_QUEUE_TAIL] %asi, %g1 ;\
stxa %g1, [ASI_CPU_MONDO_QUEUE_HEAD] %asi; \
#define H_T0_Dev_Mondo_Trap_0x7d
#define My_T0_Dev_Mondo_Trap_0x7d \
ldxa [ASI_DEVICE_QUEUE_TAIL] %asi, %g1 ;\
stxa %g1, [ASI_DEVICE_QUEUE_HEAD] %asi; \
#define H_T0_Resumable_Error_0x7e
#define My_T0_Resumable_Error_0x7e \
ldxa [ASI_RES_ERROR_QUEUE_TAIL] %asi, %g1 ;\
stxa %g1, [ASI_RES_ERROR_QUEUE_HEAD] %asi; \
#define CREGS_PSTATE_IE 1
/************************************************************************
************************************************************************/
! local reg usage for this diag
ta T_CHANGE_HPRIV ! Change to HPRIV mode
! Clear local regs for scratch registers
wrpr %l1, 0x2, %pstate ! Set PSTATE.IE=0
ldxa [ASI_CPU_MONDO_QUEUE_HEAD] %asi, %i0
ldxa [ASI_CPU_MONDO_QUEUE_TAIL] %asi, %i1
ldxa [ASI_DEVICE_QUEUE_HEAD] %asi, %i2
ldxa [ASI_DEVICE_QUEUE_TAIL] %asi, %i3
ldxa [ASI_RES_ERROR_QUEUE_HEAD] %asi, %i4
ldxa [ASI_RES_ERROR_QUEUE_TAIL] %asi, %i5
ldxa [ASI_NONRES_ERROR_QUEUE_HEAD] %asi, %i6
ldxa [ASI_NONRES_ERROR_QUEUE_TAIL] %asi, %i7
stxa %g7, [ASI_CPU_MONDO_QUEUE_HEAD] %asi
stxa %g7, [ASI_CPU_MONDO_QUEUE_TAIL] %asi
stxa %g7, [ASI_DEVICE_QUEUE_HEAD] %asi
stxa %g7, [ASI_DEVICE_QUEUE_TAIL] %asi
stxa %g7, [ASI_RES_ERROR_QUEUE_HEAD] %asi
stxa %g7, [ASI_RES_ERROR_QUEUE_TAIL] %asi
stxa %g7, [ASI_NONRES_ERROR_QUEUE_HEAD] %asi
stxa %g7, [ASI_NONRES_ERROR_QUEUE_TAIL] %asi
ldxa [ASI_CPU_MONDO_QUEUE_HEAD] %asi, %i0
ldxa [ASI_CPU_MONDO_QUEUE_TAIL] %asi, %i1
ldxa [ASI_DEVICE_QUEUE_HEAD] %asi, %i2
ldxa [ASI_DEVICE_QUEUE_TAIL] %asi, %i3
ldxa [ASI_RES_ERROR_QUEUE_HEAD] %asi, %i4
ldxa [ASI_RES_ERROR_QUEUE_TAIL] %asi, %i5
ldxa [ASI_NONRES_ERROR_QUEUE_HEAD] %asi, %i6
ldxa [ASI_NONRES_ERROR_QUEUE_TAIL] %asi, %i7
! Clear all bits - before beginning trap testing
stxa %g7, [ASI_CPU_MONDO_QUEUE_HEAD] %asi
stxa %g7, [ASI_CPU_MONDO_QUEUE_TAIL] %asi
stxa %g7, [ASI_DEVICE_QUEUE_HEAD] %asi
stxa %g7, [ASI_DEVICE_QUEUE_TAIL] %asi
stxa %g7, [ASI_RES_ERROR_QUEUE_HEAD] %asi
stxa %g7, [ASI_RES_ERROR_QUEUE_TAIL] %asi
stxa %g7, [ASI_NONRES_ERROR_QUEUE_HEAD] %asi
stxa %g7, [ASI_NONRES_ERROR_QUEUE_TAIL] %asi
ldxa [ASI_CPU_MONDO_QUEUE_HEAD] %asi, %i0
ldxa [ASI_CPU_MONDO_QUEUE_TAIL] %asi, %i1
ldxa [ASI_DEVICE_QUEUE_HEAD] %asi, %i2
ldxa [ASI_DEVICE_QUEUE_TAIL] %asi, %i3
ldxa [ASI_RES_ERROR_QUEUE_HEAD] %asi, %i4
ldxa [ASI_RES_ERROR_QUEUE_TAIL] %asi, %i5
ldxa [ASI_NONRES_ERROR_QUEUE_HEAD] %asi, %i6
ldxa [ASI_NONRES_ERROR_QUEUE_TAIL] %asi, %i7
wrpr %l1, 0x2, %pstate ! Set PSTATE.IE=1
ta T_CHANGE_HPRIV ! Change to HPRIV mode
! Write values to setup trap condition
ldxa [ASI_CPU_MONDO_QUEUE_HEAD] %asi, %l2
ldxa [ASI_CPU_MONDO_QUEUE_TAIL] %asi, %l3
! Trap if HEAD!=TAIL and HPRIV mode
stxa %l4, [ASI_CPU_MONDO_QUEUE_TAIL] %asi
ldxa [ASI_CPU_MONDO_QUEUE_HEAD] %asi, %l4
ldxa [ASI_CPU_MONDO_QUEUE_TAIL] %asi, %l5
! Change to Priv and trap should happen immediately
ta T_CHANGE_PRIV ! Change to PRIV mode
! Verify that trap was taken, %l6=TT=%l1
!! Test DEVICE MONDO Trap
ta T_CHANGE_HPRIV ! Change to HPRIV mode
! Write values to setup trap condition
ldxa [ASI_DEVICE_QUEUE_HEAD] %asi, %l2
ldxa [ASI_DEVICE_QUEUE_TAIL] %asi, %l3
! Trap if HEAD!=TAIL and HPRIV mode
stxa %l4, [ASI_DEVICE_QUEUE_TAIL] %asi
ldxa [ASI_DEVICE_QUEUE_HEAD] %asi, %l4
ldxa [ASI_DEVICE_QUEUE_TAIL] %asi, %l5
! Change to Priv and trap should happen immediately
ta T_CHANGE_PRIV ! Change to PRIV mode
! Verify that trap was taken, %l6=TT=%l1
ta T_CHANGE_HPRIV ! Change to HPRIV mode
! Write values to setup trap condition
ldxa [ASI_RES_ERROR_QUEUE_HEAD] %asi, %l2
ldxa [ASI_RES_ERROR_QUEUE_TAIL] %asi, %l3
! Trap if HEAD!=TAIL and HPRIV mode
stxa %l4, [ASI_RES_ERROR_QUEUE_TAIL] %asi
ldxa [ASI_RES_ERROR_QUEUE_HEAD] %asi, %l4
ldxa [ASI_RES_ERROR_QUEUE_TAIL] %asi, %l5
! Change to Priv and trap should happen immediately
ta T_CHANGE_PRIV ! Change to PRIV mode
! Verify that trap was taken, %l6=TT=%l1
EXIT_GOOD /* test finish */
/************************************************************************
************************************************************************/