[6b781c0] | 1 | /*
|
---|
[4872160] | 2 | * Copyright (c) 2007 Pavel Jancik
|
---|
[6b781c0] | 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
|
---|
[4872160] | 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.
|
---|
[96e0748d] | 40 | */
|
---|
[6b781c0] | 41 |
|
---|
[4872160] | 42 | #ifndef BOOT_arm32__MM_H
|
---|
| 43 | #define BOOT_arm32__MM_H
|
---|
[6b781c0] | 44 |
|
---|
[4872160] | 45 | #include <typedefs.h>
|
---|
[6b781c0] | 46 |
|
---|
[4872160] | 47 | /** Describe "section" page table entry (one-level paging with 1 MB sized pages). */
|
---|
| 48 | #define PTE_DESCRIPTOR_SECTION 0x02
|
---|
[b5a3b50] | 49 | /** Shift of memory address in section descriptor */
|
---|
| 50 | #define PTE_SECTION_SHIFT 20
|
---|
[6b781c0] | 51 |
|
---|
[4872160] | 52 | /** Page table access rights: user - no access, kernel - read/write. */
|
---|
| 53 | #define PTE_AP_USER_NO_KERNEL_RW 0x01
|
---|
[6b781c0] | 54 |
|
---|
[b5a3b50] | 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 |
|
---|
[0acd339] | 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 |
|
---|
[6968948] | 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 |
|
---|
[8f9d70b] | 70 | /** Start of ram memory on BCM2835 */
|
---|
| 71 | #define BCM2835_RAM_START 0
|
---|
| 72 | /** End of ram memory on BCM2835 */
|
---|
| 73 | #define BCM2835_RAM_END 0x20000000
|
---|
[0acd339] | 74 |
|
---|
[4872160] | 75 | /* Page table level 0 entry - "section" format is used
|
---|
| 76 | * (one-level paging, 1 MB sized pages). Used only while booting the kernel.
|
---|
[6b781c0] | 77 | */
|
---|
[4872160] | 78 | typedef struct {
|
---|
| 79 | unsigned int descriptor_type : 2;
|
---|
| 80 | unsigned int bufferable : 1;
|
---|
| 81 | unsigned int cacheable : 1;
|
---|
[4d02595] | 82 | unsigned int xn : 1;
|
---|
[4872160] | 83 | unsigned int domain : 4;
|
---|
| 84 | unsigned int should_be_zero_1 : 1;
|
---|
[4d02595] | 85 | unsigned int access_permission_0 : 2;
|
---|
| 86 | unsigned int tex : 3;
|
---|
[2e55443] | 87 | unsigned int access_permission_1 : 1;
|
---|
| 88 | unsigned int shareable : 1;
|
---|
[4d02595] | 89 | unsigned int non_global : 1;
|
---|
| 90 | unsigned int should_be_zero_2 : 1;
|
---|
| 91 | unsigned int non_secure : 1;
|
---|
[4872160] | 92 | unsigned int section_base_addr : 12;
|
---|
| 93 | } __attribute__((packed)) pte_level0_section_t;
|
---|
[6b781c0] | 94 |
|
---|
[4872160] | 95 | extern void mmu_start(void);
|
---|
[6b781c0] | 96 |
|
---|
| 97 | #endif
|
---|
| 98 |
|
---|
| 99 | /** @}
|
---|
| 100 | */
|
---|