2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* include/asm-s390/io.h
|
|
|
|
*
|
|
|
|
* S390 version
|
|
|
|
* Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
|
|
|
|
* Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
|
|
|
|
*
|
|
|
|
* Derived from "include/asm-i386/io.h"
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _S390_IO_H
|
|
|
|
#define _S390_IO_H
|
|
|
|
|
|
|
|
#include <asm/page.h>
|
|
|
|
|
|
|
|
#define IO_SPACE_LIMIT 0xffffffff
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Change virtual addresses to physical addresses and vv.
|
|
|
|
* These are pretty trivial
|
|
|
|
*/
|
2005-11-09 13:34:42 +08:00
|
|
|
static inline unsigned long virt_to_phys(volatile void * address)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
unsigned long real_address;
|
2006-09-28 22:56:43 +08:00
|
|
|
asm volatile(
|
|
|
|
" lra %0,0(%1)\n"
|
|
|
|
" jz 0f\n"
|
|
|
|
" la %0,0\n"
|
2005-04-17 06:20:36 +08:00
|
|
|
"0:"
|
2006-09-28 22:56:43 +08:00
|
|
|
: "=a" (real_address) : "a" (address) : "cc");
|
2005-04-17 06:20:36 +08:00
|
|
|
return real_address;
|
|
|
|
}
|
|
|
|
|
2005-11-09 13:34:42 +08:00
|
|
|
static inline void * phys_to_virt(unsigned long address)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2007-02-12 22:49:57 +08:00
|
|
|
return (void *) address;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
s390: allow absolute memory access for /dev/mem
Currently dev/mem for s390 provides only real memory access. This means
that the CPU prefix pages are swapped. The prefix swap for real memory
works as follows:
Each CPU owns a prefix register that points to a page aligned memory
location "P". If this CPU accesses the address range [0,0x1fff], it is
translated by the hardware to [P,P+0x1fff]. Accordingly if this CPU
accesses the address range [P,P+0x1fff], it is translated by the hardware
to [0,0x1fff]. Therefore, if [P,P+0x1fff] or [0,0x1fff] is read from
the current /dev/mem device, the incorrectly swapped memory content is
returned.
With this patch the /dev/mem architecture code is modified to provide
absolute memory access. This is done via the arch specific functions
xlate_dev_mem_ptr() and unxlate_dev_mem_ptr(). For swapped pages on
s390 the function xlate_dev_mem_ptr() now returns a new buffer with a
copy of the requested absolute memory. In case the buffer was allocated,
the unxlate_dev_mem_ptr() function frees it after /dev/mem code has
called copy_to_user().
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2012-05-09 22:27:36 +08:00
|
|
|
void *xlate_dev_mem_ptr(unsigned long phys);
|
|
|
|
void unxlate_dev_mem_ptr(unsigned long phys, void *addr);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert a virtual cached pointer to an uncached pointer
|
|
|
|
*/
|
|
|
|
#define xlate_dev_kmem_ptr(p) p
|
|
|
|
|
|
|
|
#endif
|