diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:20:36 -0700 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-sh/mmzone.h | |
download | linux-next-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.gz |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-sh/mmzone.h')
-rw-r--r-- | include/asm-sh/mmzone.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/asm-sh/mmzone.h b/include/asm-sh/mmzone.h new file mode 100644 index 000000000000..0e7406601fdf --- /dev/null +++ b/include/asm-sh/mmzone.h @@ -0,0 +1,61 @@ +/* + * linux/include/asm-sh/mmzone.h + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef __ASM_SH_MMZONE_H +#define __ASM_SH_MMZONE_H + +#include <linux/config.h> + +#ifdef CONFIG_DISCONTIGMEM + +/* Currently, just for HP690 */ +#define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0) + +extern pg_data_t discontig_page_data[MAX_NUMNODES]; +extern bootmem_data_t discontig_node_bdata[MAX_NUMNODES]; + +/* + * Following are macros that each numa implmentation must define. + */ + +/* + * Given a kernel address, find the home node of the underlying memory. + */ +#define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr)) + +/* + * Return a pointer to the node data for node n. + */ +#define NODE_DATA(nid) (&discontig_page_data[nid]) + +/* + * NODE_MEM_MAP gives the kaddr for the mem_map of the node. + */ +#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) + +#define phys_to_page(phys) \ +({ unsigned int node = PHYSADDR_TO_NID(phys); \ + NODE_MEM_MAP(node) \ + + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); }) + +static inline int is_valid_page(struct page *page) +{ + unsigned int i; + + for (i = 0; i < MAX_NUMNODES; i++) { + if (page >= NODE_MEM_MAP(i) && + page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size) + return 1; + } + return 0; +} + +#define VALID_PAGE(page) is_valid_page(page) +#define page_to_phys(page) PHYSADDR(page_address(page)) + +#endif /* CONFIG_DISCONTIGMEM */ +#endif |