* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: isa3_asi_cmp_core_1.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
!!!!!!!!!!!!!!!!!! assumes only 1 thread of core 0 running !!!
#define CMP_CORE_RUNNING_STATUS_EXP %o1
#define CMP_CORE_AVAIL_EXP 0xff
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#define ALL1S 0xffffffffffffffff
/************************************************************************
************************************************************************/
ta T_CHANGE_HPRIV ! run in Hpriv mode
rdth_id ! get thread ID in %o1
! bne wrong_thread ! only thread zero allowed!!!
!rdth_id ! get thread ID in %o1
wr %g0, ASI_CMP_CORE, %asi
! ASI_CMP_CORE_AVAIL: set at foundry
ldxa [%g0 + ASI_CMP_CORE_AVAIL] %asi, %i0
cmp %i0, CMP_CORE_AVAIL_EXP
!%i0 will hold expected value for many reads below
! ASI_CMP_CORE_ENABLE_STATUS = core enabled
ldxa [%g0 + ASI_CMP_CORE_ENABLED] %asi, %l0
cmp %l0, %i0 !CMP_CORE_ENABLED_EXP
! ASI_CMP_CORE_ENABLE: write to disable thread later after a reset.
! the reg value is moved to ASI_CMP_CORE_ENABLE_STATUS on next reset
! must keep threads 0 & 4 enabled.
! non available threads will return 0.
setx 0x5555555555555555, %g1, %l1
stxa %l1, [%g0 + ASI_CMP_CORE_ENABLE] %asi
ldxa [%g0 + ASI_CMP_CORE_ENABLE] %asi, %l0
cmp %l0, %i0 ! non available threads will return 0, else ff
stxa %l1, [%g0 + ASI_CMP_CORE_ENABLE] %asi ! write 0
ldxa [%g0 + ASI_CMP_CORE_ENABLE] %asi, %l0
cmp %l0, %i0 ! cant self disable so will get ff
! Bit mask of virtual cores that are
! currently active. 1 = active
! avail & enable & running & !parked ???
ldxa [%g0 + ASI_CMP_CORE_RUNNING_STATUS] %asi, %l0
cmp %l0, CMP_CORE_RUNNING_STATUS_EXP
! Bit mask to control which virtual
! cores are running and which are
! parked (r/w). 1= active
stxa %l1, [%g0 + ASI_CMP_CORE_RUNNING_RW] %asi
ldxa [%g0 + ASI_CMP_CORE_RUNNING_RW] %asi, %l0
mov CMP_CORE_RUNNING_STATUS_EXP, %l1
stxa %l1, [%g0 + ASI_CMP_CORE_RUNNING_RW] %asi
ldxa [%g0 + ASI_CMP_CORE_RUNNING_RW] %asi, %l0
! Bit mask to control which virtual
! cores are running and which are
! parked (r/w). 1= active
stxa %l1, [%g0 + ASI_CMP_CORE_RUNNING_W1S] %asi
ldxa [%g0 + ASI_CMP_CORE_RUNNING_RW] %asi, %l0
! cant park all from >1 threads at once, results may not be predictable
xor %l1, CMP_CORE_RUNNING_STATUS_EXP, %l1
stxa %l1, [%g0 + ASI_CMP_CORE_RUNNING_W1C] %asi
ldxa [%g0 + ASI_CMP_CORE_RUNNING_RW] %asi, %l0
cmp %l0, CMP_CORE_RUNNING_STATUS_EXP
stxa %l1, [%g0 + ASI_CMP_XIR_STEERING] %asi
ldxa [%g0 + ASI_CMP_XIR_STEERING] %asi, %l0
cmp %l0, %i0 !CMP_CORE_ENABLED_EXP
stxa %l1, [%g0 + ASI_CMP_XIR_STEERING] %asi
ldxa [%g0 + ASI_CMP_XIR_STEERING] %asi, %l0
! $!E!V trig_pc_d(1, @VA(.MAIN.wrong_thread)) -> printf("This diag only runs on thread ZERO!")
/************************************************************************
************************************************************************/