|
@@ -417,3 +417,164 @@ extern inline void __raw_writew(u16 b, volatile void __iomem *addr)
|
|
|
extern inline u8 readb(const volatile void __iomem *addr)
|
|
|
{
|
|
|
u8 ret = __raw_readb(addr);
|
|
|
+ mb();
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+extern inline u16 readw(const volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ u16 ret = __raw_readw(addr);
|
|
|
+ mb();
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+extern inline void writeb(u8 b, volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ __raw_writeb(b, addr);
|
|
|
+ mb();
|
|
|
+}
|
|
|
+
|
|
|
+extern inline void writew(u16 b, volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ __raw_writew(b, addr);
|
|
|
+ mb();
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+#if IO_CONCAT(__IO_PREFIX,trivial_rw_lq) == 1
|
|
|
+extern inline u32 __raw_readl(const volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ return IO_CONCAT(__IO_PREFIX,readl)(addr);
|
|
|
+}
|
|
|
+
|
|
|
+extern inline u64 __raw_readq(const volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ return IO_CONCAT(__IO_PREFIX,readq)(addr);
|
|
|
+}
|
|
|
+
|
|
|
+extern inline void __raw_writel(u32 b, volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ IO_CONCAT(__IO_PREFIX,writel)(b, addr);
|
|
|
+}
|
|
|
+
|
|
|
+extern inline void __raw_writeq(u64 b, volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ IO_CONCAT(__IO_PREFIX,writeq)(b, addr);
|
|
|
+}
|
|
|
+
|
|
|
+extern inline u32 readl(const volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ u32 ret = __raw_readl(addr);
|
|
|
+ mb();
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+extern inline u64 readq(const volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ u64 ret = __raw_readq(addr);
|
|
|
+ mb();
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+extern inline void writel(u32 b, volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ __raw_writel(b, addr);
|
|
|
+ mb();
|
|
|
+}
|
|
|
+
|
|
|
+extern inline void writeq(u64 b, volatile void __iomem *addr)
|
|
|
+{
|
|
|
+ __raw_writeq(b, addr);
|
|
|
+ mb();
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+#define ioread16be(p) be16_to_cpu(ioread16(p))
|
|
|
+#define ioread32be(p) be32_to_cpu(ioread32(p))
|
|
|
+#define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
|
|
|
+#define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
|
|
|
+
|
|
|
+#define inb_p inb
|
|
|
+#define inw_p inw
|
|
|
+#define inl_p inl
|
|
|
+#define outb_p outb
|
|
|
+#define outw_p outw
|
|
|
+#define outl_p outl
|
|
|
+#define readb_relaxed(addr) __raw_readb(addr)
|
|
|
+#define readw_relaxed(addr) __raw_readw(addr)
|
|
|
+#define readl_relaxed(addr) __raw_readl(addr)
|
|
|
+#define readq_relaxed(addr) __raw_readq(addr)
|
|
|
+
|
|
|
+#define mmiowb()
|
|
|
+
|
|
|
+/*
|
|
|
+ * String version of IO memory access ops:
|
|
|
+ */
|
|
|
+extern void memcpy_fromio(void *, const volatile void __iomem *, long);
|
|
|
+extern void memcpy_toio(volatile void __iomem *, const void *, long);
|
|
|
+extern void _memset_c_io(volatile void __iomem *, unsigned long, long);
|
|
|
+
|
|
|
+static inline void memset_io(volatile void __iomem *addr, u8 c, long len)
|
|
|
+{
|
|
|
+ _memset_c_io(addr, 0x0101010101010101UL * c, len);
|
|
|
+}
|
|
|
+
|
|
|
+#define __HAVE_ARCH_MEMSETW_IO
|
|
|
+static inline void memsetw_io(volatile void __iomem *addr, u16 c, long len)
|
|
|
+{
|
|
|
+ _memset_c_io(addr, 0x0001000100010001UL * c, len);
|
|
|
+}
|
|
|
+
|
|
|
+/*
|
|
|
+ * String versions of in/out ops:
|
|
|
+ */
|
|
|
+extern void insb (unsigned long port, void *dst, unsigned long count);
|
|
|
+extern void insw (unsigned long port, void *dst, unsigned long count);
|
|
|
+extern void insl (unsigned long port, void *dst, unsigned long count);
|
|
|
+extern void outsb (unsigned long port, const void *src, unsigned long count);
|
|
|
+extern void outsw (unsigned long port, const void *src, unsigned long count);
|
|
|
+extern void outsl (unsigned long port, const void *src, unsigned long count);
|
|
|
+
|
|
|
+/*
|
|
|
+ * The Alpha Jensen hardware for some rather strange reason puts
|
|
|
+ * the RTC clock at 0x170 instead of 0x70. Probably due to some
|
|
|
+ * misguided idea about using 0x70 for NMI stuff.
|
|
|
+ *
|
|
|
+ * These defines will override the defaults when doing RTC queries
|
|
|
+ */
|
|
|
+
|
|
|
+#ifdef CONFIG_ALPHA_GENERIC
|
|
|
+# define RTC_PORT(x) ((x) + alpha_mv.rtc_port)
|
|
|
+#else
|
|
|
+# ifdef CONFIG_ALPHA_JENSEN
|
|
|
+# define RTC_PORT(x) (0x170+(x))
|
|
|
+# else
|
|
|
+# define RTC_PORT(x) (0x70 + (x))
|
|
|
+# endif
|
|
|
+#endif
|
|
|
+#define RTC_ALWAYS_BCD 0
|
|
|
+
|
|
|
+/*
|
|
|
+ * Some mucking forons use if[n]def writeq to check if platform has it.
|
|
|
+ * It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
|
|
|
+ * to play with; for now just use cpp anti-recursion logics and make sure
|
|
|
+ * that damn thing is defined and expands to itself.
|
|
|
+ */
|
|
|
+
|
|
|
+#define writeq writeq
|
|
|
+#define readq readq
|
|
|
+
|
|
|
+/*
|
|
|
+ * Convert a physical pointer to a virtual kernel pointer for /dev/mem
|
|
|
+ * access
|
|
|
+ */
|
|
|
+#define xlate_dev_mem_ptr(p) __va(p)
|
|
|
+
|
|
|
+/*
|
|
|
+ * Convert a virtual cached pointer to an uncached pointer
|
|
|
+ */
|
|
|
+#define xlate_dev_kmem_ptr(p) p
|
|
|
+
|
|
|
+#endif /* __KERNEL__ */
|
|
|
+
|
|
|
+#endif /* __ALPHA_IO_H */
|