diff options
author | Kanoj Sarcar <kanoj@engr.sgi.com> | 2000-02-06 00:20:27 +0000 |
---|---|---|
committer | Kanoj Sarcar <kanoj@engr.sgi.com> | 2000-02-06 00:20:27 +0000 |
commit | 0481e7544584f5401f762fce5f2b8640e1c08e57 (patch) | |
tree | 2553ff77d37b198056407ac494462f563603de00 /include/asm-mips64/mmzone.h | |
parent | 08787df154c978f87e8066c074582adac542d305 (diff) |
Add in code for a CONFIG_DISCONTIGMEM compile. Still to be debugged.
Diffstat (limited to 'include/asm-mips64/mmzone.h')
-rw-r--r-- | include/asm-mips64/mmzone.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/include/asm-mips64/mmzone.h b/include/asm-mips64/mmzone.h new file mode 100644 index 000000000..d1a097bfa --- /dev/null +++ b/include/asm-mips64/mmzone.h @@ -0,0 +1,81 @@ +/* + * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99 + */ +#ifndef _ASM_MMZONE_H_ +#define _ASM_MMZONE_H_ + +#include <asm/sn/types.h> +#include <asm/sn/addrs.h> +#include <asm/sn/arch.h> + +extern cnodeid_t nasid_to_compact_node[]; /* to sn/arch.h */ + +typedef struct plat_pglist_data { + pg_data_t gendata; + unsigned long physstart; + unsigned long size; + unsigned long start_mapnr; +} plat_pg_data_t; + +/* + * Following are macros that are specific to this numa platform. + */ + +extern pg_data_t node_data[]; +extern plat_pg_data_t plat_node_data[]; +extern int numa_debug(void); + +#define PHYSADDR_TO_NID(pa) NASID_TO_COMPACT_NODEID(NASID_GET(pa)) +#define PLAT_NODE_DATA(n) (plat_node_data + (n)) +#define PLAT_NODE_DATA_STARTNR(n) (PLAT_NODE_DATA(n)->start_mapnr) +#define PLAT_NODE_DATA_LOCALNR(p, n) \ + (((p) - PLAT_NODE_DATA(n)->physstart) >> PAGE_SHIFT) +#define PAGE_TO_PLAT_NODE(p) (plat_pg_data_t *)((p)->zone->zone_pgdat) + +/* + * Following are macros that each numa implmentation must define. + */ + +/* + * Given a kernel address, find the home node of the underlying memory. + * For production kern_addr_valid, change to return "numnodes" instead + * of panicing. + */ +#define KVADDR_TO_NID(kaddr) \ + ((NASID_TO_COMPACT_NODEID(NASID_GET(__pa(kaddr))) != -1) ? \ + (NASID_TO_COMPACT_NODEID(NASID_GET(__pa(kaddr)))) : \ + (printk("NUMABUG: %s line %d addr 0x%lx", __FILE__, __LINE__, kaddr), \ + numa_debug(), -1)) + +/* + * Return a pointer to the node data for node n. + */ +#define NODE_DATA(n) (&((plat_node_data + (n))->gendata)) + +/* + * NODE_MEM_MAP gives the kaddr for the mem_map of the node. + */ +#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) + +/* + * Given a mem_map_t, LOCAL_MAP_BASE finds the owning node for the + * physical page and returns the kaddr for the mem_map of that node. + */ +#define LOCAL_MAP_BASE(page) \ + NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(page))) + +/* + * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory + * and returns the the mem_map of that node. + */ +#define ADDR_TO_MAPBASE(kaddr) \ + NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr))) + +/* + * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory + * and returns the kaddr corresponding to first physical page in the + * node's mem_map. + */ +#define LOCAL_BASE_ADDR(kaddr) ((unsigned long)(kaddr) & ~(NODE_MAX_MEM_SIZE-1)) + +#endif /* _ASM_MMZONE_H_ */ |