|
| 1 | +/* |
| 2 | + * Memory layout definitions for the Hexagon architecture |
| 3 | + * |
| 4 | + * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
| 5 | + * |
| 6 | + * This program is free software; you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License version 2 and |
| 8 | + * only version 2 as published by the Free Software Foundation. |
| 9 | + * |
| 10 | + * This program is distributed in the hope that it will be useful, |
| 11 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | + * GNU General Public License for more details. |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License |
| 16 | + * along with this program; if not, write to the Free Software |
| 17 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 | + * 02110-1301, USA. |
| 19 | + */ |
| 20 | + |
| 21 | +#ifndef _ASM_HEXAGON_MEM_LAYOUT_H |
| 22 | +#define _ASM_HEXAGON_MEM_LAYOUT_H |
| 23 | + |
| 24 | +#include <linux/const.h> |
| 25 | + |
| 26 | +/* |
| 27 | + * Have to do this for ginormous numbers, else they get printed as |
| 28 | + * negative numbers, which the linker no likey when you try to |
| 29 | + * assign it to the location counter. |
| 30 | + */ |
| 31 | + |
| 32 | +#define PAGE_OFFSET _AC(0xc0000000, UL) |
| 33 | + |
| 34 | +/* |
| 35 | + * LOAD_ADDRESS is the physical/linear address of where in memory |
| 36 | + * the kernel gets loaded. The 12 least significant bits must be zero (0) |
| 37 | + * due to limitations on setting the EVB |
| 38 | + * |
| 39 | + */ |
| 40 | + |
| 41 | +#ifndef LOAD_ADDRESS |
| 42 | +#define LOAD_ADDRESS 0x00000000 |
| 43 | +#endif |
| 44 | + |
| 45 | +#define TASK_SIZE (PAGE_OFFSET) |
| 46 | + |
| 47 | +/* not sure how these are used yet */ |
| 48 | +#define STACK_TOP TASK_SIZE |
| 49 | +#define STACK_TOP_MAX TASK_SIZE |
| 50 | + |
| 51 | +#ifndef __ASSEMBLY__ |
| 52 | +enum fixed_addresses { |
| 53 | + FIX_KMAP_BEGIN, |
| 54 | + FIX_KMAP_END, /* check for per-cpuism */ |
| 55 | + __end_of_fixed_addresses |
| 56 | +}; |
| 57 | + |
| 58 | +#define MIN_KERNEL_SEG 0x300 /* From 0xc0000000 */ |
| 59 | +extern int max_kernel_seg; |
| 60 | + |
| 61 | +/* |
| 62 | + * Start of vmalloc virtual address space for kernel; |
| 63 | + * supposed to be based on the amount of physical memory available |
| 64 | + */ |
| 65 | + |
| 66 | +#define VMALLOC_START (PAGE_OFFSET + VMALLOC_OFFSET + \ |
| 67 | + (unsigned long)high_memory) |
| 68 | + |
| 69 | +/* Gap between physical ram and vmalloc space for guard purposes. */ |
| 70 | +#define VMALLOC_OFFSET PAGE_SIZE |
| 71 | + |
| 72 | +/* |
| 73 | + * Create the space between VMALLOC_START and FIXADDR_TOP backwards |
| 74 | + * from the ... "top". |
| 75 | + * |
| 76 | + * Permanent IO mappings will live at 0xfexx_xxxx |
| 77 | + * Hypervisor occupies the last 16MB page at 0xffxxxxxx |
| 78 | + */ |
| 79 | + |
| 80 | +#define FIXADDR_TOP 0xfe000000 |
| 81 | +#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
| 82 | +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
| 83 | + |
| 84 | +/* |
| 85 | + * "permanent kernel mappings", defined as long-lasting mappings of |
| 86 | + * high-memory page frames into the kernel address space. |
| 87 | + */ |
| 88 | + |
| 89 | +#define LAST_PKMAP PTRS_PER_PTE |
| 90 | +#define LAST_PKMAP_MASK (LAST_PKMAP - 1) |
| 91 | +#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) |
| 92 | +#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) |
| 93 | + |
| 94 | +/* |
| 95 | + * To the "left" of the fixed map space is the kmap space |
| 96 | + * |
| 97 | + * "Permanent Kernel Mappings"; fancy (or less fancy) PTE table |
| 98 | + * that looks like it's actually walked. |
| 99 | + * Need to check the alignment/shift usage; some archs use |
| 100 | + * PMD_MASK on this value |
| 101 | + */ |
| 102 | +#define PKMAP_BASE (FIXADDR_START-PAGE_SIZE*LAST_PKMAP) |
| 103 | + |
| 104 | +/* |
| 105 | + * 2 pages of guard gap between where vmalloc area ends |
| 106 | + * and pkmap_base begins. |
| 107 | + */ |
| 108 | +#define VMALLOC_END (PKMAP_BASE-PAGE_SIZE*2) |
| 109 | +#endif /* !__ASSEMBLY__ */ |
| 110 | + |
| 111 | + |
| 112 | +#endif /* _ASM_HEXAGON_MEM_LAYOUT_H */ |
0 commit comments