OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [generic/] [resource.h] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Description of resources on the system
3
 *
4
 * Copyright (C) 2009 Bahadir Balban
5
 */
6
 
7
#ifndef __RESOURCES_H__
8
#define __RESOURCES_H__
9
 
10
/* Number of containers defined at compile-time */
11
#include <l4/generic/capability.h>
12
#include <l4/lib/list.h>
13
#include <l4/lib/mutex.h>
14
#include <l4/lib/idpool.h>
15
#include INC_SUBARCH(mm.h)
16
 
17
struct boot_resources {
18
        int nconts;
19
        int ncaps;
20
        int nthreads;
21
        int nspaces;
22
        int npmds;
23
        int nmutex;
24
 
25
        /* Kernel resource usage */
26
        int nkpmds;
27
        int nkpgds;
28
        int nkcaps;
29
};
30
 
31
/* List of containers */
32
struct container_head {
33
        int ncont;
34
        struct link list;
35
        struct spinlock lock;
36
};
37
 
38
static inline void
39
container_head_init(struct container_head *chead)
40
{
41
        chead->ncont = 0;
42
        link_init(&chead->list);
43
        spin_lock_init(&chead->lock);
44
}
45
 
46
/* Hash table for all existing tasks */
47
struct ktcb_list {
48
        struct link list;
49
        struct spinlock list_lock;
50
        int count;
51
};
52
 
53
/*
54
 * Everything on the platform is described and stored
55
 * in the structure below.
56
 */
57
struct kernel_resources {
58
        l4id_t cid;
59
 
60
        /* System id pools */
61
        struct id_pool space_ids;
62
        struct id_pool ktcb_ids;
63
        struct id_pool resource_ids;
64
        struct id_pool container_ids;
65
        struct id_pool mutex_ids;
66
        struct id_pool capability_ids;
67
 
68
        /* List of all containers */
69
        struct container_head containers;
70
 
71
        /* Physical memory caps, used/unused */
72
        struct cap_list physmem_used;
73
        struct cap_list physmem_free;
74
 
75
        /* Virtual memory caps, used/unused */
76
        struct cap_list virtmem_used;
77
        struct cap_list virtmem_free;
78
 
79
        /* Device memory caps, used/unused */
80
        struct cap_list devmem_used;
81
        struct cap_list devmem_free;
82
 
83
        /* All other caps that belong to the kernel */
84
        struct cap_list non_memory_caps;
85
 
86
        struct mem_cache *pgd_cache;
87
        struct mem_cache *pmd_cache;
88
        struct mem_cache *ktcb_cache;
89
        struct mem_cache *space_cache;
90
        struct mem_cache *mutex_cache;
91
        struct mem_cache *cap_cache;
92
        struct mem_cache *cont_cache;
93
 
94
        /* Zombie thread list */
95
        DECLARE_PERCPU(struct ktcb_list, zombie_list);
96
 
97
#if defined(CONFIG_SUBARCH_V7)
98
        /* Global page tables on split page tables */
99
        pgd_global_table_t *pgd_global;
100
#endif
101
};
102
 
103
extern struct kernel_resources kernel_resources;
104
 
105
void free_pgd(void *addr);
106
void free_pmd(void *addr);
107
void free_space(void *addr, struct ktcb *task);
108
void free_ktcb(void *addr, struct ktcb *task);
109
void free_capability(void *addr);
110
void free_container(void *addr);
111
void free_user_mutex(void *addr);
112
 
113
pgd_table_t *alloc_pgd(void);
114
pmd_table_t *alloc_pmd(void);
115
struct address_space *alloc_space(void);
116
struct ktcb *alloc_ktcb(void);
117
struct ktcb *alloc_ktcb_use_capability(struct capability *cap);
118
struct capability *boot_alloc_capability(void);
119
struct capability *alloc_capability(void);
120
struct container *alloc_container(void);
121
struct mutex_queue *alloc_user_mutex(void);
122
int free_boot_memory(struct kernel_resources *kres);
123
 
124
int init_system_resources(struct kernel_resources *kres);
125
 
126
void setup_idle_caps(); /*TODO: Delete this when done with it */
127
 
128
#endif /* __RESOURCES_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.