diff options
| author | Ivan Kokshaysky <ink@jurassic.park.msu.ru> | 2003-01-14 19:13:08 -0800 |
|---|---|---|
| committer | Richard Henderson <rth@are.twiddle.net> | 2003-01-14 19:13:08 -0800 |
| commit | 24485ae2245d00ee5087f2338597c9068c65334d (patch) | |
| tree | 04d8ef301cc59abf1ae9ddcbcde8b5bc5267a1a9 /include | |
| parent | 9e1c1f90bcdde52af0f1b7470fcd22fb6aa15f1c (diff) | |
[PATCH] alpha ev6/ev7 virt_to_phys
From Jeff.Wiedemeier@hp.com:
Adjust virt_to_phys / phys_to_virt functions to follow
EV6/7 PA sign extension to properly convert between 43-bit
superpage I/O addresses and physical addresses.
This change is backwards compatible with all previous Alphas
as they implemented fewer than 41 bits of physical address.
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-alpha/io.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h index eb6ef31bf932..fd68ef0a6601 100644 --- a/include/asm-alpha/io.h +++ b/include/asm-alpha/io.h @@ -20,6 +20,7 @@ #include <asm/system.h> #include <asm/pgtable.h> #include <asm/machvec.h> +#include <asm/hwrpb.h> /* * We try to avoid hae updates (thus the cache), but when we @@ -51,6 +52,7 @@ static inline void set_hae(unsigned long new_hae) /* * Change virtual addresses to physical addresses and vv. */ +#ifdef USE_48_BIT_KSEG static inline unsigned long virt_to_phys(void *address) { return (unsigned long)address - IDENT_ADDR; @@ -60,6 +62,26 @@ static inline void * phys_to_virt(unsigned long address) { return (void *) (address + IDENT_ADDR); } +#else +static inline unsigned long virt_to_phys(void *address) +{ + unsigned long phys; + + __asm__ ( + "sll %1, 63-40, %0\n" + "sra %0, 63-40, %0\n" + : "=r" (phys) : "r" (address)); + + phys &= (1ul << hwrpb->pa_bits) - 1; + + return phys; +} + +static inline void * phys_to_virt(unsigned long address) +{ + return (void *)(IDENT_ADDR + (address & ((1ul << 41) - 1))); +} +#endif #define page_to_phys(page) PAGE_TO_PA(page) |
