patch-2.1.116 linux/include/asm-alpha/io.h

Next file: linux/include/asm-alpha/irq.h
Previous file: linux/include/asm-alpha/init.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.115/linux/include/asm-alpha/io.h linux/include/asm-alpha/io.h
@@ -2,29 +2,17 @@
 #define __ALPHA_IO_H
 
 #include <linux/config.h>
-
 #include <asm/system.h>
+#include <asm/machvec.h>
 
 /* We don't use IO slowdowns on the Alpha, but.. */
 #define __SLOW_DOWN_IO	do { } while (0)
 #define SLOW_DOWN_IO	do { } while (0)
 
 /*
- * The hae (hardware address extension) register is used to
- * access high IO addresses. To avoid doing an external cycle
- * every time we need to set the hae, we have a hae cache in
- * memory. The kernel entry code makes sure that the hae is
- * preserved across interrupts, so it is safe to set the hae
- * once and then depend on it staying the same in kernel code.
- */
-extern struct hae {
-	unsigned long	cache;
-	unsigned long	*reg;
-} hae;
-
-/*
  * Virtual -> physical identity mapping starts at this offset
  */
+/* XXX: Do we need to conditionalize on this?  */
 #ifdef USE_48_BIT_KSEG
 #define IDENT_ADDR	(0xffff800000000000UL)
 #else
@@ -40,25 +28,34 @@
  * register not being up-to-date with respect to the hardware
  * value.
  */
-extern inline void set_hae(unsigned long new_hae)
+static inline void __set_hae(unsigned long new_hae)
 {
 	unsigned long ipl = swpipl(7);
-	hae.cache = new_hae;
-	*hae.reg = new_hae;
+
+	alpha_mv.hae_cache = new_hae;
+	*alpha_mv.hae_register = new_hae;
 	mb();
-	new_hae = *hae.reg; /* read to make sure it was written */
+
+	/* Re-read to make sure it was written.  */
+	new_hae = *alpha_mv.hae_register;
 	setipl(ipl);
 }
 
+static inline void set_hae(unsigned long new_hae)
+{
+	if (new_hae != alpha_mv.hae_cache)
+		__set_hae(new_hae);
+}
+
 /*
  * Change virtual addresses to physical addresses and vv.
  */
-extern inline unsigned long virt_to_phys(volatile void * address)
+static inline unsigned long virt_to_phys(volatile void * address)
 {
 	return 0xffffffffUL & (unsigned long) address;
 }
 
-extern inline void * phys_to_virt(unsigned long address)
+static inline void * phys_to_virt(unsigned long address)
 {
 	return (void *) (address + IDENT_ADDR);
 }
@@ -76,45 +73,79 @@
 #endif /* !__KERNEL__ */
 
 /*
- * EGCS 1.1 does a good job of using insxl.  Expose this bit of
- * the I/O process to the compiler.
+ * There are different chipsets to interface the Alpha CPUs to the world.
  */
 
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
-# define __kernel_insbl(val, shift)  (((val) & 0xfful) << ((shift) * 8))
-# define __kernel_inswl(val, shift)  (((val) & 0xfffful) << ((shift) * 8))
+#ifdef CONFIG_ALPHA_GENERIC
+
+/* In a generic kernel, we always go through the machine vector.  */
+
+# define virt_to_bus(a)	alpha_mv.mv_virt_to_bus(a)
+# define bus_to_virt(a)	alpha_mv.mv_bus_to_virt(a)
+
+# define __inb		alpha_mv.mv_inb
+# define __inw		alpha_mv.mv_inw
+# define __inl		alpha_mv.mv_inl
+# define __outb		alpha_mv.mv_outb
+# define __outw		alpha_mv.mv_outw
+# define __outl		alpha_mv.mv_outl
+
+# define __readb(a)	alpha_mv.mv_readb((unsigned long)(a))
+# define __readw(a)	alpha_mv.mv_readw((unsigned long)(a))
+# define __readl(a)	alpha_mv.mv_readl((unsigned long)(a))
+# define __readq(a)	alpha_mv.mv_readq((unsigned long)(a))
+# define __writeb(v,a)	alpha_mv.mv_writeb((v),(unsigned long)(a))
+# define __writew(v,a)	alpha_mv.mv_writew((v),(unsigned long)(a))
+# define __writel(v,a)	alpha_mv.mv_writel((v),(unsigned long)(a))
+# define __writeq(v,a)	alpha_mv.mv_writeq((v),(unsigned long)(a))
+
+# define inb		__inb
+# define inw		__inw
+# define inl		__inl
+# define outb		__outb
+# define outw		__outw
+# define outl		__outl
+
+# define readb		__readb
+# define readw		__readw
+# define readl		__readl
+# define readq		__readq
+# define writeb		__writeb
+# define writew		__writew
+# define writel		__writel
+# define writeq		__writeq
+
+# define dense_mem(a)	alpha_mv.mv_dense_mem(a)
+
 #else
