My Project
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
global.h
Go to the documentation of this file.
1 /*
2  * OpenVirtualization:
3  * For additional details and support contact developer@sierraware.com.
4  * Additional documentation can be found at www.openvirtualization.org
5  *
6  * Copyright (C) 2010-2014 SierraWare
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 /*
24  * global variables defintions
25  */
26 
27 #ifndef __OTZ_GLOBAL_H__
28 #define __OTZ_GLOBAL_H__
29 
30 #define TASK_ID_START 0x111
31 #include <sw_list.h>
32 #include <sw_board.h>
33 #include <cpu_data.h>
34 #include <sw_types.h>
35 #include <sw_timer.h>
42 typedef void (irq_handler)(int interrupt, void *data);
43 
47 struct sw_global {
51  u32 exec_mode;
54 /* Fix it */
55  u32 res0;
56 /* TODO : Add a lock to this list too */
58  struct list task_list;
71 #ifdef OTZONE_ASYNC_NOTIFY_SUPPORT
72 
73  struct otzc_notify_data *notify_data;
74 #endif
75 };
76 
80 typedef struct acl_device{
81  struct list head;
82  struct list group_head;
83  u32 did;
84 }acl_device;
85 
89 typedef struct acl_group{
90  struct list head;
91  struct list user_head;
92  u32 gid;
93 }acl_group;
94 
98 typedef struct acl_user{
99  struct list head;
100  u32 uid;
101 }acl_user;
102 
103 #ifndef ARM_ARCH_ARMV7
108 };
109 #endif
110 
111 
115 extern struct sw_global global_val;
116 
122 void global_init(void);
123 
131 struct sw_task* get_current_task(void);
132 
140 struct sw_task* get_next_task(void);
141 
147 void update_current_task(struct sw_task*);
148 
154 int get_current_task_id(void);
155 
163 void schedule_task(struct sw_task* task);
164 
173 void schedule_task_next(struct sw_task* task);
174 
182 void schedule_task_id(int task_id);
183 
192 void suspend_task(int task_id, int state);
193 
197 void print_task_list(void);
198 
199 
210 void register_irq(u32 interrupt ,irq_handler handler, void *data);
211 
221 void invoke_irq_handler(u32 interrupt, struct swi_temp_regs *regs);
222 
223 #ifdef OTZONE_ASYNC_NOTIFY_SUPPORT
224 
237 int register_notify_data(pa_t data_phys);
238 
245 void unregister_notify_data(void);
246 
258 void set_notify_data(int service_id, int session_id, int enc_id,
259  int client_pid, int dev_file_id);
260 #endif
261 
262 /* scheduler.c */
269 void scheduler(void *regs);
270 
271 
272 /* cpu_timer.c */
278 void enable_timer(void);
279 
285 void disable_timer(void);
286 
287 
293 void timer_init(void);
294 
300 int get_current_task_id(void);
306 void schedule(void);
307 
318 void clockcycles_to_timeval(pa_t clockcycles, timeval_t *timeval);
319 
320 
329 void timeval_to_clockcycles(timeval_t *time, pa_t * ret_clockcycles);
330 
331 
339 void read_freerunning_cntr(pa_t *val);
340 
341 
342 # ifdef CONFIG_EMULATE_FIQ
343 
348 u32 read_sleep_timer(void);
349 #endif
350 
358 void trigger_tick(u64 usecs);
359 
367 u64 get_timer_period(void);
368 
376 u64 get_clock_period(void);
377 
385 u32 read_timer_value(u32 timer_base);
386 #ifndef ARM_ARCH_ARMV7
387 s32 get_clock_period_ns(void);
388 
389 void secure_timer_irq_handler(int irq);
390 
391 void sw_timer_init(u32 timer_base);
392 
393 void sw_timer_disable(u32 timer_base, u32 timer_index);
394 
395 void sw_set_timer(u32 timer_base, u32 tim_mod_index,
396  u32 mode, ulong clockcycles);
397 
398 void sw_timer_enable(u32 timer_base, u32 timer_index);
399 #endif
400 
401 #ifdef OTZONE_ASYNC_NOTIFY_SUPPORT
402 
411 void invoke_ns_callback(u32 svc_id, u32 session_id, u32 enc_id, u32 client_pid,
412  u32 dev_file_id);
413 #endif
414 
415 #endif /* __OTZ_GLOBAL_H__ */
struct list head
Definition: global.h:90
void register_irq(u32 interrupt, irq_handler handler, void *data)
Register IRQ handler for the specificed interrupt ID.
Definition: global.c:279
irq_handler * task_irq_handler[GIC_NR_IRQS]
Definition: global.h:66
Structure to represent the time in High resolution format( Resolution in Nano seconds) ...
Definition: sw_timer.h:55
struct sw_task * get_next_task(void)
Get the next ready to run task.
Definition: global.c:209
struct acl_group acl_group
void secure_timer_irq_handler(int irq)
Definition: timer.c:189
void update_current_task(struct sw_task *)
Update the current task ID.
Definition: global.c:152
void enable_timer(void)
Enable secure kernel timer.
Definition: cpu_api.c:52
struct sw_task_cpu_regs regs
Definition: task.h:132
void scheduler(void *regs)
Scheduler function.
Definition: scheduler.c:38
struct acl_device acl_device
void read_freerunning_cntr(pa_t *val)
It reads and returns the value of the timer which is used as the free running counter.
Definition: timer.c:113
void sw_timer_disable(u32 timer_base, u32 timer_index)
Definition: timer.c:138
u64 get_clock_period(void)
This function returns the resolution which can be obtained with the given clock.
Definition: timer.c:39
void schedule_task_next(struct sw_task *task)
This function adds the task to the ready to run list as the first element so that the next task sched...
Definition: global.c:84
void timer_init(void)
Init secure kernel timer.
Definition: cpu_api.c:40
timer_mode
Definition: global.h:104
void global_init(void)
Global initialization.
Definition: global.c:44
struct list ready_to_run_list
Definition: global.h:60
struct sw_global global_val
Global variable structure.
Definition: global.c:37
void trigger_tick(u64 usecs)
This function writes the number of clockcycles to be expired before the next tick to the tick timer a...
Definition: cpu_api.c:89
struct acl_user acl_user
struct spinlock ready_to_run_lock
Definition: global.h:62
struct list user_head
Definition: global.h:91
struct list head
Definition: global.h:81
Definition: global.h:107
void * task_irq_handler_data[GIC_NR_IRQS]
Definition: global.h:68
void invoke_irq_handler(u32 interrupt, struct swi_temp_regs *regs)
Invoke the registered IRQ handler of specified interrupt number.
Definition: global.c:297
Structure to store register in SWI handler.
Definition: cpu_data.h:47
void timeval_to_clockcycles(timeval_t *time, pa_t *ret_clockcycles)
It converts the time (seconds and nanoseconds) to the number of clockcycles.
Definition: cpu_api.c:172
u8 * data
Definition: fat32.c:40
void( irq_handler)(int interrupt, void *data)
Task IRQ handler.
Definition: global.h:42
Definition: global.h:98
#define GIC_NR_IRQS
Definition: sw_board.h:96
struct list page_ref_list
Definition: global.h:64
void schedule_task_id(int task_id)
Schedules the task.
Definition: global.c:94
void sw_timer_init(u32 timer_base)
Definition: timer.c:150
struct list head
Definition: global.h:99
Shared memory for Notification.
Definition: otz_common.h:82
int get_current_task_id(void)
Returnd the ID of the current task.
Definition: global.c:165
u32 state
Definition: task.h:124
struct list task_list
Definition: global.h:58
Global variables structure.
Definition: global.h:47
Definition: global.h:80
void sw_timer_enable(u32 timer_base, u32 timer_index)
Definition: timer.c:124
void suspend_task(int task_id, int state)
Suspends the task.
Definition: global.c:119
void sw_set_timer(u32 timer_base, u32 tim_mod_index, u32 mode, ulong clockcycles)
Definition: timer.c:171
u32 exec_mode
Definition: global.h:51
Task structure.
Definition: task.h:111
Definition: global.h:105
s32 get_clock_period_ns(void)
Definition: timer.c:71
Definition: global.h:89
u32 read_timer_value(u32 timer_base)
void print_task_list(void)
Prints the all task names.
Definition: global.c:252
Definition: sw_list.h:56
struct sw_task * get_current_task(void)
Get the current task.
Definition: global.c:177
void schedule_task(struct sw_task *task)
Schedules the task.
Definition: global.c:72
struct list group_head
Definition: global.h:82
u32 did
Definition: global.h:83
u32 next_task_id
Definition: global.h:49
Definition: sw_semaphores.h:236
u64 get_timer_period(void)
This function returns the maximum time that can be kept track of before it gets expired. (Eg : The time taken for running from 0xFFFFFFFF to 0x00000000)
Definition: timer.c:54
struct list device_acl_list
Definition: global.h:70
u32 task_id
Definition: task.h:116
u32 res0
Definition: global.h:55
u32 current_task_id
Definition: global.h:53
u32 uid
Definition: global.h:100
u32 service_id
Definition: task.h:118
void clockcycles_to_timeval(pa_t clockcycles, timeval_t *timeval)
This function converts the clockcycles to time in seconds and nanoseconds This function definition de...
Definition: cpu_api.c:105
u32 gid
Definition: global.h:92
void disable_timer(void)
Disable secure kernel timer.
Definition: cpu_api.c:65
Definition: global.h:106
void schedule(void)
Invoke scheduler.
Definition: cpu_api.c:230