⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rominit.s

📁 WINDRIVER MCP750 BSP
💻 S
📖 第 1 页 / 共 3 页
字号:
/* romInit.s - Motorola MCP750/MCPN750 ROM initialization module *//* Copyright 1984-2001 Wind River Systems, Inc. *//* Copyright 1996,1997,1998,1999 Motorola, Inc. All Rights Reserved */	.data	.globl  copyright_wind_river	.long   copyright_wind_river/*modification history--------------------01l,01apr02,mil  Added RAM bank probe pattern for 16MB for bus capacitance                 (SPR #73257).01k,31oct01,mil  Use of macros for directives and function header updates.01j,08may01,pch  Add assembler abstractions (FUNC_EXPORT, FUNC_BEGIN, etc.)01i,21jan00,dat  fixed assembler warning01h,21dec98,mas  Added setting of SIED and BHTE bits in HID0 (SPR 22955)01g,30sep98,scb  Fix error which was not clearing HID0 ILOCK bit as intended.01f,21jul98,scb  #define name cleanup - removal of board name defines.01e,04jun98,tb   fix register contention during falcon initialization.01d,08may98,tb   Turned on Falcon's ECC01c,08may98,tb   fixed bug; r3 now contains correct DRAM size01b,13jan98,srr  SPR 20104, correct use of HI and HIADJ macros01a,09jan98,rhk  created (from version 01k, mv2600/romInit.s)*//*DESCRIPTIONThis module contains the entry code for the VxWorks bootrom.The entry point romInit, is the first code executed on power-up.It sets the BOOT_COLD parameter to be passed to the genericromStart() routine.The routine sysToMonitor() jumps to the location 4 bytespast the beginning of romInit, to perform a "warm boot".This entry point allows a parameter to be passed to romStart().This code is intended to be generic across PowerPC 603/604 boards.Hardware that requires special register setting or memorymapping to be done immediately, may do so here.*/#define	_ASMLANGUAGE#include "vxWorks.h"#include "sysLib.h"#include "asm.h"#include "config.h"#include "regs.h"		/* Exported internal functions */	FUNC_EXPORT(_romInit)		/* start of system code */	FUNC_EXPORT(romInit)		/* start of system code */	/* externals */	FUNC_IMPORT(sysGetBusSpd)	FUNC_IMPORT(sysGetDramSpd)#ifdef	INCLUDE_I2C	FUNC_IMPORT(getDIMMrefreshrate)#endif	/* INCLUDE_I2C */	FUNC_IMPORT(romStart)	/* system initialization routine */	_WRS_TEXT_SEG_START/***************************************************************************** romInit - entry point for VxWorks in ROM** SYNOPSIS* \ss* void romInit*     (*     int startType	/@ only used by 2nd entry point @/*     )* \se** INCLUDE FILES: none** RETURNS: This function does not return.** SEE ALSO:* Wind River,* .I "Tornado BSP Developer's Kit for VxWorks"**/FUNC_BEGIN(_romInit)FUNC_BEGIN(romInit)	bl	cold		bl	warm	/* copyright notice appears at beginning of ROM (in TEXT segment) */	.ascii   "Copyright 1984-1998 Wind River Systems, Inc."	.balign _PPC_TEXT_SEG_ALIGNcold:	li	r24, BOOT_COLD	bl	start		/* skip over next instruction */			warm:	or	r24, r3, r3	/* startType to r24 */start:	/* Zero-out registers: r0 & SPRGs */	xor     r0,r0,r0	mtspr   272,r0	mtspr   273,r0	mtspr   274,r0	mtspr   275,r0        /* initialize the stack pointer */        lis     sp, HI(STACK_ADRS)        ori     sp, sp, LO(STACK_ADRS)	/*	 *	Set MPU/MSR to a known state	 *	Turn on FP	 */	andi.	r3, r3, 0	ori	r3, r3, 0x2000	sync	mtmsr 	r3	isync	/* Init the floating point control/status register */	mtfsfi  7,0x0	mtfsfi  6,0x0	mtfsfi  5,0x0	mtfsfi  4,0x0	mtfsfi  3,0x0	mtfsfi  2,0x0	mtfsfi  1,0x0	mtfsfi  0,0x0	isync	/* Initialize the floating point data regsiters to a known state */	bl	ifpdr_value	.long	0x3f800000	/* 1.0 */ifpdr_value:	mfspr	r3,8	lfs	f0,0(r3)	lfs	f1,0(r3)	lfs	f2,0(r3)	lfs	f3,0(r3)	lfs	f4,0(r3)	lfs	f5,0(r3)	lfs	f6,0(r3)	lfs	f7,0(r3)	lfs	f8,0(r3)	lfs	f9,0(r3)	lfs	f10,0(r3)	lfs	f11,0(r3)	lfs	f12,0(r3)	lfs	f13,0(r3)	lfs	f14,0(r3)	lfs	f15,0(r3)	lfs	f16,0(r3)	lfs	f17,0(r3)	lfs	f18,0(r3)	lfs	f19,0(r3)	lfs	f20,0(r3)	lfs	f21,0(r3)	lfs	f22,0(r3)	lfs	f23,0(r3)	lfs	f24,0(r3)	lfs	f25,0(r3)	lfs	f26,0(r3)	lfs	f27,0(r3)	lfs	f28,0(r3)	lfs	f29,0(r3)	lfs	f30,0(r3)	lfs	f31,0(r3)	sync	/*	 *	Set MPU/MSR to a known state	 *	Turn off FP	 */	andi.	r3, r3, 0	sync	mtmsr 	r3	isync	/* Init the Segment registers */	andi.	r3, r3, 0	isync	mtsr    0,r3	isync	mtsr    1,r3	isync	mtsr    2,r3	isync	mtsr    3,r3	isync	mtsr    4,r3	isync	mtsr    5,r3	isync	mtsr    6,r3	isync	mtsr    7,r3	isync	mtsr    8,r3	isync	mtsr    9,r3	isync	mtsr    10,r3	isync	mtsr    11,r3	isync	mtsr    12,r3	isync	mtsr    13,r3	isync	mtsr    14,r3	isync	mtsr    15,r3	isync	/* Turn off the GLANCE - L2 Cache */	lis	r3, HI(SYS_REG_SXCCR_A)	ori	r3, r3, LO(SYS_REG_SXCCR_A)	addis	r4, r0, 0x0	ori	r4, r4, 0x0070	stb	r4, 0x0(r3)	/* Turn off data and instruction cache control bits */		mfspr   r3, HID0	isync	rlwinm	r4, r3, 0, 18, 15	/* r4 has ICE and DCE bits cleared */	sync	isync	mtspr	HID0, r4		/* HID0 = r4 */	isync	/* Get cpu type */	mfspr   r28, PVR	rlwinm  r28, r28, 16, 16, 31	/* invalidate the MPU's data/instruction caches */	lis	r3, 0x0	cmpli   0, 0, r28, CPU_TYPE_750	beq     CPU_IS_750	cmpli	0, 0, r28, CPU_TYPE_603	beq	CPU_IS_603	cmpli	0, 0, r28, CPU_TYPE_603E	beq	CPU_IS_603        cmpli   0, 0, r28, CPU_TYPE_603P        beq     CPU_IS_603        cmpli   0, 0, r28, CPU_TYPE_604R        bne     CPU_NOT_604RCPU_IS_604R:        lis     r3, 0x0        mtspr   HID0, r3        /* disable the caches */        isync        ori     r4, r4, 0x0002  /* disable BTAC by setting bit 30 */CPU_NOT_604R:	ori	r3, r3, 0x0C00		/* r3 has invalidate bits set */CPU_IS_603:	ori	r3, r3, 0xC000		/* r3 has enable and bits set */	or	r4, r4, r3		/* set bits */	sync	isync	mtspr   HID0, r4		/* HID0 = r4 */	andc	r4, r4, r3		/* clear bits */	isync	cmpli   0, 0, r28, CPU_TYPE_604	beq	CPU_IS_604	cmpli   0, 0, r28, CPU_TYPE_604E	beq	CPU_IS_604        cmpli   0, 0, r28, CPU_TYPE_604R        beq     CPU_IS_604        cmpli   0, 0, r28, CPU_TYPE_750        beq     CPU_IS_604	mtspr	HID0, r4	isync#ifdef USER_I_CACHE_ENABLE 	b	I_CACHE_ON_603#else	b	CACHE_ENABLE_DONE#endifCPU_IS_750:#ifdef USER_I_CACHE_ENABLE        mfspr   r3,HID0        sync        addi    r4,r0,0x0800        or      r3,r4,r3        mtspr   HID0,r3         /* set ICFI (bit 16) */        sync        andc    r3,r3,r4        mtspr   HID0,r3         /* clear ICFI (bit 16) */        sync	addi    r4,r0,0xFFFFDFFF    /* Clear ILOCK (bit 18)  */        and     r3,r3,r4         mtspr   HID0,r3        sync        ori     r3,r3,0x8000    /* Set ICE (bit 16) */	mtspr   HID0,r3        sync#endif        b       CACHE_ENABLE_DONECPU_IS_604:	lis	r5, 0x0	ori	r5, r5, 0x1000	mtspr	CTR, r5LOOP_DELAY:	nop	bdnz	LOOP_DELAY	isync	mtspr 	HID0, r4	isync	/* turn the Instruction cache ON for faster FLASH ROM boots */#ifdef USER_I_CACHE_ENABLE         ori     r4, r4, 0x8800		/* set ICE & ICFI bit */        isync                           /* Synchronize for ICE enable */	b	WRITE_R4I_CACHE_ON_603:	ori	r4, r4, 0x8800		/* set ICE & ICFI bit */        rlwinm  r3, r4, 0, 21, 19	/* clear the ICFI bit */        /*         * The setting of the instruction cache enable (ICE) bit must be         * preceded by an isync instruction to prevent the cache from being         * enabled or disabled while an instruction access is in progress.         */	isyncWRITE_R4:        mtspr   HID0, r4                /* Enable Instr Cache & Inval cache */	cmpli   0, 0, r28, CPU_TYPE_604	beq    	CACHE_ENABLE_DONE 	cmpli   0, 0, r28, CPU_TYPE_604E	beq    	CACHE_ENABLE_DONE 	cmpli   0, 0, r28, CPU_TYPE_604R	beq    	CACHE_ENABLE_DONE 	cmpli   0, 0, r28, CPU_TYPE_750	beq    	CACHE_ENABLE_DONE         mtspr   HID0, r3                /* using 2 consec instructions */                                        /* PPC603 recommendation */#endifCACHE_ENABLE_DONE:        /* Enhance execution based on cpu type */        cmpli   0, 0, r28, CPU_TYPE_603        beq     raven3        cmpli   0, 0, r28, CPU_TYPE_603E        beq     raven3        cmpli   0, 0, r28, CPU_TYPE_603P        beq     raven3        /* enable branch history table for the 604 and 750 */        mfspr   r3, HID0        ori     r3, r3, _PPC_HID0_BHTE        cmpli   0, 0, r28, CPU_TYPE_750        beq     enhanceAll        /*         * CPU is not 750 or 603x so it must be a 604x.         * Disable sequential instruction execution (go superscalar) and         * enable branch history table for the 604.         */        ori     r3, r3, _PPC_HID0_SIEDenhanceAll:        mtspr   HID0, r3/*  * Disable Raven3's Watchdog Timers. * * Note: Both of Raven3's Watchdog timers must be disabled at powerup. * Otherwise Watchdog Timer 1 will time out in 512 msec and interrupt the  * board, Watchdog Timer 2 will time out in 576 msec and reset the board. */raven3:	lis	r3,HI(RAVEN_BASE_ADRS)	ori	r3, r3, LO(RAVEN_BASE_ADRS)	isync					/* synchronize */	lbz	r4,RAVEN_MPC_REVID(r3)		/* read REVID register */	eieio					/* synchronize */	sync					/* synchronize */	cmpli	0,0,r4,0x3			/* Raven version 3 or above? */	bc	12,0,nodiswdog			/* skip if Raven2 or lower */	addis  	r4,r0,0x0000     		/* disable Watchdog Timers */	ori	r4,r4,0x0055			/* load PATTERN_1 */	isync					/* synchronize */	stb	r4, RAVEN_MPC_WDT1CNTL(r3)	/* arm Watchdog Timer 1 */	eieio					/* synchronize */	sync					/* synchronize */	addis	r4,r0,0x0000			/* load PATTERN_2 */	ori	r4,r4,0xaa0f			/* max resolution */	isync					/* synchronize */	sth	r4, RAVEN_MPC_WDT1CNTL(r3)	/* disable Timer 1 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -