Author: blueswirl Date: 2009-01-12 18:47:56 +0100 (Mon, 12 Jan 2009) New Revision: 392
Modified: openbios-devel/arch/ppc/qemu/console.c openbios-devel/arch/ppc/qemu/init.c openbios-devel/arch/ppc/qemu/qemu.h openbios-devel/config/examples/cross-ppc_config.xml openbios-devel/config/examples/ppc_config.xml openbios-devel/drivers/macio.c Log: Use ESCC for PowerMac serial
Modified: openbios-devel/arch/ppc/qemu/console.c =================================================================== --- openbios-devel/arch/ppc/qemu/console.c 2009-01-12 17:46:19 UTC (rev 391) +++ openbios-devel/arch/ppc/qemu/console.c 2009-01-12 17:47:56 UTC (rev 392) @@ -12,121 +12,11 @@ */
#include "openbios/config.h" -#include "openbios/kernel.h" #include "openbios/bindings.h" -#include "libc/diskio.h" -#include "ofmem.h" -#include "qemu/qemu.h" -#include "video_subr.h" +#include "openbios/drivers.h"
#ifdef CONFIG_DEBUG_CONSOLE - /* ****************************************************************** - * serial console functions - * ****************************************************************** */ - -#ifdef CONFIG_DEBUG_CONSOLE_SERIAL - -#define UART(port) (port==2?0x2f8:0x3f8) - -#define RBR(port) (UART(port) + 0) -#define THR(port) (UART(port) + 0) -#define IER(port) (UART(port) + 1) -#define IIR(port) (UART(port) + 2) -#define LCR(port) (UART(port) + 3) -#define MCR(port) (UART(port) + 4) -#define LSR(port) (UART(port) + 5) -#define MSR(port) (UART(port) + 6) -#define SCR(port) (UART(port) + 7) -#define DLL(port) (UART(port) + 0) -#define DLM(port) (UART(port) + 1) - -static int uart_charav(int port) -{ - if (!port) - return -1; - return ((inb(LSR(port)) & 1) != 0); -} - -static char uart_getchar(int port) -{ - if (!port) - return -1; - while (!uart_charav(port)); - return ((char) inb(RBR(port)) & 0177); -} - -static void uart_putchar(int port, unsigned char c) -{ - if (!port) - return; - while (!(inb(LSR(port)) & 0x20)); - outb(c, THR(port)); -} - -static void serial_putchar(int c) -{ - if (c == '\n') - uart_putchar(CONFIG_SERIAL_PORT, '\r'); - uart_putchar(CONFIG_SERIAL_PORT, c); -} - -static void uart_init_line(int port, unsigned long baud) -{ - int i, baudconst; - - switch (baud) { - case 115200: - baudconst = 1; - break; - case 57600: - baudconst = 2; - break; - case 38400: - baudconst = 3; - break; - case 19200: - baudconst = 6; - break; - case 9600: - default: - baudconst = 12; - break; - } - - outb(0x87, LCR(port)); - outb(0x00, DLM(port)); - outb(baudconst, DLL(port)); - outb(0x07, LCR(port)); - outb(0x0f, MCR(port)); - - for (i = 10; i > 0; i--) { - if (inb(LSR(port)) == (unsigned int) 0) - break; - inb(RBR(port)); - } -} - -int -serial_init(void) -{ - if (CONFIG_SERIAL_PORT) - uart_init_line(CONFIG_SERIAL_PORT, CONFIG_SERIAL_SPEED); - return -1; -} - -static void serial_cls(void) -{ - serial_putchar(27); - serial_putchar('['); - serial_putchar('H'); - serial_putchar(27); - serial_putchar('['); - serial_putchar('J'); -} -#endif // CONFIG_DEBUG_CONSOLE_SERIAL - -/* ****************************************************************** * common functions, implementing simple concurrent console * ****************************************************************** */
@@ -155,11 +45,4 @@ #endif return 0; } - -void cls(void) -{ -#ifdef CONFIG_DEBUG_CONSOLE_SERIAL - serial_cls(); -#endif -} #endif // CONFIG_DEBUG_CONSOLE
Modified: openbios-devel/arch/ppc/qemu/init.c =================================================================== --- openbios-devel/arch/ppc/qemu/init.c 2009-01-12 17:46:19 UTC (rev 391) +++ openbios-devel/arch/ppc/qemu/init.c 2009-01-12 17:47:56 UTC (rev 392) @@ -148,7 +148,7 @@
isa_io_base = arch->io_base;
- serial_init(); + uart_init(0x80013000ULL, CONFIG_SERIAL_SPEED);
printk("\n"); printk("=============================================================\n");
Modified: openbios-devel/arch/ppc/qemu/qemu.h =================================================================== --- openbios-devel/arch/ppc/qemu/qemu.h 2009-01-12 17:46:19 UTC (rev 391) +++ openbios-devel/arch/ppc/qemu/qemu.h 2009-01-12 17:47:56 UTC (rev 392) @@ -19,9 +19,6 @@ extern int vfd_draw_str( const char *str ); extern void vfd_close( void );
-/* console.c */ -int serial_init(void); - #include "kernel.h"
#endif /* _H_QEMU */
Modified: openbios-devel/config/examples/cross-ppc_config.xml =================================================================== --- openbios-devel/config/examples/cross-ppc_config.xml 2009-01-12 17:46:19 UTC (rev 391) +++ openbios-devel/config/examples/cross-ppc_config.xml 2009-01-12 17:47:56 UTC (rev 392) @@ -24,7 +24,7 @@ <option name="CONFIG_DEBUG_INTERPRETER" type="boolean" value="false"/> <option name="CONFIG_DEBUG_CONSOLE" type="boolean" value="true"/> <option name="CONFIG_DEBUG_CONSOLE_SERIAL" type="boolean" value="true"/> - <option name="CONFIG_SERIAL_PORT" type="integer" value="1"/> + <option name="CONFIG_SERIAL_PORT" type="integer" value="0"/> <option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/> <option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
@@ -74,5 +74,6 @@ <option name="CONFIG_DRIVER_ADB" type="boolean" value="true"/> <option name="CONFIG_DRIVER_VGA" type="boolean" value="true"/> <option name="CONFIG_DRIVER_MACIO" type="boolean" value="true"/> + <option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
</config>
Modified: openbios-devel/config/examples/ppc_config.xml =================================================================== --- openbios-devel/config/examples/ppc_config.xml 2009-01-12 17:46:19 UTC (rev 391) +++ openbios-devel/config/examples/ppc_config.xml 2009-01-12 17:47:56 UTC (rev 392) @@ -24,7 +24,7 @@ <option name="CONFIG_DEBUG_INTERPRETER" type="boolean" value="false"/> <option name="CONFIG_DEBUG_CONSOLE" type="boolean" value="true"/> <option name="CONFIG_DEBUG_CONSOLE_SERIAL" type="boolean" value="true"/> - <option name="CONFIG_SERIAL_PORT" type="integer" value="1"/> + <option name="CONFIG_SERIAL_PORT" type="integer" value="0"/> <option name="CONFIG_SERIAL_SPEED" type="integer" value="115200"/> <option name="CONFIG_DEBUG_CONSOLE_VGA" type="boolean" value="true"/>
@@ -74,5 +74,6 @@ <option name="CONFIG_DRIVER_ADB" type="boolean" value="true"/> <option name="CONFIG_DRIVER_VGA" type="boolean" value="true"/> <option name="CONFIG_DRIVER_MACIO" type="boolean" value="true"/> + <option name="CONFIG_DRIVER_ESCC" type="boolean" value="true"/>
</config>
Modified: openbios-devel/drivers/macio.c =================================================================== --- openbios-devel/drivers/macio.c 2009-01-12 17:46:19 UTC (rev 391) +++ openbios-devel/drivers/macio.c 2009-01-12 17:47:56 UTC (rev 392) @@ -16,6 +16,7 @@
#include "macio.h" #include "cuda.h" +#include "escc.h"
#define IO_NVRAM_SIZE 0x00020000 #define IO_NVRAM_OFFSET 0x00060000 @@ -137,4 +138,5 @@
cuda_init(path, addr); macio_nvram_init(path, addr); + escc_init(path, addr); }