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

📄 start.s

📁 国产CPU-龙芯(loongson)BIOS源代码
💻 S
📖 第 1 页 / 共 3 页
字号:
	/* 	 * READ(ADDR) 	 */8:	bne	t4,OP_RD,8f	nop	and	t4,t3,MOD_MASK		bne	t4,MOD_B,1f	nop	lbu	t5,0(t0)	b	.next	nop1:	bne	t4,MOD_H,1f	nop	lhu	t5,0(t0)	b	.next	nop1:	bne	t4,MOD_W,1f	nop#if __mips64	lwu	t5,0(t0)#else 	lw	t5,0(t0)#endif	b	.next	nop1:	#if __mips64	lw	t5,0(t0)	b	.next	nop#else	b	.fatal	nop#endif		/* 	 * WRITE(ADDR,VAL) 	 */8:	bne	t4,OP_WR,8f	nop	lw	t1,Init_A1(a0)	and	t4,t3,MOD_MASK		bne	t4,MOD_B,1f	nop	sb	t1,0(t0)	b	.next	nop1:	bne	t4,MOD_H,1f	nop	sh	t1,0(t0)	b	.next	nop1:	bne	t4,MOD_W,1f	nop	sw	t1,0(t0)	b	.next	nop	1:	#if __mips64	sd	t1,0(t0)	b	.next	nop#else	b	.fatal	nop#endif				/* 	 * RMW(ADDR,AND,OR) 	 */8:	bne	t4,OP_RMW,8f	nop	lw	t1,Init_A1(a0)	lw	t2,Init_A2(a0)	and	t4,t3,MOD_MASK		bne	t4,MOD_B,1f	nop	lbu	t4,0(t0)	and	t4,t1	or	t4,t2	sb	t4,0(t0)	b	.next	nop1:	bne	t4,MOD_H,1f	nop	lhu	t4,0(t0)	and	t4,t1	or	t4,t2	sh	t4,0(t0)	b	.next	nop1:	bne	t4,MOD_W,1f	nop	lw	t4,0(t0)	and	t4,t1	or	t4,t2	sw	t4,0(t0)	b	.next	nop	1:		#if __mips64	ld	t4,0(t0)	and	t4,t1	or	t4,t2	sd	t4,0(t0)	b	.next	nop#else		b	.fatal	nop#endif				/* 	 * WAIT(ADDR,MASK,VAL) 	 */8:	bne	t4,OP_WAIT,8f	nop	lw	t1,Init_A1(a0)	lw	t2,Init_A2(a0)	and	t4,t3,MOD_MASK		bne	t4,MOD_B,1f	nop3:	lbu	t4,0(t0)	and	t4,t1	bne	t4,t2,3b	nop	b	.next	nop1:	bne	t4,MOD_H,1f	nop3:	lhu	t4,0(t0)	and	t4,t1	bne	t4,t2,3b	nop	b	.next	nop1:	bne	t4,MOD_W,1f	nop3:	lw	t4,0(t0)	and	t4,t1	bne	t4,t2,3b	nop	b	.next	nop1:		#if __mips643:	ld	t4,0(t0)	and	t4,t1	bne	t4,t2,3b	nop	b	.next	nop#else		b	.fatal		nop#endif		.next:	addu	a0,Init_Size	b	reginit		nop		8:.fatal:	b .done	nop	bal 	stuck	nop.done:		/* Initialise other low-level I/O devices */	bal	initserial	nop		PRINTSTR("\r\nPMON2000 MIPS Initializing. Standby...\r\n")	PRINTSTR("ERRORPC=")	mfc0	a0, COP_0_ERROR_PC	bal	hexserial	nop	PRINTSTR(" CONFIG=")	mfc0	a0, COP_0_CONFIG	bal	hexserial	nop	PRINTSTR("\r\n")		PRINTSTR(" PRID=")	mfc0	a0, COP_0_PRID	bal	hexserial	nop	PRINTSTR("\r\n")	PRINTSTR("Raw word read of SMB base address: ");	li	a0,CFGADDR(PCI_DEV_I82371,3,I82371_PCI3_SMBBA)	li	a1,PHYS_TO_UNCACHED(PCI_CFG_SPACE)	and	a2,a0,0xffff	or	a1,a2	srl	a0,16	li	a2,BONITO_BASE+BONITO_PCIMAP_CFG	sw	a0,BONITO_PCIMAP_CFG(bonito)	lw	zero,BONITO_PCIMAP_CFG(bonito)	lw	a0,(a1)		li	a1,2	bal	hexserial	nop	PRINTSTR("\r\n")			PRINTSTR("Raw word read of SMB HSTCFG: ");	li	a0,CFGADDR(PCI_DEV_I82371,3,I82371_PCI3_SMBHSTCFG) # byte???	li	a1,PHYS_TO_UNCACHED(PCI_CFG_SPACE)	and	a2,a0,0xffff	or	a1,a2	srl	a0,16	li	a2,BONITO_BASE+BONITO_PCIMAP_CFG	sw	a0,BONITO_PCIMAP_CFG(bonito)	lw	zero,BONITO_PCIMAP_CFG(bonito)	lhu	a0,(a1)		li	a1,2	bal	hexserial	nop	PRINTSTR("\r\n")			PRINTSTR("Raw word read of SMB IO ENABLE: ");	li	a0,CFGADDR(PCI_DEV_I82371,3,PCI_COMMAND_STATUS_REG)	li	a1,PHYS_TO_UNCACHED(PCI_CFG_SPACE)	and	a2,a0,0xffff	or	a1,a2	srl	a0,16	li	a2,BONITO_BASE+BONITO_PCIMAP_CFG	sw	a0,BONITO_PCIMAP_CFG(bonito)	lw	zero,BONITO_PCIMAP_CFG(bonito)	lw	a0,(a1)		li	a1,2	bal	hexserial	nop	PRINTSTR("\r\n")		bal	i2cdump	nop	PRINTSTR("DIMM read\n")#ifdef DEBUG_DIMM_SPD  /*test i2c */  li	t4,0loop:	li	a0,0	move	a1,t4	bal	i2cread	nop	move	a0,v0	bal	hexserial	nop	PRINTSTR("\r\n")	addu	t4,1	li	t0,255	bltu	t4,t0,loop	nop#endif	/* 	 * Now determine DRAM configuration and size by	 * reading the I2C EEROM on the DIMMS	 */	li	msize,0	/* start with SODIMM #0 */	li	a0,0	li	sdCfg,0	.nextdimm:	li	sdShape,0		/* read DIMM memory type (must be SDRAM) */	li	a1,2	bal	i2cread	nop	bne	v0,4,.nodimm	nop	PRINTSTR("read memory type\r\n")	/* read DIMM memory size per side */	li	a1,31	bal	i2cread	nop	beqz	v0,.nodimm	nop	sll	tmpsize,v0,22		# multiply by 4M		PRINTSTR("read memory size per side\r\n")	/* read DIMM number of rows */	li	a1,3	bal	i2cread	nop		subu	v0,11	bgtu	v0,14-11,.nodimm	nop	sll	v0,BONITO_SDCFG_AROWBITS_SHIFT	and	v0,BONITO_SDCFG_AROWBITS	or	sdShape,v0		PRINTSTR("read number of rows\r\n")2:	/* read DIMM number of cols */	li	a1,4	bal	i2cread	nop	subu	v0,8	bgtu	v0,11-8,.nodimm	nop	sll	v0,BONITO_SDCFG_ACOLBITS_SHIFT	and	v0,BONITO_SDCFG_ACOLBITS	or	sdShape,v0		PRINTSTR("read number of col\r\n")2:	/* read DIMM number of blocks-per-dram */	li	a1,17	bal	i2cread	nop	beq	v0,2,2f	nop	bne	v0,4,.nodimm	nop	or	sdShape,BONITO_SDCFG_ABANKBIT		PRINTSTR("read blocks per dram\r\n")2:	/* read DIMM number of sides (banks) */	li	a1,5	bal	i2cread	nop	beq	v0,1,2f	nop	bne	v0,2,.nodimm	nop	or	sdShape,BONITO_SDCFG_ASIDES	sll	tmpsize,1	# msize *= 2			PRINTSTR("read number of sides\r\n")2:	/* read DIMM width */	li	a1,6	bal	i2cread	nop	bleu	v0,36,2f	nop	bgtu	v0,72,.nodimm	nop	or	sdShape,BONITO_SDCFG_AWIDTH64		PRINTSTR("read width\r\n")2:	addu	msize,tmpsize	b	2f	nop	.nodimm:#ifdef DBGSBD	move	dbg,a0	PRINTSTR ("\r\niNo DIMM in slot ")	move	a0,dbg	bal	hexserial	nop	PRINTSTR("\r\n")	move	a0,dbg#endif		or	sdShape,BONITO_SDCFG_AABSENT2:	beqz	a0,1f	nop	sll	sdShape,BONITO_SDCFG_BROWBITS_SHIFT1:	or	sdCfg,sdShape		move dbg,a0	PRINTSTR("DIMM0 in slot")	move a0,dbg	bal	hexserial	nop	PRINTSTR("\r\n")	move a0,dbg      	PRINTSTR("DIMM1...\n")      	move a0,dbg	addu	a0,1	bltu	a0,2,.nextdimm	nop	PRINTSTR("DIMM SIZE=")	move	a0,msize	bal	hexserial	nop	PRINTSTR("\r\n")	/* If we are running in SDRAM, chop 4MB off the memory size,	   and don't modify sdCfg register (assume someone in 	   PCI-world has already set it up). */	lw	t0,BONITO_BONPONCFG(bonito)	and	t0,BONITO_BONPONCFG_ROMBOOT	bne	t0,BONITO_BONPONCFG_ROMBOOT_SDRAM,1f	nop	beqz	msize,2f	# already zero!	nop	subu	msize,-1	b	2f	nop1:	sw	sdCfg,BONITO_SDCFG(bonito)	2:	b	3f		nop.skipdimm:	li	msize,4*0x1000003:#ifdef DBGSBD	PRINTSTR("sdcfg=");	move	a0,sdCfg	bal	hexserial	nop	PRINTSTR("\r\n")	#endif	li	t1,0		# accumulate pcimembasecfg settings			/* set bar0 mask and translation to point to SDRAM */	sub	t0,msize,1	not	t0	srl	t0,BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT	and	t0,BONITO_PCIMEMBASECFG_MEMBASE0_MASK	or	t1,t0		li	t0,0x00000000	srl	t0,BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT	and	t0,BONITO_PCIMEMBASECFG_MEMBASE0_TRANS	or	t1,t0	or	t1,BONITO_PCIMEMBASECFG_MEMBASE0_CACHED	/* set bar1 to minimum size to conserve PCI space */	li	t0, ~0	srl	t0,BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT	and	t0,BONITO_PCIMEMBASECFG_MEMBASE1_MASK	or	t1,t0		li	t0,0x00000000	srl	t0,BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT	and	t0,BONITO_PCIMEMBASECFG_MEMBASE1_TRANS	or	t1,t0	or	t1,BONITO_PCIMEMBASECFG_MEMBASE1_CACHED	sw	t1,BONITO_PCIMEMBASECFG(bonito)	/* enable configuration cycles now */	lw	t0,BONITO_BONPONCFG(bonito)	and	t0,~BONITO_BONPONCFG_CONFIG_DIS	sw	t0,BONITO_BONPONCFG(bonito)	PRINTSTR("Init SDRAM Done!\r\n");/* *  Reset and initialize caches to a known state. */#define IndexStoreTagI	0x08#define IndexStoreTagD	0x09#define IndexStoreTagS	0x0b#define IndexStoreTagT	0x0a#define FillI		0x14/* *  RM7000 config register bits. */#define CF_7_SE         (1 << 3)        /* Secondary cache enable */#define CF_7_SC         (1 << 31)       /* Secondary cache not present */#define CF_7_TE         (1 << 12)       /* Tertiary cache enable */#define CF_7_TC         (1 << 17)       /* Tertiary cache not present */#define CF_7_TS         (3 << 20)       /* Tertiary cache size */#define CF_7_TS_AL      20              /* Shift to align */#define NOP8 nop;nop;nop;nop;nop;nop;nop;nopdo_caches:	TTYDBG("Sizing caches...\r\n");	mfc0	t3, COP_0_CONFIG	/* t3 = original config */	and	t3, 0xffffeff0		/* Make sure coherency is OK */	and	t3, ~(CF_7_TE|CF_7_SE|CF_7_TC|CF_7_SC)  /* disable L2/L3 cache */	mtc0    t3, COP_0_CONFIG#if 1	li	t2, 4096	srl	t1, t3, 9	and	t1, 3	sllv	s3, t2, t1		/* s3 = I cache size */	and	t1, t3, 0x20	srl	t1, t1, 1	addu	s4, t1, 16		/* s4 = I cache line size */	srl	t1, t3, 6	and	t1, 3	sllv	s5, t2, t1		/* s5 = D cache size */	and	t1, t3, 0x10	addu	s6, t1, 16		/* s6 = D cache line size */#endif	TTYDBG("Init caches...\r\n")#if 1	li	s7, 0                   /* no L2 cache */	li	s8, 0                   /* no L3 cache */#endif	TTYDBG("godson1 caches found\r\n")       bal     godson1_cache_init       nop#ifdef DEBUG_LOCORE	TTYDBG("Init caches done, cfg = ")	mfc0	a0, COP_0_CONFIG	bal	hexserial	nop	TTYDBG("\r\n")#endif	TTYDBG("Copy PMON to execute location...\r\n")#ifdef DEBUG_LOCORE	TTYDBG("start = ")	la	a0, start	bal	hexserial	nop	TTYDBG("\r\ncopytoram = ")	la	a0, copytoram	addu	a0, s0	bal	hexserial	nop	TTYDBG("\r\ns0 = ")	move	a0, s0	bal	hexserial	nop	TTYDBG("\r\n")#endif	la	a0, start	li	a1, 0xbfc00000	la	a2, _edata        or      a0, 0xa0000000        or      a2, 0xa0000000	subu	t1, a2, a0	srl t1, t1, 2	move	t0, a0

⌨️ 快捷键说明

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