From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org, aviro@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 6/17] FRV: Supply various missing I/O access primitives
Date: Fri, 6 Jan 2006 16:29:36 GMT [thread overview]
Message-ID: <200601061629.k06GTaYt011371@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <dhowells1136564974@warthog.cambridge.redhat.com>
The attached patch supplies various I/O access primitives that are missing for
the FRV arch:
(*) mmiowb()
(*) read*_relaxed()
(*) ioport_*map()
(*) ioread*(), iowrite*(), ioread*_rep() and iowrite*_rep()
(*) pci_io*map()
(*) check_signature()
The patch also makes __is_PCI_addr() more efficient.
Signed-Off-By: David Howells <dhowells@redhat.com>
---
warthog>diffstat -p1 frv-io-2615.diff
include/asm-frv/io.h | 123 ++++++++++++++++++++++++++++++++++++++++++++++
include/asm-frv/mb-regs.h | 4 +
2 files changed, 127 insertions(+)
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/io.h linux-2.6.15-frv/include/asm-frv/io.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/io.h 2005-06-22 13:52:26.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/io.h 2006-01-06 14:43:43.000000000 +0000
@@ -18,6 +18,7 @@
#ifdef __KERNEL__
#include <linux/config.h>
+#include <linux/types.h>
#include <asm/virtconvert.h>
#include <asm/string.h>
#include <asm/mb-regs.h>
@@ -104,6 +105,8 @@ static inline void __insl(unsigned long
__insl_sw(addr, buf, len);
}
+#define mmiowb() mb()
+
/*
* make the short names macros so specific devices
* can override them as required
@@ -209,6 +212,10 @@ static inline uint32_t readl(const volat
return ret;
}
+#define readb_relaxed readb
+#define readw_relaxed readw
+#define readl_relaxed readl
+
static inline void writeb(uint8_t datum, volatile void __iomem *addr)
{
__builtin_write8((volatile uint8_t __force *) addr, datum);
@@ -268,11 +275,106 @@ static inline void __iomem *ioremap_full
extern void iounmap(void __iomem *addr);
+static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
+{
+ return (void __iomem *) port;
+}
+
+static inline void ioport_unmap(void __iomem *p)
+{
+}
+
static inline void flush_write_buffers(void)
{
__asm__ __volatile__ ("membar" : : :"memory");
}
+/*
+ * do appropriate I/O accesses for token type
+ */
+static inline unsigned int ioread8(void __iomem *p)
+{
+ return __builtin_read8(p);
+}
+
+static inline unsigned int ioread16(void __iomem *p)
+{
+ uint16_t ret = __builtin_read16(p);
+ if (__is_PCI_addr(p))
+ ret = _swapw(ret);
+ return ret;
+}
+
+static inline unsigned int ioread32(void __iomem *p)
+{
+ uint32_t ret = __builtin_read32(p);
+ if (__is_PCI_addr(p))
+ ret = _swapl(ret);
+ return ret;
+}
+
+static inline void iowrite8(u8 val, void __iomem *p)
+{
+ __builtin_write8(p, val);
+ if (__is_PCI_MEM(p))
+ __flush_PCI_writes();
+}
+
+static inline void iowrite16(u16 val, void __iomem *p)
+{
+ if (__is_PCI_addr(p))
+ val = _swapw(val);
+ __builtin_write16(p, val);
+ if (__is_PCI_MEM(p))
+ __flush_PCI_writes();
+}
+
+static inline void iowrite32(u32 val, void __iomem *p)
+{
+ if (__is_PCI_addr(p))
+ val = _swapl(val);
+ __builtin_write32(p, val);
+ if (__is_PCI_MEM(p))
+ __flush_PCI_writes();
+}
+
+static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count)
+{
+ io_insb((unsigned long) p, dst, count);
+}
+
+static inline void ioread16_rep(void __iomem *p, void *dst, unsigned long count)
+{
+ io_insw((unsigned long) p, dst, count);
+}
+
+static inline void ioread32_rep(void __iomem *p, void *dst, unsigned long count)
+{
+ __insl_ns((unsigned long) p, dst, count);
+}
+
+static inline void iowrite8_rep(void __iomem *p, const void *src, unsigned long count)
+{
+ io_outsb((unsigned long) p, src, count);
+}
+
+static inline void iowrite16_rep(void __iomem *p, const void *src, unsigned long count)
+{
+ io_outsw((unsigned long) p, src, count);
+}
+
+static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long count)
+{
+ __outsl_ns((unsigned long) p, src, count);
+}
+
+/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+struct pci_dev;
+extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
+static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
+{
+}
+
/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -284,6 +386,27 @@ static inline void flush_write_buffers(v
* Convert a virtual cached pointer to an uncached pointer
*/
#define xlate_dev_kmem_ptr(p) p
+
+/*
+ * Check BIOS signature
+ */
+static inline int check_signature(volatile void __iomem *io_addr,
+ const unsigned char *signature, int length)
+{
+ int retval = 0;
+
+ do {
+ if (readb(io_addr) != *signature)
+ goto out;
+ io_addr++;
+ signature++;
+ length--;
+ } while (length);
+
+ retval = 1;
+out:
+ return retval;
+}
#endif /* __KERNEL__ */
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/mb-regs.h linux-2.6.15-frv/include/asm-frv/mb-regs.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/mb-regs.h 2005-03-02 12:08:45.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/mb-regs.h 2006-01-06 14:43:43.000000000 +0000
@@ -68,6 +68,9 @@ do { \
#define __is_PCI_MEM(addr) \
((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL)
+#define __is_PCI_addr(addr) \
+ ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL)
+
#define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; })
#define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U)
@@ -149,6 +152,7 @@ do { \
#define __is_PCI_IO(addr) 0 /* no PCI */
#define __is_PCI_MEM(addr) 0
+#define __is_PCI_addr(addr) 0
#define __region_PCI_IO 0
#define __region_PCI_MEM 0
#define __flush_PCI_writes() do { } while(0)
next prev parent reply other threads:[~2006-01-06 16:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-06 16:29 [PATCH 0/17] FRV: Permit compilation with allmodconfig David Howells
2006-01-06 16:29 ` [PATCH 4/17] FRV: Implement and export various things required by modules David Howells
2006-01-06 16:29 ` [PATCH 2/17] FRV: Drop 8/16-bit xchg and cmpxchg David Howells
2006-01-06 16:29 ` [PATCH 1/17] FRV: Suppress configuration of certain features for FRV David Howells
2006-01-06 16:29 ` [PATCH 3/17] FRV: Drop unsupported debugging features David Howells
2006-01-06 16:29 ` [PATCH 9/17] FRV: Fix PCMCIA configuration David Howells
2006-01-06 16:29 ` David Howells [this message]
2006-01-06 16:29 ` [PATCH 5/17] FRV: Support module exception tables David Howells
2006-01-06 16:29 ` [PATCH 10/17] FRV: Force serial driver inclusion David Howells
2006-01-06 16:29 ` [PATCH 8/17] FRV: Add pci_iomap David Howells
2006-01-06 16:29 ` [PATCH 7/17] FRV: Add module support stubs David Howells
2006-01-06 16:29 ` [PATCH 16/17] FRV: Fix uninitialised variable in serverworks driver David Howells
2006-01-06 16:29 ` [PATCH 11/17] FRV: Make get_user macro cast pointers David Howells
2006-01-06 16:29 ` [PATCH 15/17] FRV: Export __rcuref_hash David Howells
2006-01-06 16:59 ` Eric Dumazet
2006-01-06 16:29 ` [PATCH 14/17] FRV: Stop the IEEE1394 nodemanager from accessing sem count directly David Howells
2006-01-06 16:29 ` [PATCH 13/17] FRV: Fix uninitialised variable in atm nicstar driver David Howells
2006-01-06 16:29 ` [PATCH 12/17] FRV: Miscellaneous changes David Howells
2006-01-06 16:29 ` [PATCH 17/17] FRV: Stop XFS from accessing sem count directly David Howells
2006-01-06 17:18 ` [PATCH 0/17] FRV: Permit compilation with allmodconfig Jan Dittmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200601061629.k06GTaYt011371@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=aviro@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®