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

📄 1001.earlyprintk.patch

📁 sm86xx内核源包括补丁( GPL )的
💻 PATCH
字号:
diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/kernel/printk.c linuxmips-2.4.30/kernel/printk.c--- linuxmips-2.4.30.ref/kernel/printk.c	2005-08-01 10:12:30.000000000 -0700+++ linuxmips-2.4.30/kernel/printk.c	2005-08-01 10:46:24.000000000 -0700@@ -29,6 +29,11 @@  #include <asm/uaccess.h> +#ifdef CONFIG_TANGO2+#include <asm/tango2/tango2.h>+#include <asm/io.h>+#endif+ #if !defined(CONFIG_LOG_BUF_SHIFT) || (CONFIG_LOG_BUF_SHIFT == 0) #if defined(CONFIG_MULTIQUAD) || defined(CONFIG_IA64) #define LOG_BUF_LEN	(65536)@@ -384,7 +389,7 @@ 	_call_console_drivers(start_print, end, msg_level); } -static void emit_log_char(char c)+static void emit_log_char_old(char c) { 	LOG_BUF(log_end) = c; 	log_end++;@@ -396,6 +401,19 @@ 		logged_chars++; } +void Uart16550Put(char byte);+static void emit_log_char_early(char c)+{+	if (c == '\n') { +		Uart16550Put('\r'); +		Uart16550Put('\n'); +	} else { +		Uart16550Put(c); +	}+}++static void (*emit_log_char)(char c)=emit_log_char_early;+ /*  * This is printk.  It can be called from any context.  We want it to work.  * @@ -630,6 +648,9 @@ 	if (!(console->flags & CON_ENABLED)) 		return; +	printk("now reverting to conventional printk!\n");+	emit_log_char=emit_log_char_old;+ 	/* 	 *	Put this console in the list - keep the 	 *	preferred driver at the head of the list.@@ -700,3 +721,188 @@ 		tty->driver.write(tty, 0, msg, strlen(msg)); 	return; }++/* -------------------------- early-printk hack ---------------------- */++/* base addr of uart and clock timing */+#define         BASE                    KSEG1ADDR(REG_BASE_cpu_block+CPU_UART0_base)+#define         MAX_BAUD                115200++/* distance in bytes between two serial registers */+#define         REG_OFFSET              4++/*+ * 0 - we need to do serial init+ * 1 - skip serial init+ */+static int serialPortInitialized = 0;++/*+ *  * the default baud rate *if* we do serial init+ *   */+#ifdef CONFIG_QUICKTURN+#define         BAUD_DEFAULT            UART16550_BAUD_1200+#elif defined(CONFIG_TANGO2_SMP863X)+#ifndef CONFIG_TANGO2_BASE_BAUD+#define         BAUD_DEFAULT            UART16550_BAUD_38400+#else+#define         BAUD_DEFAULT            CONFIG_TANGO2_BASE_BAUD+#endif+#else+#error not handled yet+#endif /* CONFIG_QUICKTURN */++/* === END OF CONFIG === */++/* we need uint32 uint8 */+typedef         unsigned char uint8;+typedef         unsigned int  uint32;++#define         UART16550_BAUD_1200             1200+#define         UART16550_BAUD_2400             2400+#define         UART16550_BAUD_4800             4800+#define         UART16550_BAUD_9600             9600+#define         UART16550_BAUD_19200            19200+#define         UART16550_BAUD_38400            38400+#define         UART16550_BAUD_57600            57600+#define         UART16550_BAUD_115200           115200++#define         UART16550_PARITY_NONE           0+#define         UART16550_PARITY_ODD            0x08+#define         UART16550_PARITY_EVEN           0x18+#define         UART16550_PARITY_MARK           0x28+#define         UART16550_PARITY_SPACE          0x38++#define         UART16550_DATA_5BIT             0x0+#define         UART16550_DATA_6BIT             0x1+#define         UART16550_DATA_7BIT             0x2+#define         UART16550_DATA_8BIT             0x3++#define         UART16550_STOP_1BIT             0x0+#define         UART16550_STOP_2BIT             0x4++/* register offset */+#define         OFS_RCV_BUFFER          (0*REG_OFFSET)+#define         OFS_TRANS_HOLD          (1*REG_OFFSET)+#define         OFS_SEND_BUFFER         (1*REG_OFFSET)+#define         OFS_INTR_ENABLE         (2*REG_OFFSET)+#define         OFS_INTR_ID             (3*REG_OFFSET)+#define         OFS_DATA_FORMAT         (5*REG_OFFSET)+#define         OFS_LINE_CONTROL        (5*REG_OFFSET)+#define         OFS_MODEM_CONTROL       (6*REG_OFFSET)+#define         OFS_RS232_OUTPUT        (6*REG_OFFSET)+#define         OFS_LINE_STATUS         (7*REG_OFFSET)+#define         OFS_MODEM_STATUS        (8*REG_OFFSET)+#define         OFS_RS232_INPUT         (8*REG_OFFSET)+#define         OFS_SCRATCH_PAD         (9*REG_OFFSET)++#define         OFS_DIVISOR         (10*REG_OFFSET)+#define         OFS_CLKSEL          (11*REG_OFFSET)+#define         OFS_GPIOMODE            (14*REG_OFFSET)++/* memory-mapped read/write of the port */+#define         UART16550_READ(y)    (*((volatile uint32*)(BASE + y)))+#define         UART16550_WRITE(y, z)  ((*((volatile uint32*)(BASE + y))) = z)++#ifdef CONFIG_TANGO2_SIG_BLOCK+extern unsigned long em8xxx_baudrates[2];+#endif++static unsigned long baud_default = BAUD_DEFAULT;++void Uart16550Init(uint32 baud, uint8 data, uint8 parity, uint8 stop)+{+	/* disable interrupts */+        UART16550_WRITE(OFS_LINE_CONTROL, 0x0);+	UART16550_WRITE(OFS_INTR_ENABLE, 0);++	/* set up buad rate */+	{ +		uint32 divisor;+       +		/* set DIAB bit */+	        UART16550_WRITE(OFS_LINE_CONTROL, 0x80);+        +	        /* set divisor */+#ifdef CONFIG_QUICKTURN+		divisor = 0; // no warning this way+		UART16550_WRITE(OFS_GPIOMODE,0xff00);+		UART16550_WRITE(OFS_DIVISOR,13); // quickturn (250000 Hz / 16 / 13 = 1201 bits/s)+#elif defined(CONFIG_TANGO2_SMP863X)+               {+#ifdef CONFIG_UART_USE_SYSCLK+                unsigned long sys_clkgen_pll = gbus_read_uint32(pGBus, REG_BASE_system_block + SYS_clkgen_pll);+                unsigned long sys_sysclk_mux = gbus_read_uint32(pGBus, REG_BASE_system_block + SYS_sysclk_mux);+                unsigned long n = sys_clkgen_pll & 0x000003ff;+                unsigned long m = (sys_clkgen_pll & 0x003f0000) >> 16;+                unsigned long div_cpu, div_sys, cpu_freq, sys_freq;+                div_cpu = ((sys_sysclk_mux & 0x300) == 0x300) ? 3 : 2;+                div_sys = ((sys_sysclk_mux & 0x300) == 0x0) ? 2 : (((sys_sysclk_mux & 0x300) == 0x100) ? 4 : 3);+                if (sys_sysclk_mux & 0x1) {+                        cpu_freq = ((TANGO2_BASE_FREQUENCY / (m + 2)) * (n + 2)) / div_cpu;+                        sys_freq = ((TANGO2_BASE_FREQUENCY / (m + 2)) * (n + 2)) / div_sys;+                } else {+                        cpu_freq = TANGO2_BASE_FREQUENCY / div_cpu;+                        sys_freq = TANGO2_BASE_FREQUENCY / div_sys;+                }++		divisor = 0; // no warning this way+		UART16550_WRITE(OFS_GPIOMODE,0x7f00);+		UART16550_WRITE(OFS_CLKSEL,0x0);+		UART16550_WRITE(OFS_DIVISOR,sys_freq/(16*baud));+#else+		divisor = 0; // no warning this way+		UART16550_WRITE(OFS_GPIOMODE,0x7f00);+		UART16550_WRITE(OFS_CLKSEL,0x1);+		UART16550_WRITE(OFS_DIVISOR,TANGO2_BASE_FREQUENCY/(16*baud));+#endif+		}+#else+	        divisor = MAX_BAUD / baud;+        	UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);+	        UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00)>>8);+#endif /* CONFIG_QUICKTURN */++        	/* clear DIAB bit */+	        UART16550_WRITE(OFS_LINE_CONTROL, 0x0);+	}++	/* set data format */+	UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);+}++uint8 Uart16550GetPoll(void)+{+        if (!serialPortInitialized) {+#ifdef CONFIG_TANGO2_SIG_BLOCK+		if (em8xxx_baudrates[0] != 0)+			baud_default = em8xxx_baudrates[0];+#endif+                serialPortInitialized = 1;+                Uart16550Init(baud_default,+                              UART16550_DATA_8BIT,+                              UART16550_PARITY_NONE, UART16550_STOP_1BIT);+        }++	while((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);+	return UART16550_READ(OFS_RCV_BUFFER);+}+++void Uart16550Put(char byte)+{+        if (!serialPortInitialized) {+#ifdef CONFIG_TANGO2_SIG_BLOCK+		if (em8xxx_baudrates[0] != 0)+			baud_default = em8xxx_baudrates[0];+#endif+                serialPortInitialized = 1;+                Uart16550Init(baud_default,+                              UART16550_DATA_8BIT,+                              UART16550_PARITY_NONE, UART16550_STOP_1BIT);+        }++	while ((UART16550_READ(OFS_LINE_STATUS) &0x20) == 0);+	UART16550_WRITE(OFS_SEND_BUFFER, byte);+}+diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/README.1001.earlyprintk.patch linuxmips-2.4.30/README.1001.earlyprintk.patch--- linuxmips-2.4.30.ref/README.1001.earlyprintk.patch	1969-12-31 16:00:00.000000000 -0800+++ linuxmips-2.4.30/README.1001.earlyprintk.patch	2005-08-01 10:47:40.000000000 -0700@@ -0,0 +1,19 @@+Feature:+--------+Provides support for printk when serial driver is not yet operational.++Prerequisite patch numbers:+---------------------------+0000+1000++Primary author:+---------------+Emmanuel Michon++Related to which chip version SMP863x x=?+-----------------------------------------+all++(linux patches) which CONFIG_... are provided:+----------------------------------------------

⌨️ 快捷键说明

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