#ifndef __ASSEMBLER__ #define __ASSEMBLER__ #endif #include "bmips.h" #include "bchp_common.h" #include "bchp_bsp_glb_control.h" #include "bchp_bsp_cmdbuf.h" #include "bchp_sun_top_ctrl.h" /* * The following define needs to be manually turned on/off * depending on what chip the CFE is being built for. * * NON-ZEUS_2_0: * 7231A0/7344A0/7346A0/7420A0/7425A0/7552A0 FullROM * * ZEUS_2_0: * 7231A0/7344A0/7346A0/7420A0/7425A0/7552A0 BSECK * 7231B0/7344B0/7346B0/7420B0/7425B0/7552B0 FullROM */ #define ZEUS_2_0 #if defined(ZEUS_2_0) #define CMD_INBUFFER2 (2 * 384) /* 0x300 */ #else #define CMD_INBUFFER2 (1 * 384) /* 0x180 */ #endif /* ZEUS_2_0 */ #define CMD_OUTBUFFER2 (3 * 384) /* 0x480 */ /**************************************************************** Function Name: read_otp_bit Description: Reads an OTP bit. Parameters: unsigned long bit_num - OTP bit number to read. Returns: unsigned long - status of OTP bit. ****************************************************************/ LEAF(read_otp_bit) move t8, ra bal do_bsp_cmd_prologue nop /* command ID to read MSP bit */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_INBUFFER2) li t1, 0xe455aa1b sw t1, 0xc(t0) /* command length in bytes.*/ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_INBUFFER2) li t1, 0x789a0004 sw t1, 0x10(t0) /* read msp field */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_INBUFFER2) sw a0, 0x14(t0) bal do_bsp_cmd_epilogue nop /* check status */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_OUTBUFFER2) lw v0, 0x14(t0) /* read data */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_OUTBUFFER2) lw v1, 0x18(t0) /* v0=0=> status pass, else status fail * v1=1=> boot check enabled else boot check disabled */ jr t8 nop END(read_otp_bit) /**************************************************************** Function Name: do_bsp_cmd_prologue Description: Set up first 3 words of BSP command Parameters: None Returns: N/A ****************************************************************/ .globl do_bsp_cmd_prologue .ent do_bsp_cmd_prologue do_bsp_cmd_prologue: move s5, ra bal check_for_IRDY2 nop /* version */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_CMDBUF_DMEMi_ARRAY_BASE+CMD_INBUFFER2) li t1, 0x10 sw t1, 0(t0) /* seq */ li t1, 0x22 sw t1, 4(t0) /* cont */ li t1, 0xABCDEF00 sw t1, 8(t0) jr s5 nop .end do_bsp_cmd_prologue /**************************************************************** Function Name: do_bsp_cmd_epilogue Description: Get response from BSP command Parameters: None Returns: N/A ****************************************************************/ .globl do_bsp_cmd_epilogue .ent do_bsp_cmd_epilogue do_bsp_cmd_epilogue: move s5, ra /* set BSP_GLB_NONSECURE_GLB_ILOAD2 * (volatile unsigned long*) (VIRTUAL_ADDRESS+BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_ILOAD2) = 0x01; */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_ILOAD2) li t1, 0x1 sw t1, 0(t0) /* check BSP_GLB_NONSECURE_GLB_OLOAD2 while ( ( *(volatile unsigned long*) (VIRTUAL_ADDRESS+BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_OLOAD2) & 0x01 ) != 0x01); */ bal check_for_OLOAD2 nop /* BSP_GLB_NONSECURE_GLB_HOST_INTR_STATUS = 0 *(volatile unsigned long*) (VIRTUAL_ADDRESS+BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_HOST_INTR_STATUS) = 0x00; */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_HOST_INTR_STATUS) sw zero, 0(t0) /* BSP_GLB_NONSECURE_GLB_OLOAD2 = 0 *(volatile unsigned long*) (VIRTUAL_ADDRESS+BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_OLOAD2) = 0x00; */ li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_OLOAD2) sw zero, 0(t0) jr s5 nop .end do_bsp_cmd_epilogue /**************************************************************** Function Name: check_for_IRDY2 Description: check if IRDY2 bit is set. Parameters: None Returns: None ****************************************************************/ LEAF(check_for_IRDY2) .set noreorder wait_for_IRDY2: li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_IRDY) lw t1, 0(t0) andi t1, t1, 0x02 beq t1, zero, wait_for_IRDY2 nop .set reorder jr ra nop END(check_for_IRDY2) /**************************************************************** Function Name: check_for_OLOAD2 Description: check if OLOAD2 bit is set. Parameters: None Returns: None ****************************************************************/ LEAF(check_for_OLOAD2) .set noreorder wait_for_OLOAD2: li t0, PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_BSP_GLB_CONTROL_GLB_OLOAD2) lw t1, 0(t0) andi t1, t1, 0x01 beq t1, zero, wait_for_OLOAD2 nop .set reorder jr ra nop END(check_for_OLOAD2)