OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [proc-armv/] [mm-init.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * linux/include/asm-arm/proc-armv/mm-init.h
3
 *
4
 * Copyright (C) 1996 Russell King
5
 *
6
 * This contains the code to setup the memory map on an ARM v3 or v4 machine.
7
 * This is both processor & architecture specific, and requires some
8
 * more work to get it to fit into our separate processor and architecture
9
 * structure.
10
 */
11
 
12
/*
13
 * On ebsa, we want the memory map set up so:
14
 *
15
 *   PHYS         VIRT
16
 * 00000000     00000000        Zero page
17
 * 000003ff     000003ff        Zero page end
18
 * 00000000     c0000000        Kernel and all physical memory
19
 * 01ffffff     c1ffffff        End of physical (32MB)
20
 * e0000000     e0000000        IO start
21
 * ffffffff     ffffffff        IO end
22
 *
23
 * On rpc, we want:
24
 *
25
 *   PHYS         VIRT
26
 * 10000000     00000000        Zero page
27
 * 100003ff     000003ff        Zero page end
28
 * 10000000     c0000000        Kernel and all physical memory
29
 * 1fffffff     cfffffff        End of physical (32MB)
30
 * 02000000     d?000000        Screen memory (first image)
31
 * 02000000     d8000000        Screen memory (second image)
32
 * 00000000     df000000        StrongARM cache invalidation area
33
 * 03000000     e0000000        IO start
34
 * 03ffffff     e0ffffff        IO end
35
 *
36
 * We set it up using the section page table entries.
37
 */
38
 
39
#include <asm/pgtable.h>
40
 
41
#define V2P(x)  __virt_to_phys(x)
42
 
43
#ifndef NO_MM
44
#define PTE_SIZE (PTRS_PER_PTE * 4)
45
 
46
#define PMD_SECT        (PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) | PMD_SECT_CACHEABLE)
47
 
48
static inline void setup_swapper_dir (int index, unsigned long entry)
49
{
50
        pmd_t pmd;
51
 
52
        pmd_val(pmd) = entry;
53
        set_pmd (pmd_offset (swapper_pg_dir + index, 0), pmd);
54
}
55
 
56
static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem)
57
{
58
        unsigned long address;
59
        unsigned int spi;
60
        union { unsigned long l; unsigned long *p; } u;
61
 
62
        /* map in zero page */
63
        u.l = ((start_mem + (PTE_SIZE-1)) & ~(PTE_SIZE-1));
64
        start_mem = u.l + PTE_SIZE;
65
        memzero (u.p, PTE_SIZE);
66
        *u.p = V2P(PAGE_OFFSET) | PTE_CACHEABLE | PTE_TYPE_SMALL | PTE_AP_WRITE;
67
        setup_swapper_dir (0, V2P(u.l) | PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL));
68
 
69
        for (spi = 1; spi < (PAGE_OFFSET >> PGDIR_SHIFT); spi++)
70
                pgd_val(swapper_pg_dir[spi]) = 0;
71
 
72
        /* map in physical ram & kernel */
73
        address = PAGE_OFFSET;
74
        while (spi < end_mem >> PGDIR_SHIFT) {
75
                setup_swapper_dir (spi++,
76
                                V2P(address) | PMD_SECT |
77
                                PMD_SECT_BUFFERABLE | PMD_SECT_AP_WRITE);
78
                address += PGDIR_SIZE;
79
        }
80
        while (spi < PTRS_PER_PGD)
81
                pgd_val(swapper_pg_dir[spi++]) = 0;
82
 
83
        /*
84
         * An area to invalidate the cache
85
         */
86
        setup_swapper_dir (0xdf0, SAFE_ADDR | PMD_SECT | PMD_SECT_AP_READ);
87
 
88
        /* map in IO */
89
        address = IO_START;
90
        spi = IO_BASE >> PGDIR_SHIFT;
91
 
92
        while (address - IO_START < IO_SIZE && address) {
93
                pgd_val(swapper_pg_dir[spi++]) = address |
94
                                                PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) |
95
                                                PMD_SECT_AP_WRITE;
96
                address += PGDIR_SIZE;
97
        }
98
 
99
#ifdef EASI_BASE
100
        /* map in IO */
101
        address = EASI_START;
102
        spi = EASI_BASE >> PGDIR_SHIFT;
103
 
104
        while (address < EASI_START + EASI_SIZE && address) {
105
                pgd_val(swapper_pg_dir[spi++]) = address |
106
                                                PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) |
107
                                                PMD_SECT_AP_WRITE;
108
                address += PGDIR_SIZE;
109
        }
110
#endif
111
#ifdef HAVE_MAP_VID_MEM
112
        map_screen_mem(0, 0, 0);
113
#endif
114
 
115
        flush_cache_all();
116
        return start_mem;
117
}
118
 
119
#else
120
 
121
static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem)
122
{
123
}
124
 
125
static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem)
126
{
127
        unsigned long smem;
128
 
129
        *start_mem = smem = PAGE_ALIGN(*start_mem);
130
 
131
        while (smem < end_mem) {
132
                clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags);
133
                smem += PAGE_SIZE;
134
        }
135
}
136
 
137
#endif
138
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.