免费注册 查看新帖 |

Chinaunix

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

[硬件及驱动] 8250.c中printk等级高,系统重启 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-12-29 01:26 |只看该作者 |倒序浏览
static void
receive_chars(struct uart_8250_port *up, unsigned int *status)
{
        struct tty_struct *tty = up->port.state->port.tty;
        unsigned char ch, lsr = *status;
        int max_count = 256;
        char flag;

        do {
                if (likely(lsr & UART_LSR_DR)) {
                        ch = serial_inp(up, UART_RX);
+                        if (ch == '$')
+                            printk(KERN_EMERG"----------\n");
                }
                else
                        /*
                         * Intel 82571 has a Serial Over Lan device that will
                         * set UART_LSR_BI without setting UART_LSR_DR when
                         * it receives a break. To avoid reading from the
                         * receive buffer without UART_LSR_DR bit set, we
                         * just force the read character to be 0
                         */
                        ch = 0;

                flag = TTY_NORMAL;
                up->port.icount.rx++;

                lsr |= up->lsr_saved_flags;
                up->lsr_saved_flags = 0;

                if (unlikely(lsr & UART_LSR_BRK_ERROR_BITS)) {
                        /*
                         * For statistics only
                         */
                        if (lsr & UART_LSR_BI) {
                                lsr &= ~(UART_LSR_FE | UART_LSR_PE);
                                up->port.icount.brk++;
                                /*
                                 * We do the SysRQ and SAK checking
                                 * here because otherwise the break
                                 * may get masked by ignore_status_mask
                                 * or read_status_mask.
                                 */
                                if (uart_handle_break(&up->port))
                                        goto ignore_char;
                        } else if (lsr & UART_LSR_PE)
                                up->port.icount.parity++;
                        else if (lsr & UART_LSR_FE)
                                up->port.icount.frame++;
                        if (lsr & UART_LSR_OE)
                                up->port.icount.overrun++;

                        /*
                         * Mask off conditions which should be ignored.
                         */
                        lsr &= up->port.read_status_mask;

                        if (lsr & UART_LSR_BI) {
                                DEBUG_INTR("handling break....");
                                flag = TTY_BREAK;
                        } else if (lsr & UART_LSR_PE)
                                flag = TTY_PARITY;
                        else if (lsr & UART_LSR_FE)
                                flag = TTY_FRAME;
                }
                if (uart_handle_sysrq_char(&up->port, ch))
                        goto ignore_char;

                uart_insert_char(&up->port, lsr, UART_LSR_OE, ch, flag);

ignore_char:
                lsr = serial_inp(up, UART_LSR);
        } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0));
        spin_unlock(&up->port.lock);
        tty_flip_buffer_push(tty);
        spin_lock(&up->port.lock);
        *status = lsr;
}

类似上面的添加的两行,当在串口输入'$'时就重启了。

或者
+                        if (ch == '$')
+                            printk("----------\n");
这个时候在串口输入'$',dmesg查看信息能输出。
然后修改 echo "7" > /proc/sys/kernel/printk
这个时候再在串口输入'$',系统就重启了。

请问原因是?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP