lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 5 May 2008 08:36:37 -0600
From:	"Grant Likely" <grant.likely@...retlab.ca>
To:	monstr@...nam.cz
Cc:	linux-kernel@...r.kernel.org, arnd@...db.de,
	linux-arch@...r.kernel.org, stephen.neuendorffer@...inx.com,
	John.Linn@...inx.com, john.williams@...alogix.com, matthew@....cx,
	will.newton@...il.com, drepper@...hat.com,
	microblaze-uclinux@...e.uq.edu.au,
	"Michal Simek" <monstr@...str.eu>
Subject: Re: [PATCH 18/56] microblaze_v2: early_printk support

On Sun, May 4, 2008 at 5:41 AM,  <monstr@...nam.cz> wrote:
> From: Michal Simek <monstr@...str.eu>
>
>
>  Signed-off-by: Michal Simek <monstr@...str.eu>

I'm not opposed to this as is, but longer term will you be getting the
base address out of the device tree instead of from
CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS?

Cheers,
g.

>  ---
>   arch/microblaze/kernel/early_printk.c |  115 +++++++++++++++++++++++++++++++++
>   1 files changed, 115 insertions(+), 0 deletions(-)
>   create mode 100644 arch/microblaze/kernel/early_printk.c
>
>  diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
>  new file mode 100644
>  index 0000000..0f533ff
>  --- /dev/null
>  +++ b/arch/microblaze/kernel/early_printk.c
>  @@ -0,0 +1,115 @@
>  +/*
>  + * arch/microblaze/kernel/early_printk.c
>  + *
>  + * Copyright (C) 2007 Michal Simek <monstr@...str.eu>
>  + * Copyright (C) 2003-2006 Yasushi SHOJI <yashi@...ark-techno.com>
>  + *
>  + * Early printk support for Microblaze.
>  + *
>  + * Once we got some system without uart light, we need to refactor.
>  + */
>  +
>  +#include <linux/console.h>
>  +#include <linux/kernel.h>
>  +#include <linux/init.h>
>  +#include <linux/string.h>
>  +#include <linux/tty.h>
>  +#include <asm/io.h>
>  +#include <asm/processor.h>
>  +#include <asm/fcntl.h>
>  +#include <asm/setup.h>
>  +
>  +#ifdef CONFIG_EARLY_PRINTK
>  +#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS)
>  +
>  +#define RX_FIFO        BASE_ADDR
>  +#define TX_FIFO        ((unsigned long *)(BASE_ADDR + 4))
>  +#define STATUS ((unsigned long *)(BASE_ADDR + 8))
>  +#define CONTROL        ((unsigned long *)(BASE_ADDR + 12))
>  +
>  +static void early_printk_putc(char c)
>  +{
>  +       while (ioread32(STATUS) & (1<<3));
>  +       iowrite32((c & 0xff), TX_FIFO);
>  +}
>  +
>  +static void early_printk_write(struct console *unused,
>  +                                       const char *s, unsigned n)
>  +{
>  +       while (*s && n-- > 0) {
>  +               early_printk_putc(*s);
>  +               if (*s == '\n')
>  +                       early_printk_putc('\r');
>  +               s++;
>  +       }
>  +}
>  +
>  +static struct console early_serial_console = {
>  +       .name = "earlyser",
>  +       .write = early_printk_write,
>  +       .flags = CON_PRINTBUFFER,
>  +       .index = -1,
>  +};
>  +
>  +/* Direct interface for emergencies */
>  +static struct console *early_console = &early_serial_console;
>  +static int early_console_initialized;
>  +
>  +void early_printk(const char *fmt, ...)
>  +{
>  +       char buf[512];
>  +       int n;
>  +       va_list ap;
>  +
>  +       if (early_console_initialized) {
>  +               va_start(ap, fmt);
>  +               n = vscnprintf(buf, 512, fmt, ap);
>  +               early_console->write(early_console, buf, n);
>  +               va_end(ap);
>  +       }
>  +}
>  +
>  +static int __initdata keep_early;
>  +
>  +int __init setup_early_printk(char *opt)
>  +{
>  +       char *space;
>  +       char buf[256];
>  +
>  +       if (early_console_initialized)
>  +               return 1;
>  +
>  +       strlcpy(buf, opt, sizeof(buf));
>  +       space = strchr(buf, ' ');
>  +       if (space)
>  +               *space = 0;
>  +
>  +       if (strstr(buf, "keep"))
>  +               keep_early = 1;
>  +
>  +       early_console = &early_serial_console;
>  +       early_console_initialized = 1;
>  +       register_console(early_console);
>  +       return 0;
>  +}
>  +#if 0
>  +static void __init disable_early_printk(void)
>  +{
>  +       if (!early_console_initialized || !early_console)
>  +               return;
>  +       if (!keep_early) {
>  +               printk(KERN_INFO "disabling early console\n");
>  +               unregister_console(early_console);
>  +               early_console_initialized = 0;
>  +       } else
>  +               printk(KERN_INFO "keeping early console\n");
>  +}
>  +#endif
>  +
>  +__setup("earlyprintk=", setup_early_printk);
>  +
>  +#else
>  +void early_printk(const char *fmt, ...)
>  +{
>  +}
>  +#endif
>  --
>  1.5.4.GIT
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