Author: blueswirl Date: 2008-12-24 08:12:14 +0100 (Wed, 24 Dec 2008) New Revision: 323
Modified: openbios-devel/drivers/obio.c Log: Fix serial console broken by r317
Modified: openbios-devel/drivers/obio.c =================================================================== --- openbios-devel/drivers/obio.c 2008-12-23 20:36:45 UTC (rev 322) +++ openbios-devel/drivers/obio.c 2008-12-24 07:12:14 UTC (rev 323) @@ -119,8 +119,8 @@
static volatile unsigned char *kbd_dev, *serial_dev;
-#define CTRL(port) serial_dev[(port) * 2 + 0] -#define DATA(port) serial_dev[(port) * 2 + 2] +#define CTRL(addr) (*(volatile unsigned char *)(addr)) +#define DATA(addr) (*(volatile unsigned char *)(addr + 2))
/* Conversion routines to/from brg time constants from/to bits * per second. @@ -177,7 +177,7 @@ DATA(port) = c; }
-static void uart_init_line(int port, unsigned long baud) +static void uart_init_line(volatile unsigned char *port, unsigned long baud) { CTRL(port) = 4; // reg 4 CTRL(port) = SB1 | X16CLK; // no parity, async, 1 stop bit, 16x @@ -203,19 +203,17 @@
int uart_init(uint64_t port, unsigned long speed) { - int line; - serial_dev = map_io(port & ~7ULL, 2 * 4); serial_dev += port & 7ULL; - line = port & 3ULL; - uart_init_line(line, speed); + uart_init_line(serial_dev, speed);
return -1; }
void serial_putchar(int c) { - uart_putchar(CONFIG_SERIAL_PORT, (unsigned char) (c & 0xff)); + uart_putchar((int)(serial_dev + CONFIG_SERIAL_PORT), + (unsigned char) (c & 0xff)); }
void serial_cls(void)