📄 rominit.s
字号:
/* romInit.s - Motorola ads8260 ROM initialization module *//* Copyright 1984-2002 Wind River Systems, Inc. */ .data .globl copyright_wind_river .long copyright_wind_river/*modification history--------------------01i,10dec01,jrs change copyright date01h,17oct01,jrs Upgrade to veloce set MPTPR[PTP] to PTP and PSRT to PSRT_VALUE setting refresh correctly for the oscillator frequ - SPR #6698901g,08may01,pch Add assembler abstractions (FUNC_EXPORT, FUNC_BEGIN, etc.)01f,14mar00,ms_ add support for PILOT revision of board01e,04mar00,ml changes for board rev "PILOT" (SIUMCR.DPPC/L2CPC & PSDMR.BSMA)01d,16sep99,ms_ get some .h files from h/drv instead of locally01c,15jul99,ms_ make compliant with our coding standards01b,20may99,cn fixed include m8260Cpm.h01a,19may99,cn written from ads860/romInit.s, 01m.*//*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 8 bytespast the beginning of romInit, to perform a "warm boot".This entry point allows a parameter to be passed to romStart().*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "cacheLib.h"#include "config.h"#include "regs.h" #include "sysLib.h"#include "drv/timer/m8260Clock.h"#include "drv/mem/m8260Siu.h"#include "drv/mem/m8260Memc.h" /* internals */ FUNC_EXPORT(_romInit) /* start of system code */ FUNC_EXPORT(romInit) /* start of system code */ /* externals */ .extern romStart /* system initialization routine */ .text .fill 1,1,HRCW_BYTE_0 /* byte 0 (MSByte) of the configuration master's */ /* Hard Reset Configuration Word */ .fill 7,1,0 /* Fill with 7 zeros */ .fill 1,1,HRCW_BYTE_1 .fill 7,1,0 .fill 1,1,HRCW_BYTE_2 .fill 7,1,0 .fill 1,1,HRCW_BYTE_3 /* This is the LSByte */ .fill 231,1,0 /* The rest of the space are filled with zeros */ .align 2/******************************************************************************** romInit - entry point for VxWorks in ROM*** romInit* (* int startType /@ only used by 2nd entry point @/* )*/_romInit:romInit: bl cold /* jump to the cold boot initialization */ nop bl start /* jump to the warm boot initialization */ /* copyright notice appears at beginning of ROM (in TEXT segment) */ .ascii "Copyright 1984-2002 Wind River Systems, Inc." .align 2cold: li r3, BOOT_COLD /* set cold boot as start type */ addis r4,0,0x0F01 /* R4 holds the IMMR base address */ addis r5,0,0x0000 /* Clear out all mask bits */ ori r5,r5,0x0836 stw r5,0x0104(r4) /* option register for bank 0 */ isync /* synchronize */ /* * initialize the IMMR register before any non-core registers * modification. The default IMMR base address was 0x0F000000, * as originally programmed in the Hard Reset Configuration Word. */ lis r4, HIADJ (INTERNAL_MEM_MAP_ADDR) addi r4, r4, LO (INTERNAL_MEM_MAP_ADDR) addis r8,0,0x0F01 /* IMMR was at 0x0f000000 */ stw r4,0x01a8 (r8) /* IMMR now at 0x04700000 */ isync /* * When the PowerPC 8260 is powered on, the processor fetches the * instructions located at the address 0x100. We need to jump * from the address 0x100 to the Flash space. */ lis r4, HIADJ(start) /* load r4 with the address */ addi r4, r4, LO(start) /* of start */ lis r5, HIADJ(romInit) /* load r5 with the address */ addi r5, r5, LO(romInit) /* of romInit() */ lis r6, HIADJ(ROM_TEXT_ADRS) /* load r6 with the address */ addi r6, r6, LO(ROM_TEXT_ADRS) /* of ROM_TEXT_ADRS */ sub r4, r4, r5 /* */ add r4, r4, r6 mtspr LR, r4 /* save destination address*/ /* into LR register */ blr /* jump to flash mem address */start: /* set the MSR register to a known state */ xor r0, r0, r0 /* clear register R0 */ isync /* synchronize */ mtmsr r0 /* clear the MSR register */ isync /* synchronize */ /* program the SCCR: normal operation */ lis r5, HIADJ (M8260_SCCR_DFBRG_16) addi r5, r5, LO (M8260_SCCR_DFBRG_16) lis r6, HIADJ (M8260_SCCR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_SCCR (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* SYPCR - turn off the system protection stuff */ addi r5, r5, LO (M8260_SYPCR_SWTC | M8260_SYPCR_BMT \ | M8260_SYPCR_PBME | M8260_SYPCR_LBME) lis r6, HIADJ (M8260_SYPCR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_SYPCR (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* program the BCR */ addis r5,0,0x100c lis r6, HIADJ (M8260_BCR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_BCR (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* program the PPC_ACR */ addi r5,0,0x0002 lis r6, HIADJ (M8260_PPC_ACR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_PPC_ACR (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* program the PPC_ALRH */ addis r5,0,0x0126 ori r5,r5,0x7893 lis r6, HIADJ (M8260_PPC_ALRH (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_PPC_ALRH (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* program the SIUMCR -- ADS Pilot has DPPC set to 11 */#ifdef BOARD_REV_PILOT addis r5,0,0x0A20#else addis r5,0,0x0820#endif ori r5,r5,0x0000 lis r6, HIADJ (M8260_SIUMCR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_SIUMCR (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* program the TESCR1 */ addis r5,0,0x0000 ori r5,r5,0x4000 lis r6, HIADJ (M8260_TESCR1 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_TESCR1 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* program the LTESCR1 */ addis r5,0,0x0000 ori r5,r5,0x4000 lis r6, HIADJ (M8260_LTESCR1 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_LTESCR1 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* * Map the bank 0 to the flash area - On the ADS board at reset time * the bank 0 is already used to map the flash. */ /* load the base register */ lis r5, HIADJ ((ROM_BASE_ADRS & M8260_BR_BA_MSK) | \ M8260_BR_PS_32 | M8260_BR_V) addi r5, r5, LO ((ROM_BASE_ADRS & M8260_BR_BA_MSK) | \ M8260_BR_PS_32 | M8260_BR_V) lis r6, HIADJ (M8260_BR0 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_BR0 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* load the option register */ lis r5, HIADJ ((0xff800000 & M8260_OR_AM_MSK) | M8260_OR_EHTR_8 \ | M8260_OR_CSNT_EARLY | M8260_OR_SCY_3_CLK) addi r5, r5, LO ((0xff800000 & M8260_OR_AM_MSK) | M8260_OR_EHTR_8 \ | M8260_OR_CSNT_EARLY | M8260_OR_SCY_3_CLK) lis r6, HIADJ (M8260_OR0 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_OR0 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* map the bank 1 to the BCSRs */ lis r5, HIADJ ((0xffff8000 & M8260_OR_AM_MSK) \ | M8260_OR_SCY_1_CLK) addi r5, r5, LO ((0xffff8000 & M8260_OR_AM_MSK) \ | M8260_OR_SCY_1_CLK) lis r6, HIADJ (M8260_OR1 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_OR1 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) /* write the proper value to the base register */ lis r5, HIADJ (BCSR0 | M8260_BR_PS_32 | M8260_BR_V) addi r5, r5, LO (BCSR0 | M8260_BR_PS_32 | M8260_BR_V) lis r6, HIADJ (M8260_BR1 (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_BR1 (INTERNAL_MEM_MAP_ADDR)) stw r5, 0 (r6) SdramInit: /* program the MPTPR */ addi r5,0,PTP /* MPTPR[PTP] */ lis r6, HIADJ (M8260_MPTPR (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_MPTPR (INTERNAL_MEM_MAP_ADDR)) sth r5, 0x0 (r6) /* store upper half-word */ /* program the PSRT */ addi r5,0,PSRT_VALUE lis r6, HIADJ (M8260_PSRT (INTERNAL_MEM_MAP_ADDR)) addi r6, r6, LO (M8260_PSRT (INTERNAL_MEM_MAP_ADDR)) stb r5, 0x0 (r6) /* store byte - bits[24-31] */ /* load OR2 */ lis r5, HIADJ ((0xff000000 & M8260_OR_AM_MSK) | \ M8260_OR_SDRAM_ROWST_9 \ | M8260_OR_SDRAM_NUMR_11 | M8260_OR_SDRAM_PM_NORM)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -