ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / domain.h
1 /*
2  *  linux/include/asm-arm/domain.h
3  *
4  *  Copyright (C) 1999 Russell King.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #ifndef __ASM_PROC_DOMAIN_H
11 #define __ASM_PROC_DOMAIN_H
12
13 /*
14  * Domain numbers
15  *
16  *  DOMAIN_IO     - domain 2 includes all IO only
17  *  DOMAIN_KERNEL - domain 1 includes all kernel memory only
18  *  DOMAIN_USER   - domain 0 includes all user memory only
19  */
20 #define DOMAIN_USER     0
21 #define DOMAIN_KERNEL   1
22 #define DOMAIN_TABLE    1
23 #define DOMAIN_IO       2
24
25 /*
26  * Domain types
27  */
28 #define DOMAIN_NOACCESS 0
29 #define DOMAIN_CLIENT   1
30 #define DOMAIN_MANAGER  3
31
32 #define domain_val(dom,type)    ((type) << 2*(dom))
33
34 #define set_domain(x)                                   \
35         do {                                            \
36         __asm__ __volatile__(                           \
37         "mcr    p15, 0, %0, c3, c0      @ set domain"   \
38           : : "r" (x));                                 \
39         } while (0)
40
41 #define modify_domain(dom,type)                                 \
42         do {                                                    \
43         struct thread_info *thread = current_thread_info();     \
44         unsigned int domain = thread->cpu_domain;               \
45         domain &= ~domain_val(dom, DOMAIN_MANAGER);             \
46         thread->cpu_domain = domain | domain_val(dom, type);    \
47         set_domain(thread->cpu_domain);                         \
48         } while (0)
49
50 #endif