1 | /*
|
---|
2 | * Copyright (c) 2007 Pavel Jancik
|
---|
3 | * Copyright (c) 2007 Michal Kebrt
|
---|
4 | * All rights reserved.
|
---|
5 | *
|
---|
6 | * Redistribution and use in source and binary forms, with or without
|
---|
7 | * modification, are permitted provided that the following conditions
|
---|
8 | * are met:
|
---|
9 | *
|
---|
10 | * - Redistributions of source code must retain the above copyright
|
---|
11 | * notice, this list of conditions and the following disclaimer.
|
---|
12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
13 | * notice, this list of conditions and the following disclaimer in the
|
---|
14 | * documentation and/or other materials provided with the distribution.
|
---|
15 | * - The name of the author may not be used to endorse or promote products
|
---|
16 | * derived from this software without specific prior written permission.
|
---|
17 | *
|
---|
18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
28 | */
|
---|
29 |
|
---|
30 | /** @addtogroup arm32boot
|
---|
31 | * @{
|
---|
32 | */
|
---|
33 | /** @file
|
---|
34 | * @brief Memory management used while booting the kernel.
|
---|
35 | *
|
---|
36 | * So called "section" paging is used while booting the kernel. The term
|
---|
37 | * "section" comes from the ARM architecture specification and stands for the
|
---|
38 | * following: one-level paging, 1MB sized pages, 4096 entries in the page
|
---|
39 | * table.
|
---|
40 | */
|
---|
41 |
|
---|
42 | #ifndef BOOT_arm32__MM_H
|
---|
43 | #define BOOT_arm32__MM_H
|
---|
44 |
|
---|
45 | #include <typedefs.h>
|
---|
46 |
|
---|
47 | /** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
|
---|
48 | #define PTE_DESCRIPTOR_SECTION 0x02
|
---|
49 | /** Shift of memory address in section descriptor */
|
---|
50 | #define PTE_SECTION_SHIFT 20
|
---|
51 |
|
---|
52 | /** Page table access rights: user - no access, kernel - read/write. */
|
---|
53 | #define PTE_AP_USER_NO_KERNEL_RW 0x01
|
---|
54 |
|
---|
55 | /** Start of memory mapped I/O area for GTA02 */
|
---|
56 | #define GTA02_IOMEM_START 0x48000000
|
---|
57 | /** End of memory mapped I/O area for GTA02 */
|
---|
58 | #define GTA02_IOMEM_END 0x60000000
|
---|
59 |
|
---|
60 | /** Start of ram memory on BBxM */
|
---|
61 | #define BBXM_RAM_START 0x80000000
|
---|
62 | /** Start of ram memory on BBxM */
|
---|
63 | #define BBXM_RAM_END 0xc0000000
|
---|
64 |
|
---|
65 | /** Start of ram memory on AM335x */
|
---|
66 | #define AM335x_RAM_START 0x80000000
|
---|
67 | /** End of ram memory on AM335x */
|
---|
68 | #define AM335x_RAM_END 0xC0000000
|
---|
69 |
|
---|
70 |
|
---|
71 | /* Page table level 0 entry - "section" format is used
|
---|
72 | * (one-level paging, 1 MB sized pages). Used only while booting the kernel.
|
---|
73 | */
|
---|
74 | typedef struct {
|
---|
75 | unsigned int descriptor_type : 2;
|
---|
76 | unsigned int bufferable : 1;
|
---|
77 | unsigned int cacheable : 1;
|
---|
78 | unsigned int xn : 1;
|
---|
79 | unsigned int domain : 4;
|
---|
80 | unsigned int should_be_zero_1 : 1;
|
---|
81 | unsigned int access_permission_0 : 2;
|
---|
82 | unsigned int tex : 3;
|
---|
83 | unsigned int access_permission_1 : 1;
|
---|
84 | unsigned int shareable : 1;
|
---|
85 | unsigned int non_global : 1;
|
---|
86 | unsigned int should_be_zero_2 : 1;
|
---|
87 | unsigned int non_secure : 1;
|
---|
88 | unsigned int section_base_addr : 12;
|
---|
89 | } __attribute__((packed)) pte_level0_section_t;
|
---|
90 |
|
---|
91 | extern void mmu_start(void);
|
---|
92 |
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | /** @}
|
---|
96 | */
|
---|