~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/alpha/include/asm/mmzone.h

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
  3  * Adapted for the alpha wildfire architecture Jan 2001.
  4  */
  5 #ifndef _ASM_MMZONE_H_
  6 #define _ASM_MMZONE_H_
  7 
  8 #include <asm/smp.h>
  9 
 10 struct bootmem_data_t; /* stupid forward decl. */
 11 
 12 /*
 13  * Following are macros that are specific to this numa platform.
 14  */
 15 
 16 extern pg_data_t node_data[];
 17 
 18 #define alpha_pa_to_nid(pa)             \
 19         (alpha_mv.pa_to_nid             \
 20          ? alpha_mv.pa_to_nid(pa)       \
 21          : (0))
 22 #define node_mem_start(nid)             \
 23         (alpha_mv.node_mem_start        \
 24          ? alpha_mv.node_mem_start(nid) \
 25          : (0UL))
 26 #define node_mem_size(nid)              \
 27         (alpha_mv.node_mem_size         \
 28          ? alpha_mv.node_mem_size(nid)  \
 29          : ((nid) ? (0UL) : (~0UL)))
 30 
 31 #define pa_to_nid(pa)           alpha_pa_to_nid(pa)
 32 #define NODE_DATA(nid)          (&node_data[(nid)])
 33 
 34 #define node_localnr(pfn, nid)  ((pfn) - NODE_DATA(nid)->node_start_pfn)
 35 
 36 #if 1
 37 #define PLAT_NODE_DATA_LOCALNR(p, n)    \
 38         (((p) >> PAGE_SHIFT) - PLAT_NODE_DATA(n)->gendata.node_start_pfn)
 39 #else
 40 static inline unsigned long
 41 PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
 42 {
 43         unsigned long temp;
 44         temp = p >> PAGE_SHIFT;
 45         return temp - PLAT_NODE_DATA(n)->gendata.node_start_pfn;
 46 }
 47 #endif
 48 
 49 #ifdef CONFIG_DISCONTIGMEM
 50 
 51 /*
 52  * Following are macros that each numa implementation must define.
 53  */
 54 
 55 /*
 56  * Given a kernel address, find the home node of the underlying memory.
 57  */
 58 #define kvaddr_to_nid(kaddr)    pa_to_nid(__pa(kaddr))
 59 
 60 /*
 61  * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
 62  * and returns the kaddr corresponding to first physical page in the
 63  * node's mem_map.
 64  */
 65 #define LOCAL_BASE_ADDR(kaddr)                                            \
 66     ((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn  \
 67                          << PAGE_SHIFT))
 68 
 69 /* XXX: FIXME -- nyc */
 70 #define kern_addr_valid(kaddr)  (0)
 71 
 72 #define virt_to_page(kaddr)     pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 73 
 74 #define pmd_page(pmd)           (pfn_to_page(pmd_val(pmd) >> 32))
 75 #define pgd_page(pgd)           (pfn_to_page(pgd_val(pgd) >> 32))
 76 #define pte_pfn(pte)            (pte_val(pte) >> 32)
 77 
 78 #define mk_pte(page, pgprot)                                                 \
 79 ({                                                                           \
 80         pte_t pte;                                                           \
 81         unsigned long pfn;                                                   \
 82                                                                              \
 83         pfn = page_to_pfn(page) << 32; \
 84         pte_val(pte) = pfn | pgprot_val(pgprot);                             \
 85                                                                              \
 86         pte;                                                                 \
 87 })
 88 
 89 #define pte_page(x)                                                     \
 90 ({                                                                      \
 91         unsigned long kvirt;                                            \
 92         struct page * __xx;                                             \
 93                                                                         \
 94         kvirt = (unsigned long)__va(pte_val(x) >> (32-PAGE_SHIFT));     \
 95         __xx = virt_to_page(kvirt);                                     \
 96                                                                         \
 97         __xx;                                                           \
 98 })
 99 
100 #define page_to_pa(page)                                                \
101         (page_to_pfn(page) << PAGE_SHIFT)
102 
103 #define pfn_to_nid(pfn)         pa_to_nid(((u64)(pfn) << PAGE_SHIFT))
104 #define pfn_valid(pfn)                                                  \
105         (((pfn) - node_start_pfn(pfn_to_nid(pfn))) <                    \
106          node_spanned_pages(pfn_to_nid(pfn)))                                   \
107 
108 #define virt_addr_valid(kaddr)  pfn_valid((__pa(kaddr) >> PAGE_SHIFT))
109 
110 #endif /* CONFIG_DISCONTIGMEM */
111 
112 #endif /* _ASM_MMZONE_H_ */
113 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp