* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: PCIePIOUc.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 ENABLE_PCIE_LINK_TRAINING
#define MAIN_PAGE_HV_ALSO
#define H_HT0_Data_access_error_0x32
#define SUN_H_HT0_Data_access_error_0x32 \
#define CFG0_RD_ADDR N2_PCIE_BASE_ADDR
#define CFG1_RD_ADDR mpeval(CFG0_RD_ADDR + CFG1_ACCESS_PA)
/************************************************************************
************************************************************************/
mov 0, %l4 ! zero the interrupt count
/******************************************************************************
Set the Completion Timeout Select (CTO_SEL) to its minimum (2^10 symbol times)
******************************************************************************/
setx FIRE_PLC_TLU_CTB_TLR_CSR_A_TLU_CTL_ADDR, %g2, %g3
set 0x00070000, %g4 ! set bits[18: 16] to 3'b111
! select a CFG1 address in PCI address range
setx CFG1_RD_ADDR, %g1, %g2
! Load a couple of words to show that PIOs are working
setx FIRE_PLC_TLU_CTB_TLR_CSR_A_OE_ERR_RW1C_ALIAS_ADDR, %g1, %g3
stx %g4, [%g3] ! clear it
setx FIRE_PLC_TLU_CTB_TLR_CSR_A_UE_ERR_RW1C_ALIAS_ADDR, %g1, %g5
stx %g4, [%g5] ! clear it
/******************************************************************************
On the next PIO, get an "unsupported request" completion
******************************************************************************/
! $EV trig_pc_d(1, @VA(.MAIN.PIO_Uc)) -> EnablePCIeIgCmd ("PIO_UC",0,0,0,1)
PIO_Uc: nop; nop; nop; nop; nop; nop; nop; nop;
lduw [%g2 + 2*8], %o4 ! this one should get Ur status
lduw [%g2 + 3*8], %o5 ! this one should be good
lduw [%g2 + 4*8], %o6 ! this one should be good
ldx [%g3], %g4 ! status => should get the RUC Primary Event bit set
setx 0x0000000000010000, %g1, %l1
stx %g4, [%g3] ! clear the OE status reg
ldx [%g3 + 0x10], %l0 ! OE Receive Hdr1
ldx [%g3 + 0x18], %l1 ! OE Receive Hdr2
ldx [%g5], %g6 ! UE status => should be zero
stx %g6, [%g5] ! clear the UE status reg
ldx [%g5 + 0x10], %l0 ! UE Receive Hdr1
ldx [%g5 + 0x18], %l1 ! UE Receive Hdr2
! test whether enough exceptions were taken
SECTION .DATA2 DATA_VA=CFG1_RD_ADDR
/************************************************************************/