blob: a500f0335581f5a8ff9645c9f297fd3c5339b89a [file] [log] [blame]
Jon Medhurstbb1fe202014-01-24 15:41:33 +00001/*
2 * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
Sandrine Bailleux82a6e1a2014-04-03 13:48:04 +010031#ifndef __XLAT_TABLES_H__
32#define __XLAT_TABLES_H__
33
Jon Medhurstbb1fe202014-01-24 15:41:33 +000034#include <stdint.h>
35
36/*
37 * Flags for building up memory mapping attributes.
38 * These are organised so that a clear bit gives a more restrictive mapping
39 * that a set bit, that way a bitwise-and two sets of attributes will never give
40 * an attribute which has greater access rights that any of the original
41 * attributes.
42 */
43typedef enum {
44 MT_DEVICE = 0 << 0,
45 MT_MEMORY = 1 << 0,
46
47 MT_RO = 0 << 1,
48 MT_RW = 1 << 1,
49
50 MT_SECURE = 0 << 2,
51 MT_NS = 1 << 2
Dan Handleye2712bc2014-04-10 15:37:22 +010052} mmap_attr_t;
Jon Medhurstbb1fe202014-01-24 15:41:33 +000053
54/*
55 * Structure for specifying a single region of memory.
56 */
Dan Handleye2712bc2014-04-10 15:37:22 +010057typedef struct mmap_region {
Jon Medhurstbb1fe202014-01-24 15:41:33 +000058 unsigned long base;
59 unsigned long size;
Dan Handleye2712bc2014-04-10 15:37:22 +010060 mmap_attr_t attr;
61} mmap_region_t;
Jon Medhurstbb1fe202014-01-24 15:41:33 +000062
Dan Handleya17fefa2014-05-14 12:38:32 +010063void mmap_add_region(unsigned long base, unsigned long size,
64 unsigned attr);
65void mmap_add(const mmap_region_t *mm);
Jon Medhurstbb1fe202014-01-24 15:41:33 +000066
Dan Handleya17fefa2014-05-14 12:38:32 +010067void init_xlat_tables(void);
Jon Medhurstbb1fe202014-01-24 15:41:33 +000068
69extern uint64_t l1_xlation_table[];
Sandrine Bailleux82a6e1a2014-04-03 13:48:04 +010070
71#endif /* __XLAT_TABLES_H__ */