mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-16 22:10:24 +00:00
0bb34a6bf1
This consolidates the pci_iomap() definitions and reworks how the I/O port base is handled. PCI channels can register their own I/O map base, or if none is provided, the system-wide generic I/O base is used instead. Functionally nothing changes, while this allows us to kill off lots of I/O address special casing and lookups. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
82 lines
1.8 KiB
C
82 lines
1.8 KiB
C
/*
|
|
* linux/arch/sh/kernel/io.c
|
|
*
|
|
* Copyright (C) 2000 Stuart Menefy
|
|
* Copyright (C) 2005 Paul Mundt
|
|
*
|
|
* Provide real functions which expand to whatever the header file defined.
|
|
* Also definitions of machine independent IO functions.
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
#include <linux/module.h>
|
|
#include <linux/pci.h>
|
|
#include <asm/machvec.h>
|
|
#include <asm/io.h>
|
|
|
|
/*
|
|
* Copy data from IO memory space to "real" memory space.
|
|
* This needs to be optimized.
|
|
*/
|
|
void memcpy_fromio(void *to, const volatile void __iomem *from, unsigned long count)
|
|
{
|
|
unsigned char *p = to;
|
|
while (count) {
|
|
count--;
|
|
*p = readb(from);
|
|
p++;
|
|
from++;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(memcpy_fromio);
|
|
|
|
/*
|
|
* Copy data from "real" memory space to IO memory space.
|
|
* This needs to be optimized.
|
|
*/
|
|
void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
|
|
{
|
|
const unsigned char *p = from;
|
|
while (count) {
|
|
count--;
|
|
writeb(*p, to);
|
|
p++;
|
|
to++;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(memcpy_toio);
|
|
|
|
/*
|
|
* "memset" on IO memory space.
|
|
* This needs to be optimized.
|
|
*/
|
|
void memset_io(volatile void __iomem *dst, int c, unsigned long count)
|
|
{
|
|
while (count) {
|
|
count--;
|
|
writeb(c, dst);
|
|
dst++;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(memset_io);
|
|
|
|
void __iomem *ioport_map(unsigned long port, unsigned int nr)
|
|
{
|
|
void __iomem *ret;
|
|
|
|
ret = __ioport_map_trapped(port, nr);
|
|
if (ret)
|
|
return ret;
|
|
|
|
return __ioport_map(port, nr);
|
|
}
|
|
EXPORT_SYMBOL(ioport_map);
|
|
|
|
void ioport_unmap(void __iomem *addr)
|
|
{
|
|
sh_mv.mv_ioport_unmap(addr);
|
|
}
|
|
EXPORT_SYMBOL(ioport_unmap);
|