[PATCH] powerpc: Make early debugging configurable via Kconfig

This patch adds Kconfig entries to control the early debugging options,
currently in setup_64.c.

Doing this via Kconfig rather than #defines means you can have one source tree,
which is buildable for multiple platforms - and you can enable the correct
early debug option for each platform via .config.

I made udbg_early_init() a static inline because otherwise GCC is to daft to
optimise it away when debugging is off.

Now that we have udbg_init_rtas() we can make call_rtas_display_status* static.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Michael Ellerman
2006-01-11 11:54:09 +11:00
committed by Paul Mackerras
parent bf6a7112bd
commit 296167ae17
8 changed files with 88 additions and 43 deletions

View File

@@ -29,6 +29,7 @@
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/lmb.h>
#include <asm/udbg.h>
struct rtas_t rtas = {
.lock = SPIN_LOCK_UNLOCKED
@@ -52,7 +53,7 @@ EXPORT_SYMBOL(rtas_flash_term_hook);
* are designed only for very early low-level debugging, which
* is why the token is hard-coded to 10.
*/
void call_rtas_display_status(unsigned char c)
static void call_rtas_display_status(char c)
{
struct rtas_args *args = &rtas.args;
unsigned long s;
@@ -65,14 +66,14 @@ void call_rtas_display_status(unsigned char c)
args->nargs = 1;
args->nret = 1;
args->rets = (rtas_arg_t *)&(args->args[1]);
args->args[0] = (int)c;
args->args[0] = (unsigned char)c;
enter_rtas(__pa(args));
spin_unlock_irqrestore(&rtas.lock, s);
}
void call_rtas_display_status_delay(unsigned char c)
static void call_rtas_display_status_delay(char c)
{
static int pending_newline = 0; /* did last write end with unprinted newline? */
static int width = 16;
@@ -96,6 +97,11 @@ void call_rtas_display_status_delay(unsigned char c)
}
}
void __init udbg_init_rtas(void)
{
udbg_putc = call_rtas_display_status_delay;
}
void rtas_progress(char *s, unsigned short hex)
{
struct device_node *root;

View File

@@ -70,37 +70,6 @@
#define DBG(fmt...)
#endif
/*
* Here are some early debugging facilities. You can enable one
* but your kernel will not boot on anything else if you do so
*/
/* For use on LPAR machines that support an HVC console on vterm 0 */
extern void udbg_init_debug_lpar(void);
/* This one is for use on Apple G5 machines */
extern void udbg_init_pmac_realmode(void);
/* That's RTAS panel debug */
extern void call_rtas_display_status_delay(unsigned char c);
/* Here's maple real mode debug */
extern void udbg_init_maple_realmode(void);
/* For iSeries - hit Ctrl-x Ctrl-x to see the output */
extern void udbg_init_iseries(void);
#define EARLY_DEBUG_INIT() do {} while(0)
#if 0
#define EARLY_DEBUG_INIT() udbg_init_debug_lpar()
#define EARLY_DEBUG_INIT() udbg_init_iseries()
#define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
#define EARLY_DEBUG_INIT() \
do { udbg_putc = call_rtas_display_status_delay; } while(0)
#endif
int have_of = 1;
int boot_cpuid = 0;
int boot_cpuid_phys = 0;
@@ -241,11 +210,8 @@ void __init early_setup(unsigned long dt_ptr)
struct paca_struct *lpaca = get_paca();
static struct machdep_calls **mach;
/*
* Enable early debugging if any specified (see top of
* this file)
*/
EARLY_DEBUG_INIT();
/* Enable early debugging if any specified (see udbg.h) */
udbg_early_init();
DBG(" -> early_setup()\n");

View File

@@ -15,11 +15,36 @@
#include <linux/sched.h>
#include <linux/console.h>
#include <asm/processor.h>
#include <asm/udbg.h>
void (*udbg_putc)(char c);
int (*udbg_getc)(void);
int (*udbg_getc_poll)(void);
/*
* Early debugging facilities. You can enable _one_ of these via .config,
* if you do so your kernel _will not boot_ on anything else. Be careful.
*/
void __init udbg_early_init(void)
{
#if defined(CONFIG_PPC_EARLY_DEBUG_LPAR)
/* For LPAR machines that have an HVC console on vterm 0 */
udbg_init_debug_lpar();
#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
/* For use on Apple G5 machines */
udbg_init_pmac_realmode();
#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS)
/* RTAS panel debug */
udbg_init_rtas();
#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
/* Maple real mode debug */
udbg_init_maple_realmode();
#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
/* For iSeries - hit Ctrl-x Ctrl-x to see the output */
udbg_init_iseries();
#endif
}
/* udbg library, used by xmon et al */
void udbg_puts(const char *s)
{

View File

@@ -155,7 +155,7 @@ void udbg_maple_real_putc(unsigned char c)
}
}
void udbg_init_maple_realmode(void)
void __init udbg_init_maple_realmode(void)
{
udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;