Re: [PATCH v2] x86: Early-boot serial I/O support

From: Cyrill Gorcunov
Date: Sat Jul 10 2010 - 17:08:01 EST


On Sat, Jul 10, 2010 at 10:40:20PM +0300, Pekka Enberg wrote:
> This patch adds serial I/O support to very early boot printf(). It's useful for
> debugging boot code when running Linux under KVM, for example. The actual code
> was lifted from early printk.
>
> Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Yinghai Lu <yinghai@xxxxxxxxxx>
> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
> ---
> v1 -> v2:
>
> - Use 'earlyprintk' kernel parameter to determine whether to use
> early serial or not as suggested by Yinghai and hpa.
>
> arch/x86/boot/boot.h | 16 +++++++
> arch/x86/boot/main.c | 3 +
> arch/x86/boot/string.c | 41 ++++++++++++++++++
> arch/x86/boot/tty.c | 111 +++++++++++++++++++++++++++++++++++++++++++++---
> 4 files changed, 165 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
> index 98239d2..f05b5ac 100644
> --- a/arch/x86/boot/boot.h
> +++ b/arch/x86/boot/boot.h
> @@ -37,6 +37,8 @@
> extern struct setup_header hdr;
> extern struct boot_params boot_params;
>
> +#define cpu_relax() asm volatile("rep; nop" ::: "memory")
> +
> /* Basic port I/O */
> static inline void outb(u8 v, u16 port)
> {
> @@ -203,6 +205,17 @@ static inline int isdigit(int ch)
> return (ch >= '0') && (ch <= '9');
> }
>
> +static inline int isxdigit(int ch)
> +{
> + if (isdigit(ch))
> + return true;
> +
> + if ((ch >= 'a') && (ch <= 'f'))
> + return true;
> +
> + return (ch >= 'A') && (ch <= 'F');
> +}
> +

I suspect it's supposed to be static inline *bool*, right?

-- Cyrill
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/