Only two patch file attached in this article, which implements detailed __debug_ll()__ implementation for xxx platform.
Long long ago, I want to implement this function, now, I got it. Feel good.
More detailed descriptions, please refer to :
Usage of subroutine printascill in AssembleActually, this function only deals with the transmission operations to UART1.
As we know that, during the bootup of linux kernel, it will look up the machine type ID provided by uboot, if the ID found, the kernel might be brought up properly, else, the bootup terminated, and error message will be printed out by printasscii, namely, debug_ll. Now to trigger the error, modify the machine type ID in arch/arm/tools/mach-types.
The two patches needed are attached, one is to add __debug_ll_ in _printk_, the other is to modify the settings to UART?, which is used to transmit chars.
diff --git a/kernel/printk.c b/kernel/printk.cindex e3602d0..e39866e 100644--- a/kernel/printk.c+++ b/kernel/printk.c@@ -44,6 +44,10 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...) #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) +#ifdef CONFIG_DEBUG_LL+extern void printascii(char *);+#endif+ /* printk's without a loglevel use this.. */ #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */ @@ -668,6 +672,10 @@ asmlinkage int vprintk(const char *fmt, va_list args) sizeof(printk_buf) - printed_len, fmt, args); +#ifdef CONFIG_DEBUG_LL+ printascii(printk_buf);+#endif+ /* * Copy the output into log_buf. If the caller didn't provide * appropriate log level tags, we insert them here------------------------------------------------------------------------
diff --git a/arch/arm/include/asm/hardware/debug-pl01x.S b/arch/arm/include/asm/hardware/debug-pl01x.Sindex f9fd083..1e30092 100644--- a/arch/arm/include/asm/hardware/debug-pl01x.S+++ b/arch/arm/include/asm/hardware/debug-pl01x.S@@ -17,13 +17,18 @@ .endm .macro waituart,rd,rx-1001: ldr \rd, [\rx, #UART01x_FR]- tst \rd, #UART01x_FR_TXFF- bne 1001b++@Refer to function __NS16550_putc()__ in uboot/drivers/ns16550.c+1001: ldr \rd, [\rx, #0x14] @Line Status Register / UART1_LSR_REG+ tst \rd, #0x20 @THRE bit of above register+ @which is Transmitter below threshold indicator.+ beq 1001b .endm .macro busyuart,rd,rx+#if 0 1001: ldr \rd, [\rx, #UART01x_FR] tst \rd, #UART01x_FR_BUSY bne 1001b+#endif .endmdiff --git a/arch/arm/mach-im9815/include/mach/debug-macro.S b/arch/arm/mach-im9815/include/mach/debug-macro.Sindex 165e083..4816f80 100644--- a/arch/arm/mach-im9815/include/mach/debug-macro.S+++ b/arch/arm/mach-im9815/include/mach/debug-macro.S@@ -10,14 +10,14 @@ * published by the Free Software Foundation. * */-+#include .macro addruart,rx mrc p15, 0, \rx, c1, c0 tst \rx, #1 @ MMU enabled?- moveq \rx, #0xf0000000- movne \rx, #0xef000000 @ virtual base- orr \rx, \rx, #0x00010000- orr \rx, \rx, #0x00000000+ ldreq \rx, =0xf0010000 @ physical base address of UART1+ ldrne \rx, =(IO_ADDRESS(EVB1226_UART0_BASE)) @ virtual base+@ orr \rx, \rx, #0x00010000+@ orr \rx, \rx, #0x00000000 .endm #include --------------------------------------------------------------------------------
The following is error message printed out triggered by the above settings:
U-Boot 1.1.6-gf616b9a4-dirty (Dec 1 2009 - 11:39:52)
DRAM: 128 MB
pll_switch
鯯witch PLL clock:
MCU_CLK: 208MHz.
DSP_CLK: 104MHz.
UART1~3 are assigned to ARM9!
SIM1 has initialized as VSIM1=3.3V!
PLL TEST cnt= 2
Flash: 8 MB
In: serial
Out: serial
Err: serial
boot_type_process: 1
The parameter "bootcmd" is synchronized.
bank: 1
Un-Protect Flash Bank # 1
bootcmd: nr 0x400000 0x46400000 0x33478; bootm 0x40000000
## Booting image at 40000000 ...
Image Name: Linux-2.6.29-00001-g8afb024-dirt
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1732552 Bytes = 1.7 MB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
OK
## Transferring control to Linux (at address 40008000) ...
Starting kernel ...
Error: unrecognized/unsupported machine ID (r1 = 0x0000047c).Available machine support:ID (hex) NAME0000047d iM9815 1226RC-1Please check your kernel config and/or bootloader.
阅读(2069) | 评论(0) | 转发(0) |