-# define __kernel_insbl(val, shift)					\
-  ({ unsigned long __kir;						\
-     __asm__("insbl %2,%1,%0" : "=r"(__kir) : "ri"(shift), "r"(val));	\
-     __kir; })
-# define __kernel_inswl(val, shift)					\
-  ({ unsigned long __kir;						\
-     __asm__("inswl %2,%1,%0" : "=r"(__kir) : "ri"(shift), "r"(val));	\
-     __kir; })
-#endif
-	
-/*
- * There are different chipsets to interface the Alpha CPUs to the world.
- */
-#if defined(CONFIG_ALPHA_LCA)
-# include <asm/lca.h>		/* get chip-specific definitions */
-#elif defined(CONFIG_ALPHA_APECS)
-# include <asm/apecs.h>		/* get chip-specific definitions */
+
+/* Control how and what gets defined within the core logic headers.  */
+#define __WANT_IO_DEF
+
+#if defined(CONFIG_ALPHA_APECS)
+# include <asm/core_apecs.h>
 #elif defined(CONFIG_ALPHA_CIA)
-# include <asm/cia.h>		/* get chip-specific definitions */
-#elif defined(CONFIG_ALPHA_T2)
-# include <asm/t2.h>		/* get chip-specific definitions */
+# include <asm/core_cia.h>
+#elif defined(CONFIG_ALPHA_LCA)
+# include <asm/core_lca.h>
+#elif defined(CONFIG_ALPHA_MCPCIA)
+# include <asm/core_mcpcia.h>
 #elif defined(CONFIG_ALPHA_PYXIS)
-# include <asm/pyxis.h>		/* get chip-specific definitions */
+# include <asm/core_pyxis.h>
+#elif defined(CONFIG_ALPHA_T2)
+# include <asm/core_t2.h>
 #elif defined(CONFIG_ALPHA_TSUNAMI)
-# include <asm/tsunami.h>	/* get chip-specific definitions */
-#elif defined(CONFIG_ALPHA_MCPCIA)
-# include <asm/mcpcia.h>	/* get chip-specific definitions */
-#else
+# include <asm/core_tsunami.h>
+#elif defined(CONFIG_ALPHA_JENSEN)
 # include <asm/jensen.h>
+#else
+#error "What system is this?"
 #endif
 
+#undef __WANT_IO_DEF
+
+#endif /* GENERIC */
+
 /*
  * The convention used for inb/outb etc. is that names starting with
  * two underscores are the inline versions, names starting with a
@@ -190,12 +221,12 @@
  * On the alpha, we have the whole physical address space mapped at all
  * times, so "ioremap()" and "iounmap()" do not need to do anything.
  */
-extern inline void * ioremap(unsigned long offset, unsigned long size)
+static inline void * ioremap(unsigned long offset, unsigned long size)
 {
 	return (void *) offset;
 } 
 
-extern inline void iounmap(void *addr)
+static inline void iounmap(void *addr)
 {
 }
 
@@ -263,8 +294,9 @@
 #define eth_io_copy_and_sum(skb,src,len,unused) \
   memcpy_fromio((skb)->data,(src),(len))
 
-static inline int check_signature(unsigned long io_addr,
-	const unsigned char *signature, int length)
+static inline int
+check_signature(unsigned long io_addr, const unsigned char *signature,
+		int length)
 {
 	int retval = 0;
 	do {
@@ -279,6 +311,29 @@
 	return retval;
 }
 
-#endif /* __KERNEL__ */
+/*
+ * 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)
+# define RTC_ADDR(x)	((x) | alpha_mv.rtc_addr)
+#else
+# ifdef CONFIG_ALPHA_JENSEN
+#  define RTC_PORT(x)	(0x170+(x))
+#  define RTC_ADDR(x)	(x)
+# else
+#  define RTC_PORT(x)	(0x70 + (x))
+#  define RTC_ADDR(x)	(0x80 | (x))
+# endif
 #endif
+
+#define RTC_ALWAYS_BCD	0
+
+#endif /* __KERNEL__ */
+
+#endif /* __ALPHA_IO_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov