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

📄 start.s

📁 u-boot-1.1.6 源码包
💻 S
📖 第 1 页 / 共 4 页
字号:
/* *  Copyright (C) 1998	Dan Malek <dmalek@jlc.net> *  Copyright (C) 1999	Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se> *  Copyright (C) 2000,2001,2002 Wolfgang Denk <wd@denx.de> * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA *//*------------------------------------------------------------------------------+ *//* *//*	 This source code has been made available to you by IBM on an AS-IS *//*	 basis.	 Anyone receiving this source is licensed under IBM *//*	 copyrights to use it in any way he or she deems fit, including *//*	 copying it, modifying it, compiling it, and redistributing it either *//*	 with or without modifications.	 No license under IBM patents or *//*	 patent applications is to be implied by the copyright license. *//* *//*	 Any user of this software should understand that IBM cannot provide *//*	 technical support for this software and will not be responsible for *//*	 any consequences resulting from the use of this software. *//* *//*	 Any person who transfers this source code or any derivative work *//*	 must include the IBM copyright notice, this paragraph, and the *//*	 preceding two paragraphs in the transferred software. *//* *//*	 COPYRIGHT   I B M   CORPORATION 1995 *//*	 LICENSED MATERIAL  -  PROGRAM PROPERTY OF I B M *//*------------------------------------------------------------------------------- *//*  U-Boot - Startup Code for AMCC 4xx PowerPC based Embedded Boards * * *  The processor starts at 0xfffffffc and the code is executed *  from flash/rom. *  in memory, but as long we don't jump around before relocating. *  board_init lies at a quite high address and when the cpu has *  jumped there, everything is ok. *  This works because the cpu gives the FLASH (CS0) the whole *  address space at startup, and board_init lies as a echo of *  the flash somewhere up there in the memorymap. * *  board_init will change CS0 to be positioned at the correct *  address and (s)dram will be positioned at address 0 */#include <config.h>#include <mpc8xx.h>#include <ppc4xx.h>#include <version.h>#define _LINUX_CONFIG_H 1	/* avoid reading Linux autoconf.h file	*/#include <ppc_asm.tmpl>#include <ppc_defs.h>#include <asm/cache.h>#include <asm/mmu.h>#ifndef	 CONFIG_IDENT_STRING#define	 CONFIG_IDENT_STRING ""#endif#ifdef CFG_INIT_DCACHE_CS# if (CFG_INIT_DCACHE_CS == 0)#  define PBxAP pb0ap#  define PBxCR pb0cr# endif# if (CFG_INIT_DCACHE_CS == 1)#  define PBxAP pb1ap#  define PBxCR pb1cr# endif# if (CFG_INIT_DCACHE_CS == 2)#  define PBxAP pb2ap#  define PBxCR pb2cr# endif# if (CFG_INIT_DCACHE_CS == 3)#  define PBxAP pb3ap#  define PBxCR pb3cr# endif# if (CFG_INIT_DCACHE_CS == 4)#  define PBxAP pb4ap#  define PBxCR pb4cr# endif# if (CFG_INIT_DCACHE_CS == 5)#  define PBxAP pb5ap#  define PBxCR pb5cr# endif# if (CFG_INIT_DCACHE_CS == 6)#  define PBxAP pb6ap#  define PBxCR pb6cr# endif# if (CFG_INIT_DCACHE_CS == 7)#  define PBxAP pb7ap#  define PBxCR pb7cr# endif#endif /* CFG_INIT_DCACHE_CS *//* We don't want the  MMU yet.*/#undef	MSR_KERNEL#define MSR_KERNEL ( MSR_ME  )	/* Machine Check */	.extern ext_bus_cntlr_init	.extern sdram_init#ifdef CONFIG_NAND_U_BOOT	.extern reconfig_tlb0#endif/* * Set up GOT: Global Offset Table * * Use r14 to access the GOT */#if !defined(CONFIG_NAND_SPL)	START_GOT	GOT_ENTRY(_GOT2_TABLE_)	GOT_ENTRY(_FIXUP_TABLE_)	GOT_ENTRY(_start)	GOT_ENTRY(_start_of_vectors)	GOT_ENTRY(_end_of_vectors)	GOT_ENTRY(transfer_to_handler)	GOT_ENTRY(__init_end)	GOT_ENTRY(_end)	GOT_ENTRY(__bss_start)	END_GOT#endif /* CONFIG_NAND_SPL */#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)	/*	 * NAND U-Boot image is started from offset 0	 */	.text	bl	reconfig_tlb0	GET_GOT	bl	cpu_init_f	/* run low-level CPU init code	   (from Flash) */	bl	board_init_f#endif/* * 440 Startup -- on reset only the top 4k of the effective * address space is mapped in by an entry in the instruction * and data shadow TLB. The .bootpg section is located in the * top 4k & does only what's necessary to map in the the rest * of the boot rom. Once the boot rom is mapped in we can * proceed with normal startup. * * NOTE: CS0 only covers the top 2MB of the effective address * space after reset. */#if defined(CONFIG_440)#if !defined(CONFIG_NAND_SPL)    .section .bootpg,"ax"#endif    .globl _start_440/**************************************************************************/_start_440:	/*--------------------------------------------------------------------+	| 440EPX BUP Change - Hardware team request	+--------------------------------------------------------------------*/#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)	sync	nop	nop#endif	/*----------------------------------------------------------------+	| Core bug fix.  Clear the esr	+-----------------------------------------------------------------*/	li	r0,0	mtspr	esr,r0	/*----------------------------------------------------------------*/	/* Clear and set up some registers. */	/*----------------------------------------------------------------*/	iccci	r0,r0		/* NOTE: operands not used for 440 */	dccci	r0,r0		/* NOTE: operands not used for 440 */	sync	li	r0,0	mtspr	srr0,r0	mtspr	srr1,r0	mtspr	csrr0,r0	mtspr	csrr1,r0	/* NOTE: 440GX adds machine check status regs */#if defined(CONFIG_440) && !defined(CONFIG_440GP)	mtspr	mcsrr0,r0	mtspr	mcsrr1,r0	mfspr	r1,mcsr	mtspr	mcsr,r1#endif	/*----------------------------------------------------------------*/	/* Initialize debug */	/*----------------------------------------------------------------*/	mfspr	r1,dbcr0	andis.	r1, r1, 0x8000	/* test DBCR0[EDM] bit			*/	bne	skip_debug_init	/* if set, don't clear debug register	*/	mtspr	dbcr0,r0	mtspr	dbcr1,r0	mtspr	dbcr2,r0	mtspr	iac1,r0	mtspr	iac2,r0	mtspr	iac3,r0	mtspr	dac1,r0	mtspr	dac2,r0	mtspr	dvc1,r0	mtspr	dvc2,r0	mfspr	r1,dbsr	mtspr	dbsr,r1		/* Clear all valid bits */skip_debug_init:	/*----------------------------------------------------------------*/	/* CCR0 init */	/*----------------------------------------------------------------*/	/* Disable store gathering & broadcast, guarantee inst/data	* cache block touch, force load/store alignment	* (see errata 1.12: 440_33)	*/	lis	r1,0x0030	/* store gathering & broadcast disable */	ori	r1,r1,0x6000	/* cache touch */	mtspr	ccr0,r1#if defined (CONFIG_440SPE)	/*----------------------------------------------------------------+	| Initialize Core Configuration Reg1.	| a. ICDPEI: Record even parity. Normal operation.	| b. ICTPEI: Record even parity. Normal operation.	| c. DCTPEI: Record even parity. Normal operation.	| d. DCDPEI: Record even parity. Normal operation.	| e. DCUPEI: Record even parity. Normal operation.	| f. DCMPEI: Record even parity. Normal operation.	| g. FCOM:   Normal operation	| h. MMUPEI: Record even parity. Normal operation.	| i. FFF:    Flush only as much data as necessary.	| j. TCS:    Timebase increments from CPU clock.	+-----------------------------------------------------------------*/	li	r0,0	mtspr	ccr1, r0	/*----------------------------------------------------------------+	| Reset the timebase.	| The previous write to CCR1 sets the timebase source.	+-----------------------------------------------------------------*/	mtspr	tbl, r0	mtspr	tbu, r0#endif	/*----------------------------------------------------------------*/	/* Setup interrupt vectors */	/*----------------------------------------------------------------*/	mtspr	ivpr,r0		/* Vectors start at 0x0000_0000 */	li	r1,0x0100	mtspr	ivor0,r1	/* Critical input */	li	r1,0x0200	mtspr	ivor1,r1	/* Machine check */	li	r1,0x0300	mtspr	ivor2,r1	/* Data storage */	li	r1,0x0400	mtspr	ivor3,r1	/* Instruction storage */	li	r1,0x0500	mtspr	ivor4,r1	/* External interrupt */	li	r1,0x0600	mtspr	ivor5,r1	/* Alignment */	li	r1,0x0700	mtspr	ivor6,r1	/* Program check */	li	r1,0x0800	mtspr	ivor7,r1	/* Floating point unavailable */	li	r1,0x0c00	mtspr	ivor8,r1	/* System call */	li	r1,0x1000	mtspr	ivor10,r1	/* Decrementer (PIT for 440) */	li	r1,0x1400	mtspr	ivor13,r1	/* Data TLB error */	li	r1,0x1300	mtspr	ivor14,r1	/* Instr TLB error */	li	r1,0x2000	mtspr	ivor15,r1	/* Debug */	/*----------------------------------------------------------------*/	/* Configure cache regions  */	/*----------------------------------------------------------------*/	mtspr	inv0,r0	mtspr	inv1,r0	mtspr	inv2,r0	mtspr	inv3,r0	mtspr	dnv0,r0	mtspr	dnv1,r0	mtspr	dnv2,r0	mtspr	dnv3,r0	mtspr	itv0,r0	mtspr	itv1,r0	mtspr	itv2,r0	mtspr	itv3,r0	mtspr	dtv0,r0	mtspr	dtv1,r0	mtspr	dtv2,r0	mtspr	dtv3,r0	/*----------------------------------------------------------------*/	/* Cache victim limits */	/*----------------------------------------------------------------*/	/* floors 0, ceiling max to use the entire cache -- nothing locked	*/	lis	r1,0x0001	ori	r1,r1,0xf800	mtspr	ivlim,r1	mtspr	dvlim,r1	/*----------------------------------------------------------------+	|Initialize MMUCR[STID] = 0.	+-----------------------------------------------------------------*/	mfspr	r0,mmucr	addis	r1,0,0xFFFF	ori	r1,r1,0xFF00	and	r0,r0,r1	mtspr	mmucr,r0	/*----------------------------------------------------------------*/	/* Clear all TLB entries -- TID = 0, TS = 0 */	/*----------------------------------------------------------------*/	addis	r0,0,0x0000	li	r1,0x003f	/* 64 TLB entries */	mtctr	r1rsttlb:	tlbwe	r0,r1,0x0000	/* Invalidate all entries (V=0)*/	tlbwe	r0,r1,0x0001	tlbwe	r0,r1,0x0002	subi	r1,r1,0x0001	bdnz	rsttlb	/*----------------------------------------------------------------*/	/* TLB entry setup -- step thru tlbtab */	/*----------------------------------------------------------------*/#if defined(CONFIG_440SPE)	/*----------------------------------------------------------------*/	/* We have different TLB tables for revA and rev B of 440SPe */	/*----------------------------------------------------------------*/	mfspr	r1, PVR	lis	r0,0x5342	ori	r0,r0,0x1891	cmpw	r7,r1,r0	bne	r7,..revA	bl	tlbtabB	b	..goon..revA:	bl	tlbtabA..goon:#else	bl	tlbtab		/* Get tlbtab pointer */#endif	mr	r5,r0	li	r1,0x003f	/* 64 TLB entries max */	mtctr	r1	li	r4,0		/* TLB # */	addi	r5,r5,-41:	lwzu	r0,4(r5)	cmpwi	r0,0	beq	2f		/* 0 marks end */	lwzu	r1,4(r5)	lwzu	r2,4(r5)	tlbwe	r0,r4,0		/* TLB Word 0 */	tlbwe	r1,r4,1		/* TLB Word 1 */	tlbwe	r2,r4,2		/* TLB Word 2 */	addi	r4,r4,1		/* Next TLB */	bdnz	1b	/*----------------------------------------------------------------*/	/* Continue from 'normal' start */	/*----------------------------------------------------------------*/2:#if defined(CONFIG_NAND_SPL)	/*	 * Enable internal SRAM	 */	lis	r2,0x7fff	ori	r2,r2,0xffff	mfdcr	r1,isram0_dpc	and	r1,r1,r2		/* Disable parity check */	mtdcr	isram0_dpc,r1	mfdcr	r1,isram0_pmeg	and	r1,r1,r2		/* Disable pwr mgmt */	mtdcr	isram0_pmeg,r1	/*	 * Copy SPL from cache into internal SRAM	 */	li	r4,(CFG_NAND_BOOT_SPL_SIZE >> 2) - 1	mtctr	r4	lis	r2,CFG_NAND_BOOT_SPL_SRC@h	ori	r2,r2,CFG_NAND_BOOT_SPL_SRC@l	lis	r3,CFG_NAND_BOOT_SPL_DST@h	ori	r3,r3,CFG_NAND_BOOT_SPL_DST@lspl_loop:	lwzu	r4,4(r2)	stwu	r4,4(r3)	bdnz	spl_loop	/*	 * Jump to code in RAM	 */	bl	00f00:	mflr	r10	lis	r3,(CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)@h	ori	r3,r3,(CFG_NAND_BOOT_SPL_SRC - CFG_NAND_BOOT_SPL_DST)@l	sub	r10,r10,r3	addi	r10,r10,28	mtlr	r10	blrstart_ram:	sync	isync#endif	bl	3f	b	_start3:	li	r0,0	mtspr	srr1,r0		/* Keep things disabled for now */	mflr	r1	mtspr	srr0,r1	rfi#endif /* CONFIG_440 *//* * r3 - 1st arg to board_init(): IMMP pointer * r4 - 2nd arg to board_init(): boot flag */#ifndef CONFIG_NAND_SPL	.text	.long	0x27051956		/* U-Boot Magic Number			*/	.globl	version_stringversion_string:	.ascii U_BOOT_VERSION	.ascii " (", __DATE__, " - ", __TIME__, ")"	.ascii CONFIG_IDENT_STRING, "\0"/* * Maybe this should be moved somewhere else because the current * location (0x100) is where the CriticalInput Execption should be. */	. = EXC_OFF_SYS_RESET#endif	.globl	_start_start:/*****************************************************************************/#if defined(CONFIG_440)

⌨️ 快捷键说明

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