The udbg low level io layer has an issue with udbg_getc() returning a
char (unsigned on ppc) instead of an int, thus the -1 if you had no
available input device could end up turned into 0xff, filling your
display with bogus characters. This fixes it, along with adding a little
blob to xmon to do a delay before exiting when getting an EOF and fixing
the detection of ADB keyboards in udbg_adb.c
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
finish:
of_dump_addr("OF: parent translation for:", addr, pna);
finish:
of_dump_addr("OF: parent translation for:", addr, pna);
- DBG("OF: with offset: %lx\n", offset);
+ DBG("OF: with offset: "PRu64"\n", offset);
/* Translate it into parent bus space */
return pbus->translate(addr, offset, pna);
/* Translate it into parent bus space */
return pbus->translate(addr, offset, pna);
#include <asm/processor.h>
void (*udbg_putc)(char c);
#include <asm/processor.h>
void (*udbg_putc)(char c);
-char (*udbg_getc)(void);
int (*udbg_getc_poll)(void);
/* udbg library, used by xmon et al */
int (*udbg_getc_poll)(void);
/* udbg library, used by xmon et al */
int udbg_read(char *buf, int buflen)
{
int udbg_read(char *buf, int buflen)
{
- char c, *p = buf;
- int i;
+ char *p = buf;
+ int i, c;
if (!udbg_getc)
return 0;
if (!udbg_getc)
return 0;
for (i = 0; i < buflen; ++i) {
do {
c = udbg_getc();
for (i = 0; i < buflen; ++i) {
do {
c = udbg_getc();
+ if (c == -1 && i == 0)
+ return -1;
+
} while (c == 0x11 || c == 0x13);
} while (c == 0x11 || c == 0x13);
-static char udbg_550_getc(void)
+static int udbg_550_getc(void)
{
if (udbg_comport) {
while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
/* wait for char */;
return in_8(&udbg_comport->rbr);
}
{
if (udbg_comport) {
while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
/* wait for char */;
return in_8(&udbg_comport->rbr);
}
}
void udbg_init_uart(void __iomem *comport, unsigned int speed,
}
void udbg_init_uart(void __iomem *comport, unsigned int speed,
*/
static void (*udbg_adb_old_putc)(char c);
*/
static void (*udbg_adb_old_putc)(char c);
-static char (*udbg_adb_old_getc)(void);
+static int (*udbg_adb_old_getc)(void);
static int (*udbg_adb_old_getc_poll)(void);
static enum {
static int (*udbg_adb_old_getc_poll)(void);
static enum {
"\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
"\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
"\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
"\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
-static char udbg_adb_local_getc(void)
+static int udbg_adb_local_getc(void)
}
#endif /* CONFIG_BOOTX_TEXT */
}
#endif /* CONFIG_BOOTX_TEXT */
-static char udbg_adb_getc(void)
+static int udbg_adb_getc(void)
{
#ifdef CONFIG_BOOTX_TEXT
if (udbg_adb_use_btext && input_type != input_adb_none)
{
#ifdef CONFIG_BOOTX_TEXT
if (udbg_adb_use_btext && input_type != input_adb_none)
*/
for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
struct device_node *parent = of_get_parent(np);
*/
for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
struct device_node *parent = of_get_parent(np);
- int found = (parent && !strcmp(parent->type, "adb") == 0);
+ int found = (parent && strcmp(parent->type, "adb") == 0);
of_node_put(parent);
if (found)
break;
of_node_put(parent);
if (found)
break;
-static char udbg_scc_getc(void)
+static int udbg_scc_getc(void)
{
if (sccc) {
while ((in_8(sccc) & SCC_RXRDY) == 0)
;
return in_8(sccd);
}
{
if (sccc) {
while ((in_8(sccc) & SCC_RXRDY) == 0)
;
return in_8(sccd);
}
}
static unsigned char scc_inittab[] = {
}
static unsigned char scc_inittab[] = {
-static char udbg_hvsi_getc(void)
+static int udbg_hvsi_getc(void)
-static char udbg_getcLP(void)
+static int udbg_getcLP(void)
leave:
cpu_clear(cpu, cpus_in_xmon);
xmon_fault_jmp[cpu] = NULL;
leave:
cpu_clear(cpu, cpus_in_xmon);
xmon_fault_jmp[cpu] = NULL;
#else
/* UP is simple... */
if (in_xmon) {
#else
/* UP is simple... */
if (in_xmon) {
break;
case 'x':
case 'X':
break;
case 'x':
case 'X':
+ printf(" <no input ...>\n");
+ mdelay(2000);
return cmd;
case '?':
printf(help_string);
return cmd;
case '?':
printf(help_string);
goto fail;
}
taddr = of_translate_address(vias, reg);
goto fail;
}
taddr = of_translate_address(vias, reg);
+ if (taddr == OF_BAD_ADDR) {
printk(KERN_ERR "via-pmu: Can't translate address !\n");
goto fail;
}
printk(KERN_ERR "via-pmu: Can't translate address !\n");
goto fail;
}
- printk(KERN_INFO "PMU driver %d initialized for %s, firmware: %02x\n",
+ printk(KERN_INFO "PMU driver v%d initialized for %s, firmware: %02x\n",
PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version);
sys_ctrler = SYS_CTRLER_PMU;
PMU_DRIVER_VERSION, pbook_type[pmu_kind], pmu_version);
sys_ctrler = SYS_CTRLER_PMU;
#include <linux/init.h>
extern void (*udbg_putc)(char c);
#include <linux/init.h>
extern void (*udbg_putc)(char c);
-extern char (*udbg_getc)(void);
+extern int (*udbg_getc)(void);
extern int (*udbg_getc_poll)(void);
extern void udbg_puts(const char *s);
extern int (*udbg_getc_poll)(void);
extern void udbg_puts(const char *s);