[OpenBIOS] [commit] r1232 - in trunk/openbios-devel: arch/ppc/qemu config/examples
repository service
svn at openbios.org
Fri Oct 25 12:38:25 CEST 2013
Author: mcayland
Date: Fri Oct 25 12:38:24 2013
New Revision: 1232
URL: http://tracker.coreboot.org/trac/openbios/changeset/1232
Log:
ppc: enable basic PReP serial console
This patch follows on from the previous patchsets and provides a basic PReP
serial console when launched under QEMU with -nographic. This is done by
including the PC serial driver as part of the PPC binary build and setting
up a prep_console_ops structure for use when PReP architecture is detected.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
CC: Andreas Färber <afaerber at suse.de>
CC: Hervé Poussineau <hpoussin at reactos.org>
Modified:
trunk/openbios-devel/arch/ppc/qemu/console.c
trunk/openbios-devel/arch/ppc/qemu/init.c
trunk/openbios-devel/arch/ppc/qemu/main.c
trunk/openbios-devel/config/examples/ppc_config.xml
Modified: trunk/openbios-devel/arch/ppc/qemu/console.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/arch/ppc/qemu/console.c Fri Oct 25 12:38:24 2013 (r1232)
@@ -53,4 +53,36 @@
.getchar = mac_getchar
};
+static int prep_putchar(int c)
+{
+#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
+ uart_putchar(c & 0xff);
+#endif
+ return c;
+}
+
+static int prep_availchar(void)
+{
+#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
+ if (uart_charav(CONFIG_SERIAL_PORT))
+ return 1;
+#endif
+ return 0;
+}
+
+static int prep_getchar(void)
+{
+#ifdef CONFIG_DEBUG_CONSOLE_SERIAL
+ if (uart_charav(CONFIG_SERIAL_PORT))
+ return (uart_getchar(CONFIG_SERIAL_PORT));
+#endif
+ return 0;
+}
+
+struct _console_ops prep_console_ops = {
+ .putchar = prep_putchar,
+ .availchar = prep_availchar,
+ .getchar = prep_getchar
+};
+
#endif // CONFIG_DEBUG_CONSOLE
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/init.c Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/arch/ppc/qemu/init.c Fri Oct 25 12:38:24 2013 (r1232)
@@ -163,7 +163,7 @@
};
unsigned long isa_io_base;
-extern struct _console_ops mac_console_ops;
+extern struct _console_ops mac_console_ops, prep_console_ops;
void
entry(void)
@@ -188,7 +188,11 @@
isa_io_base = arch->io_base;
#ifdef CONFIG_DEBUG_CONSOLE
- init_console(mac_console_ops);
+ if (is_apple()) {
+ init_console(mac_console_ops);
+ } else {
+ init_console(prep_console_ops);
+ }
#endif
if (temp != 1) {
@@ -658,6 +662,11 @@
ofmem_t *ofmem = ofmem_arch_get_private();
+ if (!is_apple()) {
+ /* Initialise PReP serial port */
+ ob_pc_serial_init("", "serial", arch->io_base, 0x3f8ULL, 0);
+ }
+
openbios_init();
modules_init();
setup_timers();
@@ -823,12 +832,17 @@
#endif
if (fw_cfg_read_i16(FW_CFG_NOGRAPHIC)) {
- if (CONFIG_SERIAL_PORT) {
- stdin_path = "scca";
- stdout_path = "scca";
+ if (is_apple()) {
+ if (CONFIG_SERIAL_PORT) {
+ stdin_path = "scca";
+ stdout_path = "scca";
+ } else {
+ stdin_path = "sccb";
+ stdout_path = "sccb";
+ }
} else {
- stdin_path = "sccb";
- stdout_path = "sccb";
+ stdin_path = "/serial";
+ stdout_path = "/serial";
}
/* Some bootloaders force the output to the screen device, so
Modified: trunk/openbios-devel/arch/ppc/qemu/main.c
==============================================================================
--- trunk/openbios-devel/arch/ppc/qemu/main.c Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/arch/ppc/qemu/main.c Fri Oct 25 12:38:24 2013 (r1232)
@@ -22,6 +22,7 @@
#include "libc/diskio.h"
#include "libc/vsprintf.h"
#include "kernel.h"
+#include "drivers/drivers.h"
#include "libopenbios/ofmem.h"
#define NO_QEMU_PROTOS
#include "arch/common/fw_cfg.h"
@@ -78,5 +79,7 @@
check_preloaded_kernel();
}
- update_nvram();
+ if (is_apple()) {
+ update_nvram();
+ }
}
Modified: trunk/openbios-devel/config/examples/ppc_config.xml
==============================================================================
--- trunk/openbios-devel/config/examples/ppc_config.xml Fri Oct 25 12:38:14 2013 (r1231)
+++ trunk/openbios-devel/config/examples/ppc_config.xml Fri Oct 25 12:38:24 2013 (r1232)
@@ -8,6 +8,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_DRIVER_PC_SERIAL" type="boolean" value="true"/>
<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"/>
More information about the OpenBIOS
mailing list