Index: kernel/arch/sparc32/src/machine/leon3/leon3.c
===================================================================
--- kernel/arch/sparc32/src/machine/leon3/leon3.c	(revision 96b972427511fafc3a7d22675c4ad68162b5f167)
+++ kernel/arch/sparc32/src/machine/leon3/leon3.c	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
@@ -41,6 +41,6 @@
 #include <arch/machine/leon3/leon3.h>
 
-#include <genarch/drivers/grlib_uart/grlib_uart.h>
-#include <genarch/drivers/grlib_irqmp/grlib_irqmp.h>
+#include <genarch/drivers/grlib/uart.h>
+#include <genarch/drivers/grlib/irqmp.h>
 #include <genarch/srln/srln.h>
 
Index: kernel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc	(revision 96b972427511fafc3a7d22675c4ad68162b5f167)
+++ kernel/genarch/Makefile.inc	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
@@ -112,10 +112,10 @@
 ifeq ($(CONFIG_GRLIB_UART),y)
 	GENARCH_SOURCES += \
-		genarch/src/drivers/grlib_uart/grlib_uart.c
+		genarch/src/drivers/grlib/uart.c
 endif
 
 ifeq ($(CONFIG_GRLIB_IRQMP),y)
 	GENARCH_SOURCES += \
-		genarch/src/drivers/grlib_irqmp/grlib_irqmp.c
+		genarch/src/drivers/grlib/irqmp.c
 endif
 
