Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/sh/mm/init.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 1999 Niibe Yutaka |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 5 | * Copyright (C) 2002 - 2007 Paul Mundt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
| 7 | * Based on linux/arch/i386/mm/init.c: |
| 8 | * Copyright (C) 1995 Linus Torvalds |
| 9 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/mm.h> |
| 11 | #include <linux/swap.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/bootmem.h> |
Paul Mundt | 2cb7ce3 | 2006-09-27 18:20:58 +0900 | [diff] [blame] | 14 | #include <linux/proc_fs.h> |
Paul Mundt | 27641de | 2007-05-14 10:48:01 +0900 | [diff] [blame] | 15 | #include <linux/pagemap.h> |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 16 | #include <linux/percpu.h> |
| 17 | #include <linux/io.h> |
Paul Mundt | 94c2851 | 2009-10-27 17:07:45 +0900 | [diff] [blame] | 18 | #include <linux/dma-mapping.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | #include <asm/mmu_context.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <asm/tlb.h> |
| 21 | #include <asm/cacheflush.h> |
Paul Mundt | 07cbb41 | 2007-06-06 12:23:06 +0900 | [diff] [blame] | 22 | #include <asm/sections.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <asm/cache.h> |
| 24 | |
| 25 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
| 26 | pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
Stuart Menefy | c6feb61 | 2008-09-05 16:06:42 +0900 | [diff] [blame] | 27 | |
| 28 | #ifdef CONFIG_SUPERH32 |
| 29 | /* |
| 30 | * Handle trivial transitions between cached and uncached |
| 31 | * segments, making use of the 1:1 mapping relationship in |
| 32 | * 512MB lowmem. |
| 33 | * |
| 34 | * This is the offset of the uncached section from its cached alias. |
| 35 | * Default value only valid in 29 bit mode, in 32bit mode will be |
| 36 | * overridden in pmb_init. |
| 37 | */ |
| 38 | unsigned long cached_to_uncached = P2SEG - P1SEG; |
| 39 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | |
Yoshinori Sato | 11cbb70 | 2006-12-07 18:07:27 +0900 | [diff] [blame] | 41 | #ifdef CONFIG_MMU |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) |
| 43 | { |
| 44 | pgd_t *pgd; |
Paul Mundt | 26ff6c1 | 2006-09-27 15:13:36 +0900 | [diff] [blame] | 45 | pud_t *pud; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | pmd_t *pmd; |
| 47 | pte_t *pte; |
| 48 | |
Stuart Menefy | 99a596f | 2006-11-21 15:38:05 +0900 | [diff] [blame] | 49 | pgd = pgd_offset_k(addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | if (pgd_none(*pgd)) { |
| 51 | pgd_ERROR(*pgd); |
| 52 | return; |
| 53 | } |
| 54 | |
Stuart Menefy | 99a596f | 2006-11-21 15:38:05 +0900 | [diff] [blame] | 55 | pud = pud_alloc(NULL, pgd, addr); |
| 56 | if (unlikely(!pud)) { |
| 57 | pud_ERROR(*pud); |
| 58 | return; |
Paul Mundt | 26ff6c1 | 2006-09-27 15:13:36 +0900 | [diff] [blame] | 59 | } |
| 60 | |
Stuart Menefy | 99a596f | 2006-11-21 15:38:05 +0900 | [diff] [blame] | 61 | pmd = pmd_alloc(NULL, pud, addr); |
| 62 | if (unlikely(!pmd)) { |
| 63 | pmd_ERROR(*pmd); |
| 64 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | pte = pte_offset_kernel(pmd, addr); |
| 68 | if (!pte_none(*pte)) { |
| 69 | pte_ERROR(*pte); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, prot)); |
Paul Mundt | 997d003 | 2009-06-19 15:37:11 +0900 | [diff] [blame] | 74 | local_flush_tlb_one(get_asid(), addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | /* |
| 78 | * As a performance optimization, other platforms preserve the fixmap mapping |
| 79 | * across a context switch, we don't presently do this, but this could be done |
| 80 | * in a similar fashion as to the wired TLB interface that sh64 uses (by way |
Simon Arlott | e868d61 | 2007-05-14 08:15:10 +0900 | [diff] [blame] | 81 | * of the memory mapped UTLB configuration) -- this unfortunately forces us to |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | * give up a TLB entry for each mapping we want to preserve. While this may be |
| 83 | * viable for a small number of fixmaps, it's not particularly useful for |
| 84 | * everything and needs to be carefully evaluated. (ie, we may want this for |
| 85 | * the vsyscall page). |
| 86 | * |
| 87 | * XXX: Perhaps add a _PAGE_WIRED flag or something similar that we can pass |
| 88 | * in at __set_fixmap() time to determine the appropriate behavior to follow. |
| 89 | * |
| 90 | * -- PFM. |
| 91 | */ |
| 92 | void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t prot) |
| 93 | { |
| 94 | unsigned long address = __fix_to_virt(idx); |
| 95 | |
| 96 | if (idx >= __end_of_fixed_addresses) { |
| 97 | BUG(); |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | set_pte_phys(address, phys, prot); |
| 102 | } |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 103 | |
| 104 | void __init page_table_range_init(unsigned long start, unsigned long end, |
| 105 | pgd_t *pgd_base) |
| 106 | { |
| 107 | pgd_t *pgd; |
| 108 | pud_t *pud; |
| 109 | pmd_t *pmd; |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 110 | pte_t *pte; |
| 111 | int i, j, k; |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 112 | unsigned long vaddr; |
| 113 | |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 114 | vaddr = start; |
| 115 | i = __pgd_offset(vaddr); |
| 116 | j = __pud_offset(vaddr); |
| 117 | k = __pmd_offset(vaddr); |
| 118 | pgd = pgd_base + i; |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 119 | |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 120 | for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { |
| 121 | pud = (pud_t *)pgd; |
| 122 | for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) { |
Matt Fleming | 5d9b4b1 | 2009-12-13 14:38:50 +0000 | [diff] [blame] | 123 | #ifdef __PAGETABLE_PMD_FOLDED |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 124 | pmd = (pmd_t *)pud; |
Matt Fleming | 5d9b4b1 | 2009-12-13 14:38:50 +0000 | [diff] [blame] | 125 | #else |
| 126 | pmd = (pmd_t *)alloc_bootmem_low_pages(PAGE_SIZE); |
| 127 | pud_populate(&init_mm, pud, pmd); |
| 128 | pmd += k; |
| 129 | #endif |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 130 | for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) { |
| 131 | if (pmd_none(*pmd)) { |
| 132 | pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE); |
| 133 | pmd_populate_kernel(&init_mm, pmd, pte); |
| 134 | BUG_ON(pte != pte_offset_kernel(pmd, 0)); |
| 135 | } |
| 136 | vaddr += PMD_SIZE; |
| 137 | } |
| 138 | k = 0; |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 139 | } |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 140 | j = 0; |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 141 | } |
| 142 | } |
Yoshinori Sato | 11cbb70 | 2006-12-07 18:07:27 +0900 | [diff] [blame] | 143 | #endif /* CONFIG_MMU */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | /* |
| 146 | * paging_init() sets up the page tables |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | */ |
| 148 | void __init paging_init(void) |
| 149 | { |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 150 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 151 | unsigned long vaddr, end; |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 152 | int nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 154 | /* We don't need to map the kernel through the TLB, as |
| 155 | * it is permanatly mapped using P1. So clear the |
| 156 | * entire pgd. */ |
| 157 | memset(swapper_pg_dir, 0, sizeof(swapper_pg_dir)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | |
Stuart Menefy | 6e4662f | 2006-11-21 13:53:44 +0900 | [diff] [blame] | 159 | /* Set an initial value for the MMU.TTB so we don't have to |
| 160 | * check for a null value. */ |
| 161 | set_TTB(swapper_pg_dir); |
| 162 | |
Paul Mundt | acca4f4 | 2008-11-10 20:00:45 +0900 | [diff] [blame] | 163 | /* |
| 164 | * Populate the relevant portions of swapper_pg_dir so that |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 165 | * we can use the fixmap entries without calling kmalloc. |
Paul Mundt | acca4f4 | 2008-11-10 20:00:45 +0900 | [diff] [blame] | 166 | * pte's will be filled in by __set_fixmap(). |
| 167 | */ |
| 168 | vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; |
Paul Mundt | 0906a3a | 2009-09-03 17:21:10 +0900 | [diff] [blame] | 169 | end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK; |
| 170 | page_table_range_init(vaddr, end, swapper_pg_dir); |
Paul Mundt | acca4f4 | 2008-11-10 20:00:45 +0900 | [diff] [blame] | 171 | |
| 172 | kmap_coherent_init(); |
Stuart Menefy | 2adb4e1 | 2007-11-30 17:59:55 +0900 | [diff] [blame] | 173 | |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 174 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); |
| 175 | |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 176 | for_each_online_node(nid) { |
| 177 | pg_data_t *pgdat = NODE_DATA(nid); |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 178 | unsigned long low, start_pfn; |
| 179 | |
Johannes Weiner | 3560e24 | 2008-07-23 21:28:09 -0700 | [diff] [blame] | 180 | start_pfn = pgdat->bdata->node_min_pfn; |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 181 | low = pgdat->bdata->node_low_pfn; |
| 182 | |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 183 | if (max_zone_pfns[ZONE_NORMAL] < low) |
| 184 | max_zone_pfns[ZONE_NORMAL] = low; |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 185 | |
| 186 | printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n", |
| 187 | nid, start_pfn, low); |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 188 | } |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 189 | |
| 190 | free_area_init_nodes(max_zone_pfns); |
Stuart Menefy | cbaa118 | 2007-11-30 17:06:36 +0900 | [diff] [blame] | 191 | |
| 192 | /* Set up the uncached fixmap */ |
| 193 | set_fixmap_nocache(FIX_UNCACHED, __pa(&__uncached_start)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | } |
| 195 | |
Paul Mundt | 94c2851 | 2009-10-27 17:07:45 +0900 | [diff] [blame] | 196 | /* |
| 197 | * Early initialization for any I/O MMUs we might have. |
| 198 | */ |
| 199 | static void __init iommu_init(void) |
| 200 | { |
| 201 | no_iommu_init(); |
| 202 | } |
| 203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | void __init mem_init(void) |
| 205 | { |
Paul Mundt | dfbb904 | 2007-05-23 17:48:36 +0900 | [diff] [blame] | 206 | int codesize, datasize, initsize; |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 207 | int nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | |
Paul Mundt | 94c2851 | 2009-10-27 17:07:45 +0900 | [diff] [blame] | 209 | iommu_init(); |
| 210 | |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 211 | num_physpages = 0; |
| 212 | high_memory = NULL; |
| 213 | |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 214 | for_each_online_node(nid) { |
| 215 | pg_data_t *pgdat = NODE_DATA(nid); |
| 216 | unsigned long node_pages = 0; |
| 217 | void *node_high_memory; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 219 | num_physpages += pgdat->node_present_pages; |
| 220 | |
| 221 | if (pgdat->node_spanned_pages) |
| 222 | node_pages = free_all_bootmem_node(pgdat); |
| 223 | |
| 224 | totalram_pages += node_pages; |
| 225 | |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 226 | node_high_memory = (void *)__va((pgdat->node_start_pfn + |
| 227 | pgdat->node_spanned_pages) << |
| 228 | PAGE_SHIFT); |
Paul Mundt | 0106662 | 2007-03-28 16:38:13 +0900 | [diff] [blame] | 229 | if (node_high_memory > high_memory) |
| 230 | high_memory = node_high_memory; |
| 231 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | |
Paul Mundt | 37443ef | 2009-08-15 12:29:49 +0900 | [diff] [blame] | 233 | /* Set this up early, so we can take care of the zero page */ |
| 234 | cpu_cache_init(); |
| 235 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | /* clear the zero-page */ |
| 237 | memset(empty_zero_page, 0, PAGE_SIZE); |
| 238 | __flush_wback_region(empty_zero_page, PAGE_SIZE); |
| 239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | codesize = (unsigned long) &_etext - (unsigned long) &_text; |
| 241 | datasize = (unsigned long) &_edata - (unsigned long) &_etext; |
| 242 | initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; |
| 243 | |
Paul Mundt | 2cb7ce3 | 2006-09-27 18:20:58 +0900 | [diff] [blame] | 244 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " |
Paul Mundt | dfbb904 | 2007-05-23 17:48:36 +0900 | [diff] [blame] | 245 | "%dk data, %dk init)\n", |
Geert Uytterhoeven | cc013a8 | 2009-09-21 17:02:36 -0700 | [diff] [blame] | 246 | nr_free_pages() << (PAGE_SHIFT-10), |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 247 | num_physpages << (PAGE_SHIFT-10), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | codesize >> 10, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | datasize >> 10, |
| 250 | initsize >> 10); |
| 251 | |
Paul Mundt | 19f9a34 | 2006-09-27 18:33:49 +0900 | [diff] [blame] | 252 | /* Initialize the vDSO */ |
| 253 | vsyscall_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | void free_initmem(void) |
| 257 | { |
| 258 | unsigned long addr; |
Paul Mundt | 65463b7 | 2005-11-07 00:58:24 -0800 | [diff] [blame] | 259 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | addr = (unsigned long)(&__init_begin); |
| 261 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { |
| 262 | ClearPageReserved(virt_to_page(addr)); |
Nick Piggin | 7835e98 | 2006-03-22 00:08:40 -0800 | [diff] [blame] | 263 | init_page_count(virt_to_page(addr)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | free_page(addr); |
| 265 | totalram_pages++; |
| 266 | } |
Paul Mundt | 07cbb41 | 2007-06-06 12:23:06 +0900 | [diff] [blame] | 267 | printk("Freeing unused kernel memory: %ldk freed\n", |
| 268 | ((unsigned long)&__init_end - |
| 269 | (unsigned long)&__init_begin) >> 10); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | #ifdef CONFIG_BLK_DEV_INITRD |
| 273 | void free_initrd_mem(unsigned long start, unsigned long end) |
| 274 | { |
| 275 | unsigned long p; |
| 276 | for (p = start; p < end; p += PAGE_SIZE) { |
| 277 | ClearPageReserved(virt_to_page(p)); |
Nick Piggin | 7835e98 | 2006-03-22 00:08:40 -0800 | [diff] [blame] | 278 | init_page_count(virt_to_page(p)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | free_page(p); |
| 280 | totalram_pages++; |
| 281 | } |
Paul Mundt | 2de212e | 2007-06-06 12:09:54 +0900 | [diff] [blame] | 282 | printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | } |
| 284 | #endif |
Paul Mundt | 33d63bd | 2007-06-07 11:32:52 +0900 | [diff] [blame] | 285 | |
| 286 | #ifdef CONFIG_MEMORY_HOTPLUG |
Paul Mundt | 33d63bd | 2007-06-07 11:32:52 +0900 | [diff] [blame] | 287 | int arch_add_memory(int nid, u64 start, u64 size) |
| 288 | { |
| 289 | pg_data_t *pgdat; |
| 290 | unsigned long start_pfn = start >> PAGE_SHIFT; |
| 291 | unsigned long nr_pages = size >> PAGE_SHIFT; |
| 292 | int ret; |
| 293 | |
| 294 | pgdat = NODE_DATA(nid); |
| 295 | |
| 296 | /* We only have ZONE_NORMAL, so this is easy.. */ |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 297 | ret = __add_pages(nid, pgdat->node_zones + ZONE_NORMAL, |
| 298 | start_pfn, nr_pages); |
Paul Mundt | 33d63bd | 2007-06-07 11:32:52 +0900 | [diff] [blame] | 299 | if (unlikely(ret)) |
Harvey Harrison | 866e6b9 | 2008-03-04 15:23:47 -0800 | [diff] [blame] | 300 | printk("%s: Failed, __add_pages() == %d\n", __func__, ret); |
Paul Mundt | 33d63bd | 2007-06-07 11:32:52 +0900 | [diff] [blame] | 301 | |
| 302 | return ret; |
| 303 | } |
| 304 | EXPORT_SYMBOL_GPL(arch_add_memory); |
| 305 | |
Paul Mundt | 357d594 | 2007-06-11 15:32:07 +0900 | [diff] [blame] | 306 | #ifdef CONFIG_NUMA |
Paul Mundt | 33d63bd | 2007-06-07 11:32:52 +0900 | [diff] [blame] | 307 | int memory_add_physaddr_to_nid(u64 addr) |
| 308 | { |
| 309 | /* Node 0 for now.. */ |
| 310 | return 0; |
| 311 | } |
| 312 | EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); |
| 313 | #endif |
Matt Fleming | 1f69b6a | 2009-10-06 21:22:25 +0000 | [diff] [blame] | 314 | |
Paul Mundt | 3159e7d | 2008-09-05 15:39:12 +0900 | [diff] [blame] | 315 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
Matt Fleming | 1f69b6a | 2009-10-06 21:22:25 +0000 | [diff] [blame] | 316 | |
| 317 | #ifdef CONFIG_PMB |
| 318 | int __in_29bit_mode(void) |
| 319 | { |
| 320 | return !(ctrl_inl(PMB_PASCR) & PASCR_SE); |
| 321 | } |
| 322 | #endif /* CONFIG_PMB */ |