mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Made changes to map devices dynamically upon irq registration.
All will be reverted since mapping devices statically is much simpler.
This commit is contained in:
@@ -141,5 +141,6 @@
|
||||
#define ENOCAP 134 /* None or insufficient capability */
|
||||
#define ENOUTCB 135 /* Task has no utcb set up */
|
||||
#define ENOMAP 136 /* The memory area has unmapped regions */
|
||||
#define ENOIRQ 137 /* Irq cannot be registered */
|
||||
|
||||
#endif /* __ERRNO_H__ */
|
||||
|
||||
@@ -105,6 +105,6 @@ int cap_cap_check(struct ktcb *task, unsigned int req, unsigned int flags);
|
||||
int cap_mutex_check(unsigned long mutex_address, int mutex_op);
|
||||
|
||||
int cap_irq_check(struct ktcb *registrant, unsigned int req,
|
||||
unsigned int flags, l4id_t irq);
|
||||
unsigned int flags, l4id_t irq, struct capability **cap);
|
||||
|
||||
#endif /* __GENERIC_CAPABILITY_H__ */
|
||||
|
||||
@@ -40,11 +40,17 @@ struct irq_desc {
|
||||
struct irq_chip *chip;
|
||||
|
||||
/* Thread registered for this irq */
|
||||
struct ktcb *irq_thread;
|
||||
struct ktcb *task;
|
||||
|
||||
/* Notification slot for this irq */
|
||||
int task_notify_slot;
|
||||
|
||||
/* Device virtual address */
|
||||
unsigned long device_virtual;
|
||||
|
||||
/* Device capability */
|
||||
struct capability *devcap;
|
||||
|
||||
/* NOTE: This could be a list for multiple handlers for shared irqs */
|
||||
irq_handler_t handler;
|
||||
};
|
||||
@@ -68,8 +74,8 @@ static inline void irq_disable(int irq_index)
|
||||
this_chip->ops.ack_and_mask(irq_index - this_chip->start);
|
||||
}
|
||||
|
||||
int irq_register(struct ktcb *task, int notify_slot,
|
||||
l4id_t irq_index, irq_handler_t handler);
|
||||
void irq_generic_map_device(struct irq_desc *desc);
|
||||
int irq_register(struct ktcb *task, int notify_slot, l4id_t irq_index);
|
||||
|
||||
void do_irq(void);
|
||||
void irq_controllers_init(void);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
* Complicated for you? Suggest a simpler design and it shall be implemented!
|
||||
*/
|
||||
|
||||
#define MR_REST ((UTCB_SIZE >> 2) - MR_TOTAL - 2) /* -2 is for fields on utcb */
|
||||
#define MR_REST ((UTCB_SIZE >> 2) - MR_TOTAL - 4) /* -4 is for fields on utcb */
|
||||
#define MR_TOTAL 6
|
||||
#define MR_TAG 0 /* Contains the purpose of message */
|
||||
#define MR_SENDER 1 /* For anythread receivers to discover sender */
|
||||
@@ -83,6 +83,7 @@ struct utcb {
|
||||
u32 mr[MR_TOTAL]; /* MRs that are mapped to real registers */
|
||||
u32 saved_tag; /* Saved tag field for stacked ipcs */
|
||||
u32 saved_sender; /* Saved sender field for stacked ipcs */
|
||||
u8 notify_slot[8]; /* Irq notification slots */
|
||||
u32 mr_rest[MR_REST]; /* Complete the utcb for up to 64 words */
|
||||
};
|
||||
#endif
|
||||
|
||||
24
include/l4/lib/addr.h
Normal file
24
include/l4/lib/addr.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Address allocation pool
|
||||
*
|
||||
* Copyright (C) 2007 - 2009 Bahadir Balban
|
||||
*/
|
||||
#ifndef __KERNEL_ADDR_H__
|
||||
#define __KERNEL_ADDR_H__
|
||||
|
||||
#include <lib/idpool.h>
|
||||
|
||||
/* Address pool to allocate from a range of addresses */
|
||||
struct address_pool {
|
||||
struct id_pool idpool;
|
||||
unsigned long start;
|
||||
unsigned long end;
|
||||
};
|
||||
|
||||
void *kernel_new_address(int npages);
|
||||
int kernel_delete_address(void *addr, int npages);
|
||||
|
||||
void *address_new(struct address_pool *pool, int npages);
|
||||
int address_del(struct address_pool *, void *addr, int npages);
|
||||
|
||||
#endif /* __KERNEL_ADDR_H__ */
|
||||
@@ -40,9 +40,9 @@ static inline void spin_unlock(struct spinlock *s)
|
||||
* on other cpus.
|
||||
*/
|
||||
static inline void spin_lock_irq(struct spinlock *s,
|
||||
unsigned long state)
|
||||
unsigned long *state)
|
||||
{
|
||||
irq_local_disable_save(&state);
|
||||
irq_local_disable_save(state);
|
||||
#if defined(CONFIG_SMP)
|
||||
__spin_lock(&s->lock);
|
||||
#endif
|
||||
|
||||
@@ -13,8 +13,9 @@ struct waitqueue {
|
||||
#define WAKEUP_ASYNC 0
|
||||
|
||||
enum wakeup_flags {
|
||||
WAKEUP_INTERRUPT = (1 << 0),
|
||||
WAKEUP_SYNC = (1 << 1)
|
||||
WAKEUP_INTERRUPT = (1 << 0), /* Set interrupt flag for task */
|
||||
WAKEUP_SYNC = (1 << 1), /* Wake it up synchronously */
|
||||
WAKEUP_IRQ = (1 << 2) /* Disable irqs on spinlocks */
|
||||
};
|
||||
|
||||
#define CREATE_WAITQUEUE_ON_STACK(wq, tsk) \
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
#define PB926_UART0_VOFFSET 0x00001000
|
||||
#define PB926_VIC_VOFFSET 0x00002000
|
||||
#define PB926_SIC_VOFFSET 0x00003000
|
||||
#define PB926_SYSREGS_VOFFSET 0x00005000
|
||||
#define PB926_SYSCTRL_VOFFSET 0x00006000
|
||||
#define PB926_SYSREGS_VOFFSET 0x00004000
|
||||
#define PB926_SYSCTRL_VOFFSET 0x00005000
|
||||
|
||||
#define PLATFORM_CONSOLE_VIRTUAL (IO_AREA0_VADDR + PB926_UART0_VOFFSET)
|
||||
#define PLATFORM_TIMER0_VIRTUAL (IO_AREA0_VADDR + PB926_TIMER01_VOFFSET)
|
||||
@@ -50,6 +50,8 @@
|
||||
#define PLATFORM_IRQCTRL0_VIRTUAL (IO_AREA0_VADDR + PB926_VIC_VOFFSET)
|
||||
#define PLATFORM_IRQCTRL1_VIRTUAL (IO_AREA0_VADDR + PB926_SIC_VOFFSET)
|
||||
|
||||
/* Add userspace devices here as they become necessary for irqs */
|
||||
#define PLATFORM_TIMER1_VIRTUAL (IO_AREA0_VADDR + PB926_TIMER23_VOFFSET)
|
||||
|
||||
#endif /* __PLATFORM_PB926_OFFSETS_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user