* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: bootprom_init.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 ============================================
#include "partial_modes.h"
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This section replicated from hred_reset_handler.s
!! becuse we need to run the bootprom init fom chip master
wrhpr %l1, 0x820, %hpstate
! set hyper trap base addr
best_set_reg(HV_TRAP_BASE_PA, %g2, %l7)
! Doing this in delay slot of jump from boot prom ...
ldxa [%g0] ASI_INTR_ID, %g1 ! USING this on N2 as a shortcut
bootprom_init_non_cmp_check_master_tid:
! Non-cmp thread startup.
brz %g1, bootprom_init_master ! T0 is chip master
! Else figure out if lowest running
wr %g0, ASI_CMP_CORE, %asi
ldxa [0x50]%asi, %g2 ! Who is running ?
and %g2, 1, %g3 ! T0 IS running
brnz %g3, bootprom_init_notmaster
popc %l1, %l1 ! Get lowest bit set ..
be %xcc, bootprom_init_master
srlx %g1, 3, %l1 ! Get core-id
bootprom_init_cmp_check_master_tid:
! CMP thread startup ! DONT USE %G1 until CMP IS Done
! Find out if current thread is chip master thread,
changequote([, ])dnl ! The M4_* variables need this
changequote(`,')dnl ! [] are not quotes anymore
! Determine master thread by querying CORE_RUNNING
ldxa [%g3]ASI_CMP_CORE, %g2 ! Who is running ?
popc %l1, %l1 ! Get lowest bit set ..
be %xcc, bootprom_init_master
!!!!!!!!!End of thread check for chip master !!!!!!!!!!!!!!!!!!!
ifelse(mpeval((HV_RED_TEXT_PA > 0xffffffff),2),1,
`setx nc_check_core_master_thread, %g3, %g2',
`set nc_check_core_master_thread, %g2')
wr %g0, ASI_CMP_CORE, %asi
ifelse(mpeval((HV_RED_TEXT_PA > 0xffffffff),2),1,
`setx check_core_master_thread, %g3, %g2',
`set check_core_master_thread, %g2')
wr %g0, ASI_CMP_CORE, %asi
!!!!!!!!!!!! Master Thread Inits Here !!!!!!!!!!!!!!!!!!!!!!!!!!
setx RESET_STAT, %g3, %g2
ldx [%g2], %g3 !! read reset source
and %g3, 2, %g3 !! nonzero if WMR
stx %g3, [%g4] !!trigger a warm reset
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!if ccu programming is required then it is done here
!and then a warm reset is issued
bootprom_init_check_reset_stat:
setx RESET_STAT, %g3, %g2
ldx [%g2], %g3 !! read reset source
and %g3, 2, %g3 !! nonzero if WMR
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bootprom_init_program_ccu:
setx cregs_ccu_ctl_reg_r64, %g2, %g3
stx %g3, [%g4] !!store to pll_ctl reg to make freq change
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! AT 04/12/06: Add DTM setup for PEU/PSR CSRs.
#define PEU_MPY_FACTOR_DATA 0x0000000000000005
#define PEU_ILU_FACTOR_DATA 0x00000003ffff0004
#define PEU_PLL_CNTL_REG_ADDR 0x88006e2200
#define PEU_ILU_REG_ADDR 0x8800652000
! program MPY field of PEU Serdes PLL Ctrl Reg to x10
setx PEU_MPY_FACTOR_DATA, %g1, %g4
setx PEU_PLL_CNTL_REG_ADDR, %g1, %g2
! Now switch the PEU rate scale from full to half rate
setx PEU_ILU_FACTOR_DATA, %g1, %g4
setx PEU_ILU_REG_ADDR, %g1, %g2
#if defined(NO_SLAM_INIT_MCUCTL)
#define MCU_CHANNEL_DATA 0x0000000000170017
#define MCU_CHANNEL_MASK 0xffffffffff000000
#define MCU_CHANNEL_ADDR 0x84000008b8
#define SER_CONFIG_DATA 0x0000000010000000
#define SER_CONFIG_MASK 0xffffffffcfffffff
#define SER_CONFIG_ADDR 0x84000008d0
sllx %g5, 12, %g5 !! %g5 is 0x1000. MCU0/1/2/3's FBD_CHANNEL_STATE_REG is 0x1000 apart
! Now set the channel latency in the MCU to 0x14
setx MCU_CHANNEL_ADDR, %g1, %g2
setx MCU_CHANNEL_MASK, %g1, %g4
setx MCU_CHANNEL_DATA, %g1, %g4 !MCU_CHANNEL_DATA
add %g2, %g5, %g2 !%g2 has MCU1 address
setx MCU_CHANNEL_DATA, %g1, %g4 !MCU_CHANNEL_DATA
add %g2, %g5, %g2 !%g2 has MCU2 address
setx MCU_CHANNEL_DATA, %g1, %g4 !MCU_CHANNEL_DATA
add %g2, %g5, %g2 !%g2 has MCU3 address
setx MCU_CHANNEL_DATA, %g1, %g4 !MCU_CHANNEL_DATA
! Now set the MCU serdes Configuration Register to half rate.
setx SER_CONFIG_ADDR, %g1, %g2
setx SER_CONFIG_MASK, %g1, %g4
setx SER_CONFIG_DATA, %g1, %g4
setx SER_CONFIG_DATA, %g1, %g4
setx SER_CONFIG_DATA, %g1, %g4
setx SER_CONFIG_DATA, %g1, %g4
#include "boot_mcuctl_init_b4wmr.s"
! end of ifdef NO_SLAM_INIT_MCUCTL
! end of ifdef DTM_ENABLED
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bootprom_init_program_mbist:
#include "mbist_defines.h"
setx MBIST_MODE, %g2, %g4
stx %g3, [%g4] !!store to mbist_mode to configure mbist operation
setx MBIST_BYPASS_REG, %g2, %g3
setx MBIST_BYPASS, %g2, %g4
stx %g3, [%g4] !!Program mbist_bypass to select engines
setx MBIST_START_WMR, %g2, %g4
stx %g3, [%g4] !!Enable MBIST operation during warm reset
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!program core enable register
bootprom_init_program_core_enable:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!program bank enable register
bootprom_init_program_l2_bank_enable:
setx 0x8400001018, %g2, %g3
bootprom_init_program_l2_hash_enable:
setx L2_IDX_HASH_EN_ADDR, %g2, %g3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!Progam the SSI clock ratio io2clk/4
!!system defaults to io2clk/8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
bootprom_init_program_ssi_clk_4:
setx NCU_SCKSEL, %l2, %l1
bootprom_init_program_ssi_clk_8_2:
setx NCU_SCKSEL, %l2, %l1
bootprom_init_program_ssi_clk_8_3:
setx NCU_SCKSEL, %l2, %l1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!Down the FBD links b4 a warm reset is given
setx 0x8400000800, %g3, %g4 !! MCU0's FBD_CHANNEL_STATE_REG
sllx %g5, 12, %g5 !! %g5 is 0x1000. MCU0/1/2/3's FBD_CHANNEL_STATE_REG is 0x1000 apart
! AT 04/12/06: For DTM vector generation, JTAG asserts PB_RST to trigger
! WMR1 and WMR2. Hence, not trigger WMR here in boot code.
! In normal DTM runs, still want to issue the WMR.
stx %g3, [%g4] !!trigger a warm reset
#endif /* DTM_JTAG_POR */
#ifndef DTM_ENABLED /* Does not work for partial mode in DTM so removed for DTM */
setx 0x8400000280, %g2, %g3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!WRITE to ASI_VEC_MASK This will cause all threads started
!from now on to vector to 0000020
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#ifdef BOOT_SLAVE_THREADS_FROM_MEMORY
stxa %l0, [%l1]0x45 !set the vec mask to 1 this should cause
!fetches to 0x0000 for other threads
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!Set and release the ENFTP signal
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#define SERDES_CONFIG_ENFTP_MASK 0x80000
setx SER_CONFIG_ADDR, %g3, %g2
setx SERDES_CONFIG_ENFTP_MASK, %g5, %g6
sllx %g5, 12, %g5 !! %g5 is 0x1000. MCU0/1/2/3's FBD_CHANNEL_STATE_REG is 0x1000 apart
setx SER_CONFIG_ADDR, %g3, %g2
setx SERDES_CONFIG_ENFTP_MASK, %g5, %g6
sllx %g5, 12, %g5 !! %g5 is 0x1000. MCU0/1/2/3's FBD_CHANNEL_STATE_REG is 0x1000 apart
#endif /* TOGGLE_ENFTP */
!! AT 04/12/06: Add DTM setup to bypass IOMMU, also disable scrambling.
! Note these are not wmr_protected, need to do this after WMR2.
! Then trigger user event to train PCI-E link.
#ifdef SSI_VEC_DIAG_POST_WRM_PEU
#define PEU_IOMMU_CNTL_REG_ADDR 0x8800640000
#define PEU_IOMMU_DATA 0x0000000000000002
#define PEU_SYMBOL_TIMER_REG_ADDR 0x88006e2078
#define PEU_SYMBOL_TIMER_DATA 0x20
#define PEU_MAC_CTRL_REG_ADDR 0x88006e2060
#define PEU_MAC_CTRL_REG_SCRAMBLE_MASK 0xfffffffffffffffd
#define PEU_MAC_CTRL_REG_SCRAMBLE_DATA 0x0000000000000002
setx PEU_IOMMU_DATA, %g1, %g4
setx PEU_IOMMU_CNTL_REG_ADDR, %g1, %g2
! Disable scrambling so that peu_mio_debug_txdata is meaningful.
programm_peu_scrambling_reg_dtm:
setx PEU_MAC_CTRL_REG_ADDR, %g1, %g2
setx PEU_MAC_CTRL_REG_SCRAMBLE_MASK, %g1, %g4
setx PEU_MAC_CTRL_REG_SCRAMBLE_DATA, %g1, %g4
! Now we need to create a user event for the tester to send
! sufficent FTS order sets
! Also need the tester to send one SKP order set
! Following user event does both
#ifdef DTM_PCI_USER_EVENT
!!!!! x$EV trig_pc_d(1,expr(@VA(.RED_SEC.StartDtm)&0x0000ffffffffffff,16,16)) -> EnablePCIeIgCmd("STARTDTM", 0, 0, 0, 1)
! the above User Event does 25 FTSs and 1 SKP
#include "peu_init_dtm.h"
! end of ifdef SSI_VEC_DIAG_POST_WRM
! end of ifdef DTM_ENABLED
!!!!!!!#if defined(NO_SLAM_INIT_MCUCTL)
#include "hboot_mcuctl_init.s"
! Check bank enable status
setx 0x8000001028, %g3, %g2
mov BANK_SET_MASK_CSR, %l1
setx 0x8900000808, %g3, %g4
#ifdef SSI_VEC_DIAG_POST_WRM
#include SSI_VEC_DIAG_POST_WRM
!!!!!!!!!!!! Master Thread Inits END !!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!! END OF BOOTPROM INIT !!!!!!!!!!!!!!!!!!!!!!!!!!
ifelse(mpeval((HV_RED_TEXT_PA > 0xffffffff),2),1,
`setx nc_chip_master_thread, %g3, %g2',
`set nc_chip_master_thread, %g2')
wr %g0, ASI_CMP_CORE, %asi
ifelse(mpeval((HV_RED_TEXT_PA > 0xffffffff),2),1,
`setx chip_master_thread, %g3, %g2',
`set chip_master_thread, %g2')
wr %g0, ASI_CMP_CORE, %asi
! No Code beyond this point