Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision bbb99f8282ee38769ab9130ff5683535ed6c6d33)
+++ HelenOS.config	(revision 68d873626159ee46816ad04fc6e4763eebe6eb12)
@@ -407,5 +407,5 @@
 
 % Support for Intel i8259 PIC
-! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_I8259 (y)
+! [PLATFORM=ia32|PLATFORM=amd64|(PLATFORM=mips32&MACHINE=bmalta)|(PLATFORM=mips32&MACHINE=lmalta)] CONFIG_I8259 (y)
 
 % Virtually indexed D-cache support
@@ -489,4 +489,7 @@
 ! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_NS16550 (y/n)
 
+% Support for NS16550 controller
+! [CONFIG_HID_IN=generic&PLATFORM=mips32&(MACHINE=lmalta|MACHINE=bmalta)] CONFIG_NS16550 (y)
+
 % Support for PL011 UART
 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&(MACHINE=integratorcp|MACHINE=raspberrypi)] CONFIG_PL011_UART (y/n)
@@ -501,4 +504,7 @@
 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_NS16550_KCON=y] CONFIG_NS16550_OUT (y)
 
+% Use NS16550 controller as dummy serial output (kernel console)
+! [CONFIG_HID_OUT=generic&PLATFORM=mips32&(MACHINE=lmalta|MACHINE=bmalta)] CONFIG_NS16550_OUT (y)
+
 % Support for Samsung S3C24XX on-chip UART
 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n)
@@ -535,5 +541,5 @@
 
 % Serial line input module
-! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_PL011_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_OMAP_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_OMAP_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)|(PLATFORM=arm32&MACHINE=raspberrypi&CONFIG_PL011_UART=y)|(PLATFORM=ia32&CONFIG_NS16550=y)|(PLATFORM=amd64&CONFIG_NS16550=y)] CONFIG_SRLN (y)
+! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_PL011_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_OMAP_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_OMAP_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)|(PLATFORM=arm32&MACHINE=raspberrypi&CONFIG_PL011_UART=y)|(PLATFORM=ia32&CONFIG_NS16550=y)|(PLATFORM=amd64&CONFIG_NS16550=y)|(PLATFORM=mips32&CONFIG_NS16550=y)] CONFIG_SRLN (y)
 
 % EGA support
Index: kernel/arch/mips32/include/arch/mach/malta/malta.h
===================================================================
--- kernel/arch/mips32/include/arch/mach/malta/malta.h	(revision bbb99f8282ee38769ab9130ff5683535ed6c6d33)
+++ kernel/arch/mips32/include/arch/mach/malta/malta.h	(revision 68d873626159ee46816ad04fc6e4763eebe6eb12)
@@ -38,4 +38,17 @@
 
 #include <arch/machine_func.h>
+#include <arch/mm/page.h>
+
+#define MALTA_PCI_BASE		PA2KSEG1(0x18000000UL)
+#define MALTA_GT64120_BASE	PA2KSEG1(0x1be00000UL)
+
+#define PIC0_BASE		(MALTA_PCI_BASE + 0x20)
+#define PIC1_BASE		(MALTA_PCI_BASE + 0xa0)
+
+#define TTY_BASE		(MALTA_PCI_BASE + 0x3f8)
+#define TTY_CPU_INT		2
+#define TTY_ISA_IRQ		4
+
+#define GT64120_PCI0_INTACK	(MALTA_GT64120_BASE + 0xc34)
 
 extern struct mips32_machine_ops malta_machine_ops;
Index: kernel/arch/mips32/include/arch/mm/page.h
===================================================================
--- kernel/arch/mips32/include/arch/mm/page.h	(revision bbb99f8282ee38769ab9130ff5683535ed6c6d33)
+++ kernel/arch/mips32/include/arch/mm/page.h	(revision 68d873626159ee46816ad04fc6e4763eebe6eb12)
@@ -43,4 +43,5 @@
 
 #ifndef __ASSEMBLER__
+#	define PA2KSEG1(x)	(((uintptr_t) (x)) + 0xa0000000)
 #	define KA2PA(x)	(((uintptr_t) (x)) - 0x80000000)
 #	define PA2KA(x)	(((uintptr_t) (x)) + 0x80000000)
