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

📄 startz.s.bad1

📁 国产CPU-龙芯(loongson)BIOS源代码
💻 BAD1
字号:
/*	$Id: startz.S,v 1.2 2003/11/11 02:19:43 wlin Exp $ *//* * Copyright (c) 2001 Opsycon AB  (www.opsycon.se) *  * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by Opsycon AB, Sweden. * 4. The name of the author may not be used to endorse or promote products *    derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */#ifndef _KERNEL#define _KERNEL#endif#include <target/it8172.h>#include <asm.h>#include <regnum.h>#include <cpu.h>#include <pte.h>#define IndexInvalidate_I       0x00#define IndexWriteBack_D        0x01/* * gpio function define          */#define GPIO_LOOP       10000#define MK_LAT(v)\        li              t0, (v);        \9:      subu    t0, 1;          \        bne             t0, 0, 9b;      \        nop;#define FLASH_GPIO(a)   \        li      a0, (a)         ;\        bal     __flash_gpio    ;\        nop	.set	noreorder	.globl	_start	.globl	start_start:start:	bal 	Init_ITE_CPU	nop	bal	locate	noplocate:	subu	s8, ra, 16	/* Where we were loaded */	la	sp, (.stack + 8192)	move	s0, a0		/* Save boot rom start args */	move	s1, a1	move	s2, a2	move	s3, a3	nop	la	a0, start	/* Where we were linked to run */	move	a1, s8	la	a2, _edata	subu	t1, a2, a0	srl	t1, t1, 2	/* copy text section */	li	t0, 01:	lw	v0, 0(a1)	nop	sw	v0, 0(a0)	xor	t0, t0, v0	addu	a0, 4	bne	a2, a0, 1b	addu	a1, 4		/* Clear BSS */	la	a0, _edata	la	a2, _end2:	sw	zero, 0(a0)	bne a2, a0, 2b	addu	a0, 4	move	a0, s8		     /* load address */	move	a1, t1               /* length in words */	move	a2, t0               /* checksum */	move	a3, sp	la	ra, 1f	la	k0, decompress_pmon	jr	k0	nop1:	move	a0, s0	move	a1, s1	move	a2, s2	move	a3, s3	li	k0, PMON_ENTRY	jr	k0	nop3:	b 3b	.comm .stack,4096*2,4LEAF(Init_ITE_CPU)/* Initialize CPU */        .set    noreorder        .set    nomacro	move 	t4, ra	bal             1f	lui             t0, 0xa000	        # in fact, here a nop instruction inserted1:      or              ra, t0                        addiu           ra, 16                  # 16 = 4 * sizeof(LX-1 inst size).        j               ra                      # now ra = . + 1        nop        .set    macro        .set    reorder	.set noreorder	mfc0    t0, COP_0_PRID	mfc0    v0, COP_0_STATUS_REG 	mtc0    zero, COP_0_WATCH_LO	mtc0    zero, COP_0_WATCH_HI	.set reorder	and             v0, SR_SOFT_RESET	or              v0, SR_BOOT_EXC_VEC	.set noreorder	mtc0    v0, COP_0_STATUS_REG	mtc0    zero, COP_0_CAUSE_REG#define CFG_IB		0x00000020#define CFG_DB		0x00000010#define	CFG_C_WBACK	3#define CFG_BE		0x00008000#define	FG_BE 		0x00008000#define	CFG_EPMASK	0x0f000000#define	CFG_EPD		0x00000000#define	CFG_AD		0x00800000/* * Initialize Configuration for board */       	mfc0	   t1, COP_0_CONFIG                  # Get Config Reg	nop	and             t1, ~0x3f               # Set Config Reg bits 5..0 only        or              t1, CFG_IB \                          | CFG_DB \                          | CFG_C_WBACK         # Set Cache Mode related bits in Config Reg        and             t1, ~CFG_BE             # Clean Big Endian bit in Config Reg        /* set DDDD rate for CPUs that aren't hardware configured */        and             t1, ~CFG_EPMASK         # Set EP 4 bits to 0 in Config Reg        or              t1, CFG_EPD             # Set EP DataPattern 0        and             t1, ~CFG_AD                             # ???        mtc0    t1, COP_0_CONFIG           # Re-Set Config Reg bits	nop        mfc0    t1, COP_0_STATUS_REG           	nop        mtc0    zero, COP_0_CAUSE_REG          	nop        and             t1, SR_SOFT_RESET       #        or              t1, SR_BOOT_EXC_VEC      # Should be omited because it has been done before        mtc0    t1, COP_0_STATUS_REG           # Set STATUS Reg        nop/* * Read Memory Capacity and Update IT8172 related Register */	li	t9, 0x1b	sw      t9, ( IT_MC_SDTYPE + IT8172_BASE + KSEG1 )	nop        li      t9, 0x0300              # 4mA        sh      t9, (UNCACHED_MEMORY_ADDR + IT8172_BASE + IT_PCDCR)        nop        li      t9, 0x803B              # cas=3, burst length=8        sh      t9, (UNCACHED_MEMORY_ADDR + IT8172_BASE + IT_MC_SDRMR)        nop        li      t9, 0x01ff        sh      t9, (UNCACHED_MEMORY_ADDR + IT8172_BASE + IT_MC_SDRTR)        nop        li      t9, 0x1                 # open board        sh      t9, (UNCACHED_MEMORY_ADDR + IT8172_BASE + IT_CMFPCR)    # change IT_CMFPCR        nop	move	ra, t4	j 	raEND(Init_ITE_CPU)/* * flash_gpio entry  */LEAF(__flash_gpio)        li      t2, 0xb4013802        li      t3, 0x550        sh      t3, (t2)        subu    t2, t2, 2        move    t3, a0        sll     t3, 2        sb      t3, (t2)        MK_LAT(GPIO_LOOP)        j       raEND(__flash_gpio)

⌨️ 快捷键说明

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