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

@@ -877,8 +877,7 @@ int cap_thread_check(struct ktcb *task,
int cap_irq_check(struct ktcb *registrant, unsigned int req,
unsigned int flags, l4id_t irq,
struct capability **device_cap)
unsigned int flags, l4id_t irq)
{
struct sys_irqctrl_args args = {
.registrant = registrant,
@@ -896,8 +895,8 @@ int cap_irq_check(struct ktcb *registrant, unsigned int req,
* Find the device capability and
* check that it allows irq registration
*/
if (!(*device_cap = cap_find(current, cap_match_devmem,
&args, CAP_TYPE_MAP_PHYSMEM)))
if (!cap_find(current, cap_match_devmem,
&args, CAP_TYPE_MAP_PHYSMEM))
return -ENOCAP;
return 0;
@@ -940,7 +939,7 @@ int cap_thread_check(struct ktcb *task,
}
int cap_irq_check(struct ktcb *registrant, unsigned int req,
unsigned int flags, l4id_t irq, struct capability **cap)
unsigned int flags, l4id_t irq)
{
return 0;
}

View File

@@ -15,34 +15,6 @@
#include INC_PLAT(irq.h)
#include INC_ARCH(exception.h)
/*
* Checks that a device was validly registered for the irq,
* and lazily maps it to currently interrupted process.
*/
void irq_generic_map_device(struct irq_desc *desc)
{
/*
* Check that irq is registered with a
* valid device capability and virtual address
*/
if (!desc->devcap || !KERN_ADDR(devcap->device_virtual)) {
printk("Spurious irq. %s irq occured but "
"no device capability or valid virtual device "
"address associated with the irq.\n",
desc->name);
BUG();
}
/* Check and lazy map device */
if (check_access(desc->device_virtual,
desc->devcap->end - desc->devcap->start,
MAP_SVC_RW_FLAGS, 0) < 0) {
add_mapping(__pfn_to_addr(devcap->start),
desc->device_virtual, MAP_SVC_RW_FLAGS,
desc->devcap->end - desc->devcap->start);
}
}
/*
* Registers a userspace thread as an irq handler.
*
@@ -54,8 +26,7 @@ void irq_generic_map_device(struct irq_desc *desc)
* If the irq does not have these set up, we cannot allow
* the irq registry.
*/
int irq_register(struct ktcb *task, int notify_slot,
l4id_t irq_index, struct capability *device)
int irq_register(struct ktcb *task, int notify_slot, l4id_t irq_index)
{
struct irq_desc *this_desc = irq_desc_array + irq_index;
@@ -67,17 +38,6 @@ int irq_register(struct ktcb *task, int notify_slot,
this_desc->task = task;
this_desc->task_notify_slot = notify_slot;
/*
* Setup capability and allocate virtual kernel address.
*
* This is required so that the irq handler may reach
* the device from the kernel at any runnable process.
*/
this_desc->devcap = device;
if (!(this_desc->device_virtual =
kernel_new_address(device->end - device->start)))
return -ENOMEM;
/* Enable the irq */
irq_enable(irq_index);

View File

@@ -416,19 +416,6 @@ int free_boot_memory(struct kernel_resources *kres)
return 0;
}
void kernel_address_pool_init(struct kernel_resources *kres)
{
/* Initialize id pool spinlock */
spin_lock_init(&kres->kernel_address_pool.idpool.lock);
/* Initialize id pool number of words */
kres->kernel_address_pool.idpool.nwords = SYSTEM_IDS_MAX;
/* Initialize address pool start and end ranges */
kres->kernel_address_pool.start = page_align_up(_end);
kres->kernel_address_pool.end = KERNEL_AREA_END;
}
/*
* Initializes kernel caplists, and sets up total of physical
* and virtual memory as single capabilities of the kernel.
@@ -448,9 +435,6 @@ void init_kernel_resources(struct kernel_resources *kres)
kres->mutex_ids.nwords = SYSTEM_IDS_MAX;
kres->capability_ids.nwords = SYSTEM_IDS_MAX;
/* Initialize kernel's virtual address pool */
kernel_address_pool_init(kres);
/* Initialize container head */
container_head_init(&kres->containers);