patch-2.3.16 linux/include/asm-alpha/core_tsunami.h

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

diff -u --recursive --new-file v2.3.15/linux/include/asm-alpha/core_tsunami.h linux/include/asm-alpha/core_tsunami.h
@@ -24,8 +24,8 @@
  *
  * Sigh...
  */
-#define TSUNAMI_DMA_WIN_BASE_DEFAULT	(1UL*1024*1024*1024)
-#define TSUNAMI_DMA_WIN_SIZE_DEFAULT	(2UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN_BASE		(1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN_SIZE		(2UL*1024*1024*1024)
 
 #define TSUNAMI_DMA_WIN0_BASE_DEFAULT	(1UL*1024*1024*1024)
 #define TSUNAMI_DMA_WIN0_SIZE_DEFAULT	(1UL*1024*1024*1024)
@@ -35,13 +35,6 @@
 #define TSUNAMI_DMA_WIN1_SIZE_DEFAULT	(1UL*1024*1024*1024)
 #define TSUNAMI_DMA_WIN1_TRAN_DEFAULT	(1UL*1024*1024*1024)
 
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define TSUNAMI_DMA_WIN_BASE		alpha_mv.dma_win_base
-#define TSUNAMI_DMA_WIN_SIZE		alpha_mv.dma_win_size
-#else
-#define TSUNAMI_DMA_WIN_BASE		TSUNAMI_DMA_WIN_BASE_DEFAULT
-#define TSUNAMI_DMA_WIN_SIZE		TSUNAMI_DMA_WIN_SIZE_DEFAULT
-#endif
 
 /* XXX: Do we need to conditionalize on this?  */
 #ifdef USE_48_BIT_KSEG
@@ -279,14 +272,25 @@
 /*
  * Memory spaces:
  */
-#define HOSE(h) (((unsigned long)(h)) << 33)
+#define TSUNAMI_HOSE(h)		(((unsigned long)(h)) << 33)
+#define TSUNAMI_BASE		(IDENT_ADDR + TS_BIAS)
+
+#define TSUNAMI_MEM(h)		(TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x000000000UL)
+#define _TSUNAMI_IACK_SC(h)	(TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1F8000000UL)
+#define TSUNAMI_IO(h)		(TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FC000000UL)
+#define TSUNAMI_CONF(h)		(TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FE000000UL)
+
+#define TSUNAMI_IACK_SC		_TSUNAMI_IACK_SC(0) /* hack! */
 
-#define TSUNAMI_MEM(h)	     (IDENT_ADDR + TS_BIAS + 0x000000000UL + HOSE(h))
-#define _TSUNAMI_IACK_SC(h)  (IDENT_ADDR + TS_BIAS + 0x1F8000000UL + HOSE(h))
-#define TSUNAMI_IO(h)	     (IDENT_ADDR + TS_BIAS + 0x1FC000000UL + HOSE(h))
-#define TSUNAMI_CONF(h)	     (IDENT_ADDR + TS_BIAS + 0x1FE000000UL + HOSE(h))
 
-#define TSUNAMI_IACK_SC	     _TSUNAMI_IACK_SC(0) /* hack! */
+/* 
+ * The canonical non-remaped I/O and MEM addresses have these values
+ * subtracted out.  This is arranged so that folks manipulating ISA
+ * devices can use their familiar numbers and have them map to bus 0.
+ */
+
+#define TSUNAMI_IO_BIAS          TSUNAMI_IO(0)
+#define TSUNAMI_MEM_BIAS         TSUNAMI_MEM(0)
 
 
 /*
@@ -329,39 +333,47 @@
 #define vuip	volatile unsigned int *
 #define vulp	volatile unsigned long *
 
-#define XADDR	((addr) & 0xffffffffUL)
-#define XHOSE	(((addr) >> 32) & 3UL)
-
 __EXTERN_INLINE unsigned int tsunami_inb(unsigned long addr)
 {
-	return __kernel_ldbu(*(vucp)(XADDR + TSUNAMI_IO(XHOSE)));
+	/* ??? I wish I could get rid of this.  But there's no ioremap
+	   equivalent for I/O space.  PCI I/O can be forced into the
+	   correct hose's I/O region, but that doesn't take care of
+	   legacy ISA crap.  */
+
+	addr += TSUNAMI_IO_BIAS;
+	return __kernel_ldbu(*(vucp)addr);
 }
 
 __EXTERN_INLINE void tsunami_outb(unsigned char b, unsigned long addr)
 {
-	__kernel_stb(b, *(vucp)(XADDR + TSUNAMI_IO(XHOSE)));
+	addr += TSUNAMI_IO_BIAS;
+	__kernel_stb(b, *(vucp)addr);
 	mb();
 }
 
 __EXTERN_INLINE unsigned int tsunami_inw(unsigned long addr)
 {
-	return __kernel_ldwu(*(vusp)(XADDR + TSUNAMI_IO(XHOSE)));
+	addr += TSUNAMI_IO_BIAS;
+	return __kernel_ldwu(*(vusp)addr);
 }
 
 __EXTERN_INLINE void tsunami_outw(unsigned short b, unsigned long addr)
 {
-	__kernel_stw(b, *(vusp)(XADDR + TSUNAMI_IO(XHOSE)));
+	addr += TSUNAMI_IO_BIAS;
+	__kernel_stw(b, *(vusp)addr);
 	mb();
 }
 
 __EXTERN_INLINE unsigned int tsunami_inl(unsigned long addr)
 {
-	return *(vuip)(XADDR + TSUNAMI_IO(XHOSE));
+	addr += TSUNAMI_IO_BIAS;
+	return *(vuip)addr;
 }
 
 __EXTERN_INLINE void tsunami_outl(unsigned int b, unsigned long addr)
 {
-	*(vuip)(XADDR + TSUNAMI_IO(XHOSE)) = b;
+	addr += TSUNAMI_IO_BIAS;
+	*(vuip)addr = b;
 	mb();
 }
 
