blob: 4ef110358f657bb12725fa85f19a053cc51ebd81 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2
3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#ifndef __ARM926EJ_S_H__
16#define __ARM926EJ_S_H__
17
18// Domain Access Control Register
19#define DOMAIN_ACCESS_CONTROL_MASK(a) (3UL << (2 * (a)))
20#define DOMAIN_ACCESS_CONTROL_NONE(a) (0UL << (2 * (a)))
21#define DOMAIN_ACCESS_CONTROL_CLIENT(a) (1UL << (2 * (a)))
22#define DOMAIN_ACCESS_CONTROL_RESERVED(a) (2UL << (2 * (a)))
23#define DOMAIN_ACCESS_CONTROL_MANAGER(a) (3UL << (2 * (a)))
24
25#define TRANSLATION_TABLE_SIZE (16 * 1024)
26#define TRANSLATION_TABLE_ALIGNMENT (16 * 1024)
27#define TRANSLATION_TABLE_ALIGNMENT_MASK (TRANSLATION_TABLE_ALIGNMENT - 1)
28
29#define TRANSLATION_TABLE_ENTRY_FOR_VIRTUAL_ADDRESS(table, address) ((UINT32 *)(table) + (((UINTN)(address)) >> 20))
30
31// Translation table descriptor types
32#define TT_DESCRIPTOR_TYPE_MASK (3UL << 0)
33#define TT_DESCRIPTOR_TYPE_FAULT (0UL << 0)
34#define TT_DESCRIPTOR_TYPE_COARSE ((1UL << 0) | (1UL << 4))
35#define TT_DESCRIPTOR_TYPE_SECTION ((2UL << 0) | (1UL << 4))
36#define TT_DESCRIPTOR_TYPE_FINE ((3UL << 0) | (1UL << 4))
37
38// Section descriptor definitions
39#define TT_DESCRIPTOR_SECTION_SIZE (0x00100000)
40
41#define TT_DESCRIPTOR_SECTION_CACHE_POLICY_MASK (3UL << 2)
42#define TT_DESCRIPTOR_SECTION_CACHE_POLICY_UNCACHED_UNBUFFERED (0UL << 2)
43#define TT_DESCRIPTOR_SECTION_CACHE_POLICY_UNCACHED_BUFFERED (1UL << 2)
44#define TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_THROUGH (2UL << 2)
45#define TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_BACK (3UL << 2)
46
47#define TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_MASK (3UL << 10)
48#define TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_NONE (1UL << 10)
49#define TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_READ_ONLY (2UL << 10)
50#define TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_READ_WRITE (3UL << 10)
51
52#define TT_DESCRIPTOR_SECTION_DOMAIN_MASK (0x0FUL << 5)
53#define TT_DESCRIPTOR_SECTION_DOMAIN(a) (((a) & 0xF) << 5)
54
55#define TT_DESCRIPTOR_SECTION_BASE_ADDRESS_MASK (0xFFF00000)
56#define TT_DESCRIPTOR_SECTION_BASE_ADDRESS(a) (a & TT_DESCRIPTOR_SECTION_BASE_ADDRESS_MASK)
57
58#define TT_DESCRIPTOR_SECTION_WRITE_BACK (TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_READ_WRITE | \
59 TT_DESCRIPTOR_SECTION_DOMAIN(0) | \
60 TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_BACK | \
61 TT_DESCRIPTOR_TYPE_SECTION)
62#define TT_DESCRIPTOR_SECTION_WRITE_THROUGH (TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_READ_WRITE | \
63 TT_DESCRIPTOR_SECTION_DOMAIN(0) | \
64 TT_DESCRIPTOR_SECTION_CACHE_POLICY_WRITE_THROUGH | \
65 TT_DESCRIPTOR_TYPE_SECTION)
66#define TT_DESCRIPTOR_SECTION_UNCACHED_UNBUFFERED (TT_DESCRIPTOR_SECTION_ACCESS_PERMISSION_READ_WRITE | \
67 TT_DESCRIPTOR_SECTION_DOMAIN(0) | \
68 TT_DESCRIPTOR_SECTION_CACHE_POLICY_UNCACHED_UNBUFFERED | \
69 TT_DESCRIPTOR_TYPE_SECTION)
70
71#endif // __ARM926EJ_S_H__