patch-2.3.16 linux/include/asm-ppc/page.h

Next file: linux/include/asm-ppc/pgtable.h
Previous file: linux/include/asm-ppc/mmu_context.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.15/linux/include/asm-ppc/page.h linux/include/asm-ppc/page.h
@@ -23,7 +23,7 @@
 #define BUG() do { \
 	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
 	__asm__ __volatile__(".long 0x0"); \
-}
+} while (0)
 #endif
 #define PAGE_BUG(page) do { BUG(); } while (0)
 
@@ -80,15 +80,34 @@
 #define copy_page(to,from)	memcpy((void *)(to), (void *)(from), PAGE_SIZE)
 
 /* map phys->virtual and virtual->phys for RAM pages */
-#ifdef CONFIG_APUS
-#include <asm/amigappc.h>
-/* Word at CYBERBASEp has the value (-KERNELBASE+CYBERBASE). */
-#define __pa(x)			((unsigned long)(x)+(*(unsigned long*)CYBERBASEp))
-#define __va(x)			((void *)((unsigned long)(x)-(*(unsigned long*)CYBERBASEp)))
-#else
-#define __pa(x)			((unsigned long)(x)-PAGE_OFFSET)
-#define __va(x)			((void *)((unsigned long)(x)+PAGE_OFFSET))
-#endif
+static inline unsigned long ___pa(unsigned long v)
+{ 
+	unsigned long p;
+	asm volatile ("1: addis %0, %1, %2;" 
+		      ".section \".vtop_fixup\",\"aw\";"
+		      ".align  1;"
+		      ".long   1b;"
+		      ".previous;"
+		      : "=r" (p) 
+		      : "b" (v), "K" (((-PAGE_OFFSET) >> 16) & 0xffff));
+
+	return p;
+}
+static inline void* ___va(unsigned long p)
+{ 
+	unsigned long v;
+	asm volatile ("1: addis %0, %1, %2;" 
+		      ".section \".ptov_fixup\",\"aw\";"
+		      ".align  1;"
+		      ".long   1b;"
+		      ".previous;"
+		      : "=r" (v) 
+		      : "b" (p), "K" (((PAGE_OFFSET) >> 16) & 0xffff));
+
+	return (void*) v;
+}
+#define __pa(x) ___pa ((unsigned long)(x))
+#define __va(x) ___va ((unsigned long)(x))
 
 #define MAP_NR(addr)		(((unsigned long)addr-PAGE_OFFSET) >> PAGE_SHIFT)
 #define MAP_PAGE_RESERVED	(1<<15)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)