More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / include / asm-mips64 / mmzone.h
blob7b06e7a91a57747af1f4193d7d10ca8bd7e4c49b
1 /*
2 * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99
3 */
4 #ifndef _ASM_MMZONE_H_
5 #define _ASM_MMZONE_H_
7 #include <linux/config.h>
8 #include <asm/sn/types.h>
9 #include <asm/sn/addrs.h>
10 #include <asm/sn/arch.h>
11 #include <asm/sn/klkernvars.h>
13 typedef struct plat_pglist_data {
14 pg_data_t gendata;
15 kern_vars_t kern_vars;
16 } plat_pg_data_t;
19 * Following are macros that are specific to this numa platform.
22 extern int numa_debug(void);
23 extern plat_pg_data_t *plat_node_data[];
25 #define PHYSADDR_TO_NID(pa) NASID_TO_COMPACT_NODEID(NASID_GET(pa))
26 #define PLAT_NODE_DATA(n) (plat_node_data[n])
27 #define PLAT_NODE_DATA_STARTNR(n) (PLAT_NODE_DATA(n)->gendata.node_start_mapnr)
28 #define PLAT_NODE_DATA_SIZE(n) (PLAT_NODE_DATA(n)->gendata.node_size)
29 #define PLAT_NODE_DATA_LOCALNR(p, n) \
30 (((p) - PLAT_NODE_DATA(n)->gendata.node_start_paddr) >> PAGE_SHIFT)
32 #define numa_node_id() cputocnode(current->processor)
34 #ifdef CONFIG_DISCONTIGMEM
37 * Following are macros that each numa implmentation must define.
41 * Given a kernel address, find the home node of the underlying memory.
43 #define KVADDR_TO_NID(kaddr) \
44 ((NASID_TO_COMPACT_NODEID(NASID_GET(__pa(kaddr))) != -1) ? \
45 (NASID_TO_COMPACT_NODEID(NASID_GET(__pa(kaddr)))) : \
46 (printk("NUMABUG: %s line %d addr 0x%lx", __FILE__, __LINE__, kaddr), \
47 numa_debug(), -1))
50 * Return a pointer to the node data for node n.
52 #define NODE_DATA(n) (&((PLAT_NODE_DATA(n))->gendata))
55 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
57 #define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
60 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
61 * and returns the the mem_map of that node.
63 #define ADDR_TO_MAPBASE(kaddr) \
64 NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
67 * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
68 * and returns the kaddr corresponding to first physical page in the
69 * node's mem_map.
71 #define LOCAL_BASE_ADDR(kaddr) ((unsigned long)(kaddr) & ~(NODE_MAX_MEM_SIZE-1))
73 #define LOCAL_MAP_NR(kvaddr) \
74 (((unsigned long)(kvaddr)-LOCAL_BASE_ADDR((kvaddr))) >> PAGE_SHIFT)
76 #define MIPS64_NR(kaddr) (((unsigned long)(kaddr) > (unsigned long)high_memory)\
77 ? (max_mapnr + 1) : (LOCAL_MAP_NR((kaddr)) + \
78 (((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \
79 sizeof(mem_map_t))))
81 #define kern_addr_valid(addr) ((KVADDR_TO_NID((unsigned long)addr) > \
82 -1) ? 0 : (test_bit(LOCAL_MAP_NR((addr)), \
83 NODE_DATA(KVADDR_TO_NID((unsigned long)addr))->valid_addr_bitmap)))
85 #define virt_to_page(kaddr) (mem_map + MIPS64_NR(kaddr))
86 #define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
88 #endif /* CONFIG_DISCONTIGMEM */
90 #endif /* _ASM_MMZONE_H_ */