📄 rominit.s
字号:
/* romInit.s - Motorola MVME2600 ROM initialization module *//* Copyright 1984-2000 Wind River Systems, Inc. *//* Copyright 1996,1997,1998 Motorola, Inc. All Rights Reserved */ .data .globl copyright_wind_river .long copyright_wind_river/*modification history--------------------01q,08may01,pch Add assembler abstractions (FUNC_EXPORT, FUNC_BEGIN, etc.)01p,21jan00,dat fixed assembler warning01o,11oct99,dmw Added the ability to come up if VME_A32_MSTR_LOCAL is less than the total DRAM size.01n,16feb99,mas Added setting of SIED and BHTE bits in HID0 (SPR 24453); added Raven3 compatibility.01m,30sep98,tm Fixed ILOCK bit clear in MPC750 iCache enable (SPR 22121)01l,14apr98,ms_ merged Motorola mv2700 support01k,06apr98,scb Modify to never alter r0, once it is initially set to zero.01j,02apr98,tb Turned on Falcon's ECC01i,22jan98,rhk SPR 20104, correct use of HI and HIADJ macros.01h,16jul97,scb added support for MPC750 (Arthur).01g,14oct97,srr added floating point data register initialization.01f,25jul97,srr/ added 604r (Mach 5) support (SPR 8911). mas01e,29may97,srr Chg RAVEN #defines to support vxMemProbe and replace hardcoded values where appropriate. (MCG MR#67,69) SPRs 8289, 8560.01d,06may97,mas added extended VME support (SPR 8410).01c,24apr97,mas added Motorola MPIC support (SPR 8170).01b,02jan97,dat mod history fix01a,01sep96,mot written. (from mv1603/romInit.s, ver 01l)*//*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 */ .extern romStart /* system initialization routine */ .text .align 2 /******************************************************************************** romInit - entry point for VxWorks in ROM** romInit* (* int startType /@ only used by 2nd entry point @/* )*/_romInit:romInit: bl cold bl warm /* copyright notice appears at beginning of ROM (in TEXT segment) */ .ascii "Copyright 1984-1999 Wind River Systems, Inc." .align 2cold: li r11, BOOT_COLD bl start /* skip over next instruction */ warm: or r11, r3, r3 /* startType to r11 */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 HID0 to a known state * Enable machine check input pin (EMCP) for DRAM ECC detection */ addis r3,r0,0x8000 ori r3,r3,0x0000 mtspr HID0, r3 /* * 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#ifndef MV2300 /* Turn off the GLANCE - L2 Cache */ lis r3, HI(MV2600_SXCCR_A) ori r3, r3, LO(MV2600_SXCCR_A) addis r4, r0, 0x0 ori r4, r4, 0x0070 stb r4, 0x0(r3)#endif /* MV2300 */ /* 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, r3raven3:/* * This following contains the entry code for the initialization code * for the Raven, a Host PCI Bridge/Memory Controller used in * Motorola's PowerPC based boards. *//* * 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. */ 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 */ eieio /* synchronize */ sync /* synchronize */ addis r4,r0,0x0000 /* load PATTERN_1 */ ori r4,r4,0x0055 isync /* synchronize */ stb r4,RAVEN_MPC_WDT2CNTL(r3) /* arm Watchdog Timer 2 */ eieio /* synchronize */ sync /* synchronize */ addis r4,r0,0x0000 /* load PATTERN_2 */ ori r4,r4,0xaa0f /* max resolution */ isync /* synchronize */ sth r4,RAVEN_MPC_WDT2CNTL(r3) /* disable Timer2 */ eieio /* synchronize */ sync /* synchronize */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -