Commit f68f3400 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: early printk support from Todd Inglett

parent 2afbb6a5
...@@ -7,6 +7,7 @@ define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n ...@@ -7,6 +7,7 @@ define_bool CONFIG_RWSEM_GENERIC_SPINLOCK n
define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM y
define_bool CONFIG_GENERIC_ISA_DMA y define_bool CONFIG_GENERIC_ISA_DMA y
define_bool CONFIG_HAVE_DEC_LOCK y define_bool CONFIG_HAVE_DEC_LOCK y
define_bool CONFIG_EARLY_PRINTK y
source init/Config.in source init/Config.in
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <linux/ide.h> #include <linux/ide.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/console.h>
#include <linux/version.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -116,6 +118,23 @@ void ppcdbg_initialize(void) { ...@@ -116,6 +118,23 @@ void ppcdbg_initialize(void) {
_naca->debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */; _naca->debug_switch = PPC_DEBUG_DEFAULT; /* | PPCDBG_BUSWALK | PPCDBG_PHBINIT | PPCDBG_MM | PPCDBG_MMINIT | PPCDBG_TCEINIT | PPCDBG_TCE */;
} }
static struct console udbg_console = {
name: "udbg",
write: udbg_console_write,
flags: CON_PRINTBUFFER,
index: -1,
};
static int early_console_initialized;
void __init disable_early_printk(void)
{
if (!early_console_initialized)
return;
unregister_console(&udbg_console);
early_console_initialized = 0;
}
/* /*
* Do some initial setup of the system. The paramters are those which * Do some initial setup of the system. The paramters are those which
* were passed in from the bootloader. * were passed in from the bootloader.
...@@ -162,62 +181,31 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -162,62 +181,31 @@ void setup_system(unsigned long r3, unsigned long r4, unsigned long r5,
#endif #endif
} }
udbg_puts("\n-----------------------------------------------------\n"); if (naca->platform & PLATFORM_PSERIES) {
udbg_puts("Naca Info...\n\n"); early_console_initialized = 1;
udbg_puts("naca = 0x"); register_console(&udbg_console);
udbg_puthex((unsigned long)naca); }
udbg_putc('\n');
udbg_puts("naca->physicalMemorySize = 0x");
udbg_puthex(naca->physicalMemorySize);
udbg_putc('\n');
udbg_puts("naca->dCacheL1LineSize = 0x");
udbg_puthex(naca->dCacheL1LineSize);
udbg_putc('\n');
udbg_puts("naca->dCacheL1LogLineSize = 0x");
udbg_puthex(naca->dCacheL1LogLineSize);
udbg_putc('\n');
udbg_puts("naca->dCacheL1LinesPerPage = 0x");
udbg_puthex(naca->dCacheL1LinesPerPage);
udbg_putc('\n');
udbg_puts("naca->iCacheL1LineSize = 0x");
udbg_puthex(naca->iCacheL1LineSize);
udbg_putc('\n');
udbg_puts("naca->iCacheL1LogLineSize = 0x");
udbg_puthex(naca->iCacheL1LogLineSize);
udbg_putc('\n');
udbg_puts("naca->iCacheL1LinesPerPage = 0x");
udbg_puthex(naca->iCacheL1LinesPerPage);
udbg_putc('\n');
udbg_puts("naca->pftSize = 0x");
udbg_puthex(naca->pftSize);
udbg_putc('\n');
udbg_puts("naca->serialPortAddr = 0x");
udbg_puthex(naca->serialPortAddr);
udbg_putc('\n');
udbg_puts("naca->interrupt_controller = 0x");
udbg_puthex(naca->interrupt_controller);
udbg_putc('\n');
udbg_printf("\nHTAB Info ...\n\n");
udbg_puts("htab_data.htab = 0x");
udbg_puthex((unsigned long)htab_data.htab);
udbg_putc('\n');
udbg_puts("htab_data.num_ptegs = 0x");
udbg_puthex(htab_data.htab_num_ptegs);
udbg_putc('\n');
udbg_puts("\n-----------------------------------------------------\n"); printk("Starting Linux PPC64 %s\n", UTS_RELEASE);
printk("-----------------------------------------------------\n");
printk("naca = 0x%p\n", naca);
#if 0
printk("naca->processorCount = 0x%x\n", naca->processorCount);
#endif
printk("naca->physicalMemorySize = 0x%lx\n", naca->physicalMemorySize);
printk("naca->dCacheL1LineSize = 0x%x\n", naca->dCacheL1LineSize);
printk("naca->dCacheL1LogLineSize = 0x%x\n", naca->dCacheL1LogLineSize);
printk("naca->dCacheL1LinesPerPage = 0x%x\n", naca->dCacheL1LinesPerPage);
printk("naca->iCacheL1LineSize = 0x%x\n", naca->iCacheL1LineSize);
printk("naca->iCacheL1LogLineSize = 0x%x\n", naca->iCacheL1LogLineSize);
printk("naca->iCacheL1LinesPerPage = 0x%x\n", naca->iCacheL1LinesPerPage);
printk("naca->pftSize = 0x%lx\n", naca->pftSize);
printk("naca->debug_switch = 0x%lx\n", naca->debug_switch);
printk("naca->interrupt_controller = 0x%d\n", naca->interrupt_controller);
printk("htab_data.htab = 0x%p\n", htab_data.htab);
printk("htab_data.num_ptegs = 0x%lx\n", htab_data.htab_num_ptegs);
printk("-----------------------------------------------------\n");
if (naca->platform & PLATFORM_PSERIES) { if (naca->platform & PLATFORM_PSERIES) {
finish_device_tree(); finish_device_tree();
...@@ -492,7 +480,6 @@ void __init ppc64_calibrate_delay(void) ...@@ -492,7 +480,6 @@ void __init ppc64_calibrate_delay(void)
printk("Calibrating delay loop... %lu.%02lu BogoMips\n", printk("Calibrating delay loop... %lu.%02lu BogoMips\n",
loops_per_jiffy/(500000/HZ), loops_per_jiffy/(500000/HZ),
loops_per_jiffy/(5000/HZ) % 100); loops_per_jiffy/(5000/HZ) % 100);
} }
extern void (*calibrate_delay)(void); extern void (*calibrate_delay)(void);
......
...@@ -52,8 +52,6 @@ struct NS16550 { ...@@ -52,8 +52,6 @@ struct NS16550 {
volatile struct NS16550 *udbg_comport; volatile struct NS16550 *udbg_comport;
spinlock_t udbg_lock = SPIN_LOCK_UNLOCKED;
void void
udbg_init_uart(void *comport) udbg_init_uart(void *comport)
{ {
...@@ -160,6 +158,12 @@ udbg_read(char *buf, int buflen) { ...@@ -160,6 +158,12 @@ udbg_read(char *buf, int buflen) {
return i; return i;
} }
void
udbg_console_write(struct console *con, const char *s, unsigned int n)
{
udbg_write(s, n);
}
void void
udbg_puthex(unsigned long val) udbg_puthex(unsigned long val)
{ {
...@@ -190,16 +194,13 @@ udbg_printSP(const char *s) ...@@ -190,16 +194,13 @@ udbg_printSP(const char *s)
void void
udbg_printf(const char *fmt, ...) udbg_printf(const char *fmt, ...)
{ {
unsigned long flags;
unsigned char buf[256]; unsigned char buf[256];
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
spin_lock_irqsave(&udbg_lock, flags);
vsprintf(buf, fmt, args); vsprintf(buf, fmt, args);
udbg_puts(buf); udbg_puts(buf);
spin_unlock_irqrestore(&udbg_lock, flags);
va_end(args); va_end(args);
} }
...@@ -208,7 +209,6 @@ udbg_printf(const char *fmt, ...) ...@@ -208,7 +209,6 @@ udbg_printf(const char *fmt, ...)
void void
udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
{ {
unsigned long flags;
unsigned long active_debugs = debug_flags & naca->debug_switch; unsigned long active_debugs = debug_flags & naca->debug_switch;
if ( active_debugs ) { if ( active_debugs ) {
...@@ -216,7 +216,6 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) ...@@ -216,7 +216,6 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
unsigned char buf[256]; unsigned char buf[256];
unsigned long i, len = 0; unsigned long i, len = 0;
spin_lock_irqsave(&udbg_lock, flags);
for(i=0; i < PPCDBG_NUM_FLAGS ;i++) { for(i=0; i < PPCDBG_NUM_FLAGS ;i++) {
if (((1U << i) & active_debugs) && if (((1U << i) & active_debugs) &&
trace_names[i]) { trace_names[i]) {
...@@ -237,7 +236,6 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...) ...@@ -237,7 +236,6 @@ udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(buf, fmt, ap); vsprintf(buf, fmt, ap);
udbg_puts(buf); udbg_puts(buf);
spin_unlock_irqrestore(&udbg_lock, flags);
va_end(ap); va_end(ap);
} }
......
...@@ -55,7 +55,7 @@ static u_int bus_error_jmp[100]; ...@@ -55,7 +55,7 @@ static u_int bus_error_jmp[100];
/* Breakpoint stuff */ /* Breakpoint stuff */
struct bpt { struct bpt {
unsigned long address; unsigned long address;
unsigned long instr; unsigned instr;
unsigned long count; unsigned long count;
unsigned char enabled; unsigned char enabled;
char funcname[64]; /* function name for humans */ char funcname[64]; /* function name for humans */
......
...@@ -17,6 +17,8 @@ int udbg_getc_poll(void); ...@@ -17,6 +17,8 @@ int udbg_getc_poll(void);
void udbg_puts(const char *s); void udbg_puts(const char *s);
int udbg_write(const char *s, int n); int udbg_write(const char *s, int n);
int udbg_read(char *buf, int buflen); int udbg_read(char *buf, int buflen);
struct console;
void udbg_console_write(struct console *con, const char *s, unsigned int n);
void udbg_puthex(unsigned long val); void udbg_puthex(unsigned long val);
void udbg_printSP(const char *s); void udbg_printSP(const char *s);
void udbg_printf(const char *fmt, ...); void udbg_printf(const char *fmt, ...);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment