/* romInit.s - MCP8270 ROM initialization module */
.data
.globl copyright_wind_river /* zonewone注释:全局使用 */
.long copyright_wind_river /* zonewone注释:.int 运行时给表达式赋值 */
/*zonewone注释: 系统初始化对不同的CPU,基本步骤是类似的。 系统初始化的主要步骤如下启动; 关闭中断; 放boot type到堆栈; 清空缓存
VxWorks 系统的 PowerPC BSP, 系统开机后执行的第一个函数 romInit(), 在ROM的起点*/
/*zonewone注释:
.data:包含用于该程序的预初始化数据 .text:包含实际代码(过去称为程序文本)
.opd:包含 “正式过程声明”,它用于辅助连接函数和指定程序的入口点(入口点就是要执行的代码中的第一条指令)*/
/*
DESCRIPTION
This 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 generic
romStart() routine.
The routine sysToMonitor() jumps to the location 4 bytes
past the beginning of romInit, to perform a "warm boot".
This entry point allows a parameter to be passed to romStart().
*/
/*zonewone注释:CPU一上电就开始执行romInit( )函数,因此在romInit.s代码段中它必须是第一个函数。 跳转到C程序romStart( )函数中。*/
#define _ASMLANGUAGE
#include "vxWorks.h"
#include "asm.h"
#include "cacheLib.h"
#include "config.h"
#include "hlct8270.h"
#include "regs.h"
#include "sysLib.h"
#include "config.h"
#include "drv/timer/m8260Clock.h"
#include "drv/mem/m8260Siu.h"
#include "drv/mem/m8260Memc.h"
/* internals */
FUNC_EXPORT(_romInit)
/*zonewone注释:start of system code .globl _romInit ; .type _romInit,@function 没搞明白@fun的含义*/
FUNC_EXPORT(romInit) /* start of system code */
/* externals */
FUNC_IMPORT(romStart) /* system initialization routine .extern romStart */
_WRS_TEXT_SEG_START
/*fill hard config word in image head*/
.fill 8,1,HRDW_BYTE1
.fill 8,1,HRDW_BYTE2
.fill 8,1,HRDW_BYTE3
.fill 8,1,HRDW_BYTE4
.fill 224,1,0
.align 2 /*zonewone注释:使用“位置计数器”做相应的对齐操作*/
/***************************************************************************
*
* romInit - entry point for VxWorks in ROM
*
* SYNOPSIS
* /ss
* romInit
* (
* int startType /@ only used by 2nd entry point @/
* )
* /se
*/
FUNC_BEGIN(_romInit) /*#define FUNC_LABEL(func) func:*/
FUNC_BEGIN(romInit)
/*romInit:
_romInit:
*/
bl cold /* jump to the cold boot initialization zonewone注释:冷启动*/
nop
bl start /* jump to the warm boot initialization zonewone注释:热启动*/
/*zonewone注释:b ADDRESS:跳转(或转移)到地址 ADDRESS 处的指令;
bl ADDRESS:对地址 ADDRESS 的子例程调用*/
/* copyright notice appears at beginning of ROM (in TEXT segment) */
.ascii "Copyright 1984-2001 Wind River Systems, Inc."
.align 2
cold:
li r3, BOOT_COLD /* set cold boot as start type (0x02) */
/*zonewone注释:li : 加载寄存器r3<-0x02; */
start:
/* disable external interrupts (by zeroing out msr) */
xor r5,r5,r5
/*zonewone注释:xor ra, rS, rb . ra/rb :Instruction syntax used to identify a source GPR .
GPR:general-purpose registers*/
isync
/*zonewone注释:
The isync instruction waits for all previous instructions to
complete and discards any prefetched instructions,
causing subsequent instructions to be refetched from
memory. 等待指令
*/
/*zonewone注释:SPR是特殊功能寄存器,DCR为设备控制寄存器,MSR机器状态寄存器*/
mtmsr r5 /*Move to Machine State Register*/
isync
/* invalidate and disable the MPU's data/instruction caches */
mfspr r6, HID0 /*zonewone注释:Move from Special-Purpose Register 1008*/
ori r5,r5,(_PPC_HID0_ICE | _PPC_HID0_DCE)
/*zonewone注释:ori rA,rS,UIMM Unsigned immediate value ; Instruction/Data Cache ennabe*/
andc r6,r6,r5 /* clear cache enable bits in r6 */
/*zonewone注释:AND with Complement andc ra, rs, rb. rs:respectively 分别 */
mr r5,r6 /*move register. mr Rx, Ry = or Rx,Ry,Ry*/
ori r5,r5,(_PPC_HID0_ICE | _