dslinux/linux-2.6.x/include/asm-arm/arch-nds memory.h

amadeus dslinux_amadeus at user.in-berlin.de
Sat Aug 19 12:20:22 CEST 2006


Update of /cvsroot/dslinux/dslinux/linux-2.6.x/include/asm-arm/arch-nds
In directory antilope:/tmp/cvs-serv2276/linux-2.6.x/include/asm-arm/arch-nds

Modified Files:
	memory.h 
Log Message:
GBA ROM space as memory

Index: memory.h
===================================================================
RCS file: /cvsroot/dslinux/dslinux/linux-2.6.x/include/asm-arm/arch-nds/memory.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- memory.h	20 Feb 2006 20:18:47 -0000	1.1
+++ memory.h	19 Aug 2006 10:20:20 -0000	1.2
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/arch-p2001/memory.h
+ * linux/include/asm-arm/arch-nds/memory.h
  *
  *  Copyright (C) 2004 Tobias Lorenz
  *
@@ -30,4 +30,44 @@
 #define __virt_to_bus(vpage) ((unsigned long) (vpage))
 #define __bus_to_virt(ppage) ((unsigned long) (ppage))
 
+#ifdef CONFIG_DISCONTIGMEM
+
+/*
+ * 	node 0:  0x02000000 - 0x023fffff
+ * 	node 1:  0x08000000 - 0x09ffffff
+ */
+#define NODE_MAX_MEM_SHIFT	26
+#define NODE_MAX_MEM_SIZE	(1<<NODE_MAX_MEM_SHIFT)
+
+/*
+ * Given a kernel address, find the home node of the underlying memory.
+ */
+#define KVADDR_TO_NID(addr) \
+		(((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MAX_MEM_SHIFT)
+
+/*
+ * Given a page frame number, convert it to a node id.
+ */
+#define PFN_TO_NID(pfn) \
+	(((pfn) - PHYS_PFN_OFFSET) >> (NODE_MAX_MEM_SHIFT - PAGE_SHIFT))
+
+/*
+ * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
+ * and returns the mem_map of that node.
+ */
+#define ADDR_TO_MAPBASE(kaddr) \
+			NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
+
+#define PFN_TO_MAPBASE(pfn)	NODE_MEM_MAP(PFN_TO_NID(pfn))
+
+/*
+ * Given a kaddr, LOCAL_MAR_NR finds the owning node of the memory
+ * and returns the index corresponding to the appropriate page in the
+ * node's mem_map.
+ */
+#define LOCAL_MAP_NR(addr) \
+	(((unsigned long)(addr) & (NODE_MAX_MEM_SIZE - 1)) >> PAGE_SHIFT)
+
+#endif /* CONFIG_DISCONTIGMEM */
+
 #endif /*  __ASM_ARCH_MEMORY_H */




More information about the dslinux-commit mailing list