Commit 7d1689a2 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Greg Kroah-Hartman

parisc: iomap: introduce io{read|write}64

Add support for io{read|write}64() functions in parisc architecture.
These are pretty straightforward copies of similar functions which
make use of readq and writeq.

Also, indicate that the lo_hi and hi_lo variants of these functions
are not provided by this architecture.
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarHelge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aecc787c
...@@ -311,6 +311,15 @@ extern void outsl (unsigned long port, const void *src, unsigned long count); ...@@ -311,6 +311,15 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
* value for either 32 or 64 bit mode */ * value for either 32 or 64 bit mode */
#define F_EXTEND(x) ((unsigned long)((x) | (0xffffffff00000000ULL))) #define F_EXTEND(x) ((unsigned long)((x) | (0xffffffff00000000ULL)))
#define ioread64 ioread64
#define ioread64be ioread64be
#define iowrite64 iowrite64
#define iowrite64be iowrite64be
extern u64 ioread64(void __iomem *addr);
extern u64 ioread64be(void __iomem *addr);
extern void iowrite64(u64 val, void __iomem *addr);
extern void iowrite64be(u64 val, void __iomem *addr);
#include <asm-generic/iomap.h> #include <asm-generic/iomap.h>
/* /*
......
...@@ -48,11 +48,15 @@ struct iomap_ops { ...@@ -48,11 +48,15 @@ struct iomap_ops {
unsigned int (*read16be)(void __iomem *); unsigned int (*read16be)(void __iomem *);
unsigned int (*read32)(void __iomem *); unsigned int (*read32)(void __iomem *);
unsigned int (*read32be)(void __iomem *); unsigned int (*read32be)(void __iomem *);
u64 (*read64)(void __iomem *);
u64 (*read64be)(void __iomem *);
void (*write8)(u8, void __iomem *); void (*write8)(u8, void __iomem *);
void (*write16)(u16, void __iomem *); void (*write16)(u16, void __iomem *);
void (*write16be)(u16, void __iomem *); void (*write16be)(u16, void __iomem *);
void (*write32)(u32, void __iomem *); void (*write32)(u32, void __iomem *);
void (*write32be)(u32, void __iomem *); void (*write32be)(u32, void __iomem *);
void (*write64)(u64, void __iomem *);
void (*write64be)(u64, void __iomem *);
void (*read8r)(void __iomem *, void *, unsigned long); void (*read8r)(void __iomem *, void *, unsigned long);
void (*read16r)(void __iomem *, void *, unsigned long); void (*read16r)(void __iomem *, void *, unsigned long);
void (*read32r)(void __iomem *, void *, unsigned long); void (*read32r)(void __iomem *, void *, unsigned long);
...@@ -171,6 +175,16 @@ static unsigned int iomem_read32be(void __iomem *addr) ...@@ -171,6 +175,16 @@ static unsigned int iomem_read32be(void __iomem *addr)
return __raw_readl(addr); return __raw_readl(addr);
} }
static u64 iomem_read64(void __iomem *addr)
{
return readq(addr);
}
static u64 iomem_read64be(void __iomem *addr)
{
return __raw_readq(addr);
}
static void iomem_write8(u8 datum, void __iomem *addr) static void iomem_write8(u8 datum, void __iomem *addr)
{ {
writeb(datum, addr); writeb(datum, addr);
...@@ -196,6 +210,16 @@ static void iomem_write32be(u32 datum, void __iomem *addr) ...@@ -196,6 +210,16 @@ static void iomem_write32be(u32 datum, void __iomem *addr)
__raw_writel(datum, addr); __raw_writel(datum, addr);
} }
static void iomem_write64(u64 datum, void __iomem *addr)
{
writel(datum, addr);
}
static void iomem_write64be(u64 datum, void __iomem *addr)
{
__raw_writel(datum, addr);
}
static void iomem_read8r(void __iomem *addr, void *dst, unsigned long count) static void iomem_read8r(void __iomem *addr, void *dst, unsigned long count)
{ {
while (count--) { while (count--) {
...@@ -250,11 +274,15 @@ static const struct iomap_ops iomem_ops = { ...@@ -250,11 +274,15 @@ static const struct iomap_ops iomem_ops = {
.read16be = iomem_read16be, .read16be = iomem_read16be,
.read32 = iomem_read32, .read32 = iomem_read32,
.read32be = iomem_read32be, .read32be = iomem_read32be,
.read64 = iomem_read64,
.read64be = iomem_read64be,
.write8 = iomem_write8, .write8 = iomem_write8,
.write16 = iomem_write16, .write16 = iomem_write16,
.write16be = iomem_write16be, .write16be = iomem_write16be,
.write32 = iomem_write32, .write32 = iomem_write32,
.write32be = iomem_write32be, .write32be = iomem_write32be,
.write64 = iomem_write64,
.write64be = iomem_write64be,
.read8r = iomem_read8r, .read8r = iomem_read8r,
.read16r = iomem_read16r, .read16r = iomem_read16r,
.read32r = iomem_read32r, .read32r = iomem_read32r,
...@@ -304,6 +332,20 @@ unsigned int ioread32be(void __iomem *addr) ...@@ -304,6 +332,20 @@ unsigned int ioread32be(void __iomem *addr)
return *((u32 *)addr); return *((u32 *)addr);
} }
u64 ioread64(void __iomem *addr)
{
if (unlikely(INDIRECT_ADDR(addr)))
return iomap_ops[ADDR_TO_REGION(addr)]->read64(addr);
return le64_to_cpup((u64 *)addr);
}
u64 ioread64be(void __iomem *addr)
{
if (unlikely(INDIRECT_ADDR(addr)))
return iomap_ops[ADDR_TO_REGION(addr)]->read64be(addr);
return *((u64 *)addr);
}
void iowrite8(u8 datum, void __iomem *addr) void iowrite8(u8 datum, void __iomem *addr)
{ {
if (unlikely(INDIRECT_ADDR(addr))) { if (unlikely(INDIRECT_ADDR(addr))) {
...@@ -349,6 +391,24 @@ void iowrite32be(u32 datum, void __iomem *addr) ...@@ -349,6 +391,24 @@ void iowrite32be(u32 datum, void __iomem *addr)
} }
} }
void iowrite64(u64 datum, void __iomem *addr)
{
if (unlikely(INDIRECT_ADDR(addr))) {
iomap_ops[ADDR_TO_REGION(addr)]->write64(datum, addr);
} else {
*((u64 *)addr) = cpu_to_le64(datum);
}
}
void iowrite64be(u64 datum, void __iomem *addr)
{
if (unlikely(INDIRECT_ADDR(addr))) {
iomap_ops[ADDR_TO_REGION(addr)]->write64be(datum, addr);
} else {
*((u64 *)addr) = datum;
}
}
/* Repeating interfaces */ /* Repeating interfaces */
void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
...@@ -449,11 +509,15 @@ EXPORT_SYMBOL(ioread16); ...@@ -449,11 +509,15 @@ EXPORT_SYMBOL(ioread16);
EXPORT_SYMBOL(ioread16be); EXPORT_SYMBOL(ioread16be);
EXPORT_SYMBOL(ioread32); EXPORT_SYMBOL(ioread32);
EXPORT_SYMBOL(ioread32be); EXPORT_SYMBOL(ioread32be);
EXPORT_SYMBOL(ioread64);
EXPORT_SYMBOL(ioread64be);
EXPORT_SYMBOL(iowrite8); EXPORT_SYMBOL(iowrite8);
EXPORT_SYMBOL(iowrite16); EXPORT_SYMBOL(iowrite16);
EXPORT_SYMBOL(iowrite16be); EXPORT_SYMBOL(iowrite16be);
EXPORT_SYMBOL(iowrite32); EXPORT_SYMBOL(iowrite32);
EXPORT_SYMBOL(iowrite32be); EXPORT_SYMBOL(iowrite32be);
EXPORT_SYMBOL(iowrite64);
EXPORT_SYMBOL(iowrite64be);
EXPORT_SYMBOL(ioread8_rep); EXPORT_SYMBOL(ioread8_rep);
EXPORT_SYMBOL(ioread16_rep); EXPORT_SYMBOL(ioread16_rep);
EXPORT_SYMBOL(ioread32_rep); EXPORT_SYMBOL(ioread32_rep);
......
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