memory.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * linux/include/asm-arm26/memory.h
  3. *
  4. * Copyright (C) 2000-2002 Russell King
  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 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Note: this file should not be included by non-asm/.h files
  11. */
  12. #ifndef __ASM_ARM_MEMORY_H
  13. #define __ASM_ARM_MEMORY_H
  14. /*
  15. * User space: 26MB
  16. */
  17. #define TASK_SIZE (0x01a00000UL)
  18. /*
  19. * This decides where the kernel will search for a free chunk of vm
  20. * space during mmap's.
  21. */
  22. #define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
  23. /*
  24. * Page offset: 32MB
  25. */
  26. #define PAGE_OFFSET (0x02000000UL)
  27. #define PHYS_OFFSET (0x02000000UL)
  28. #define PHYS_TO_NID(addr) (0)
  29. /*
  30. * PFNs are used to describe any physical page; this means
  31. * PFN 0 == physical address 0.
  32. *
  33. * This is the PFN of the first RAM page in the kernel
  34. * direct-mapped view. We assume this is the first page
  35. * of RAM in the mem_map as well.
  36. */
  37. #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
  38. /*
  39. * These are *only* valid on the kernel direct mapped RAM memory.
  40. */
  41. static inline unsigned long virt_to_phys(void *x)
  42. {
  43. return (unsigned long)x;
  44. }
  45. static inline void *phys_to_virt(unsigned long x)
  46. {
  47. return (void *)((unsigned long)x);
  48. }
  49. #define __pa(x) (unsigned long)(x)
  50. #define __va(x) ((void *)(unsigned long)(x))
  51. /*
  52. * Virtual <-> DMA view memory address translations
  53. * Again, these are *only* valid on the kernel direct mapped RAM
  54. * memory. Use of these is *depreciated*.
  55. */
  56. #define virt_to_bus(x) ((unsigned long)(x))
  57. #define bus_to_virt(x) ((void *)((unsigned long)(x)))
  58. /*
  59. * Conversion between a struct page and a physical address.
  60. *
  61. * Note: when converting an unknown physical address to a
  62. * struct page, the resulting pointer must be validated
  63. * using VALID_PAGE(). It must return an invalid struct page
  64. * for any physical address not corresponding to a system
  65. * RAM address.
  66. *
  67. * page_to_pfn(page) convert a struct page * to a PFN number
  68. * pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
  69. * pfn_valid(pfn) indicates whether a PFN number is valid
  70. *
  71. * virt_to_page(k) convert a _valid_ virtual address to struct page *
  72. * virt_addr_valid(k) indicates whether a virtual address is valid
  73. */
  74. #define ARCH_PFN_OFFSET (PHYS_PFN_OFFSET)
  75. #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
  76. #define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
  77. #define virt_addr_valid(kaddr) ((int)(kaddr) >= PAGE_OFFSET && (int)(kaddr) < (unsigned long)high_memory)
  78. /*
  79. * For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
  80. */
  81. #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
  82. /*
  83. * We should really eliminate virt_to_bus() here - it's depreciated.
  84. */
  85. #define page_to_bus(page) (page_address(page))
  86. #include <asm-generic/memory_model.h>
  87. #endif