Commit 7dc59bdd authored by GuanXuetao's avatar GuanXuetao

asm-generic: fix inX/outX functions for architectures that have PCI

The definitions for the PC-style PIO functions in asm-generic/io.h were
meant as dummies so you could compile code on architectures without
ISA and PCI buses. However, unicore32 actually wants to use them
with a real PCI bus, so they need to be defined to actually address
the register window holding the I/O ports.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 521cb40b
...@@ -94,6 +94,10 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr) ...@@ -94,6 +94,10 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr) #define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
#endif #endif
#ifndef PCI_IOBASE
#define PCI_IOBASE ((void __iomem *) 0)
#endif
/*****************************************************************************/ /*****************************************************************************/
/* /*
* traditional input/output functions * traditional input/output functions
...@@ -101,32 +105,32 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr) ...@@ -101,32 +105,32 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
static inline u8 inb(unsigned long addr) static inline u8 inb(unsigned long addr)
{ {
return readb((volatile void __iomem *) addr); return readb(addr + PCI_IOBASE);
} }
static inline u16 inw(unsigned long addr) static inline u16 inw(unsigned long addr)
{ {
return readw((volatile void __iomem *) addr); return readw(addr + PCI_IOBASE);
} }
static inline u32 inl(unsigned long addr) static inline u32 inl(unsigned long addr)
{ {
return readl((volatile void __iomem *) addr); return readl(addr + PCI_IOBASE);
} }
static inline void outb(u8 b, unsigned long addr) static inline void outb(u8 b, unsigned long addr)
{ {
writeb(b, (volatile void __iomem *) addr); writeb(b, addr + PCI_IOBASE);
} }
static inline void outw(u16 b, unsigned long addr) static inline void outw(u16 b, unsigned long addr)
{ {
writew(b, (volatile void __iomem *) addr); writew(b, addr + PCI_IOBASE);
} }
static inline void outl(u32 b, unsigned long addr) static inline void outl(u32 b, unsigned long addr)
{ {
writel(b, (volatile void __iomem *) addr); writel(b, addr + PCI_IOBASE);
} }
#define inb_p(addr) inb(addr) #define inb_p(addr) inb(addr)
...@@ -213,32 +217,32 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) ...@@ -213,32 +217,32 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
static inline void readsl(const void __iomem *addr, void *buf, int len) static inline void readsl(const void __iomem *addr, void *buf, int len)
{ {
insl((unsigned long)addr, buf, len); insl(addr - PCI_IOBASE, buf, len);
} }
static inline void readsw(const void __iomem *addr, void *buf, int len) static inline void readsw(const void __iomem *addr, void *buf, int len)
{ {
insw((unsigned long)addr, buf, len); insw(addr - PCI_IOBASE, buf, len);
} }
static inline void readsb(const void __iomem *addr, void *buf, int len) static inline void readsb(const void __iomem *addr, void *buf, int len)
{ {
insb((unsigned long)addr, buf, len); insb(addr - PCI_IOBASE, buf, len);
} }
static inline void writesl(const void __iomem *addr, const void *buf, int len) static inline void writesl(const void __iomem *addr, const void *buf, int len)
{ {
outsl((unsigned long)addr, buf, len); outsl(addr - PCI_IOBASE, buf, len);
} }
static inline void writesw(const void __iomem *addr, const void *buf, int len) static inline void writesw(const void __iomem *addr, const void *buf, int len)
{ {
outsw((unsigned long)addr, buf, len); outsw(addr - PCI_IOBASE, buf, len);
} }
static inline void writesb(const void __iomem *addr, const void *buf, int len) static inline void writesb(const void __iomem *addr, const void *buf, int len)
{ {
outsb((unsigned long)addr, buf, len); outsb(addr - PCI_IOBASE, buf, len);
} }
#ifndef CONFIG_GENERIC_IOMAP #ifndef CONFIG_GENERIC_IOMAP
...@@ -269,8 +273,9 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len) ...@@ -269,8 +273,9 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
outsl((unsigned long) (p), (src), (count)) outsl((unsigned long) (p), (src), (count))
#endif /* CONFIG_GENERIC_IOMAP */ #endif /* CONFIG_GENERIC_IOMAP */
#ifndef IO_SPACE_LIMIT
#define IO_SPACE_LIMIT 0xffffffff #define IO_SPACE_LIMIT 0xffff
#endif
#ifdef __KERNEL__ #ifdef __KERNEL__
......
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