Index: kernel/genarch/include/genarch/drivers/grlib/irqmp.h
===================================================================
--- kernel/genarch/include/genarch/drivers/grlib/irqmp.h	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
+++ kernel/genarch/include/genarch/drivers/grlib/irqmp.h	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013 Jakub Klama
+ * 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
+ * @brief Gaisler GRLIB interrupt controller driver.
+ */
+
+#ifndef KERN_GRLIB_IRQMP_H_
+#define KERN_GRLIB_IRQMP_H_
+
+#include <typedefs.h>
+#include <arch.h>
+
+#define GRLIB_IRQMP_MASK_OFFSET   0x40
+#define GRLIB_IRQMP_FORCE_OFFSET  0x80
+
+/** IRQMP registers */
+typedef struct {
+	uint32_t level;
+	uint32_t pending;
+	uint32_t force;
+	uint32_t clear;
+	uint32_t mp_status;
+	uint32_t broadcast;
+} grlib_irqmp_regs_t;
+
+/** LEON3 interrupt assignments */
+enum grlib_irq_source {
+	GRLIB_INT_AHBERROR = 1,
+	GRLIB_INT_UART1    = 2,
+	GRLIB_INT_PCIDMA   = 4,
+	GRLIB_INT_CAN      = 5,
+	GRLIB_INT_TIMER0   = 6,
+	GRLIB_INT_TIMER1   = 7,
+	GRLIB_INT_TIMER2   = 8,
+	GRLIB_INT_TIMER3   = 9,
+	GRLIB_INT_ETHERNET = 14
+};
+
+typedef struct {
+	grlib_irqmp_regs_t *regs;
+} grlib_irqmp_t;
+
+extern void grlib_irqmp_init(grlib_irqmp_t *, bootinfo_t *);
+extern int grlib_irqmp_inum_get(grlib_irqmp_t *);
+extern void grlib_irqmp_clear(grlib_irqmp_t *, unsigned int);
+extern void grlib_irqmp_mask(grlib_irqmp_t *, unsigned int);
+extern void grlib_irqmp_unmask(grlib_irqmp_t *, unsigned int);
+
+#endif
+
+/** @}
+ */
Index: kernel/genarch/include/genarch/drivers/grlib/uart.h
===================================================================
--- kernel/genarch/include/genarch/drivers/grlib/uart.h	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
+++ kernel/genarch/include/genarch/drivers/grlib/uart.h	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010 Jiri Svoboda
+ * Copyright (c) 2013 Jakub Klama
+ * 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
+ * @brief Gaisler GRLIB UART IP-Core driver.
+ */
+
+#ifndef KERN_GRLIB_UART_H_
+#define KERN_GRLIB_UART_H_
+
+#include <ddi/ddi.h>
+#include <ddi/irq.h>
+#include <console/chardev.h>
+#include <typedefs.h>
+
+typedef struct {
+	unsigned int rcnt: 6;
+	unsigned int tcnt: 6;
+	unsigned int : 9;
+	unsigned int rf: 1;
+	unsigned int tf: 1;
+	unsigned int rh: 1;
+	unsigned int th: 1;
+	unsigned int fe: 1;
+	unsigned int pe: 1;
+	unsigned int ov: 1;
+	unsigned int br: 1;
+	unsigned int te: 1;
+	unsigned int ts: 1;
+	unsigned int dr: 1;
+} grlib_uart_status_t;
+
+typedef struct {
+	unsigned int fa: 1;
+	unsigned int : 16;
+	unsigned int si: 1;
+	unsigned int di: 1;
+	unsigned int bi: 1;
+	unsigned int db: 1;
+	unsigned int rf: 1;
+	unsigned int tf: 1;
+	unsigned int ec: 1;
+	unsigned int lb: 1;
+	unsigned int fl: 1;
+	unsigned int pe: 1;
+	unsigned int ps: 1;
+	unsigned int ti: 1;
+	unsigned int ri: 1;
+	unsigned int te: 1;
+	unsigned int re: 1;
+} grlib_uart_control_t;
+
+/** GRLIB UART registers */
+typedef struct {
+	uint32_t data;
+	uint32_t status;
+	uint32_t control;
+	uint32_t scaler;
+	uint32_t debug;
+} grlib_uart_io_t;
+
+typedef struct {
+	grlib_uart_io_t *io;
+	indev_t *indev;
+	irq_t irq;
+	parea_t parea;
+} grlib_uart_t;
+
+extern outdev_t *grlib_uart_init(uintptr_t, inr_t);
+extern void grlib_uart_input_wire(grlib_uart_t *,
+    indev_t *);
+
+#endif
+
+/** @}
+ */
Index: rnel/genarch/include/genarch/drivers/grlib_irqmp/grlib_irqmp.h
===================================================================
--- kernel/genarch/include/genarch/drivers/grlib_irqmp/grlib_irqmp.h	(revision 96b972427511fafc3a7d22675c4ad68162b5f167)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Klama
- * 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
- * @brief Gaisler GRLIB interrupt controller driver.
- */
-
-#ifndef KERN_GRLIB_IRQMP_H_
-#define KERN_GRLIB_IRQMP_H_
-
-#include <typedefs.h>
-#include <arch.h>
-
-#define GRLIB_IRQMP_MASK_OFFSET		0x40
-#define	GRLIB_IRQMP_FORCE_OFFSET	0x80
-
-/** IRQMP registers */
-typedef struct {
-	uint32_t level;
-	uint32_t pending;
-	uint32_t force;
-	uint32_t clear;
-	uint32_t mp_status;
-	uint32_t broadcast;
-} grlib_irqmp_regs_t;
-
-/** LEON3 interrupt assignments */
-enum grlib_irq_source {
-	GRLIB_INT_AHBERROR	= 1,
-	GRLIB_INT_UART1		= 2,
-	GRLIB_INT_PCIDMA	= 4,
-	GRLIB_INT_CAN		= 5,
-	GRLIB_INT_TIMER0	= 6,
-	GRLIB_INT_TIMER1	= 7,
-	GRLIB_INT_TIMER2	= 8,
-	GRLIB_INT_TIMER3	= 9,
-	GRLIB_INT_ETHERNET	= 14
-};
-
-typedef struct {
-	grlib_irqmp_regs_t *regs;
-} grlib_irqmp_t;
-
-extern void grlib_irqmp_init(grlib_irqmp_t *, bootinfo_t *);
-extern int grlib_irqmp_inum_get(grlib_irqmp_t *);
-extern void grlib_irqmp_clear(grlib_irqmp_t *, int);
-extern void grlib_irqmp_mask(grlib_irqmp_t *, int);
-extern void grlib_irqmp_unmask(grlib_irqmp_t *, int);
-
-#endif
-
-/** @}
- */
Index: rnel/genarch/include/genarch/drivers/grlib_uart/grlib_uart.h
===================================================================
--- kernel/genarch/include/genarch/drivers/grlib_uart/grlib_uart.h	(revision 96b972427511fafc3a7d22675c4ad68162b5f167)
+++ 	(revision )
@@ -1,106 +1,0 @@
-/*
- * Copyright (c) 2010 Jiri Svoboda
- * Copyright (c) 2013 Jakub Klama
- * 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
- * @brief Gaisler GRLIB UART IP-Core driver.
- */
-
-#ifndef KERN_GRLIB_UART_H_
-#define KERN_GRLIB_UART_H_
-
-#include <ddi/ddi.h>
-#include <ddi/irq.h>
-#include <console/chardev.h>
-#include <typedefs.h>
-
-typedef struct {
-	unsigned int rcnt: 6;
-	unsigned int tcnt: 6;
-	unsigned int : 9;
-	unsigned int rf: 1;
-	unsigned int tf: 1;
-	unsigned int rh: 1;
-	unsigned int th: 1;
-	unsigned int fe: 1;
-	unsigned int pe: 1;
-	unsigned int ov: 1;
-	unsigned int br: 1;
-	unsigned int te: 1;
-	unsigned int ts: 1;
-	unsigned int dr: 1;
-} grlib_uart_status_t;
-
-typedef struct {
-	unsigned int fa: 1;
-	unsigned int : 16;
-	unsigned int si: 1;
-	unsigned int di: 1;
-	unsigned int bi: 1;
-	unsigned int db: 1;
-	unsigned int rf: 1;
-	unsigned int tf: 1;
-	unsigned int ec: 1;
-	unsigned int lb: 1;
-	unsigned int fl: 1;
-	unsigned int pe: 1;
-	unsigned int ps: 1;
-	unsigned int ti: 1;
-	unsigned int ri: 1;
-	unsigned int te: 1;
-	unsigned int re: 1;
-} grlib_uart_control_t;
-
-/** GRLIB UART registers */
-typedef struct {
-	uint32_t data;
-	uint32_t status;
-	uint32_t control;
-	uint32_t scaler;
-	uint32_t debug;
-} grlib_uart_io_t;
-
-typedef struct {
-	grlib_uart_io_t *io;
-	indev_t *indev;
-	irq_t irq;
-	parea_t parea;
-} grlib_uart_t;
-
-extern outdev_t *grlib_uart_init(uintptr_t, inr_t inr);
-extern void grlib_uart_input_wire(grlib_uart_t *,
-    indev_t *);
-
-#endif
-
-/** @}
- */
Index: kernel/genarch/src/drivers/grlib/irqmp.c
===================================================================
--- kernel/genarch/src/drivers/grlib/irqmp.c	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
+++ kernel/genarch/src/drivers/grlib/irqmp.c	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013 Jakub Klama
+ * 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
+ * @brief Gaisler GRLIB interrupt controller.
+ */
+
+#include <genarch/drivers/grlib/irqmp.h>
+#include <arch/asm.h>
+#include <mm/km.h>
+
+void grlib_irqmp_init(grlib_irqmp_t *irqc, bootinfo_t *bootinfo)
+{
+	irqc->regs = (void *) km_map(bootinfo->intc_base, PAGE_SIZE,
+	    PAGE_NOT_CACHEABLE);
+	
+	/* Mask all interrupts */
+	pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, 0x8);
+}
+
+int grlib_irqmp_inum_get(grlib_irqmp_t *irqc)
+{
+	uint32_t pending = pio_read_32(&irqc->regs->pending);
+	
+	for (unsigned int i = 1; i < 16; i++) {
+		if (pending & (1 << i))
+			return i;
+	}
+	
+	return -1;
+}
+
+void grlib_irqmp_clear(grlib_irqmp_t *irqc, unsigned int inum)
+{
+	inum++;
+	pio_write_32(&irqc->regs->clear, (1 << inum));
+}
+
+void grlib_irqmp_mask(grlib_irqmp_t *irqc, unsigned int src)
+{
+	uint32_t mask = pio_read_32((void *) irqc->regs +
+	    GRLIB_IRQMP_MASK_OFFSET);
+	
+	src++;
+	mask &= ~(1 << src);
+	
+	pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask);
+}
+
+void grlib_irqmp_unmask(grlib_irqmp_t *irqc, unsigned int src)
+{
+	uint32_t mask = pio_read_32((void *) irqc->regs +
+	    GRLIB_IRQMP_MASK_OFFSET);
+	
+	src++;
+	mask |= (1 << src);
+	
+	pio_write_32((void *) irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask);
+}
+
+/** @}
+ */
Index: kernel/genarch/src/drivers/grlib/uart.c
===================================================================
--- kernel/genarch/src/drivers/grlib/uart.c	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
+++ kernel/genarch/src/drivers/grlib/uart.c	(revision e47ed059f2f1f9164ef7bfb956f1b38b5998b23d)
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2009 Martin Decky
+ * Copyright (c) 2010 Jiri Svoboda
+ * Copyright (c) 2013 Jakub Klama
+ * 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
+ * @brief Gaisler GRLIB UART IP-Core driver.
+ */
+
+#include <genarch/drivers/grlib/uart.h>
+#include <console/chardev.h>
+#include <console/console.h>
+#include <ddi/device.h>
+#include <arch/asm.h>
+#include <mm/slab.h>
+#include <mm/page.h>
+#include <mm/km.h>
+#include <sysinfo/sysinfo.h>
+#include <str.h>
+
+static void grlib_uart_sendb(outdev_t *dev, uint8_t byte)
+{
+	grlib_uart_status_t *status;
+	grlib_uart_t *uart = (grlib_uart_t *) dev->data;
+	
+	/* Wait for space becoming available in Tx FIFO. */
+	do {
+		uint32_t reg = pio_read_32(&uart->io->status);
+		status = (grlib_uart_status_t *) &reg;
+	} while (status->tf != 0);
+	
+	pio_write_32(&uart->io->data, byte);
+}
+
+static void grlib_uart_putchar(outdev_t *dev, wchar_t ch)
+{
+	grlib_uart_t *uart = (grlib_uart_t *) dev->data;
+	
+	if ((!uart->parea.mapped) || (console_override)) {
+		if (!ascii_check(ch)) {
+			grlib_uart_sendb(dev, U_SPECIAL);
+		} else {
+			if (ch == '\n')
+				grlib_uart_sendb(dev, (uint8_t) '\r');
+			
+			grlib_uart_sendb(dev, (uint8_t) ch);
+		}
+	}
+}
+
+static irq_ownership_t grlib_uart_claim(irq_t *irq)
+{
+	return IRQ_ACCEPT;
+}
+
+static void grlib_uart_irq_handler(irq_t *irq)
+{
+	grlib_uart_t *uart = irq->instance;
+	
+	uint32_t reg = pio_read_32(&uart->io->status);
+	grlib_uart_status_t *status = (grlib_uart_status_t *) &reg;
+	
+	while (status->dr != 0) {
+		uint32_t data = pio_read_32(&uart->io->data);
+		reg = pio_read_32(&uart->io->status);
+		status = (grlib_uart_status_t *) &reg;
+		indev_push_character(uart->indev, data & 0xff);
+	}
+}
+
+static outdev_operations_t grlib_uart_ops = {
+	.write = grlib_uart_putchar,
+	.redraw = NULL
+};
+
+outdev_t *grlib_uart_init(uintptr_t paddr, inr_t inr)
+{
+	outdev_t *uart_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC);
+	if (!uart_dev)
+		return NULL;
+	
+	grlib_uart_t *uart = malloc(sizeof(grlib_uart_t), FRAME_ATOMIC);
+	if (!uart) {
+		free(uart_dev);
+		return NULL;
+	}
+	
+	outdev_initialize("grlib_uart_dev", uart_dev, &grlib_uart_ops);
+	uart_dev->data = uart;
+	
+	uart->io = (grlib_uart_io_t *) km_map(paddr, PAGE_SIZE,
+	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
+	uart->indev = NULL;
+	
+	/* Initialize IRQ structure. */
+	irq_initialize(&uart->irq);
+	uart->irq.devno = device_assign_devno();
+	uart->irq.inr = inr;
+	uart->irq.claim = grlib_uart_claim;
+	uart->irq.handler = grlib_uart_irq_handler;
+	uart->irq.instance = uart;
+	
+	/* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
+	grlib_uart_control_t control = {
+		.fa = 1,
+		.rf = 1,
+		.tf = 1,
+		.ri = 1,
+		.te = 1,
+		.re = 1
+	};
+	
+	uint32_t *reg = (uint32_t *) &control;
+	pio_write_32(&uart->io->control, *reg);
+	
+	link_initialize(&uart->parea.link);
+	uart->parea.pbase = paddr;
+	uart->parea.frames = 1;
+	uart->parea.unpriv = false;
+	uart->parea.mapped = false;
+	ddi_parea_register(&uart->parea);
+	
+	return uart_dev;
+}
+
+void grlib_uart_input_wire(grlib_uart_t *uart, indev_t *indev)
+{
+	ASSERT(uart);
+	ASSERT(indev);
+	
+	uart->indev = indev;
+	irq_register(&uart->irq);
+}
+
+/** @}
+ */
Index: rnel/genarch/src/drivers/grlib_irqmp/grlib_irqmp.c
===================================================================
--- kernel/genarch/src/drivers/grlib_irqmp/grlib_irqmp.c	(revision 96b972427511fafc3a7d22675c4ad68162b5f167)
+++ 	(revision )
@@ -1,92 +1,0 @@
-/*
- * Copyright (c) 2013 Jakub Klama
- * 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
- * @brief Gaisler GRLIB interrupt controller.
- */
-
-#include <genarch/drivers/grlib_irqmp/grlib_irqmp.h>
-#include <arch/asm.h>
-#include <mm/km.h>
-
-void grlib_irqmp_init(grlib_irqmp_t *irqc, bootinfo_t *bootinfo)
-{
-	irqc->regs = (void *) km_map(bootinfo->intc_base, PAGE_SIZE,
-	    PAGE_NOT_CACHEABLE);
-
-	printf("irqmp regs: %p\n", irqc->regs);
-
-	/* Mask all interrupts */
-	pio_write_32((void *)irqc->regs + GRLIB_IRQMP_MASK_OFFSET, 0x8);
-}
-
-int grlib_irqmp_inum_get(grlib_irqmp_t *irqc)
-{
-	int i;
-	uint32_t pending = pio_read_32(&irqc->regs->pending);
-
-	for (i = 1; i < 16; i++) {
-		if (pending & (1 << i))
-			return i;
-	}
-
-	return -1;
-}
-
-void grlib_irqmp_clear(grlib_irqmp_t *irqc, int inum)
-{
-	inum++;
-	pio_write_32(&irqc->regs->clear, (1 << inum));
-}
-
-void grlib_irqmp_mask(grlib_irqmp_t *irqc, int src)
-{
-	uint32_t mask = pio_read_32((void *)irqc->regs + GRLIB_IRQMP_MASK_OFFSET);
-
-	src++;
-	mask &= ~(1 << src);
-
-	pio_write_32((void *)irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask);
-}
-
-void grlib_irqmp_unmask(grlib_irqmp_t *irqc, int src)
-{
-	uint32_t mask = pio_read_32((void *)irqc->regs + GRLIB_IRQMP_MASK_OFFSET);
-
-	src++;
-	mask |= (1 << src);
-
-	pio_write_32((void *)irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask);
-}
-
-/** @}
- */
Index: rnel/genarch/src/drivers/grlib_uart/grlib_uart.c
===================================================================
--- kernel/genarch/src/drivers/grlib_uart/grlib_uart.c	(revision 96b972427511fafc3a7d22675c4ad68162b5f167)
+++ 	(revision )
@@ -1,167 +1,0 @@
-/*
- * Copyright (c) 2009 Martin Decky
- * Copyright (c) 2010 Jiri Svoboda
- * Copyright (c) 2013 Jakub Klama
- * 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
- * @brief Gaisler GRLIB UART IP-Core driver.
- */
-
-#include <genarch/drivers/grlib_uart/grlib_uart.h>
-#include <console/chardev.h>
-#include <console/console.h>
-#include <ddi/device.h>
-#include <arch/asm.h>
-#include <mm/slab.h>
-#include <mm/page.h>
-#include <mm/km.h>
-#include <sysinfo/sysinfo.h>
-#include <str.h>
-
-static void grlib_uart_sendb(outdev_t *dev, uint8_t byte)
-{
-	uint32_t reg;
-	grlib_uart_status_t *status;
-	grlib_uart_t *uart =
-	    (grlib_uart_t *) dev->data;
-
-	/* Wait for space becoming available in Tx FIFO. */
-	do {
-		reg = pio_read_32(&uart->io->status);
-		status = (grlib_uart_status_t *)&reg;
-	} while (status->tf != 0);
-
-	pio_write_32(&uart->io->data, byte);
-}
-
-static void grlib_uart_putchar(outdev_t *dev, wchar_t ch)
-{
-	grlib_uart_t *uart =
-	    (grlib_uart_t *) dev->data;
-	
-	if ((!uart->parea.mapped) || (console_override)) {
-		if (!ascii_check(ch)) {
-			grlib_uart_sendb(dev, U_SPECIAL);
-		} else {
-			if (ch == '\n')
-				grlib_uart_sendb(dev, (uint8_t) '\r');
-			grlib_uart_sendb(dev, (uint8_t) ch);
-		}
-	}
-}
-
-static irq_ownership_t grlib_uart_claim(irq_t *irq)
-{
-	return IRQ_ACCEPT;
-}
-
-static void grlib_uart_irq_handler(irq_t *irq)
-{
-	uint32_t reg;
-	grlib_uart_t *uart = irq->instance;
-	grlib_uart_status_t *status;
-
-	reg = pio_read_32(&uart->io->status);
-	status = (grlib_uart_status_t *)&reg;
-
-	while (status->dr != 0) {
-		uint32_t data = pio_read_32(&uart->io->data);
-		reg = pio_read_32(&uart->io->status);
-		status = (grlib_uart_status_t *)&reg;
-		indev_push_character(uart->indev, data & 0xff);
-	}
-}
-
-static outdev_operations_t grlib_uart_ops = {
-	.write = grlib_uart_putchar,
-	.redraw = NULL
-};
-
-outdev_t *grlib_uart_init(uintptr_t paddr, inr_t inr)
-{
-	printf("grlib_uart_init: paddr=0x%08x\n", paddr);
-
-	outdev_t *uart_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC);
-	if (!uart_dev)
-		return NULL;
-
-	grlib_uart_t *uart =
-	    malloc(sizeof(grlib_uart_t), FRAME_ATOMIC);
-	if (!uart) {
-		free(uart_dev);
-		return NULL;
-	}
-
-	outdev_initialize("grlib_uart_dev", uart_dev, &grlib_uart_ops);
-	uart_dev->data = uart;
-
-	uart->io = (grlib_uart_io_t *) km_map(paddr, PAGE_SIZE,
-	    PAGE_WRITE | PAGE_NOT_CACHEABLE);
-	uart->indev = NULL;
-
-	/* Initialize IRQ structure. */
-	irq_initialize(&uart->irq);
-	uart->irq.devno = device_assign_devno();
-	uart->irq.inr = inr;
-	uart->irq.claim = grlib_uart_claim;
-	uart->irq.handler = grlib_uart_irq_handler;
-	uart->irq.instance = uart;
-
-	/* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
-	grlib_uart_control_t control = 
-		{ .fa = 1, .rf = 1, .tf = 1, .ri = 1, 
-		  .te = 1, .re = 1};
-
-	uint32_t *reg = (uint32_t *)&control;
-	pio_write_32(&uart->io->control, *reg);
-
-	link_initialize(&uart->parea.link);
-	uart->parea.pbase = paddr;
-	uart->parea.frames = 1;
-	uart->parea.unpriv = false;
-	uart->parea.mapped = false;
-	ddi_parea_register(&uart->parea);
-	
-	return uart_dev;
-}
-
-void grlib_uart_input_wire(grlib_uart_t *uart, indev_t *indev)
-{
-	ASSERT(uart);
-	ASSERT(indev);
-
-	uart->indev = indev;
-	irq_register(&uart->irq);
-}
-
-/** @}
- */