Index: kernel/arch/mips32/src/exception.c
===================================================================
--- kernel/arch/mips32/src/exception.c	(revision bbb99f8282ee38769ab9130ff5683535ed6c6d33)
+++ kernel/arch/mips32/src/exception.c	(revision 68d873626159ee46816ad04fc6e4763eebe6eb12)
@@ -189,4 +189,6 @@
 				 */
 				irq->handler(irq);
+				if (irq->cir)
+					irq->cir(irq->cir_arg, i);
 				irq_spinlock_unlock(&irq->lock, false);
 			} else {
Index: kernel/arch/mips32/src/mach/malta/malta.c
===================================================================
--- kernel/arch/mips32/src/mach/malta/malta.c	(revision bbb99f8282ee38769ab9130ff5683535ed6c6d33)
+++ kernel/arch/mips32/src/mach/malta/malta.c	(revision 68d873626159ee46816ad04fc6e4763eebe6eb12)
@@ -38,4 +38,8 @@
 #include <console/chardev.h>
 #include <arch/mm/page.h>
+#include <genarch/drivers/i8259/i8259.h>
+#include <genarch/drivers/ns16550/ns16550.h>
+#include <genarch/srln/srln.h>
+#include <arch/interrupt.h>
 
 static void malta_init(void);
@@ -57,6 +61,32 @@
 };
 
+#ifdef CONFIG_NS16550
+static ns16550_instance_t *tty_instance;
+#endif
+#ifdef CONFIG_NS16550_OUT
+static outdev_t *tty_out;
+#endif
+
+#ifdef CONFIG_NS16550
+static void tty_clear_interrupt(void *arg, inr_t inr)
+{
+	(void) pio_read_8((ioport8_t *) GT64120_PCI0_INTACK);
+	pic_eoi();
+}
+#endif
+
 void malta_init(void)
 {
+	i8259_init((i8259_t *) PIC0_BASE, (i8259_t *) PIC1_BASE, 2, 0, 8);
+
+#if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT))
+#ifdef CONFIG_NS16550_OUT
+	outdev_t **tty_out_ptr = &tty_out;
+#else
+	outdev_t **tty_out_ptr = NULL;
+#endif
+	tty_instance = ns16550_init((ioport8_t *) TTY_BASE, 0, TTY_CPU_INT,
+	    tty_clear_interrupt, NULL, tty_out_ptr);
+#endif
 }
 
@@ -73,37 +103,26 @@
 }
 
-#define YAMON_SUBR_BASE         PA2KA(0x1fc00500)
-#define YAMON_SUBR_PRINT_COUNT  (YAMON_SUBR_BASE + 0x4)
-
-typedef void (**yamon_print_count_ptr_t)(uint32_t, const char *, uint32_t);
-
-yamon_print_count_ptr_t yamon_print_count =
-    (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
-
-static void yamon_putwchar(outdev_t *dev, const wchar_t wch)
-{
-
-	const char ch = (char) wch;
-
-	(*yamon_print_count)(0, &ch, 1);
-}
-
-static outdev_t yamon_outdev;
-static outdev_operations_t yamon_outdev_ops = {
-	.write = yamon_putwchar,
-	.redraw = NULL,
-	.scroll_up = NULL,
-	.scroll_down = NULL
-};
-
 void malta_output_init(void)
 {
-	outdev_initialize("yamon", &yamon_outdev, &yamon_outdev_ops);
-	stdout_wire(&yamon_outdev);
+#ifdef CONFIG_NS16550_OUT
+	if (tty_out)
+		stdout_wire(tty_out);
+#endif
 }
 
 void malta_input_init(void)
 {
-	(void) stdin_wire();
+#ifdef CONFIG_NS16550
+	if (tty_instance) {
+		srln_instance_t *srln_instance = srln_init();
+		if (srln_instance) {
+			indev_t *sink = stdin_wire();
+			indev_t *srln = srln_wire(srln_instance, sink);
+			ns16550_wire(tty_instance, srln);
+			pic_enable_irqs(1 << TTY_ISA_IRQ);
+			cp0_unmask_int(TTY_CPU_INT);
+		}
+	}
+#endif
 }
 
