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

📄 tqm8xx.patch

📁 linux交叉编译环境个软件和内核的补丁。
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+#include <asm/processor.h>+#include <asm/cache.h>+#include <asm/tqm8xx.h>+#include <linux/uts.h>+#include <linux/version.h>+#include <linux/compile.h>++	.text++/*+ * $Id: head.S,v 1.4 1999/06/08 12:21:07 wd Exp wd $+ *	+ * This code is loaded by the ROM loader at some arbitrary location.+ * Move it to high memory so that it can load the kernel at 0x0000.+ *+ * This is a three step process that will also work when booting from+ * a Flash PROM normally located in high memory.+ *+ * First, the entire image is loaded into some high memory address.+ * This is usually at or above 0x02000000.  This is done by a network+ * boot function supported by the board or a debugger over BDM port.+ *+ * Second, the start up function here will relocate the decompress+ * function to run at the link address of 0x01000000.+ *+ * Last, the decompression function will relocate the initrd, zImage, and+ * the residual data to locations under 8 Meg.  This is necessary because+ * the embedded kernel start up uses 8 Meg translations to access physical+ * space before the MMU is enabled.  Finally, the zImage is uncompressed+ * to location 0 and we jump to it.+ *+ * This version of head.S is special for the TQM8xx(L) modules.+ * (C) 1999,2000 DENX Software Engineering, Wolfgang Denk, wd@denx.de+ */+++/**+ ** Registers:+ **+ **	r28 --> Boot parameter block+ **	r27 --> argument string+ **	r26 --> Board Info Block+ **	r25 --> IMMR+ **	r24 --> Start Address+ **	r23:	length of image to copy+ **	r22:	checksum+ **/+	.globl	start+start:+	bl	tqm_start+	.long	0,0,0,0,0,0,0+	.long	0,0,0,0,0,0,0,0+	.string "Version"UTS_RELEASE"("LINUX_COMPILE_BY"@"LINUX_COMPILE_HOST") ("LINUX_COMPILER") "UTS_VERSION+	.org	start+0x100+	.globl	tqm_start+tqm_start:+	bl	start_+start_:+	.set	sp,1			# r1 used as stack pointer+	.set	bi_size,64		# sizeof(struct bd_info)+	sync+        addis   r0,r0,0                 # Set initial and cache clear+        mtmsr   r0                      # Setup Initial MSR+        sync++        lis     r3, 0x0400              # cache_disable code in CMD field+        mtspr   560, r3+        lis     r3, 0x0400              # cache_disable code in CMD field+        mtspr   568, r3++        li      r0, 7+        mtspr   158, r0++	addis	r28,r0,0		# r28 -> Boot parameter block+	addi	r28,r0,0x3400+	lwz	r3,0x00(r28)		# size of  DRAM memory++	lis	r9,0x0080		# use not more than 8 MB+	cmpw	cr1,r3,r9		# (max. initial mapping for Linux)+	cror	4*cr1+so,4*cr1+eq,4*cr1	# skip next instruction if r3<=r0+	mfcr	r0+	rlwinm	0,r0,8,31,31+	neg	r0,r0+	and	r3,r3,r0+	andc	r0,r9,r0+	or	r3,r3,r0		# r3 = max(RAM, 8MB)++	addi	r27,r3,-512		# r27 -> argument string++	addi	r26,r27,-bi_size	# r26 -> Board Info Block++        addi    sp,r26,-32		# sp  -> stack pointer, leaving some room+	li	r2,0x000F		# mask stack pointer to 16-byte boundary+	andc	sp,sp,r2++	mflr	r3			# remember start address+	subi	r3,r3,4+0x100		# we get the nip, not the ip of the branch+	stw     r3,-4(r26)		# ...and we have to correct the TQM header++#ifdef	TQM_UART_DEBUG+	bl	tqm_init_uart		# init standalone print+	lis	r3,0x4c69		# Li+	ori	r3,r3,0x6e75		#   nu+	bl	tqm_str+	lis	r3,0x783a		#     x:+	ori	r3,r3,0x0d0a+	bl	tqm_str+#endif	/* TQM_UART_DEBUG */++	lis	r25,TQM_IMMR_BASE@h	# IMMR pointer++	lis	r0,0x55CC		# unlock key code+	ori	r0,r0,0xAA33+	stw	r0,0x0300(r25)		# unlock TBSCRK+	stw	r0,0x030C(r25)		# unlock TBK+	stw	r0,0x0320(r25)		# unlock RTCSK+	stw	r0,0x0324(r25)		# unlock RTCK++	lhz	r0,0x200(r25)		# TBSCR+	ori	r0,r0,0xC1		#	|= 0xC1+	sth	r0,0x200(r25)++	lhz	r0,0x220(r25)		# RTCSC+	ori	r0,r0,0xC1		#	|= 0xC1+	sth	r0,0x220(r25)++	lwz	r0,0x280(r25)		# SCCR+	oris	r0,r0,0x0200		#	|=  0x0200.0000+	rlwinm	r0,r0,0,9,6		#	&= ~0x0180.0000	:-)+	stw	r0,0x280(r25)++	li	r0,TQM_CLOCKRATE*625	# clock in MHz: * 1,000,000 / 16 / 100+	mtdec	r0++	li	r0,0+	mttbl	r0			# initialize TMBCLK+	mttbu	r0+#ifdef	TQM_UART_DEBUG+	li r3,1 ; bl tqm_hexc # XXX 1 XXX+#endif	/* TQM_UART_DEBUG */++/*+ * struct bd_info:+ * +00	unsigned long	bi_memstart	 start of  DRAM memory+ *	--- copied from monitor boot parameter block ---+ * +04	unsigned long	bi_memsize	 size  of  DRAM memory in bytes+ * +08	unsigned long	bi_flashstart	 start of FLASH memory+ * +0C	unsigned long	bi_flashsize	 size  of FLASH memory+ * +10	unsigned long	bi_flashoffset	 reserved area for startup monitor+ * +14	unsigned long	bi_sramstart	 start of  SRAM memory+ * +18	unsigned long	bi_sramsize	 size  of  SRAM memory+ * +1C	unsigned long	bi_immr_base	 base of IMMR register+ * +20	unsigned long	bi_bootflags	 boot / reboot flag (for LynxOS)+ * +24	unsigned long	bi_ip_addr	 IP Address+ * +28	unsigned char	bi_enetaddr[6]	 Ethernet adress+ * +2C	unsigned char	bi_reserved[2]+ * +30	unsigned long	bi_putchar	 Addr of monitor putchar() to Console+ *	--- end of monitor boot parameter block ---+ * +34	unsigned long	bi_intfreq	 Internal Freq, in MHz+ * +38	unsigned long	bi_busfreq	 Bus Freq, in MHz+ * +3C	unsigned long	bi_baudrate	 Console Baudrate+ */++	li	r3,0			# RAM starts always @ 0+	stw	r3,0x00(r26)		# -> bi_memstart++	lwz	r3,0x00(r28)		# size of DRAM memory+	stw	r3,0x04(r26)		# -> bi_memsize++	lwz     r3,0x04(r28)		# start of FLASH memory+	stw     r3,0x08(r26)		# -> bi_flashstart++	lwz     r3,0x08(r28)		# size of FLASH memory+	stw     r3,0x0C(r26)		# -> bi_flashsize++	lwz     r3,0x0C(r28)		# reserved area for startup monitor+	stw     r3,0x10(r26)		# -> bi_flashoffset++	lwz     r3,0x10(r28)		# start of SRAM memory+	stw     r3,0x14(r26)		# -> bi_sramstart++	lwz     r3,0x14(r28)		# size of SRAM memory+	stw     r3,0x18(r26)		# -> bi_sramsize++	lwz     r3,0x18(r28)		# base of IMMR register+	stw     r3,0x1C(r26)		# -> bi_immr_base++###	Not set by current version of monitor+###	lwz     r3,0x1C(r28)		# boot / reboot flag (for LynxOS)+  li r3,8+	stw     r3,0x20(r26)		# -> bi_bootflags++###	Not set by current version of monitor+###	lwz     r3,0x20(r28)		# IP Address+  lis r3,TQM_IP_ADDR@h+  ori r3,r3,TQM_IP_ADDR@l+	stw     r3,0x24(r26)		# -> bi_ip_addr++	lwz     r3,0x24(r28)		# Ethernet adress (part 1)+	stw     r3,0x28(r26)		# -> bi_enetaddr[0...3]++	lwz     r3,0x28(r28)		# Ethernet adress (part 2)+	stw     r3,0x2C(r26)		# -> bi_enetaddr[4...5] + reserved++###	Not set by current version of monitor+###	lwz     r3,0x2C(r28)		# Addr of monitor putchar() to Console+  li r3,0+	stw     r3,0x30(r26)		# -> bi_putchar++	li	r3,TQM_CLOCKRATE	# 50 MHz+	stw	r3,0x34(r26)		# -> bi_intfreq+	stw	r3,0x38(r26)		# -> bi_busfreq++	lis	r3,TQM_BAUDRATE@h	# Console baud rate+	ori	r3,r3,TQM_BAUDRATE@l+	stw	r3,0x3C(r26)		# -> bi_baudrate++#ifdef	TQM_UART_DEBUG+	li r3,2 ; bl tqm_hexc # XXX 2 XXX+#endif	/* TQM_UART_DEBUG */++/* check if we need to relocate ourselves to the link addr or were we+   loaded there to begin with -- Cort */+	lis	r4,start@h+	ori	r4,r4,start@l+	lwz	r3,-4(r26)		/* Address we've been started at */+	mr	r24,r3			/* r24 -> start address */+	cmp	0,r3,r4+	beq	start_ldr		/* Branch if loaded OK */++/* + * no matter where we're loaded, move ourselves to -Ttext address+ */+	lis	r5,end@h+	ori	r5,r5,end@l+	addi	r5,r5,3			/* Round up - just in case */+	sub	r5,r5,r4		/* Compute # longwords to move */+	srwi	r5,r5,2+	mtctr	r5+	mr	r23,r5			/* r23: length to copy */+	li	r22,0			/* r22: checksum */+	subi	r3,r3,4			/* Set up for loop */+	subi	r4,r4,4+00:	lwzu	r5,4(r3)+	stwu	r5,4(r4)+	xor	r22,r22,r5+	bdnz	00b++#ifdef	TQM_UART_DEBUG+	li r3,3 ; bl tqm_hexc # XXX 3 XXX+#endif	/* TQM_UART_DEBUG */++  	lis	r3,start_ldr@h		/* jump to link address */+	ori	r3,r3,start_ldr@l+	mtlr	r3			/* Easiest way to do an absolute jump */+	blr++start_ldr:+/* Most 8xx boards don't boot up with the I-cache enabled.  Do that+ * now because the decompress runs much faster that way.+ */+	lis	r3, IDC_INVALL@h+	mtspr	IC_CST, r3+	lis	r3, IDC_ENABLE@h+	mtspr	IC_CST, r3++#ifdef	TQM_UART_DEBUG+	li r3,4 ; bl tqm_hexc # XXX 4 XXX+	lis r3,edata@h ; ori r3,r3,edata@l ; bl tqm_hexl+	lis r3,end@h ; ori r3,r3,end@l ; bl tqm_hexl+	li r3,5 ; bl tqm_hexc # XXX 5 XXX+#endif	/* TQM_UART_DEBUG */++/* Clear all of BSS */+	lis	r3,edata@h+	ori	r3,r3,edata@l+	lis	r4,end@h+	ori	r4,r4,end@l+	subi	r3,r3,4+	subi	r4,r4,4+	li	r0,0+50:	stwu	r0,4(r3)+	cmp	0,r3,r4+	bne	50b++#ifdef	TQM_UART_DEBUG+	li r3,6 ; bl tqm_hexc # XXX 6 XXX+#endif	/* TQM_UART_DEBUG */++	mr	r3,r26			/* arg: ptr. to Board Info data */+	bl      serial_init		/* Init serial port */++	li	r0, 0			/* Disable Ethernet SCC */+	stw	r0, 0x0a00(r25)		/* SCC1 GSMR_L */++	lwz	r3,-4(r26)		/* Address we've been started at */+	mr	r4,r23			/* Program length */+	mr	r5,r22			/* Checksum */+	mr	r6,r26			/* board info data */+	bl	decompress_kernel+	+/*+ * Booting the kernel for the TQM8xx. Right now I only support an ELF+ * compressed (zImage) boot from MON8xx startup monitor.+ * Arguments passed to the kernel:+ *+ *   r3: ptr to board info data+ *   r4: initrd_start or if no initrd then 0+ *   r5: initrd_end - unused if r4 is 0+ *   r6: Start of command line string+ *   r7: End of command line string+ */+	mr	r3,r26			/* r3: board info data */++	lis	r2,initrd_start@h+	ori	r2,r2,initrd_start@l+	lwz	r4,0(r2)		/* r4: initrd_start */++	lis	r2,initrd_end@h+	ori	r2,r2,initrd_end@l+	lwz	r5,0(r2)		/* r5: initrd_end */+	+	mr	r6,r27			/* r6: Start of command line string */++	subi	r7,r6,1+99:	lbzu	r2,1(r7)+	cmpi	0,r2,0+	bne	99b			/* r7: End of command line string */++	/* +	 * get start address of kernel code which is stored as a coff+	 * entry.  see boot/head.S -- Cort +	 */+	li	r9,0x0+	lwz	r9,0(r9)+	mtlr	r9++	/* Invalidate the instruction cache because we just copied a+	 * bunch of kernel instructions.+	 */+	lis	r9, IDC_INVALL@h+	mtspr	IC_CST, r9++	blr+hang:+	b	hang	++/*+ * Delay for a number of microseconds+ * -- Use the BUS timer (assumes 66MHz)+ */+	.globl	udelay+udelay:		+	mulli	r4,r3,10000	/* 50 MHz / 16 = 3125000 */+	li	r5,3125+	divw	r4,r4,r5	/* BUS ticks */+1:	mftbu	r5+	mftb	r6+	mftbu	r7+	cmp	0,r5,r7+	bne	1b		/* Get [synced] base time */+	addc	r9,r6,r4	/* Compute end time */+	addze	r8,r5+2:	mftbu	r5+	cmp	0,r5,r8+	blt	2b+	bgt	3f+	mftb	r6+	cmp	0,r6,r9+	blt	2b+3:	blr		++.globl _get_MSR+_get_MSR:		+	mfmsr	r3+	blr+	+.globl _put_MSR+_put_MSR:		+	mtmsr	r3+	blr+ diff -u linux-2.2.13/arch/ppc/8xx_io/TQM_Config.in.ORIG linux-2.2.13/arch/ppc/8xx_io/TQM_Config.in--- linux-2.2.13/arch/ppc/8xx_io/TQM_Config.in.ORIG	Sun Jan  9 21:03:51 2000+++ linux-2.2.13/arch/ppc/8xx_io/TQM_Config.in	Sun Jan  9 16:55:49 2000@@ -0,0 +1,21 @@+#+# TQM Module Configuration Options+#+mainmenu_option next_comment+comment 'TQM8xx Module Options'++int	'Console baudrate (9600 ... 115200)'	TQM_BAUDRATE	38400+int	'CPU clock (MHz)'			TQM_CLOCKRATE	50+hex	'Target IP Address (in Hex!)  '		TQM_IP_ADDR	0x0A000063+string	'NFS Server IP Address        '		TQM_SERVER_IP	10.0.0.2+string	'NFS exported root directory  '		TQM_SERVER_DIR	/Linuxppc+bool	'NFS Server in different Sub-Net'	TQM_NEED_GW+if [ "$TQM_NEED_GW" = y ]; then+  string 'Gateway IP address           '	TQM_GATEWAY_IP	10.0.0.1+fi+bool	'Non-Standard Netmask'			TQM_NEED_NM+if [ "$TQM_NEED_NM" = y ]; then+  string 'Netmask                      '	TQM_NETMASK	255.0.0.0+fi++endmenu

⌨️ 快捷键说明

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