okl4: use bender, read out comport from BDA

Issue #768
This commit is contained in:
Alexander Boettcher 2013-06-10 11:36:21 +02:00 committed by Norman Feske
parent 32fb7bbddd
commit 1887222b53
3 changed files with 67 additions and 1 deletions

View File

@ -61,6 +61,11 @@ This directory contains patches for the OKL4 kernel version 2.1.1-patch.9.
console instead of sending an exception IPC to the userland. This patch
fixes the problem by removing the code that invokes the debugger console.
:'bda.patch':
This patch reads out the I/O port of the serial device from the BIOS data
area (on x86).
Applying the patches
--------------------

View File

@ -0,0 +1,59 @@
--- pistachio/platform/pc99/pistachio/kdb/io.cc 2013-06-10 11:34:34.607813369 +0200
+++ pistachio/platform/pc99/pistachio/kdb/io.cc 2013-06-10 11:32:02.607810593 +0200
@@ -336,16 +336,23 @@
#define COMPORT CONFIG_KDB_COMPORT
#define RATE CONFIG_KDB_COMSPEED
+static unsigned short comport = COMPORT;
+
void Platform::serial_init(void)
{
-#define IER (COMPORT+1)
-#define EIR (COMPORT+2)
-#define LCR (COMPORT+3)
-#define MCR (COMPORT+4)
-#define LSR (COMPORT+5)
-#define MSR (COMPORT+6)
-#define DLLO (COMPORT+0)
-#define DLHI (COMPORT+1)
+ /* read BDA region to obtain I/O ports of serial device */
+ unsigned short comport_count = (*((unsigned short *)0x410) >> 9) & 0x7;
+ if (comport_count)
+ comport = *((unsigned short *)0x400);
+
+#define IER (comport+1)
+#define EIR (comport+2)
+#define LCR (comport+3)
+#define MCR (comport+4)
+#define LSR (comport+5)
+#define MSR (comport+6)
+#define DLLO (comport+0)
+#define DLHI (comport+1)
out_u8(LCR, 0x80); /* select bank 1 */
for (volatile int i = 10000000; i--; );
@@ -367,8 +374,8 @@
void Platform::serial_putc(char c)
{
- while ((in_u8(COMPORT+5) & 0x60) == 0);
- out_u8(COMPORT,c);
+ while ((in_u8(comport+5) & 0x60) == 0);
+ out_u8(comport,c);
if (c == '\n')
Platform::serial_putc('\r');
@@ -376,11 +383,11 @@
int Platform::serial_getc(bool can_block)
{
- if ((in_u8(COMPORT+5) & 0x01) == 0)
+ if ((in_u8(comport+5) & 0x01) == 0)
{
return -1;
}
- return (int) in_u8(COMPORT);
+ return (int) in_u8(comport);
}
DECLARE_CMD (cmd_dumpvga, arch, 'V', "screendump", "dump VGA screen contents");

View File

@ -11,6 +11,7 @@
#
proc install_pxe_bootloader_to_run_dir { } {
exec cp [genode_dir]/tool/boot/pulsar [run_dir]/boot/pulsar
exec cp [genode_dir]/tool/boot/bender [run_dir]/boot/bender
}
##
@ -211,7 +212,8 @@ proc build_boot_image {binaries} {
set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"]
# load okl4 at 256M to avoid overwritting binary, adjust by need
puts $fh " addr 0x10000000"
puts $fh " exec /image.elf"
puts $fh " exec /boot/bender"
puts $fh " load /image.elf"
close $fh
#