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 --- openbios-devel/arch/ppc/qemu/console.c | 8 ++--- openbios-devel/arch/sparc32/console.c | 8 ++--- openbios-devel/arch/sparc32/openbios.c | 2 +- openbios-devel/arch/sparc64/console.c | 2 +- openbios-devel/drivers/escc.c | 50 +++++++++++++++--------------- openbios-devel/drivers/pc_serial.c | 10 +++--- openbios-devel/include/drivers/drivers.h | 10 +++--- 7 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/openbios-devel/arch/ppc/qemu/console.c b/openbios-devel/arch/ppc/qemu/console.c index affafc1..25b21c0 100644 --- a/openbios-devel/arch/ppc/qemu/console.c +++ b/openbios-devel/arch/ppc/qemu/console.c @@ -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_putchar(int c) 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_availchar(void) 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; } diff --git a/openbios-devel/arch/sparc32/console.c b/openbios-devel/arch/sparc32/console.c index 9a6912b..61c2e23 100644 --- a/openbios-devel/arch/sparc32/console.c +++ b/openbios-devel/arch/sparc32/console.c @@ -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_putchar(int c) 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_availchar(void) 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()) diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c index a8b20b2..abdfe7c 100644 --- a/openbios-devel/arch/sparc32/openbios.c +++ b/openbios-devel/arch/sparc32/openbios.c @@ -941,7 +941,7 @@ int openbios(void) #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 diff --git a/openbios-devel/arch/sparc64/console.c b/openbios-devel/arch/sparc64/console.c index 1cb00d9..6ab5cba 100644 --- a/openbios-devel/arch/sparc64/console.c +++ b/openbios-devel/arch/sparc64/console.c @@ -28,7 +28,7 @@ static int arch_putchar(int c) { #ifdef CONFIG_DEBUG_CONSOLE_SERIAL - serial_putchar(c); + uart_putchar(c); #endif return c; } diff --git a/openbios-devel/drivers/escc.c b/openbios-devel/drivers/escc.c index 5690625..105a47d 100644 --- a/openbios-devel/drivers/escc.c +++ b/openbios-devel/drivers/escc.c @@ -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 @@ static volatile unsigned char *serial_dev; #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 @@ static void uart_init_line(volatile unsigned char *port, unsigned long baud)
}
-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 @@ escc_read(ucell *address) 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 @@ escc_write(ucell *address) 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 @@ escc_open(ucell *address) free(args); } #else - *address = (unsigned long)serial_dev; // XXX + *address = (unsigned long)escc_serial_dev; // XXX #endif RET ( -1 ); } @@ -470,7 +470,7 @@ escc_init(const char *path, phys_addr_t addr) 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 diff --git a/openbios-devel/drivers/pc_serial.c b/openbios-devel/drivers/pc_serial.c index 5882a05..6192f18 100644 --- a/openbios-devel/drivers/pc_serial.c +++ b/openbios-devel/drivers/pc_serial.c @@ -40,10 +40,10 @@ char uart_getchar(int port) 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 @@ int uart_init(int port, unsigned long speed) 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 @@ pc_serial_write(unsigned long *address) addr = (unsigned char *)POP();
for (i = 0; i < len; i++) { - uart_putchar(*address, addr[i]); + uart_port_putchar(*address, addr[i]); } PUSH(len); } diff --git a/openbios-devel/include/drivers/drivers.h b/openbios-devel/include/drivers/drivers.h index 47d730f..52bc881 100644 --- a/openbios-devel/include/drivers/drivers.h +++ b/openbios-devel/include/drivers/drivers.h @@ -109,13 +109,13 @@ void ob_pc_serial_init(const char *path, const char *dev_name, uint64_t base, 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);