Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb6b9b28 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras
Browse files

[PATCH] powerpc: udbg updates



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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 54b9a9ae
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -276,7 +276,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,


 finish:
 finish:
	of_dump_addr("OF: parent translation for:", addr, pna);
	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 */
	/* Translate it into parent bus space */
	return pbus->translate(addr, offset, pna);
	return pbus->translate(addr, offset, pna);
+7 −4
Original line number Original line Diff line number Diff line
@@ -17,7 +17,7 @@
#include <asm/processor.h>
#include <asm/processor.h>


void (*udbg_putc)(char c);
void (*udbg_putc)(char c);
char (*udbg_getc)(void);
int (*udbg_getc)(void);
int (*udbg_getc_poll)(void);
int (*udbg_getc_poll)(void);


/* udbg library, used by xmon et al */
/* udbg library, used by xmon et al */
@@ -57,8 +57,8 @@ int udbg_write(const char *s, int n)


int udbg_read(char *buf, int buflen)
int udbg_read(char *buf, int buflen)
{
{
	char c, *p = buf;
	char *p = buf;
	int i;
	int i, c;


	if (!udbg_getc)
	if (!udbg_getc)
		return 0;
		return 0;
@@ -66,8 +66,11 @@ int udbg_read(char *buf, int buflen)
	for (i = 0; i < buflen; ++i) {
	for (i = 0; i < buflen; ++i) {
		do {
		do {
			c = udbg_getc();
			c = udbg_getc();
			if (c == -1 && i == 0)
				return -1;

		} while (c == 0x11 || c == 0x13);
		} while (c == 0x11 || c == 0x13);
		if (c == 0)
		if (c == 0 || c == -1)
			break;
			break;
		*p++ = c;
		*p++ = c;
	}
	}
+2 −2
Original line number Original line Diff line number Diff line
@@ -69,14 +69,14 @@ static int udbg_550_getc_poll(void)
	return -1;
	return -1;
}
}


static char udbg_550_getc(void)
static int udbg_550_getc(void)
{
{
	if (udbg_comport) {
	if (udbg_comport) {
		while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
		while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
			/* wait for char */;
			/* wait for char */;
		return in_8(&udbg_comport->rbr);
		return in_8(&udbg_comport->rbr);
	}
	}
	return 0;
	return -1;
}
}


void udbg_init_uart(void __iomem *comport, unsigned int speed,
void udbg_init_uart(void __iomem *comport, unsigned int speed,
+4 −4
Original line number Original line Diff line number Diff line
@@ -29,7 +29,7 @@
 */
 */


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 int (*udbg_adb_old_getc_poll)(void);


static enum {
static enum {
@@ -73,7 +73,7 @@ static unsigned char xmon_shift_keytab[128] =
	"\0.\0*\0+\0\0\0\0\0/\r\0-\0"			/* 0x40 - 0x4f */
	"\0.\0*\0+\0\0\0\0\0/\r\0-\0"			/* 0x40 - 0x4f */
	"\0\0000123456789\0\0\0";			/* 0x50 - 0x5f */
	"\0\0000123456789\0\0\0";			/* 0x50 - 0x5f */


static char udbg_adb_local_getc(void)
static int udbg_adb_local_getc(void)
{
{
	int k, t, on;
	int k, t, on;


@@ -116,7 +116,7 @@ static char 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
#ifdef CONFIG_BOOTX_TEXT
	if (udbg_adb_use_btext && input_type != input_adb_none)
	if (udbg_adb_use_btext && input_type != input_adb_none)
@@ -195,7 +195,7 @@ int udbg_adb_init(int force_btext)
	 */
	 */
	for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
	for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
		struct device_node *parent = of_get_parent(np);
		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);
		of_node_put(parent);
		if (found)
		if (found)
			break;
			break;
+2 −2
Original line number Original line Diff line number Diff line
@@ -47,14 +47,14 @@ static int udbg_scc_getc_poll(void)
	return -1;
	return -1;
}
}


static char udbg_scc_getc(void)
static int udbg_scc_getc(void)
{
{
	if (sccc) {
	if (sccc) {
		while ((in_8(sccc) & SCC_RXRDY) == 0)
		while ((in_8(sccc) & SCC_RXRDY) == 0)
			;
			;
		return in_8(sccd);
		return in_8(sccd);
	}
	}
	return 0;
	return -1;
}
}


static unsigned char scc_inittab[] = {
static unsigned char scc_inittab[] = {
Loading