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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [proc-trio/] [mm-init.h] - Blame information for rev 1765

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/arch/mmap.h>
40
#include <asm/pgtable.h>
41
 
42
#define V2P(x)  __virt_to_phys(x)
43
#define PTE_SIZE (PTRS_PER_PTE * 4)
44
 
45
#define PMD_SECT        (PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) | PMD_SECT_CACHEABLE)
46
 
47
static inline void setup_swapper_dir (int index, unsigned long entry)
48
{
49
        pmd_t pmd;
50
 
51
        pmd_val(pmd) = entry;
52
        set_pmd (pmd_offset (swapper_pg_dir + index, 0), pmd);
53
}
54
 
55
static inline unsigned long setup_pagetables(unsigned long start_mem, unsigned long end_mem)
56
{
57
        unsigned long address;
58
        unsigned int spi;
59
        union { unsigned long l; unsigned long *p; } u;
60
 
61
        /* map in zero page */
62
        u.l = ((start_mem + (PTE_SIZE-1)) & ~(PTE_SIZE-1));
63
        start_mem = u.l + PTE_SIZE;
64
        memzero (u.p, PTE_SIZE);
65
        *u.p = V2P(PAGE_OFFSET) | PTE_CACHEABLE | PTE_TYPE_SMALL | PTE_AP_WRITE;
66
        setup_swapper_dir (0, V2P(u.l) | PMD_TYPE_TABLE | PMD_DOMAIN(DOMAIN_KERNEL));
67
 
68
        for (spi = 1; spi < (PAGE_OFFSET >> PGDIR_SHIFT); spi++)
69
                pgd_val(swapper_pg_dir[spi]) = 0;
70
 
71
        /* map in physical ram & kernel */
72
        address = PAGE_OFFSET;
73
        while (spi < end_mem >> PGDIR_SHIFT) {
74
                setup_swapper_dir (spi++,
75
                                V2P(address) | PMD_SECT |
76
                                PMD_SECT_BUFFERABLE | PMD_SECT_AP_WRITE);
77
                address += PGDIR_SIZE;
78
        }
79
        while (spi < PTRS_PER_PGD)
80
                pgd_val(swapper_pg_dir[spi++]) = 0;
81
 
82
        /*
83
         * An area to invalidate the cache
84
         */
85
        setup_swapper_dir (0xdf0, SAFE_ADDR | PMD_SECT | PMD_SECT_AP_READ);
86
 
87
        /* map in IO */
88
        address = IO_START;
89
        spi = IO_BASE >> PGDIR_SHIFT;
90
 
91
        while (address - IO_START < IO_SIZE && address) {
92
                pgd_val(swapper_pg_dir[spi++]) = address |
93
                                                PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) |
94
                                                PMD_SECT_AP_WRITE;
95
                address += PGDIR_SIZE;
96
        }
97
 
98
#ifdef EASI_BASE
99
        /* map in IO */
100
        address = EASI_START;
101
        spi = EASI_BASE >> PGDIR_SHIFT;
102
 
103
        while (address < EASI_START + EASI_SIZE && address) {
104
                pgd_val(swapper_pg_dir[spi++]) = address |
105
                                                PMD_TYPE_SECT | PMD_DOMAIN(DOMAIN_KERNEL) |
106
                                                PMD_SECT_AP_WRITE;
107
                address += PGDIR_SIZE;
108
        }
109
#endif
110
#ifdef HAVE_MAP_VID_MEM
111
        map_screen_mem(0, 0, 0);
112
#endif
113
 
114
        flush_cache_all();
115
        return start_mem;
116
}
117
 
118
static inline void mark_usable_memory_areas(unsigned long *start_mem, unsigned long end_mem)
119
{
120
        unsigned long smem;
121
 
122
        *start_mem = smem = PAGE_ALIGN(*start_mem);
123
 
124
        while (smem < end_mem) {
125
                clear_bit(PG_reserved, &mem_map[MAP_NR(smem)].flags);
126
                smem += PAGE_SIZE;
127
        }
128
}
129
 

powered by: WebSVN 2.1.0

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