Index: uspace/drv/char/msim-con/Makefile
===================================================================
--- uspace/drv/char/msim-con/Makefile	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
+++ uspace/drv/char/msim-con/Makefile	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2017 Jiri Svoboda
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+USPACE_PREFIX = ../../..
+LIBS = drv
+BINARY = msim-con
+
+SOURCES = \
+	main.c \
+	msim-con.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/char/msim-con/main.c
===================================================================
--- uspace/drv/char/msim-con/main.c	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
+++ uspace/drv/char/msim-con/main.c	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2017 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup genarch
+ * @{
+ */
+/** @file MSIM console driver
+ */
+
+#include <ddf/driver.h>
+#include <ddf/log.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "msim-con.h"
+
+#define NAME  "msim-con"
+
+static int msim_con_dev_add(ddf_dev_t *dev);
+static int msim_con_dev_remove(ddf_dev_t *dev);
+static int msim_con_dev_gone(ddf_dev_t *dev);
+static int msim_con_fun_online(ddf_fun_t *fun);
+static int msim_con_fun_offline(ddf_fun_t *fun);
+
+static driver_ops_t driver_ops = {
+	.dev_add = msim_con_dev_add,
+	.dev_remove = msim_con_dev_remove,
+	.dev_gone = msim_con_dev_gone,
+	.fun_online = msim_con_fun_online,
+	.fun_offline = msim_con_fun_offline
+};
+
+static driver_t msim_con_driver = {
+	.name = NAME,
+	.driver_ops = &driver_ops
+};
+
+static int msim_con_dev_add(ddf_dev_t *dev)
+{
+	msim_con_t *msim_con;
+
+        ddf_msg(LVL_DEBUG, "msim_con_dev_add(%p)", dev);
+	msim_con = ddf_dev_data_alloc(dev, sizeof(msim_con_t));
+	if (msim_con == NULL) {
+		ddf_msg(LVL_ERROR, "Failed allocating soft state.");
+		return ENOMEM;
+	}
+
+	msim_con->dev = dev;
+
+	return msim_con_add(msim_con);
+}
+
+static int msim_con_dev_remove(ddf_dev_t *dev)
+{
+        msim_con_t *msim_con = (msim_con_t *)ddf_dev_data_get(dev);
+
+        ddf_msg(LVL_DEBUG, "msim_con_dev_remove(%p)", dev);
+
+        return msim_con_remove(msim_con);
+}
+
+static int msim_con_dev_gone(ddf_dev_t *dev)
+{
+        msim_con_t *msim_con = (msim_con_t *)ddf_dev_data_get(dev);
+
+        ddf_msg(LVL_DEBUG, "msim_con_dev_gone(%p)", dev);
+
+        return msim_con_gone(msim_con);
+}
+
+static int msim_con_fun_online(ddf_fun_t *fun)
+{
+        ddf_msg(LVL_DEBUG, "msim_con_fun_online()");
+        return ddf_fun_online(fun);
+}
+
+static int msim_con_fun_offline(ddf_fun_t *fun)
+{
+        ddf_msg(LVL_DEBUG, "msim_con_fun_offline()");
+        return ddf_fun_offline(fun);
+}
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": MSIM console driver\n");
+	ddf_log_init(NAME);
+	return ddf_driver_main(&msim_con_driver);
+}
+
+/** @}
+ */
Index: uspace/drv/char/msim-con/msim-con.c
===================================================================
--- uspace/drv/char/msim-con/msim-con.c	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
+++ uspace/drv/char/msim-con/msim-con.c	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2006 Josef Cejka
+ * Copyright (c) 2011 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @file
+ * @brief Msim console driver.
+ */
+
+#include <async.h>
+#include <ddf/driver.h>
+#include <ddf/log.h>
+#include <ddi.h>
+#include <errno.h>
+#include <ipc/char.h>
+#include <sysinfo.h>
+
+#include "msim-con.h"
+
+static void msim_con_connection(ipc_callid_t, ipc_call_t *, void *);
+
+static irq_pio_range_t msim_ranges[] = {
+	{
+		.base = 0,
+		.size = 1
+	}
+};
+
+static irq_cmd_t msim_cmds[] = {
+	{
+		.cmd = CMD_PIO_READ_8,
+		.addr = (void *) 0,	/* will be patched in run-time */
+		.dstarg = 2
+	},
+	{
+		.cmd = CMD_ACCEPT
+	}
+};
+
+static irq_code_t msim_kbd = {
+	sizeof(msim_ranges) / sizeof(irq_pio_range_t),
+	msim_ranges,
+	sizeof(msim_cmds) / sizeof(irq_cmd_t),
+	msim_cmds
+};
+#include <stdio.h>
+static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
+{
+	msim_con_t *con = (msim_con_t *) arg;
+	uint8_t c;
+
+	c = IPC_GET_ARG2(*call);
+	printf("key=%d\n", c);
+	if (con->client_sess != NULL) {
+		async_exch_t *exch = async_exchange_begin(con->client_sess);
+		async_msg_1(exch, CHAR_NOTIF_BYTE, c);
+		async_exchange_end(exch);
+	}
+}
+
+/** Add msim console device. */
+int msim_con_add(msim_con_t *con)
+{
+	ddf_fun_t *fun = NULL;
+	bool subscribed = false;
+	int rc;
+
+	printf("msim_con_add\n");
+	fun = ddf_fun_create(con->dev, fun_exposed, "a");
+	if (fun == NULL) {
+		ddf_msg(LVL_ERROR, "Error creating function 'a'.");
+		rc = ENOMEM;
+		goto error;
+	}
+
+	ddf_fun_set_conn_handler(fun, msim_con_connection);
+
+	sysarg_t paddr;
+	if (sysinfo_get_value("kbd.address.physical", &paddr) != EOK) {
+		rc = ENOENT;
+		goto error;
+	}
+
+	sysarg_t inr;
+	if (sysinfo_get_value("kbd.inr", &inr) != EOK) {
+		rc = ENOENT;
+		goto error;
+	}
+
+	printf("msim_con_add: irq subscribe\n");
+
+	msim_ranges[0].base = paddr;
+	msim_cmds[0].addr = (void *) paddr;
+	async_irq_subscribe(inr, msim_irq_handler, con, &msim_kbd);
+	subscribed = true;
+
+	printf("msim_con_add: bind\n");
+	rc = ddf_fun_bind(fun);
+	if (rc != EOK) {
+		ddf_msg(LVL_ERROR, "Error binding function 'a'.");
+		goto error;
+	}
+
+	printf("msim_con_add: DONE\n");
+	return EOK;
+error:
+	if (subscribed)
+		async_irq_unsubscribe(inr);
+	if (fun != NULL)
+		ddf_fun_destroy(fun);
+
+	return rc;
+}
+
+/** Remove msim console device */
+int msim_con_remove(msim_con_t *con)
+{
+	return ENOTSUP;
+}
+
+/** Msim console device gone */
+int msim_con_gone(msim_con_t *con)
+{
+	return ENOTSUP;
+}
+
+static void msim_con_putchar(msim_con_t *con, uint8_t ch)
+{
+}
+
+/** Character device connection handler. */
+static void msim_con_connection(ipc_callid_t iid, ipc_call_t *icall,
+    void *arg)
+{
+	msim_con_t *con;
+
+	/* Answer the IPC_M_CONNECT_ME_TO call. */
+	async_answer_0(iid, EOK);
+
+	printf("msim_con_connection\n");
+
+	con = (msim_con_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
+
+	while (true) {
+		ipc_call_t call;
+		ipc_callid_t callid = async_get_call(&call);
+		sysarg_t method = IPC_GET_IMETHOD(call);
+
+		if (!method) {
+			/* The other side has hung up. */
+			async_answer_0(callid, EOK);
+			return;
+		}
+
+		async_sess_t *sess =
+		    async_callback_receive_start(EXCHANGE_SERIALIZE, &call);
+		if (sess != NULL) {
+			if (con->client_sess == NULL) {
+				con->client_sess = sess;
+				async_answer_0(callid, EOK);
+			} else
+				async_answer_0(callid, ELIMIT);
+			printf("msim_con_connection: set client_sess\n");
+		} else {
+			switch (method) {
+			case CHAR_WRITE_BYTE:
+				ddf_msg(LVL_DEBUG, "Write %" PRIun " to device\n",
+				    IPC_GET_ARG1(call));
+				msim_con_putchar(con, (uint8_t) IPC_GET_ARG1(call));
+				async_answer_0(callid, EOK);
+				break;
+			default:
+				async_answer_0(callid, EINVAL);
+			}
+		}
+	}
+}
+
+/** @}
+ */
Index: uspace/drv/char/msim-con/msim-con.h
===================================================================
--- uspace/drv/char/msim-con/msim-con.h	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
+++ uspace/drv/char/msim-con/msim-con.h	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2017 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup genarch
+ * @{
+ */
+/** @file
+ */
+
+#ifndef MSIM_CON_H
+#define MSIM_CON_H
+
+#include <async.h>
+#include <ddf/driver.h>
+#include <loc.h>
+#include <stdint.h>
+
+/** MSIM console */
+typedef struct {
+	async_sess_t *client_sess;
+	ddf_dev_t *dev;
+} msim_con_t;
+
+extern int msim_con_init(msim_con_t *);
+extern void msim_con_write(uint8_t data);
+
+
+extern int msim_con_add(msim_con_t *);
+extern int msim_con_remove(msim_con_t *);
+extern int msim_con_gone(msim_con_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/drv/char/msim-con/msim-con.ma
===================================================================
--- uspace/drv/char/msim-con/msim-con.ma	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
+++ uspace/drv/char/msim-con/msim-con.ma	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -0,0 +1,1 @@
+10 msim/console
Index: uspace/drv/char/ski-con/ski-con.c
===================================================================
--- uspace/drv/char/ski-con/ski-con.c	(revision 25b853ccda3ce00185615bd0ae2d9ee1d2094374)
+++ uspace/drv/char/ski-con/ski-con.c	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -50,6 +50,5 @@
 static void ski_con_connection(ipc_callid_t, ipc_call_t *, void *);
 
-#include <stdio.h>
-/** Initialize Ski port driver. */
+/** Add ski console device. */
 int ski_con_add(ski_con_t *con)
 {
Index: uspace/drv/char/ski-con/ski-con.h
===================================================================
--- uspace/drv/char/ski-con/ski-con.h	(revision 25b853ccda3ce00185615bd0ae2d9ee1d2094374)
+++ uspace/drv/char/ski-con/ski-con.h	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -41,5 +41,5 @@
 #include <stdint.h>
 
-/** IntegratorCP Interrupt Controller */
+/** Ski console */
 typedef struct {
 	async_sess_t *client_sess;
Index: uspace/drv/platform/msim/msim.c
===================================================================
--- uspace/drv/platform/msim/msim.c	(revision 25b853ccda3ce00185615bd0ae2d9ee1d2094374)
+++ uspace/drv/platform/msim/msim.c	(revision 676e8336ad77d890d2dc43660cc53d5575875f79)
@@ -192,5 +192,9 @@
 static bool msim_add_functions(ddf_dev_t *dev)
 {
-	return msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data);
+	if (!msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data))
+		return false;
+	if (!msim_add_fun(dev, "console", "msim/console", &disk_data))
+		return false;
+	return true;
 }
 
