Reverted all changes - userspace devices mapped at initialization.

This is much simpler, no device map/unmap maintenance at run-time,
no lazy device mapping etc.
This commit is contained in:
Bahadir Balban
2009-12-11 19:27:46 +02:00
parent 59af5d3794
commit b1614191b3
14 changed files with 42 additions and 161 deletions

View File

@@ -1,48 +0,0 @@
/*
* This module allocates an unused address range from
* a given memory region defined as the pool range.
*
* Copyright (C) 2007 - 2009 Bahadir Balban
*/
#include <lib/bit.h>
#include <l4/macros.h>
#include <l4/types.h>
#include INC_GLUE(memory.h)
#include <lib/addr.h>
#include <stdio.h>
extern struct kernel_resources kres;
void *address_new(struct address_pool *pool, int npages)
{
unsigned int pfn;
if ((int)(pfn = ids_new_contiguous(pool->idpool, npages)) < 0)
return 0;
return (void *)__pfn_to_addr(pfn) + pool->start;
}
int address_del(struct address_pool *pool, void *addr, int npages)
{
unsigned long pfn = __pfn(page_align(addr) - pool->start);
if (ids_del_contiguous(pool->idpool, pfn, npages) < 0) {
printf("%s: Invalid address range returned to "
"virtual address pool.\n", __FUNCTION__);
return -1;
}
return 0;
}
void *kernel_new_address(int npages)
{
return address_new(&kres->kernel_address_pool, npages);
}
int kernel_delete_address(void *addr, int npages)
{
address_del(&kres->kernel_address_pool, addr, npages);
}

View File

@@ -139,13 +139,13 @@ void wake_up_all(struct waitqueue_head *wqh, unsigned int flags)
/* Wake up single waiter */
void wake_up(struct waitqueue_head *wqh, unsigned int flags)
{
unsigned int irqflags;
unsigned long irqflags;
BUG_ON(wqh->sleepers < 0);
/* Irq version */
if (flags & WAKEUP_IRQ)
spin_lock_irq(&wqh->lock, &irqflags);
spin_lock_irq(&wqh->slock, &irqflags);
else
spin_lock(&wqh->slock);
if (wqh->sleepers > 0) {
@@ -161,7 +161,7 @@ void wake_up(struct waitqueue_head *wqh, unsigned int flags)
sleeper->flags |= TASK_INTERRUPTED;
//printk("(%d) Waking up (%d)\n", current->tid, sleeper->tid);
if (flags & WAKEUP_IRQ)
spin_unlock_irqrestore(&wqh->slock, irqflags);
spin_unlock_irq(&wqh->slock, irqflags);
else
spin_unlock(&wqh->slock);
@@ -172,7 +172,7 @@ void wake_up(struct waitqueue_head *wqh, unsigned int flags)
return;
}
if (flags & WAKEUP_IRQ)
spin_unlock_irqrestore(&wqh->slock, irqflags);
spin_unlock_irq(&wqh->slock, irqflags);
else
spin_unlock(&wqh->slock);
}