免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1496 | 回复: 0
打印 上一主题 下一主题

Usage of debug_ll [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-10 22:59 |只看该作者 |倒序浏览

                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 Assemble
Actually, 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  +#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.
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/43047/showart_2116835.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP