Author: mcayland Date: Fri Oct 25 12:38:14 2013 New Revision: 1231 URL: http://tracker.coreboot.org/trac/openbios/changeset/1231
Log: escc/pc_serial: separate uart_* functions into separate namespaces
In order to allow architectures to support both ESCC and PC serial, add an escc_ prefix to the ESCC serial functions so that they can both co-exist within the same binary.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk CC: Andreas Färber afaerber@suse.de CC: Hervé Poussineau hpoussin@reactos.org
Modified: trunk/openbios-devel/arch/ppc/qemu/console.c trunk/openbios-devel/arch/sparc32/console.c trunk/openbios-devel/arch/sparc32/openbios.c trunk/openbios-devel/arch/sparc64/console.c trunk/openbios-devel/drivers/escc.c trunk/openbios-devel/drivers/pc_serial.c trunk/openbios-devel/include/drivers/drivers.h
Modified: trunk/openbios-devel/arch/ppc/qemu/console.c ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:14 2013 (r1231) @@ -24,7 +24,7 @@ static int mac_putchar(int c) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - serial_putchar(c); + escc_uart_putchar(c & 0xff); #endif return c; } @@ -32,7 +32,7 @@ static int mac_availchar(void) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - if (uart_charav(CONFIG_SERIAL_PORT)) + if (escc_uart_charav(CONFIG_SERIAL_PORT)) return 1; #endif return 0; @@ -41,8 +41,8 @@ static int mac_getchar(void) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - if (uart_charav(CONFIG_SERIAL_PORT)) - return (uart_getchar(CONFIG_SERIAL_PORT)); + if (escc_uart_charav(CONFIG_SERIAL_PORT)) + return (escc_uart_getchar(CONFIG_SERIAL_PORT)); #endif return 0; }
Modified: trunk/openbios-devel/arch/sparc32/console.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/console.c Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/arch/sparc32/console.c Fri Oct 25 12:38:14 2013 (r1231) @@ -22,7 +22,7 @@ static int arch_putchar(int c) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - serial_putchar(c); + escc_uart_putchar(c); #endif return c; } @@ -30,7 +30,7 @@ static int arch_availchar(void) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - if (uart_charav(CONFIG_SERIAL_PORT)) + if (escc_uart_charav(CONFIG_SERIAL_PORT)) return 1; #endif #ifdef CONFIG_DEBUG_CONSOLE_VIDEO @@ -43,8 +43,8 @@ static int arch_getchar(void) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - if (uart_charav(CONFIG_SERIAL_PORT)) - return (uart_getchar(CONFIG_SERIAL_PORT)); + if (escc_uart_charav(CONFIG_SERIAL_PORT)) + return (escc_uart_getchar(CONFIG_SERIAL_PORT)); #endif #ifdef CONFIG_DEBUG_CONSOLE_VIDEO if (keyboard_dataready())
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/arch/sparc32/openbios.c Fri Oct 25 12:38:14 2013 (r1231) @@ -941,7 +941,7 @@ #endif #ifdef CONFIG_DEBUG_CONSOLE #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - uart_init(hwdef->serial_base | (CONFIG_SERIAL_PORT? 0ULL: 4ULL), + escc_uart_init(hwdef->serial_base | (CONFIG_SERIAL_PORT? 0ULL: 4ULL), CONFIG_SERIAL_SPEED); #endif #ifdef CONFIG_DEBUG_CONSOLE_VIDEO
Modified: trunk/openbios-devel/arch/sparc64/console.c ============================================================================== --- trunk/openbios-devel/arch/sparc64/console.c Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/arch/sparc64/console.c Fri Oct 25 12:38:14 2013 (r1231) @@ -28,7 +28,7 @@ static int arch_putchar(int c) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - serial_putchar(c); + uart_putchar(c); #endif return c; }
Modified: trunk/openbios-devel/drivers/escc.c ============================================================================== --- trunk/openbios-devel/drivers/escc.c Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/drivers/escc.c Fri Oct 25 12:38:14 2013 (r1231) @@ -11,7 +11,7 @@ * serial console functions * ****************************************************************** */
-static volatile unsigned char *serial_dev; +static volatile unsigned char *escc_serial_dev;
#define CTRL(addr) (*(volatile unsigned char *)(uintptr_t)(addr)) #ifdef CONFIG_DRIVER_ESCC_SUN @@ -54,25 +54,25 @@ #define Rx_CH_AV 0x1 /* Rx Character Available */ #define Tx_BUF_EMP 0x4 /* Tx Buffer empty */
-int uart_charav(uintptr_t port) +int escc_uart_charav(uintptr_t port) { return (CTRL(port) & Rx_CH_AV) != 0; }
-char uart_getchar(uintptr_t port) +char escc_uart_getchar(uintptr_t port) { - while (!uart_charav(port)) + while (!escc_uart_charav(port)) ; return DATA(port) & 0177; }
-static void uart_putchar(uintptr_t port, unsigned char c) +static void escc_uart_port_putchar(uintptr_t port, unsigned char c) { - if (!serial_dev) + if (!escc_serial_dev) return;
if (c == '\n') - uart_putchar(port, '\r'); + escc_uart_port_putchar(port, '\r'); while (!(CTRL(port) & Tx_BUF_EMP)) ; DATA(port) = c; @@ -102,31 +102,31 @@
}
-int uart_init(phys_addr_t port, unsigned long speed) +int escc_uart_init(phys_addr_t port, unsigned long speed) { #ifdef CONFIG_DRIVER_ESCC_SUN - serial_dev = (unsigned char *)ofmem_map_io(port & ~7ULL, ZS_REGS); - serial_dev += port & 7ULL; + escc_serial_dev = (unsigned char *)ofmem_map_io(port & ~7ULL, ZS_REGS); + escc_serial_dev += port & 7ULL; #else - serial_dev = (unsigned char *)(uintptr_t)port; + escc_serial_dev = (unsigned char *)(uintptr_t)port; #endif - uart_init_line(serial_dev, speed); + uart_init_line(escc_serial_dev, speed); return -1; }
-void serial_putchar(int c) +void escc_uart_putchar(int c) { - uart_putchar((uintptr_t)serial_dev, (unsigned char) (c & 0xff)); + escc_uart_port_putchar((uintptr_t)escc_serial_dev, (unsigned char) (c & 0xff)); }
void serial_cls(void) { - serial_putchar(27); - serial_putchar('['); - serial_putchar('H'); - serial_putchar(27); - serial_putchar('['); - serial_putchar('J'); + escc_uart_putchar(27); + escc_uart_putchar('['); + escc_uart_putchar('H'); + escc_uart_putchar(27); + escc_uart_putchar('['); + escc_uart_putchar('J'); }
/* ( addr len -- actual ) */ @@ -142,8 +142,8 @@ if (len < 1) printk("escc_read: bad len, addr %p len %x\n", addr, len);
- if (uart_charav(*address)) { - *addr = (char)uart_getchar(*address); + if (escc_uart_charav(*address)) { + *addr = (char)escc_uart_getchar(*address); PUSH(1); } else { PUSH(0); @@ -161,7 +161,7 @@ addr = (unsigned char *)cell2pointer(POP());
for (i = 0; i < len; i++) { - uart_putchar(*address, addr[i]); + escc_uart_port_putchar(*address, addr[i]); } PUSH(len); } @@ -194,7 +194,7 @@ free(args); } #else - *address = (unsigned long)serial_dev; // XXX + *address = (unsigned long)escc_serial_dev; // XXX #endif RET ( -1 ); } @@ -470,7 +470,7 @@ escc_add_channel(buf, "a", addr, 1); escc_add_channel(buf, "b", addr, 0);
- serial_dev = (unsigned char *)addr + IO_ESCC_OFFSET + + escc_serial_dev = (unsigned char *)addr + IO_ESCC_OFFSET + (CONFIG_SERIAL_PORT ? 0 : 0x20); } #endif
Modified: trunk/openbios-devel/drivers/pc_serial.c ============================================================================== --- trunk/openbios-devel/drivers/pc_serial.c Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/drivers/pc_serial.c Fri Oct 25 12:38:14 2013 (r1231) @@ -40,10 +40,10 @@ return ((char) inb(RBR(port)) & 0177); }
-static void uart_putchar(int port, unsigned char c) +static void uart_port_putchar(int port, unsigned char c) { if (c == '\n') - uart_putchar(port, '\r'); + uart_port_putchar(port, '\r'); while (!(inb(LSR(port)) & 0x20)); outb(c, THR(port)); } @@ -91,9 +91,9 @@ return -1; }
-void serial_putchar(int c) +void uart_putchar(int c) { - uart_putchar(CONFIG_SERIAL_PORT, (unsigned char) (c & 0xff)); + uart_port_putchar(CONFIG_SERIAL_PORT, (unsigned char) (c & 0xff)); } #endif
@@ -129,7 +129,7 @@ addr = (unsigned char *)POP();
for (i = 0; i < len; i++) { - uart_putchar(*address, addr[i]); + uart_port_putchar(*address, addr[i]); } PUSH(len); }
Modified: trunk/openbios-devel/include/drivers/drivers.h ============================================================================== --- trunk/openbios-devel/include/drivers/drivers.h Fri Oct 25 12:38:08 2013 (r1230) +++ trunk/openbios-devel/include/drivers/drivers.h Fri Oct 25 12:38:14 2013 (r1231) @@ -109,13 +109,13 @@ int uart_init(int port, unsigned long speed); int uart_charav(int port); char uart_getchar(int port); -void serial_putchar(int c); +void uart_putchar(int c); #endif #ifdef CONFIG_DRIVER_ESCC -int uart_init(phys_addr_t port, unsigned long speed); -int uart_charav(uintptr_t port); -char uart_getchar(uintptr_t port); -void serial_putchar(int c); +int escc_uart_init(phys_addr_t port, unsigned long speed); +int escc_uart_charav(uintptr_t port); +char escc_uart_getchar(uintptr_t port); +void escc_uart_putchar(int c); void serial_cls(void); #ifdef CONFIG_DRIVER_ESCC_SUN int keyboard_dataready(void);