mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Changes since April
Clean up of build directories. Simplifications to capability model.
This commit is contained in:
@@ -12,26 +12,6 @@
|
||||
/* Capability syscall request types */
|
||||
#define CAP_CONTROL_NCAPS 0x00000000
|
||||
#define CAP_CONTROL_READ 0x00000001
|
||||
#define CAP_CONTROL_SHARE 0x00000002
|
||||
#define CAP_CONTROL_GRANT 0x00000003
|
||||
#define CAP_CONTROL_REPLICATE 0x00000004
|
||||
#define CAP_CONTROL_SPLIT 0x00000005
|
||||
#define CAP_CONTROL_DEDUCE 0x00000006
|
||||
#define CAP_CONTROL_DESTROY 0x00000007
|
||||
|
||||
#define CAP_SHARE_MASK 0x0000000F
|
||||
#define CAP_SHARE_SINGLE 0x00000001
|
||||
#define CAP_SHARE_ALL_CONTAINER 0x00000002
|
||||
#define CAP_SHARE_ALL_SPACE 0x00000003
|
||||
|
||||
#define CAP_GRANT_MASK 0x0000000F
|
||||
#define CAP_GRANT_SINGLE 0x00000001
|
||||
#define CAP_GRANT_IMMUTABLE 0x00000004
|
||||
|
||||
#define CAP_SPLIT_MASK 0x0000000F
|
||||
#define CAP_SPLIT_SIZE 0x00000001
|
||||
#define CAP_SPLIT_ACCESS 0x00000002
|
||||
#define CAP_SPLIT_RANGE 0x00000003 /* Returns -EPERM */
|
||||
|
||||
/*
|
||||
* A capability is a unique representation of security
|
||||
@@ -87,10 +67,6 @@ struct capability {
|
||||
|
||||
/* Use count of resource */
|
||||
unsigned long used;
|
||||
|
||||
/* Device attributes, if this is a device. */
|
||||
unsigned int attr;
|
||||
l4id_t irq;
|
||||
};
|
||||
|
||||
#endif /* __API_CAPABILITY_H__ */
|
||||
|
||||
@@ -25,6 +25,7 @@ _bootstack_physical = _end_bootstack - kernel_offset;
|
||||
* virtual address.
|
||||
*/
|
||||
ENTRY(kernel_physical)
|
||||
OUTPUT_ARCH(arm)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
@@ -40,31 +40,6 @@
|
||||
{(c)->type &= ~CAP_RTYPE_MASK; \
|
||||
(c)->type |= CAP_RTYPE_MASK & rtype;}
|
||||
|
||||
/*
|
||||
* User-defined device-types
|
||||
* (Kept in the user field)
|
||||
*/
|
||||
#define CAP_DEVTYPE_TIMER 1
|
||||
#define CAP_DEVTYPE_UART 2
|
||||
#define CAP_DEVTYPE_KEYBOARD 3
|
||||
#define CAP_DEVTYPE_MOUSE 4
|
||||
#define CAP_DEVTYPE_CLCD 5
|
||||
#define CAP_DEVTYPE_OTHER 0xF
|
||||
#define CAP_DEVTYPE_MASK 0xFFFF
|
||||
#define CAP_DEVNUM_MASK 0xFFFF0000
|
||||
#define CAP_DEVNUM_SHIFT 16
|
||||
|
||||
#define cap_is_devmem(c) ((c)->attr)
|
||||
#define cap_set_devtype(c, devtype) \
|
||||
{(c)->attr &= ~CAP_DEVTYPE_MASK; \
|
||||
(c)->attr |= CAP_DEVTYPE_MASK & devtype;}
|
||||
#define cap_set_devnum(c, devnum) \
|
||||
{(c)->attr &= ~CAP_DEVNUM_MASK; \
|
||||
(c)->attr |= CAP_DEVNUM_MASK & (devnum << CAP_DEVNUM_SHIFT);}
|
||||
#define cap_devnum(c) \
|
||||
(((c)->attr & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT)
|
||||
#define cap_devtype(c) ((c)->attr & CAP_DEVTYPE_MASK)
|
||||
|
||||
/*
|
||||
* Access permissions
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <l4/api/exregs.h>
|
||||
#include <l4/api/capability.h>
|
||||
#include <l4/lib/printk.h>
|
||||
|
||||
/*
|
||||
* Some resources that capabilities possess don't
|
||||
@@ -21,15 +22,11 @@
|
||||
|
||||
|
||||
struct cap_list {
|
||||
int ktcb_refs;
|
||||
int ncaps;
|
||||
struct link caps;
|
||||
};
|
||||
|
||||
void capability_init(struct capability *cap);
|
||||
struct capability *capability_create(void);
|
||||
struct capability *boot_capability_create(void);
|
||||
|
||||
|
||||
static inline void cap_list_init(struct cap_list *clist)
|
||||
{
|
||||
@@ -94,14 +91,13 @@ struct task_ids;
|
||||
/* Capability checking for quantitative capabilities */
|
||||
int capability_consume(struct capability *cap, int quantity);
|
||||
int capability_free(struct capability *cap, int quantity);
|
||||
struct capability *capability_find_by_rtype(struct ktcb *task,
|
||||
unsigned int rtype);
|
||||
struct capability *cap_find_by_rtype(struct ktcb *task,
|
||||
unsigned int rtype);
|
||||
int cap_count(struct ktcb *task);
|
||||
struct capability *cap_list_find_by_rtype(struct cap_list *clist,
|
||||
unsigned int rtype);
|
||||
struct capability *cap_find_by_capid(l4id_t capid, struct cap_list **clist);
|
||||
|
||||
/* Capability checking on system calls */
|
||||
/* Capability checking on systm calls */
|
||||
int cap_map_check(struct ktcb *task, unsigned long phys, unsigned long virt,
|
||||
unsigned long npages, unsigned int flags);
|
||||
int cap_unmap_check(struct ktcb *task, unsigned long virt,
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#define curcont (current->container)
|
||||
|
||||
#define CONFIG_CONTAINER_NAMESIZE 64
|
||||
#define CONFIG_MAX_CAPS_USED 16
|
||||
#define CONFIG_MAX_PAGER_CAPS 20
|
||||
#define CONFIG_MAX_CONT_CAPS 5
|
||||
#define CONFIG_MAX_PAGERS_USED 1
|
||||
|
||||
/* Container macro. No locks needed! */
|
||||
@@ -33,18 +34,13 @@ struct pager {
|
||||
unsigned long memsize;
|
||||
struct cap_list cap_list;
|
||||
|
||||
/*
|
||||
* Section markings,
|
||||
* We dont care for other types of sections,
|
||||
* RO will be included inside RX.
|
||||
*/
|
||||
unsigned long rw_sections_start;
|
||||
unsigned long rw_sections_end;
|
||||
unsigned long rx_sections_start;
|
||||
unsigned long rx_sections_end;
|
||||
/* Program header markings of pager's elf */
|
||||
unsigned long rw_pheader_start;
|
||||
unsigned long rw_pheader_end;
|
||||
unsigned long rx_pheader_start;
|
||||
unsigned long rx_pheader_end;
|
||||
};
|
||||
|
||||
|
||||
struct container {
|
||||
l4id_t cid; /* Unique container id */
|
||||
int npagers; /* # of pagers */
|
||||
@@ -82,15 +78,11 @@ struct pager_info {
|
||||
unsigned long start_address;
|
||||
unsigned long stack_address;
|
||||
|
||||
/*
|
||||
* Section markings,
|
||||
* We dont care for other types of sections,
|
||||
* RO will be included inside RX.
|
||||
*/
|
||||
unsigned long rw_sections_start;
|
||||
unsigned long rw_sections_end;
|
||||
unsigned long rx_sections_start;
|
||||
unsigned long rx_sections_end;
|
||||
/* Program header markings of pager's elf */
|
||||
unsigned long rw_pheader_start;
|
||||
unsigned long rw_pheader_end;
|
||||
unsigned long rx_pheader_start;
|
||||
unsigned long rx_pheader_end;
|
||||
|
||||
/* Number of capabilities defined */
|
||||
int ncaps;
|
||||
@@ -106,7 +98,7 @@ struct pager_info {
|
||||
* One or more virtmem caps,
|
||||
* Zero or more umutex caps,
|
||||
*/
|
||||
struct cap_info caps[CONFIG_MAX_CAPS_USED];
|
||||
struct cap_info caps[CONFIG_MAX_PAGER_CAPS];
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -116,6 +108,8 @@ struct pager_info {
|
||||
struct container_info {
|
||||
char name[CONFIG_CONTAINER_NAMESIZE];
|
||||
int npagers;
|
||||
int ncaps;
|
||||
struct cap_info caps[CONFIG_MAX_CONT_CAPS];
|
||||
struct pager_info pager[CONFIG_MAX_PAGERS_USED];
|
||||
};
|
||||
|
||||
@@ -128,8 +122,10 @@ struct container *container_create(void);
|
||||
|
||||
int container_init_pagers(struct kernel_resources *kres);
|
||||
|
||||
struct container *container_alloc_init(void);
|
||||
int init_containers(struct kernel_resources *kres);
|
||||
struct container *container_find(struct kernel_resources *kres, l4id_t cid);
|
||||
struct ktcb *container_find_tcb(struct container *c, l4id_t tid);
|
||||
|
||||
#endif /* __CONTAINER_H__ */
|
||||
|
||||
|
||||
8
include/l4/generic/idle.h
Normal file
8
include/l4/generic/idle.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __IDLE_H__
|
||||
#define __IDLE_H__
|
||||
|
||||
void setup_idle_task(void);
|
||||
void containers_setup_idle(void);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,8 +26,25 @@ void platform_irq_disable(int irq);
|
||||
void print_early(char *str);
|
||||
void printhex8(unsigned int);
|
||||
|
||||
int platform_setup_device_caps(struct kernel_resources *kres);
|
||||
|
||||
void platform_test_cpucycles(void);
|
||||
|
||||
enum mem_type {
|
||||
MEM_TYPE_RAM = 0,
|
||||
MEM_TYPE_DEV = 1,
|
||||
};
|
||||
|
||||
struct platform_mem_range {
|
||||
unsigned long start;
|
||||
unsigned long end;
|
||||
unsigned int type;
|
||||
};
|
||||
|
||||
struct platform_mem_regions {
|
||||
int nregions;
|
||||
struct platform_mem_range mem_range[];
|
||||
};
|
||||
|
||||
/* Kernel uses this to initialize physmem capabilities */
|
||||
extern struct platform_mem_regions platform_mem_regions;
|
||||
|
||||
#endif /* __PLATFORM_H__ */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
/* Number of containers defined at compile-time */
|
||||
#include <l4/generic/capability.h>
|
||||
#include <l4/generic/space.h>
|
||||
#include <l4/lib/list.h>
|
||||
#include <l4/lib/mutex.h>
|
||||
#include <l4/lib/idpool.h>
|
||||
@@ -21,11 +22,6 @@ struct boot_resources {
|
||||
int nspaces;
|
||||
int npmds;
|
||||
int nmutex;
|
||||
|
||||
/* Kernel resource usage */
|
||||
int nkpmds;
|
||||
int nkpgds;
|
||||
int nkcaps;
|
||||
};
|
||||
|
||||
/* List of containers */
|
||||
@@ -80,9 +76,6 @@ struct kernel_resources {
|
||||
struct cap_list devmem_used;
|
||||
struct cap_list devmem_free;
|
||||
|
||||
/* All other caps that belong to the kernel */
|
||||
struct cap_list non_memory_caps;
|
||||
|
||||
struct mem_cache *pgd_cache;
|
||||
struct mem_cache *pmd_cache;
|
||||
struct mem_cache *ktcb_cache;
|
||||
@@ -98,31 +91,25 @@ struct kernel_resources {
|
||||
/* Global page tables on split page tables */
|
||||
pgd_global_table_t *pgd_global;
|
||||
#endif
|
||||
struct address_space init_space;
|
||||
};
|
||||
|
||||
extern struct kernel_resources kernel_resources;
|
||||
|
||||
void free_pgd(void *addr);
|
||||
void free_pmd(void *addr);
|
||||
void free_space(void *addr, struct ktcb *task);
|
||||
void free_ktcb(void *addr, struct ktcb *task);
|
||||
void free_capability(void *addr);
|
||||
void free_container(void *addr);
|
||||
void free_user_mutex(void *addr);
|
||||
void pgd_free(void *addr);
|
||||
void pmd_cap_free(void *addr, struct cap_list *clist);
|
||||
void space_cap_free(void *addr, struct cap_list *clist);
|
||||
void ktcb_cap_free(void *addr, struct cap_list *clist);
|
||||
void mutex_cap_free(void *addr);
|
||||
|
||||
pgd_table_t *alloc_pgd(void);
|
||||
pmd_table_t *alloc_pmd(void);
|
||||
struct address_space *alloc_space(void);
|
||||
struct ktcb *alloc_ktcb(void);
|
||||
struct ktcb *alloc_ktcb_use_capability(struct capability *cap);
|
||||
struct capability *boot_alloc_capability(void);
|
||||
struct capability *alloc_capability(void);
|
||||
struct container *alloc_container(void);
|
||||
struct mutex_queue *alloc_user_mutex(void);
|
||||
int free_boot_memory(struct kernel_resources *kres);
|
||||
pgd_table_t *pgd_alloc(void);
|
||||
pmd_table_t *pmd_cap_alloc(struct cap_list *clist);
|
||||
struct address_space *space_cap_alloc(struct cap_list *clist);
|
||||
struct ktcb *ktcb_cap_alloc(struct cap_list *clist);
|
||||
struct mutex_queue *mutex_cap_alloc(void);
|
||||
|
||||
int init_system_resources(struct kernel_resources *kres);
|
||||
|
||||
void setup_idle_caps(); /*TODO: Delete this when done with it */
|
||||
void setup_idle_caps(struct kernel_resources *kres);
|
||||
|
||||
#endif /* __RESOURCES_H__ */
|
||||
|
||||
@@ -63,17 +63,13 @@ enum sched_flags {
|
||||
/* Contains per-container scheduling structures */
|
||||
struct scheduler {
|
||||
unsigned int flags;
|
||||
unsigned int task_select_ctr;
|
||||
unsigned int task_select_counter;
|
||||
struct runqueue sched_rq[SCHED_RQ_TOTAL];
|
||||
|
||||
/* Regular runqueues */
|
||||
struct runqueue *rq_runnable;
|
||||
struct runqueue *rq_expired;
|
||||
|
||||
/* Real-time runqueues */
|
||||
struct runqueue *rq_rt_runnable;
|
||||
struct runqueue *rq_rt_expired;
|
||||
|
||||
struct ktcb *idle_task;
|
||||
|
||||
/* Total priority of all tasks in container */
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
struct address_space {
|
||||
l4id_t spid;
|
||||
struct link list;
|
||||
struct mutex lock;
|
||||
struct spinlock lock;
|
||||
pgd_table_t *pgd;
|
||||
|
||||
/* Capabilities shared by threads in same space */
|
||||
@@ -50,13 +50,12 @@ struct address_space {
|
||||
|
||||
struct address_space_list {
|
||||
struct link list;
|
||||
struct mutex lock;
|
||||
struct spinlock lock;
|
||||
int count;
|
||||
};
|
||||
|
||||
struct address_space *address_space_create(struct address_space *orig);
|
||||
void address_space_delete(struct address_space *space,
|
||||
struct ktcb *task_accounted);
|
||||
void address_space_delete(struct address_space *space, struct cap_list *clist);
|
||||
void address_space_attach(struct ktcb *tcb, struct address_space *space);
|
||||
struct address_space *address_space_find(l4id_t spid);
|
||||
void address_space_add(struct address_space *space);
|
||||
|
||||
@@ -70,6 +70,12 @@ struct task_ids {
|
||||
|
||||
struct container;
|
||||
|
||||
#define tcb_pagerid(tcb) ((tcb)->pager->tid)
|
||||
|
||||
#define space_is_pager(tcb) \
|
||||
((tcb)->space->spid == (tcb)->pager->space->spid)
|
||||
#define thread_is_pager(tcb) ((tcb)->pager == (tcb))
|
||||
|
||||
struct ktcb {
|
||||
/* User context */
|
||||
task_context_t context;
|
||||
@@ -91,9 +97,6 @@ struct ktcb {
|
||||
/* CPU affinity */
|
||||
int affinity;
|
||||
|
||||
/* Other related threads */
|
||||
l4id_t pagerid;
|
||||
|
||||
/* Flags to indicate various task status */
|
||||
unsigned int flags;
|
||||
|
||||
@@ -133,10 +136,10 @@ struct ktcb {
|
||||
|
||||
/* Container */
|
||||
struct container *container;
|
||||
struct pager *pager;
|
||||
|
||||
/* Capability lists */
|
||||
struct cap_list cap_list; /* Own private capabilities */
|
||||
/* Other related threads */
|
||||
struct ktcb *pager;
|
||||
int nchild;
|
||||
|
||||
/* Fields for ipc rendezvous */
|
||||
struct waitqueue_head wqh_recv;
|
||||
|
||||
@@ -12,15 +12,14 @@
|
||||
void switch_to_user(struct ktcb *inittask);
|
||||
void timer_start(void);
|
||||
|
||||
extern struct address_space init_space;
|
||||
void init_kernel_mappings(void);
|
||||
void start_virtual_memory(void);
|
||||
void finalize_virtual_memory(void);
|
||||
void init_finalize(void);
|
||||
|
||||
void secondary_idle_task_init(void);
|
||||
void remove_section_mapping(unsigned long vaddr);
|
||||
|
||||
void vectors_init(void);
|
||||
void setup_idle_caps(void);
|
||||
void setup_idle_task(void);
|
||||
|
||||
#endif /* __ARM_GLUE_INIT_H__ */
|
||||
|
||||
@@ -17,19 +17,27 @@
|
||||
|
||||
unsigned int space_flags_to_ptflags(unsigned int flags);
|
||||
|
||||
void add_mapping_pgd(unsigned long paddr, unsigned long vaddr,
|
||||
unsigned int size, unsigned int flags,
|
||||
pgd_table_t *pgd);
|
||||
struct address_space;
|
||||
struct cap_list;
|
||||
int add_mapping_use_cap(unsigned long paddr, unsigned long vaddr,
|
||||
unsigned int size, unsigned int flags,
|
||||
struct address_space *space,
|
||||
struct cap_list *clist);
|
||||
|
||||
void add_mapping(unsigned long paddr, unsigned long vaddr,
|
||||
int add_mapping_space(unsigned long paddr, unsigned long vaddr,
|
||||
unsigned int size, unsigned int flags,
|
||||
struct address_space *space);
|
||||
|
||||
int add_mapping(unsigned long paddr, unsigned long vaddr,
|
||||
unsigned int size, unsigned int flags);
|
||||
|
||||
void add_boot_mapping(unsigned long paddr, unsigned long vaddr,
|
||||
unsigned int size, unsigned int flags);
|
||||
|
||||
int remove_mapping(unsigned long vaddr);
|
||||
int remove_mapping_pgd(pgd_table_t *pgd, unsigned long vaddr);
|
||||
void remove_mapping_pgd_all_user(pgd_table_t *pgd);
|
||||
int remove_mapping_space(struct address_space *space, unsigned long vaddr);
|
||||
void remove_mapping_pgd_all_user(struct address_space *space,
|
||||
struct cap_list *clist);
|
||||
|
||||
int check_mapping_pgd(unsigned long vaddr, unsigned long size,
|
||||
unsigned int flags, pgd_table_t *pgd);
|
||||
@@ -40,7 +48,7 @@ int check_mapping(unsigned long vaddr, unsigned long size,
|
||||
void copy_pgd_kern_all(pgd_table_t *);
|
||||
|
||||
struct address_space;
|
||||
int delete_page_tables(struct address_space *space);
|
||||
int delete_page_tables(struct address_space *space, struct cap_list *clist);
|
||||
int copy_user_tables(struct address_space *new, struct address_space *orig);
|
||||
void remap_as_pages(void *vstart, void *vend);
|
||||
|
||||
@@ -62,14 +70,14 @@ unsigned long virt_to_phys_by_pgd(pgd_table_t *pgd, unsigned long vaddr);
|
||||
void arch_prepare_pte(u32 paddr, u32 vaddr, unsigned int flags,
|
||||
pte_t *ptep);
|
||||
|
||||
void arch_write_pte(pte_t *ptep, pte_t pte, u32 vaddr);
|
||||
void arch_write_pte(pte_t *ptep, pte_t pte, u32 vaddr, u32 asid);
|
||||
|
||||
void arch_prepare_write_pte(u32 paddr, u32 vaddr,
|
||||
void arch_prepare_write_pte(struct address_space *space, u32 paddr, u32 vaddr,
|
||||
unsigned int flags, pte_t *ptep);
|
||||
|
||||
pmd_t *arch_pick_pmd(pgd_table_t *pgd, unsigned long vaddr);
|
||||
|
||||
void arch_write_pmd(pmd_t *pmd_entry, u32 pmd_phys, u32 vaddr);
|
||||
void arch_write_pmd(pmd_t *pmd_entry, u32 pmd_phys, u32 vaddr, u32 asid);
|
||||
|
||||
int arch_check_pte_access_perms(pte_t pte, unsigned int flags);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ struct cpuinfo {
|
||||
|
||||
extern struct cpuinfo cpuinfo;
|
||||
|
||||
#if defined(CONFIG_SMP)
|
||||
#if defined(CONFIG_SMP_)
|
||||
|
||||
void smp_attach(void);
|
||||
void smp_start_cores(void);
|
||||
|
||||
@@ -30,7 +30,7 @@ static inline void spin_lock_init(struct spinlock *s)
|
||||
static inline void spin_lock(struct spinlock *s)
|
||||
{
|
||||
preempt_disable(); /* This must disable local preempt */
|
||||
#if defined(CONFIG_SMP)
|
||||
#if defined(CONFIG_SMP_)
|
||||
|
||||
#if defined (CONFIG_DEBUG_SPINLOCKS)
|
||||
spin_lock_record_check(s);
|
||||
@@ -41,7 +41,7 @@ static inline void spin_lock(struct spinlock *s)
|
||||
|
||||
static inline void spin_unlock(struct spinlock *s)
|
||||
{
|
||||
#if defined(CONFIG_SMP)
|
||||
#if defined(CONFIG_SMP_)
|
||||
|
||||
#if defined (CONFIG_DEBUG_SPINLOCKS)
|
||||
spin_unlock_delete_check(s);
|
||||
@@ -60,7 +60,7 @@ static inline void spin_lock_irq(struct spinlock *s,
|
||||
unsigned long *state)
|
||||
{
|
||||
irq_local_disable_save(state);
|
||||
#if defined(CONFIG_SMP)
|
||||
#if defined(CONFIG_SMP_)
|
||||
#if defined (CONFIG_DEBUG_SPINLOCKS)
|
||||
spin_lock_record_check(s);
|
||||
#endif
|
||||
@@ -72,7 +72,7 @@ static inline void spin_lock_irq(struct spinlock *s,
|
||||
static inline void spin_unlock_irq(struct spinlock *s,
|
||||
unsigned long state)
|
||||
{
|
||||
#if defined(CONFIG_SMP)
|
||||
#if defined(CONFIG_SMP_)
|
||||
|
||||
#if defined (CONFIG_DEBUG_SPINLOCKS)
|
||||
spin_unlock_delete_check(s);
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define SZ_1K 1024
|
||||
#define SZ_2K 2048
|
||||
#define SZ_4K 0x1000
|
||||
#define SZ_8K 0x2000
|
||||
#define SZ_16K 0x4000
|
||||
#define SZ_32K 0x8000
|
||||
#define SZ_64K 0x10000
|
||||
@@ -63,14 +64,14 @@
|
||||
|
||||
/* Per-cpu variables */
|
||||
|
||||
#if defined CONFIG_SMP
|
||||
#if defined CONFIG_SMP_
|
||||
#define DECLARE_PERCPU(type, name) \
|
||||
type name[CONFIG_NCPU]
|
||||
|
||||
#define per_cpu(val) (val)[smp_get_cpuid()]
|
||||
#define per_cpu_byid(val, cpu) (val)[(cpu)]
|
||||
|
||||
#else /* Not CONFIG_SMP */
|
||||
#else /* Not CONFIG_SMP_ */
|
||||
|
||||
#define DECLARE_PERCPU(type, name) \
|
||||
type name
|
||||
@@ -78,7 +79,7 @@ type name
|
||||
#define per_cpu(val) (val)
|
||||
#define per_cpu_byid(val, cpu) val
|
||||
|
||||
#endif /* End of Not CONFIG_SMP */
|
||||
#endif /* End of Not CONFIG_SMP_ */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <stddef.h> /* offsetof macro, defined in the `standard' way. */
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
#define IRQS_MAX 96
|
||||
#endif
|
||||
|
||||
/* Range of IRQ numbers used by this platform */
|
||||
#define IRQ_RANGE_START 0
|
||||
#define IRQ_RANGE_END IRQS_MAX
|
||||
|
||||
/*
|
||||
* Interrupt Distribution:
|
||||
* 0-31: Used as SI provided by distributed interrupt controller
|
||||
@@ -44,9 +48,14 @@
|
||||
#define EB_IRQ_AACI (EB_GIC_IRQ_OFFSET + 19) /* Advanced Audio codec */
|
||||
#define EB_IRQ_KMI0 (EB_GIC_IRQ_OFFSET + 20) /* Keyboard */
|
||||
#define EB_IRQ_KMI1 (EB_GIC_IRQ_OFFSET + 21) /* Mouse */
|
||||
#define EB_IRQ_LCD (EB_GIC_IRQ_OFFSET + 20) /* Character LCD */
|
||||
#define EB_IRQ_DMAC (EB_GIC_IRQ_OFFSET + 20) /* DMA Controller */
|
||||
|
||||
/*
|
||||
* We have 3 IRQs for CLCD
|
||||
* 23 - clcd display
|
||||
* 30, 31 for touch screen pen interrupt
|
||||
*/
|
||||
#define EB_IRQ_CLCD (EB_GIC_IRQ_OFFSET + 23)
|
||||
|
||||
/* Interrupt Sources to ARM 11 MPCore or EB+A9 MPCore GIC */
|
||||
#define MPCORE_GIC_IRQ_AACI (EB_GIC_IRQ_OFFSET + 0)
|
||||
@@ -59,6 +68,7 @@
|
||||
#define MPCORE_GIC_IRQ_KMI0 (EB_GIC_IRQ_OFFSET + 7)
|
||||
#define MPCORE_GIC_IRQ_KMI1 (EB_GIC_IRQ_OFFSET + 8)
|
||||
#define MPCORE_GIC_IRQ_ETH (EB_GIC_IRQ_OFFSET + 9)
|
||||
#define MPCORE_GIC_IRQ_CLCD (EB_GIC_IRQ_OFFSET + 23)
|
||||
|
||||
/* Interrupt from GIC1 on Base board */
|
||||
#define MPCORE_GIC_IRQ_EB_GIC1 (EB_GIC_IRQ_OFFSET + 10)
|
||||
@@ -69,13 +79,15 @@
|
||||
#if defined (CONFIG_CPU_ARM11MPCORE) || defined (CONFIG_CPU_CORTEXA9)
|
||||
#define IRQ_TIMER0 MPCORE_GIC_IRQ_TIMER01
|
||||
#define IRQ_TIMER1 MPCORE_GIC_IRQ_TIMER23
|
||||
#define IRQ_KEYBOARD0 MPCORE_GIC_IRQ_TIMER01
|
||||
#define IRQ_KEYBOARD0 MPCORE_GIC_IRQ_KMI0
|
||||
#define IRQ_MOUSE0 MPCORE_GIC_IRQ_KMI1
|
||||
#define IRQ_CLCD0 MPCORE_GIC_IRQ_CLCD
|
||||
#else
|
||||
#define IRQ_TIMER0 EB_IRQ_TIMER01
|
||||
#define IRQ_TIMER1 EB_IRQ_TIMER23
|
||||
#define IRQ_KEYBOARD0 EB_IRQ_KMI0
|
||||
#define IRQ_MOUSE0 EB_IRQ_KMI1
|
||||
#define IRQ_CLCD0 EB_IRQ_CLCD
|
||||
#endif
|
||||
|
||||
#endif /* __PLATFORM_IRQ_H__ */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <l4/platform/realview/offsets.h>
|
||||
|
||||
/* Device offsets in physical memory */
|
||||
#define PLATFORM_CLCD0_BASE 0x10020000 /* CLCD0 */
|
||||
#define PLATFORM_GIC1_BASE 0x10040000 /* GIC 1 */
|
||||
#define PLATFORM_GIC2_BASE 0x10050000 /* GIC 2 */
|
||||
#define PLATFORM_GIC3_BASE 0x10060000 /* GIC 3 */
|
||||
|
||||
@@ -52,4 +52,8 @@
|
||||
#define IRQ_KEYBOARD0 (SIC_IRQ_KEYBOARD + SIC_CHIP_OFFSET)
|
||||
#define IRQ_MOUSE0 (SIC_IRQ_MOUSE + SIC_CHIP_OFFSET)
|
||||
|
||||
/* Range of IRQ numbers used by this platform */
|
||||
#define IRQ_RANGE_START 0
|
||||
#define IRQ_RANGE_END 63
|
||||
|
||||
#endif /* __PLATFORM_IRQ_H__ */
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define PLATFORM_UART2_BASE 0x101F3000 /* Console port (UART2) */
|
||||
#define PLATFORM_UART3_BASE 0x10009000 /* Console port (UART3) */
|
||||
#define PLATFORM_CLCD0_BASE 0x10120000 /* Color LCD */
|
||||
|
||||
#define PLATFORM_SYSREGS_SIZE 0x01000000 /* Portion allocated for sysregs */
|
||||
/*
|
||||
* Device offsets in virtual memory. They offset to some virtual
|
||||
* device base address. Each page on this virtual base is consecutively
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#ifndef __PLATFORM_IRQ_H__
|
||||
#define __PLATFORM_IRQ_H__
|
||||
|
||||
|
||||
/* TODO: Not sure about this, need to check */
|
||||
#define IRQ_CHIPS_MAX 1
|
||||
#define IRQS_MAX 96
|
||||
@@ -32,5 +31,9 @@
|
||||
* 75- 81: Test chip interrupts
|
||||
*/
|
||||
|
||||
/* Range of IRQ numbers used by this platform */
|
||||
#define IRQ_RANGE_START 0
|
||||
#define IRQ_RANGE_END 95
|
||||
|
||||
#endif /* __PLATFORM_IRQ_H__ */
|
||||
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
#include <l4/platform/realview/offsets.h>
|
||||
|
||||
#define PLATFORM_DEVICES1_START 0x40000000
|
||||
#define PLATFORM_DEVICES1_END 0x60000000
|
||||
|
||||
/*
|
||||
* Device offsets in physical memory
|
||||
* Naming of devices done starting with 0 subscript,
|
||||
|
||||
@@ -9,4 +9,13 @@
|
||||
|
||||
#include <l4/platform/realview/platform.h>
|
||||
|
||||
#define CLCD_SELECT_BOARD 0
|
||||
#define CLCD_SELECT_TILE 1
|
||||
|
||||
void sri_set_mux(int offset);
|
||||
void clcd_clock_write(u32 freq, int clcd_select);
|
||||
u32 clcd_clock_read(int clcd_select);
|
||||
void clcd_init(void);
|
||||
void kmi_init(void);
|
||||
|
||||
#endif /* __PBA9_PLATFORM_H__ */
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#define PLATFORM_PHYS_MEM_START 0x00000000 /* inclusive */
|
||||
#define PLATFORM_PHYS_MEM_END 0x10000000 /* 256 MB, exclusive */
|
||||
|
||||
#define PLATFORM_DEVICES_START 0x10000000 /* System registers */
|
||||
#define PLATFORM_DEVICES_END 0x20000000 /* System regs end */
|
||||
|
||||
/*
|
||||
* Device offsets in physical memory
|
||||
* Naming of devices done starting with 0 subscript,
|
||||
|
||||
Reference in New Issue
Block a user