pistachio: use bender, read out comport from BDA

Issue #768
This commit is contained in:
Alexander Boettcher 2013-06-10 13:16:53 +02:00 committed by Norman Feske
parent 1887222b53
commit bdd2935d4a
3 changed files with 75 additions and 1 deletions

View File

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

View File

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

View File

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