From bdd2935d4a00d9271fbc132f01dc23ecb1d7674e Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 10 Jun 2013 13:16:53 +0200 Subject: [PATCH] pistachio: use bender, read out comport from BDA Issue #768 --- base-pistachio/Makefile | 2 + base-pistachio/patches/bda.patch | 70 ++++++++++++++++++++++++++++++++ base-pistachio/run/env | 4 +- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 base-pistachio/patches/bda.patch diff --git a/base-pistachio/Makefile b/base-pistachio/Makefile index 2a5ba87524..1b8e55d765 100644 --- a/base-pistachio/Makefile +++ b/base-pistachio/Makefile @@ -53,6 +53,8 @@ $(CONTRIB_DIR): prepare: $(CONTRIB_DIR) $(VERBOSE)cd $(CONTRIB_DIR); git fetch; git reset --hard $(GIT_REV) + $(ECHO) "applying patches to '$(CONTRIB_DIR)/'" + $(VERBOSE)for i in $(PATCHES); do patch -d $(CONTRIB_DIR) -p1 < $$i; done @# use GCC front end for as linker for the pistachio user land $(VERBOSE)sed -i "/LD=/s/^.*$$/LD=\$$(CC)/" $(CONTRIB_DIR)/user/config.mk.in @# add '-Wl,' prefix to '-melf_*' linker options diff --git a/base-pistachio/patches/bda.patch b/base-pistachio/patches/bda.patch new file mode 100644 index 0000000000..3f89fbbac8 --- /dev/null +++ b/base-pistachio/patches/bda.patch @@ -0,0 +1,70 @@ +diff --git a/kernel/kdb/platform/pc99/io.cc b/kernel/kdb/platform/pc99/io.cc +index 9dedf7a..0a70b23 100644 +--- a/kernel/kdb/platform/pc99/io.cc ++++ b/kernel/kdb/platform/pc99/io.cc +@@ -299,17 +299,23 @@ static char getc_screen (bool block) + ** + */ + ++static unsigned short comport = COMPORT; + + static void init_serial (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--; ); +@@ -326,13 +332,14 @@ static void init_serial (void) + in_u8(MCR); + in_u8(LSR); + in_u8(MSR); ++ + } + + + static void putc_serial (const char c) + { + while ((in_u8(LSR) & 0x20) == 0); +- out_u8(COMPORT,c); ++ out_u8(comport,c); + while ((in_u8(LSR) & 0x40) == 0); + if (c == '\n') + putc_serial('\r'); +@@ -357,7 +364,7 @@ static char getc_serial (bool block) + getc_blocked = false; + + } +- return in_u8(COMPORT); ++ return in_u8(comport); + } + + #if defined(CONFIG_KDB_BREAKIN) +@@ -381,7 +388,7 @@ void kdebug_check_breakin (void) + } + #endif + #if defined(CONFIG_KDB_BREAKIN_ESCAPE) +- if ((c & 0x01) && (in_u8(COMPORT) == 0x1b)) ++ if ((c & 0x01) && (in_u8(comport) == 0x1b)) + enter_kdebug("breakin"); + #endif + return; diff --git a/base-pistachio/run/env b/base-pistachio/run/env index c0ce135295..32ef731f45 100644 --- a/base-pistachio/run/env +++ b/base-pistachio/run/env @@ -12,6 +12,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 } @@ -119,7 +120,8 @@ proc build_boot_image {binaries} { # Generate pulsar config file # set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"] - puts $fh " exec /pistachio/kickstart" + puts $fh " exec /boot/bender" + puts $fh " load /pistachio/kickstart" puts $fh " load /pistachio/kernel" puts $fh " load /pistachio/sigma0" puts $fh " load /genode/core"