nommu.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/bootmem.h>
  10. #include <linux/io.h>
  11. #include <asm/cacheflush.h>
  12. #include <asm/sections.h>
  13. #include <asm/page.h>
  14. #include <asm/setup.h>
  15. #include <asm/mach/arch.h>
  16. #include "mm.h"
  17. /*
  18. * Reserve the various regions
  19. */
  20. void __init reserve_special_regions(void)
  21. {
  22. /*
  23. * Register the kernel text and data with bootmem.
  24. * Note that this can only be in node 0.
  25. */
  26. #ifdef CONFIG_XIP_KERNEL
  27. reserve_bootmem(__pa(_data), _end - _data, BOOTMEM_DEFAULT);
  28. #else
  29. reserve_bootmem(__pa(_stext), _end - _stext, BOOTMEM_DEFAULT);
  30. #endif
  31. /*
  32. * Register the exception vector page.
  33. * some architectures which the DRAM is the exception vector to trap,
  34. * alloc_page breaks with error, although it is not NULL, but "0."
  35. */
  36. reserve_bootmem(CONFIG_VECTORS_BASE, PAGE_SIZE, BOOTMEM_DEFAULT);
  37. }
  38. /*
  39. * paging_init() sets up the page tables, initialises the zone memory
  40. * maps, and sets up the zero page, bad page and bad page tables.
  41. */
  42. void __init paging_init(struct machine_desc *mdesc)
  43. {
  44. bootmem_init(mdesc);
  45. }
  46. /*
  47. * We don't need to do anything here for nommu machines.
  48. */
  49. void setup_mm_for_reboot(char mode)
  50. {
  51. }
  52. void flush_dcache_page(struct page *page)
  53. {
  54. __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE);
  55. }
  56. EXPORT_SYMBOL(flush_dcache_page);
  57. void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
  58. unsigned long uaddr, void *dst, const void *src,
  59. unsigned long len)
  60. {
  61. memcpy(dst, src, len);
  62. if (vma->vm_flags & VM_EXEC)
  63. __cpuc_coherent_user_range(uaddr, uaddr + len);
  64. }
  65. void __iomem *__arm_ioremap_pfn(unsigned long pfn, unsigned long offset,
  66. size_t size, unsigned int mtype)
  67. {
  68. if (pfn >= (0x100000000ULL >> PAGE_SHIFT))
  69. return NULL;
  70. return (void __iomem *) (offset + (pfn << PAGE_SHIFT));
  71. }
  72. EXPORT_SYMBOL(__arm_ioremap_pfn);
  73. void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
  74. size_t size, unsigned int mtype, void *caller)
  75. {
  76. return __arm_ioremap_pfn(pfn, offset, size, mtype);
  77. }
  78. void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
  79. unsigned int mtype)
  80. {
  81. return (void __iomem *)phys_addr;
  82. }
  83. EXPORT_SYMBOL(__arm_ioremap);
  84. void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
  85. unsigned int mtype, void *caller)
  86. {
  87. return __arm_ioremap(phys_addr, size, mtype);
  88. }
  89. void __iounmap(volatile void __iomem *addr)
  90. {
  91. }
  92. EXPORT_SYMBOL(__iounmap);