Use ESCC for PowerMac serial

git-svn-id: svn://coreboot.org/openbios/openbios-devel@392 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2009-01-12 17:47:56 +00:00
parent 4f2d4ae6f2
commit 3eda0189f0
6 changed files with 8 additions and 124 deletions

View File

@@ -12,120 +12,10 @@
*/
#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 @@ int getchar(void)
#endif
return 0;
}
void cls(void)
{
#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
serial_cls();
#endif
}
#endif // CONFIG_DEBUG_CONSOLE

View File

@@ -148,7 +148,7 @@ entry( void )
isa_io_base = arch->io_base;
serial_init();
uart_init(0x80013000ULL, CONFIG_SERIAL_SPEED);
printk("\n");
printk("=============================================================\n");

View File

@@ -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 */

View File

@@ -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>

View File

@@ -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>

View File

@@ -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 @@ ob_macio_init(const char *path, uint32_t addr)
cuda_init(path, addr);
macio_nvram_init(path, addr);
escc_init(path, addr);
}