/*1* arch/arm/include/asm/domain.h2*3* Copyright (C) 1999 Russell King.4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/9#ifndef __ASM_PROC_DOMAIN_H10#define __ASM_PROC_DOMAIN_H1112/*13* Domain numbers14*15* DOMAIN_IO - domain 2 includes all IO only16* DOMAIN_USER - domain 1 includes all user memory only17* DOMAIN_KERNEL - domain 0 includes all kernel memory only18*19* The domain numbering depends on whether we support 36 physical20* address for I/O or not. Addresses above the 32 bit boundary can21* only be mapped using supersections and supersections can only22* be set for domain 0. We could just default to DOMAIN_IO as zero,23* but there may be systems with supersection support and no 36-bit24* addressing. In such cases, we want to map system memory with25* supersections to reduce TLB misses and footprint.26*27* 36-bit addressing and supersections are only available on28* CPUs based on ARMv6+ or the Intel XSC3 core.29*/30#ifndef CONFIG_IO_3631#define DOMAIN_KERNEL 032#define DOMAIN_TABLE 033#define DOMAIN_USER 134#define DOMAIN_IO 235#else36#define DOMAIN_KERNEL 237#define DOMAIN_TABLE 238#define DOMAIN_USER 139#define DOMAIN_IO 040#endif4142/*43* Domain types44*/45#define DOMAIN_NOACCESS 046#define DOMAIN_CLIENT 147#ifdef CONFIG_CPU_USE_DOMAINS48#define DOMAIN_MANAGER 349#else50#define DOMAIN_MANAGER 151#endif5253#define domain_val(dom,type) ((type) << (2*(dom)))5455#ifndef __ASSEMBLY__5657#ifdef CONFIG_CPU_USE_DOMAINS58#define set_domain(x) \59do { \60__asm__ __volatile__( \61"mcr p15, 0, %0, c3, c0 @ set domain" \62: : "r" (x)); \63isb(); \64} while (0)6566#define modify_domain(dom,type) \67do { \68struct thread_info *thread = current_thread_info(); \69unsigned int domain = thread->cpu_domain; \70domain &= ~domain_val(dom, DOMAIN_MANAGER); \71thread->cpu_domain = domain | domain_val(dom, type); \72set_domain(thread->cpu_domain); \73} while (0)7475#else76#define set_domain(x) do { } while (0)77#define modify_domain(dom,type) do { } while (0)78#endif7980/*81* Generate the T (user) versions of the LDR/STR and related82* instructions (inline assembly)83*/84#ifdef CONFIG_CPU_USE_DOMAINS85#define T(instr) #instr "t"86#else87#define T(instr) #instr88#endif8990#else /* __ASSEMBLY__ */9192/*93* Generate the T (user) versions of the LDR/STR and related94* instructions95*/96#ifdef CONFIG_CPU_USE_DOMAINS97#define T(instr) instr ## t98#else99#define T(instr) instr100#endif101102#endif /* __ASSEMBLY__ */103104#endif /* !__ASM_PROC_DOMAIN_H */105106107