nommu.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * linux/arch/arm/mm/nommu.c
  3. *
  4. * ARM uCLinux supporting functions.
  5. */
  6. #include <linux/module.h>
  7. #include <linux/mm.h>
  8. #include <linux/pagemap.h>
  9. #include <linux/io.h>
  10. #include <linux/memblock.h>
  11. #include <asm/cacheflush.h>
  12. #include <asm/sections.h>
  13. #include <asm/page.h>
  14. #include <asm/setup.h>
  15. #include <asm/traps.h>
  16. #include <asm/mach/arch.h>
  17. #include "mm.h"
  18. void __init arm_mm_memblock_reserve(void)
  19. {
  20. /*
  21. * Register the exception vector page.
  22. * some architectures which the DRAM is the exception vector to trap,
  23. * alloc_page breaks with error, although it is not NULL, but "0."
  24. */
  25. memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
  26. }
  27. void __init sanity_check_meminfo(void)
  28. {
  29. phys_addr_t end = bank_phys_end(&meminfo.bank[meminfo.nr_banks - 1]);
  30. high_memory = __va(end - 1) + 1;
  31. }
  32. /*
  33. * paging_init() sets up the page tables, initialises the zone memory
  34. * maps, and sets up the zero page, bad page and bad page tables.
  35. */
  36. void __init paging_init(struct machine_desc *mdesc)
  37. {
  38. early_trap_init((void *)CONFIG_VECTORS_BASE);
  39. bootmem_init();
  40. }
  41. /*
  42. * We don't need to do anything here for nommu machines.
  43. */
  44. void setup_mm_for_reboot(void)
  45. {
  46. }
  47. void flush_dcache_page(struct page *page)
  48. {
  49. __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
  50. }
  51. EXPORT_SYMBOL(flush_dcache_page);
  52. void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
  53. unsigned long uaddr, void *dst, const void *src,
  54. unsigned long len)
  55. {
  56. memcpy(dst, src, len);
  57. if (vma->vm_flags & VM_EXEC)
  58. __cpuc_coherent_user_range(uaddr, uaddr + len);
  59. }
  60. void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
  61. size_t size, unsigned int mtype)
  62. {
  63. if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
  64. return NULL;
  65. return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
  66. }
  67. EXPORT_SYMBOL(__arm_ioremap_pfn);
  68. void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
  69. size_t size, unsigned int mtype, void *caller)
  70. {
  71. return __arm_ioremap_pfn(pfn, offset, size, mtype);
  72. }
  73. void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
  74. unsigned int mtype)
  75. {
  76. return (void __iomem *)phys_addr;
  77. }
  78. EXPORT_SYMBOL(__arm_ioremap);
  79. void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *);
  80. void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
  81. unsigned int mtype, void *caller)
  82. {
  83. return __arm_ioremap(phys_addr, size, mtype);
  84. }
  85. void (*arch_iounmap)(volatile void __iomem *);
  86. void __arm_iounmap(volatile void __iomem *addr)
  87. {
  88. }
  89. EXPORT_SYMBOL(__arm_iounmap);