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

📄 start.s.svn-base

📁 u-boot for S3c2443 processor
💻 SVN-BASE
📖 第 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 IBM 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/* * Set up GOT: Global Offset Table * * Use r14 to access the GOT */	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/* * 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)    .section .bootpg,"ax"    .globl _start_440/**************************************************************************/_start_440:	/*----------------------------------------------------------------*/	/* 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#if defined (CONFIG_440_GX) /* NOTE: 440GX adds machine check status regs */	mtspr   mcsrr0,r0	mtspr   mcsrr1,r0	mfspr   r1, mcsr	mtspr   mcsr,r1#endif	/*----------------------------------------------------------------*/	/* Initialize debug */	/*----------------------------------------------------------------*/	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 */	/*----------------------------------------------------------------*/	/* 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	/*----------------------------------------------------------------*/	/* 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	/*----------------------------------------------------------------*/	/* Clear all TLB entries -- TID = 0, TS = 0 */	/*----------------------------------------------------------------*/	mtspr	mmucr,r0	li	r1,0x003f	/* 64 TLB entries */	mtctr	r10:	tlbwe	r0,r1,0x0000	/* Invalidate all entries (V=0)*/	subi	r1,r1,0x0001	bdnz	0b	/*----------------------------------------------------------------*/	/* TLB entry setup -- step thru tlbtab */	/*----------------------------------------------------------------*/	bl	tlbtab		/* Get tlbtab pointer */	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:	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 */	.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	.globl	_start_start:/*****************************************************************************/#if defined(CONFIG_440)	/*----------------------------------------------------------------*/	/* Clear and set up some registers. */	/*----------------------------------------------------------------*/	li	r0,0x0000	lis	r1,0xffff	mtspr	dec,r0			/* prevent dec exceptions */	mtspr	tbl,r0			/* prevent fit & wdt exceptions */	mtspr	tbu,r0	mtspr	tsr,r1			/* clear all timer exception status */	mtspr	tcr,r0			/* disable all */	mtspr	esr,r0			/* clear exception syndrome register */	mtxer	r0			/* clear integer exception register */#if !defined(CONFIG_440_GX)	lis	r1,0x0002		/* set CE bit (Critical Exceptions) */	ori	r1,r1,0x1000		/* set ME bit (Machine Exceptions) */	mtmsr	r1			/* change MSR */#else	bl	__440gx_msr_set	b	__440gx_msr_continue__440gx_msr_set:	lis 	r1, 0x0002		/* set CE bit (Critical Exceptions) */	ori 	r1,r1,0x1000	/* set ME bit (Machine Exceptions) */	mtspr	srr1,r1	mflr	r1	mtspr	srr0,r1	rfi__440gx_msr_continue:#endif	/*----------------------------------------------------------------*/	/* Debug setup -- some (not very good) ice's need an event*/	/* to establish control :-( Define CFG_INIT_DBCR to the dbsr */	/* value you need in this case 0x8cff 0000 should do the trick */	/*----------------------------------------------------------------*/#if defined(CFG_INIT_DBCR)	lis	r1,0xffff	ori	r1,r1,0xffff	mtspr	dbsr,r1			/* Clear all status bits */	lis	r0,CFG_INIT_DBCR@h	ori	r0,r0,CFG_INIT_DBCR@l	mtspr	dbcr0,r0	isync#endif	/*----------------------------------------------------------------*/	/* Setup the internal SRAM */	/*----------------------------------------------------------------*/	li	r0,0#if defined (CONFIG_440_GX)	mtdcr   l2_cache_cfg,r0		/* Ensure L2 Cache is off */#endif	mtdcr	isram0_sb1cr,r0		/* Disable bank 1 */	li	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	andis.	r1,r1,r2		/* Disable pwr mgmt */	mtdcr	isram0_pmeg,r1	lis	r1,0x8000		/* BAS = 8000_0000 */#if defined(CONFIG_440_GX)	ori	r1,r1,0x0980		/* first 64k */	mtdcr   isram0_sb0cr,r1	lis	r1,0x8001	ori	r1,r1,0x0980		/* second 64k */	mtdcr   isram0_sb1cr,r1	lis	r1, 0x8002	ori	r1,r1, 0x0980		/* third 64k */	mtdcr   isram0_sb2cr,r1	lis	r1, 0x8003	ori	r1,r1, 0x0980		/* fourth 64k */	mtdcr   isram0_sb3cr,r1#else	ori	r1,r1,0x0380		/* 8k rw */	mtdcr	isram0_sb0cr,r1#endif	/*----------------------------------------------------------------*/	/* Setup the stack in internal SRAM */	/*----------------------------------------------------------------*/	lis	r1,CFG_INIT_RAM_ADDR@h	ori	r1,r1,CFG_INIT_SP_OFFSET@l	li	r0,0

⌨️ 快捷键说明

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