@@ -371,115 +383,51 @@
 
 __EXTERN_INLINE unsigned long tsunami_ioremap(unsigned long addr)
 {
-	return XADDR + TSUNAMI_MEM(XHOSE);
+	return addr + TSUNAMI_MEM_BIAS;
 }
 
 __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
 {
-	return addr >= IDENT_ADDR+TS_BIAS;
+	return addr >= TSUNAMI_BASE;
 }
 
 __EXTERN_INLINE unsigned long tsunami_readb(unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	return __kernel_ldbu(*(vucp)addr);
 }
 
 __EXTERN_INLINE unsigned long tsunami_readw(unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	return __kernel_ldwu(*(vusp)addr);
 }
 
 __EXTERN_INLINE unsigned long tsunami_readl(unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	return *(vuip)addr;
 }
 
 __EXTERN_INLINE unsigned long tsunami_readq(unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	return *(vulp)addr;
 }
 
 __EXTERN_INLINE void tsunami_writeb(unsigned char b, unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	__kernel_stb(b, *(vucp)addr);
 }
 
 __EXTERN_INLINE void tsunami_writew(unsigned short b, unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	__kernel_stw(b, *(vusp)addr);
 }
 
 __EXTERN_INLINE void tsunami_writel(unsigned int b, unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	*(vuip)addr = b;
 }
 
 __EXTERN_INLINE void tsunami_writeq(unsigned long b, unsigned long addr)
 {
-#if __DEBUG_IOREMAP
-	if (addr <= 0x1000000000) {
-		printk(KERN_CRIT "tsunami: 0x%lx not ioremapped (%p)\n",
-		       addr, __builtin_return_address(0));
-		addr = tsunami_ioremap(addr);
-	}
-#endif
-
 	*(vulp)addr = b;
 }
 
@@ -488,9 +436,6 @@
 #undef vuip
 #undef vulp
 
-#undef XADDR
-#undef XHOSE
-
 #ifdef __WANT_IO_DEF
 
 #define virt_to_bus	tsunami_virt_to_bus
@@ -513,24 +458,21 @@
 #define __ioremap	tsunami_ioremap
 #define __is_ioaddr	tsunami_is_ioaddr
 
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
+#define inb(port)	__inb((port))
+#define inw(port)	__inw((port))
+#define inl(port)	__inl((port))
+#define outb(v, port)	__outb((v),(port))
+#define outw(v, port)	__outw((v),(port))
+#define outl(v, port)	__outl((v),(port))
 
-#if !__DEBUG_IOREMAP
 #define __raw_readb(a)		__readb((unsigned long)(a))
 #define __raw_readw(a)		__readw((unsigned long)(a))
 #define __raw_readl(a)		__readl((unsigned long)(a))
 #define __raw_readq(a)		__readq((unsigned long)(a))
 #define __raw_writeb(v,a)	__writeb((v),(unsigned long)(a))
-#define __raw_writeb(v,a)	__writew((v),(unsigned long)(a))
+#define __raw_writew(v,a)	__writew((v),(unsigned long)(a))
 #define __raw_writel(v,a)	__writel((v),(unsigned long)(a))
 #define __raw_writeq(v,a)	__writeq((v),(unsigned long)(a))
-#endif
 
 #endif /* __WANT_IO_DEF */
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)