Commit 24485ae2 authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Richard Henderson

[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.
parent 9e1c1f90
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment