patch-2.4.22 linux-2.4.22/include/asm-sh/mmzone.h
Next file: linux-2.4.22/include/asm-sh/parport.h
Previous file: linux-2.4.22/include/asm-sh/mmu_context.h
Back to the patch index
Back to the overall index
- Lines: 62
- Date:
2003-08-25 04:44:44.000000000 -0700
- Orig file:
linux-2.4.21/include/asm-sh/mmzone.h
- Orig date:
1969-12-31 16:00:00.000000000 -0800
diff -urN linux-2.4.21/include/asm-sh/mmzone.h linux-2.4.22/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>
+
+/* Currently, just for HP690 */
+#define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0)
+#define NR_NODES 2
+
+extern pg_data_t discontig_page_data[NR_NODES];
+extern bootmem_data_t discontig_node_bdata[NR_NODES];
+
+#ifdef CONFIG_DISCONTIGMEM
+/*
+ * 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 < NR_NODES; 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
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)